GBC_host.h 8.82 KB
#ifdef __GBC_LOAD_APP_SWITCH_ON__ //__GBC_SPT__
#include "MMI_features.h"
#include "pixteldatatypes.h"
#include "MMIDataType.h"
#include "GlobalDefs.h"
#include "GlobalConstants.h"
#include "ProtocolEvents.h"
#include "NVRAMType.h"
#include "TimerEvents.h"
#include "l1audio.h"
#include "gui_ems.h"
#include "Unicodexdcl.h"
#include "CharsetTable.h"
#include "Conversions.h"
#include "nvram_user_defs.h"
#include "MessagesMiscell.h"
#include "FileManagerGProt.h"
#include "PsCallHelperDef.h"
#include "smsal_l4c_enum.h"
#include "SmsGuiInterfaceType.h"
#include "mmi_msg_context.h"
#include "MessagesResourceData.h"
#include "CallManagementStruct.h"
#include "app_datetime.h"
#include "SettingProfile.h"
#include "wgui_softkeys.h"
#include "SettingDefs.h"
#include "csmcc_enums.h"
#ifdef MMI_ON_HARDWARE_P
#include "Fat_fs.h"
#include "reg_base.h"
#include "drv_comm.h"
#include "keypad_sw.h"
#include "kbd_table.h"
#else
#include "Fs_errcode.h"
#include "Fs_type.h"
#include "Fs_func.h"
#endif
#include "FontDcl.h"
#include "FontRes.h"
#include "math.h"
#include "med_utility.h"
#include "med_api.h"
#include "UCMResDef.h"
#include "IdleAppResDef.h"
#include "gui_data_types.h"

///////////////////////////////////////////
//#define GBC_DEBUG

/* 
ROM: 30K, RAM: 16K, Log:  20K
0x0828 0x0840 0x0912 0x0936 0x0952 0x1012 
0x1108 0x1132 0x1204 0x1224 0x1308 0x1352
*/
//#define GBC_VER			(0x1308)
#define GBC_VER			    (0x1352)

///////////////////////////////////////////
#define GBC_GPRS

#if (GBC_VER>=0x0828)
#if (GBC_VER<0x1204)
#include "ConnectManageGProt.h"
#endif
#endif
#if (GBC_VER>0x0828)
#include "custom_events_notify.h"
#endif
#if (GBC_VER>0x0912)
#include "mmi_frm_events.h"
#if (GBC_VER<0x1308) 
#include "mma_api.h"
#endif
#endif
#if (GBC_VER<0x1012) 
#include "SMSApi.h"
#include "SMSStruct.h"
#include "CmErrorTypes.h"
#include "wgui_status_icons.h"
#include "PhonebookDef.h"
#include "PhoneBookProt.h"
#include "PhoneBookGprot.h"
#include "PhoneBookTypes.h"
#include "QueueGprot.h"
#else /* <= 0x1012 */
#include "smssrvgprot.h"
#endif

#if (GBC_VER >=0x1012)
#if defined(GBC_GPRS)
#if (GBC_VER<0x1308) 
#include "Mma_struct.h"
#endif
#if (GBC_VER<0x1204)
#include "mms_sap_struct.h"
#include "MMSAppDataManager.h"
#endif
#endif
#include "mmi_frm_queue_gprot.h"
#include "smslib_enum.h"
#include "smslib_def.h"
#include "smsstoragecoresrv.h"
#include "SmsDispatchSrv.h"
#include "UcmSrvGprot.h"
#include "mmi_msg_struct.h"
#include "csmcc_common_enums.h"
#endif
#if (GBC_VER < 0x1108)
#include "SimDetectionDef.h"
#include "NVRAMProt.h"
#endif
#if defined(GBC_GPRS)
#include "soc_api.h"
#include "ServiceDefs.h"
#include "wapadp.h"
#include "wap_ps_struct.h"
#include "app2soc_struct.h"
#include "DataAccountEnum.h"
#include "DataAccountDef.h"
#include "DataAccountStruct.h"
#include "DataAccountProt.h"
#include "DataAccountResDef.h"
#include "custom_data_account.h"
#endif

#if (GBC_VER >= 0x1108)
#include "cbm_api.h"
#include "gcallsrvdef.h"
#include "GCallSrvGprot.h"
#include "mmi_frm_events.h"
#include "modeswitchsrvgprot.h"
#include "mmi_frm_events_gprot.h"

#if defined(GBC_GPRS)
#if (GBC_VER<0x1204)
#include "Dtcntsrvgprot.h"
#include "dtcntsrvintstruct.h"
#endif
#endif

#include "FileMgrSrvGProt.h"
#include "SimCtrlSrvGprot.h"
#include "custom_phb_config.h"

#if (GBC_VER<0x1204)
#include "mmi_rp_app_mainmenu_def.h"
#include "mmi_rp_app_organizer_def.h"
#if defined(GBC_GPRS)
extern U32 g_mmi_dtcnt_acct_num;
extern srv_dtcnt_store_info_context g_srv_dtcnt_store_ctx;
extern mmi_dtcnt_list_disp_struct g_mmi_dtcnt_list_item[SRV_DTCNT_PROF_MAX_ACCOUNT_NUM];
#endif
#endif

#endif
#if (GBC_VER < 0x1132)
#include "mtpnp_ad_master_common_def.h"
#endif

#if defined(GBC_GPRS)
#if defined(WIN32)
//#define GBC_GPRS_NET
#endif
#if (GBC_VER >= 0x0828)
#define PF_INET			SOC_PF_INET
#define SOCK_STREAM	SOC_SOCK_STREAM
#define SOCK_DGRAM		SOC_SOCK_DGRAM
#endif
#define DATA_ACCOUNT_UCS		0x08
#define DATA_ACCOUNT_ASCII	0x00
#define ACCOUNT_NAME_LEN		64
#define APN_NAME_LEN			128 //MAX_GPRS_APN_LEN
#define USERNAME_LEN			32  //MAX_GPRS_USER_NAME_LEN
#define PASSWORD_LEN			32  //MAX_GPRS_PASSWORD_LEN
#define DNSADDRESS_LEN			4
#define PROXY_LEN				32
#define GBC_WAP_CONTEXT_INDEX	(8)
#define GBC_NET_CONTEXT_INDEX	(9)
#if  (GBC_VER<0x0828)
#define cbm_encode_data_account_id(acct_id, sim_id, app_id, always_ask) always_ask_encode_data_account_id(acct_id, sim_id+1, app_id, always_ask)
#endif
#endif

#define FO_READ_ONLY	 			2
#define FO_READ_WRITE	 			1
#define FO_CREATE					0
#define GBC_IVR_HANDLE_NULL 		(-1)
#define GBC_FILENAME_LEN_MAX	(256)
#define GBC_LOG_BUFF_SIZE 		(4096)

#ifndef PRT_DTMF_START_REQ
#define PRT_DTMF_START_REQ             MSG_ID_MMI_CC_START_DTMF_REQ
#endif
#ifndef PRT_DTMF_STOP_REQ
#define PRT_DTMF_STOP_REQ              MSG_ID_MMI_CC_STOP_DTMF_REQ
#endif
#ifndef PRT_USSDVSS_REQ
#define PRT_USSDVSS_REQ                MSG_ID_MMI_SS_PARSING_STRING_REQ
#endif
#ifndef PRT_USSDVSS_RSP
#define PRT_USSDVSS_RSP                MSG_ID_MMI_SS_PARSING_STRING_RSP
#endif
#ifndef PRT_OUTGOINGCALL_EVENT_RSP
#define PRT_OUTGOINGCALL_EVENT_RSP        MSG_ID_MMI_CC_DIAL_IND
#endif
#ifndef PRT_SPEECH_IND_EVENT
#define PRT_SPEECH_IND_EVENT           MSG_ID_MMI_CC_SPEECH_IND
#endif
#ifndef PRT_OUTGOINGCALL_CONNECTED
#define PRT_OUTGOINGCALL_CONNECTED        MSG_ID_MMI_CC_CALL_CONNECT_IND
#endif
#ifndef PRT_CALLENDSPECIFIC_EVENT
#define PRT_CALLENDSPECIFIC_EVENT         MSG_ID_MMI_CC_CHLD_REQ
#endif
#ifndef PRT_ENDALLCALL_EVENT
#define PRT_ENDALLCALL_EVENT           MSG_ID_MMI_CC_CHLD_REQ
#endif
#if (GBC_VER >= 0x1132)
#define MTPNP_AD_DATA_SERVICE_CHANNEL 	0
#define MTPNP_AD_CHANNEL_MASTER			0
#define MTPNP_AD_CHANNEL_SLAVE 			0
#define MTPNP_AD_CALL_CHANNEL				0
#define MTPNP_AD_SMS_CHANNEL 				0
#ifndef MAX_PLMN_LEN
#define MAX_PLMN_LEN 						SRV_MAX_PLMN_LEN
#endif
#endif
//13670136683
#define GBC_WIN32_SC "+8613800210500"
#define GBC_WIN32_IMSI	"9460008722226978"
#if (GBC_VER<=0x1012)
#define SRV_FMGR_SYSTEM_DRV  FS_GetDrive(FS_DRIVE_I_SYSTEM, 1, FS_NO_ALT_DRIVE )
#define SRV_FMGR_PUBLIC_DRV   FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_V_NORMAL | FS_DRIVE_V_REMOVABLE)
#define SRV_FMGR_PHONE_DRV   FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_V_NORMAL | FS_DRIVE_V_REMOVABLE)
#define SRV_FMGR_CARD_DRV      FS_GetDrive(FS_DRIVE_V_REMOVABLE, 1, FS_NO_ALT_DRIVE)
#endif

typedef unsigned char		BYTE;
typedef unsigned short		WORD;
typedef unsigned int		UINT;
typedef unsigned int		DWORD;
typedef unsigned long		ULONG;
typedef unsigned char		BOOL;
typedef int			       HFILE;

typedef enum
{
	GBC_ENC,	/*unicode coding*/
	GBC_UTF8,	/*utf8 coding*/
	GBC_ASCII,	/*ascii coding*/
	GBC_UCS2
}GBC_ENDCODE_TYPE;

typedef enum
{
	GBC_SIM_NULL,
	GBC_SIM_MASTER,
	GBC_SIM_SLAVE,
	GBC_SIM_DUAL
}GBC_SIM_OPTION_ENUM;

typedef enum{
	GBC_TIMER_ID_01,
	GBC_TIMER_ID_02,
	GBC_TIMER_ID_03,
	GBC_TIMER_ID_04, 
	GBC_TIMER_ID_05,
	GBC_TIMER_ID_06, 
	GBC_TIMER_ID_07,
	GBC_TIMER_ID_08,
	GBC_TIMER_ID_09,
	GBC_TIMER_ID_10, //
	GBC_TIMER_ID_11,
	GBC_TIMER_ID_12,
	GBC_TIMER_ID_13,
	GBC_TIMER_ID_14,
	GBC_TIMER_ID_15,
	GBC_TIMER_ID_16, //
	GBC_TIMER_ID_17,
	GBC_TIMER_ID_18,
	GBC_TIMER_ID_19,
	GBC_TIMER_ID_20,//
	GBC_TIMER_ID_MAX
}GBC_TIMER_ID;

typedef struct
{
	U16 nYear;
	U8 nMonth;	
	U8 nDay;
	U8 nHour;
	U8 nMin;
	U8 nSec;
	U8 DayIndex;
}GBC_TIME;

typedef enum
{
	GBC_IVR_NONE,
	GBC_IVR_OUTGOING,	
	GBC_IVR_CCSPEECH,
	GBC_IVR_ACTIVE
}GBC_IVR_STATE;

typedef enum
{
	TFILE_ATTR_READ_ONLY    = 0x01,
	TFILE_ATTR_HIDDEN       = 0x02,
	TFILE_ATTR_SYSTEM       = 0x04,
	TFILE_ATTR_DIR          = 0x10
}TFileAttriEnum;

typedef enum
{
	FILE_SEEK_SET,	/*beginning of file*/
	FILE_SEEK_CUR,	/*current position of file pointer*/
	FILE_SEEK_END	/*end of file*/
}FILE_SEEK_TYPE;

#if defined(GBC_GPRS)
typedef struct 
{
    BYTE	sock_type;
    short	addr_len;
    WORD	port;
    /* For keep the 4-byte boundary */
    /* please do not declare other variables above addr */
    BYTE	addr[28];
} sockaddr_in;

typedef struct GPRSDataAccount
{
	unsigned char name[ACCOUNT_NAME_LEN];   /*!<账号名称, 必须为unicode编码*/
	char apn[APN_NAME_LEN];                      /*!<接入点名称, ASCII*/
	unsigned char auth_type;                /*!<认证方式*/
	char user_name[USERNAME_LEN];           /*!<用户名, ASCII*/
	char password[PASSWORD_LEN];            /*!<密码,ASCII*/
	unsigned char dns[DNSADDRESS_LEN];      /*!<DNS ip 地址*/
	unsigned char proxy[PROXY_LEN];         /*!<代理服务器*/
	unsigned short port;                    /*!<端口*/
}GPRSDataAccount;
#endif

typedef U8 (*gbc_PSHandle)(void *);
typedef void (*gbc_RspFunc)(U16 result);
typedef void	(*gbc_PSFunc)(void *, UINT mod_src);

void gbc_trace(const char *fmt, ...);
#if defined(GBC_DEBUG) && defined(__MTK_TARGET__)
/* Only ADS_v1.2 & RVCT_v3.1 supports C99 __VA_ARGS__ */
#define GBC_TRACE(...) gbc_trace(__VA_ARGS__)
#elif defined(GBC_DEBUG) && !defined(__MTK_TARGET__)
void GBC_TRACE(const char *fmt, ...);
#else
#if defined(__MTK_TARGET__)
#define GBC_TRACE(...)
#else
void GBC_TRACE(const char *fmt, ...);
#endif
#endif

#endif