#ifndef _MBN_EVENT_INTERNAL_H_ #define _MBN_EVENT_INTERNAL_H_ #include "AutoArray.h" #include "mbnapi.h" #include "SpBase.h" #define MBN_STRING_LEN 256 #define MBN_ERROR_INVALID_STRING "[Invalid]" #define MBN_ERROR_INVALID_STRING_WITH_PARAM "[Invalid#%02d]" #define WM_ADD_PROFILE_RESULT (WM_USER + 9000) #define WM_DIAL_RESULT (WM_USER + 9001) #define WM_DELETE_PROFILE_RESULT (WM_USER + 9002) #define WM_DIAL_DISCONNECT (WM_USER + 9004) #define WM_SIGNAL_CHANGE (WM_USER + 9005) #define WM_DONGLE_CHANGE (WM_USER + 9006) #define WM_FATALMESSAGE_CHANGE (WM_USER + 9007) #define WM_UPDATE_PROFILE_RESULT (WM_USER + 9008) #define WM_CONNECT_WLAN_RESULT (WM_USER + 9010) #ifdef TWINKLE_LOCAL_DEBUG static void TwDbg(const char* format, ...) { va_list args; va_start(args, format); vDbg(format, args); } //#define Dbg(fmt, ...) \ // TwDbg(fmt, ##__VA_ARGS__); \ // printf(fmt "\n", ##__VA_ARGS__) #endif #define CNT_INVALID 0x0000 #define CNT_MBN 0x0001 #define CNT_RAS 0x0002 #define CNT_AUTO 0x0003 #define CNT_ANDROID 0x0004 #define CNT_MBB 0x0005 #define AUPR_AUTO 0x0000 #define AUPR_PAP 0x0001 #define AUPR_CHAP 0x0002 #define AUPR_PAPORCHAP 0x0003 #define AUPR_MSV2 0x0004 #define AUPR_NONE 0x0005 typedef /*When modify below enum, you should change ConvertStatusToString func at the same time.*/ enum MOBILEDIAL_CONNECTION_STATE { MBD_NOT_INITIALIZED = 0, MBD_INVALID_CONNECTED, // checksocket connect to server failed. MBD_VALID_CONNECTED, // checksocket connect to server suc. MBD_NO_FOUND_CABLE, // the network cable is off device. MBD_RUN_CONFIG_INCOMPLEMENT, MBD_CHECK_NETWORK_CONNETCTED, MBD_CENTERSETTING_LACK, MBD_NETWORK_TIMEOUT=0x0100, // connect timeout. MBD_NETWORK_ERROR_SOCKET, // error_socket, a specific error code. MBD_NETWORK_NOTFOUND_SOCKET, // can not find specified socket in set. MBD_NETWORK_INVALID_SOCKET, // create check socket error. MBD_CABLE_TYPE_MBB, //connect with mifi MBD_CABLE_TYPE_LTE, //connect with lte MBD_CABLE_TYPE_WIRE, //connect with wire in cmb.lib MBD_CABLE_TYPE_DONGLE, //connect with ras MBD_CABLE_TYPE_UNKNOWN, MBD_CABLE_TYPE_WIFI, MBD_CABLE_NOT_SUPPORT_TYPE = 0x110, MBD_CABLE_TYPE_LTE_ENHANCE, MBD_NETWORK_SEPERATE, // just the seperate line betwen FSM and MBN. MBD_NO_MOBILEDONGLE=0x0200, // detect no device or can not find out interface about network card. MBD_NO_PROFILE, // can not find any profile.xml for connection operation. MBD_NO_ENTRY, // detect no dial entry for ras MBD_CREATE_ENTRY_FAILED, MBD_RUN_ENTRY_NOTFOUND, MBD_INVALID_BOTH_DONGLE, MBD_ACTIVATION_NONE=0x0300, // the connection state is unknown. MBD_ACTIVATION_CONNECTED, // the connection has been established. MBD_ACTIVATION_CONNECTING, // the device is establishing the connection. MBD_ACTIVATION_DISCONNECTED, // there is no connection. MBD_ACTIVATION_DISCONNECTING, // the device is in the process of disconnection. MBD_CONNECTION_INVALID_ACCESS, // The connection access string is not correct. MBD_CONNECTION_INVALID_NAMEORPASSWORD, // The name or password using in the connection profile is not correct. MBD_CONNECTION_FAILURE, // Connect failed, comm error from tryConnect or ConnectComplete. MBD_RASDIAL_FAILED, // 3g ras dial failed. MBD_READY_OFF = 0x0400, // ready state: the mobile broadband device stack is off. MBD_READY_SIM_NO_INSERT, // ready state: the sim is no inserted. MBD_READY_BAD_SIM_START, MBD_READY_BAD_SIM, // ready state: the sim is invalid. MBD_READY_FAILURE, // ready state: general device failure. MBD_READY_NOT_ACTIVATED, // ready state: the subscription is not activated. MBD_READY_DEVICE_LOCKED, // ready state: the device is locked by a PIN or password MBD_READY_DEVICE_BLOCKED, // ready state: the device is blocked by a PIN or password MBD_CONNECTION_PIN_REQUIRED/*=0x0500*/, // A PIN is required for the operation to complete. MBD_CONNECTION_MAX_CONTEXTS, // The Mobile Broadband service does not support multiple active contexts. MBD_POWER_OFF, // The device radio is off. MBD_REGISTERED_DEREG, // MBD_REGISTERED_DENIED, MBD_READY_BAD_SIM_END, MBD_READY_INITIALIZED, // ready state: the card ready to be used for mobile broadband operations. MBD_READY_NO_SERVICE, MBD_WLAN_OFF = 0x0500, MBD_WLAN_DISCONNECTED, MBD_WLAN_CONNECTING, MBD_WLAN_ENTRY_NO_FOUND, MBD_WLAN_INVALID_NAMEORPASSWORD, MBD_WLAN_CONNECTED, MBD_WLAN_CONNECT_FAILED, MBD_WLAN_CONFIG_CHANGED, MBD_WLAN_CONFIG_REBOOT, MBD_WLAN_DEVICE_PLUG_OFF, MBD_WLAN_CONFIG_WAIT_REBOOT, MBD_WLAN_DISCONNECT_UNEXPECT, MBD_WLAN_CONNECTED_WITH_ILLEGAL_SSID, MBD_WLAN_SSID_VISIBLE, MBD_MIFI_START = 0x0600, MBD_MIFI_LOGIN_INVALID_NAMEORPASSWORD, MBD_MIFI_MACFILTER_UPDATE_FAILED, MBD_MIFI_NEED_LOGIN, MBD_MIFI_INVALID_PARAM, MBD_MIFI_NOT_EXISTED, MBD_MIFI_NOT_IMPLEMENTED, MBD_MIFI_NO_DATA, MBD_MIFI_NO_CHANGED, MBD_MIFI_NOT_SUPPORTED, MBD_MIFI_INVALID_CERT, MBD_MIFI_NO_RIGHTS, MBD_MIFI_NO_DEVICE, MBD_MIFI_EXCEPTION, MBD_MIFI_INVALID_SITUATION, MBD_MIFI_TIMEOUT, MBD_MIFI_OPT_FAILED, MBD_MIFI_DEVICE_LOCKED, /*input error password exceeds max times, the device lock*/ MBD_MIFI_URL, MBD_MIFI_LOW_BATTERY, MBD_MIFI_BUSY, MBD_MIFI_END, // Only for event log burn, this code do not set to any variable for later judge if necessary. MBD_CABLE_DEVICE_REMOVE = 0x0700, MBD_MBN_DEVICE_REMOVE, MBD_RAS_DEVICE_REMOVE, MBD_MBN_DEVICE_REMOVE_IN_BUSINESS, MBD_RAS_DEVICE_REMOVE_IN_BUSINESS, MBD_CABLE_DEVICE_ARRIVAL = 0x710, MBD_MBN_DEVICE_ARRIVAL , MBD_RAS_DEVICE_ARRIVAL, MBD_MBB_DEVICE_ARRIVAL, MBD_CABLE_DIALUP_CONNETED = 0x720, MBD_MBN_DIALUP_CONNETED, MBD_RAS_DIALUP_CONNETED, MBD_MBB_DIALUP_CONNECTED, MBD_CABLE_DIALUP_DISCONNETED = 0x730, MBD_MBN_DIALUP_DISCONNETED, MBD_RAS_DIALUP_DISCONNETED, MBD_MBN_DIALUP_DISCONNETED_IN_BUSINESS, MBD_RAS_DIALUP_DISCONNETED_IN_BUSINESS, MBD_DNS_SET_FAILED = 0x740, MBD_DNS_MULTI_CABLE_CONNECT, MBD_INTERNET_START = 0x800, MBD_CABLE_TYPE_INTERNET_WIFI, MBD_CABLE_TYPE_INTERNET_LTE, MBD_CABLE_TYPE_INTERNET_DONGLE, MBD_CABLE_TYPE_INERNET_UNKNOWN, MBD_HOLD_MOBILEDONGLE = 0xfffc, // Has been hold the cur dongle. //MBD_WIN32_NOT_FOUND=0xfffc, // Not find the target such as profile etc. MBD_UNKNOWN=0xfffd, // query produre returns pending status. MBD_INTERNAL_ERROR=0xfffe //, // Can not figure the error type for now but can find key issue from dbg. //MBD_UNEXPECTED_FAILURE=0xffff } MOBILEDIAL_CONNECTION_STATE; typedef struct _AccessKeyInfo { CSimpleStringA strProfileDesc; // 配置文件名称 CSimpleStringA strAccessString; // APN CSimpleStringA strUserName; // 用户名 CSimpleStringA strPassword; // 密码 CSimpleStringA strIPType; // IP类型(MBN有效) CSimpleStringA strAuthProtocol; // 登录类型(MBN有效) CSimpleStringA strPhoneNum; // 电话号码(RAS有效) BOOL IsDefault; // 是否为已应用 USHORT usCntType; //RAS vaild USHORT usAPType; //协议(RAS有效) } AccessKeyInfo, *ptAccessKeyInfo; void InitAccessKeyInfo(ptAccessKeyInfo info); typedef struct _MbnProfileInfo { CSimpleStringA strProfileName; // 配置文件中的名称 AccessKeyInfo AccessInfo; bool bUserDefined; int priority; } MbnProfileInfo, *ptMbnProfileInfo; typedef CAutoArray MBNProfileList; typedef struct _MbnDongleSubInfo { CSimpleStringA strDeviceID; // 设备ID CSimpleStringA strManufacturer; // 制造商 CSimpleStringA strMode; // 型号 CSimpleStringA strFirmware; // 固件 CSimpleStringA strCellularClass; // 网络类型 //CSimpleStringA strReadyState; //CSimpleStringA strConnectState; //CSimpleStringA strRegisterState; MBN_READY_STATE mbnReadyState; MBN_REGISTER_STATE mbnRegState; MBN_ACTIVATION_STATE mbnCntState; CSimpleStringA strDataClass; CSimpleStringA strProfileName; // 已连接状态下的配置名称 CSimpleStringA strProviderName; // 提供商名字(用于显示网卡名称) //对于GSM,其值表示 International Mobile Equipment Identity(IMSI) 多至15位数字 //对于CDMA, 表示 Moblile Identification Number 或者 International Roaming MIN(IRM) CSimpleStringA strIMSI; // SIM international circuit card number CSimpleStringA strSimIccID; ULONG ulSingnal; } MbnDongleSubInfo, *pMbnDongleSubInfo; void InitMbnDongleSubInfo(pMbnDongleSubInfo info); #define DEVTYPE_UNKNOWN 0x0000 #define DEVTYPE_MODEM 0x0001 #define DEVTYPE_INTER 0x0002 #define DEVTYPE_MBB 0x0004 #define DEVTYPE_ANDROID_UKNOWN 0x0010 #define DEVTYPE_ANDROID_MAIN 0x0011 #define DEVTYPE_ANDROID_VICE 0x0012 #define DEFAULT_PASSWORD_CHECK "*95555*" typedef struct _MbnDongleInfo { CSimpleStringA csInterfaceId; //在RAS中存储为设备名称 MbnDongleSubInfo subInfo; MBNProfileList profileList; USHORT usDeviceType; MOBILEDIAL_CONNECTION_STATE state; int priority; }MbnDongleInfo, *ptMbnDongleInfo; typedef CAutoArray DongleList; extern DongleList g_DongleInfos; extern ULONG wv; extern int gArch; void GetCurWindowsVersion(void); void ResetDongleInfos(void); const char* ActivationStateToString(MBN_ACTIVATION_STATE activationState); const char* RegisterStateToString(MBN_REGISTER_STATE registerState, MOBILEDIAL_CONNECTION_STATE& rdState); const char* StateToString(MBN_READY_STATE readyState, MOBILEDIAL_CONNECTION_STATE& rdState); const char* CellularToString(MBN_CELLULAR_CLASS cellularClass); const char* ConnectStateToString(MBN_ACTIVATION_STATE& cntState); const char* DataClassToString(MBN_DATA_CLASS dts); LPCTSTR ConvertStatusToString(MOBILEDIAL_CONNECTION_STATE state); LPCTSTR ConvertStatusToSimpleName(MOBILEDIAL_CONNECTION_STATE state); int GetSignalRank(ULONG ulStrength); #define USING_ENCRYPT #ifdef USING_ENCRYPT CSimpleStringA EncryptString(LPCTSTR lpszText); CSimpleStringA DecryptString(LPCTSTR lpszEncrpyted); #endif namespace MBN { LPCTSTR ConvertOperatorToString(int value); MBN_READY_STATE ConvertToMBNState(int value); MOBILEDIAL_CONNECTION_STATE ConvertToMCS(MBN_READY_STATE state); } MOBILEDIAL_CONNECTION_STATE MBBResult2Status(int value); #endif //_MBN_EVENT_INTERNAL_H_