📄 plxuilib.c
字号:
info->num[0] = '+';
memcpy (&info->num[1], (char*)localPtr->dest.number, localPtr->dest.length);
info->num[localPtr->dest.length+1] = '\0';
}
else {
memcpy (info->num, (char*)localPtr->dest.number, localPtr->dest.length);
info->num[localPtr->dest.length] = '\0';
}
#else
if ( info == NULL )
return;
pfnUnicodeStrcpy((char*)info->name, gDtcnt.defname);
strcpy (info->user, "wap");
strcpy (info->pass, "wap");
strcpy (info->num, "17266");
#endif
gDtcnt.actInfo = NULL;
if ( gUserNotify.cbAccountInfo ) {
GETDTCNTCALLBACK callback = gUserNotify.cbAccountInfo;
gUserNotify.cbAccountInfo = NULL;
callback ((void*)info);
}
}
static void GetGPRSAccountReq (int accID)
{
#ifdef MMI_ON_HARDWARE_P
mmi_ps_get_gprs_data_account_req_struct *myMsgPtr;
MYQUEUE Message;
myMsgPtr = (mmi_ps_get_gprs_data_account_req_struct*) OslConstructDataPtr(sizeof(mmi_ps_get_gprs_data_account_req_struct));
myMsgPtr->profile_id = (unsigned char)(accID + 1);
Message.oslSrcId=MOD_MMI;
Message.oslDestId=MOD_L4C;
Message.oslMsgId = PRT_MMI_PS_GET_GPRS_DATA_ACCOUNT_REQ;
Message.oslDataPtr = (oslParaType *)myMsgPtr;
Message.oslPeerBuffPtr= NULL;
SetProtocolEventHandler(GetGPRSAccountRsp,PRT_MMI_PS_GET_GPRS_DATA_ACCOUNT_RSP);
OslMsgSendExtQueue(&Message);
#else
PlxPostMessage ((void*)wndproc, LIBMSG_GETACCOUNT, accID, 1);
#endif
}
static void GetGPRSAccountRsp(void* para)
{
PACCOUNTINFO info = gDtcnt.actInfo;
#ifdef MMI_ON_HARDWARE_P
mmi_ps_get_gprs_data_account_rsp_struct *localPtr;
if ( info == NULL )
return;
localPtr = (mmi_ps_get_gprs_data_account_rsp_struct *)para;
if(localPtr->gprs_account.name_dcs == DATA_ACCOUNT_UCS)
{
int i = 0;
if (localPtr->gprs_account.name_length == 0) {
pfnUnicodeStrcpy((char*)info->name, gDtcnt.defname);
}
else {
while( i != localPtr->gprs_account.name_length)
{
((char*)info->name)[i] = localPtr->gprs_account.name[i+1];
((char*)info->name)[i+1] = localPtr->gprs_account.name[i];
i+=2;
}
((char*)info->name)[localPtr->gprs_account.name_length] = '\0';
((char*)info->name)[localPtr->gprs_account.name_length+1] = '\0';
}
}
else if(localPtr->gprs_account.name_dcs == DATA_ACCOUNT_ASCII)
{
if (localPtr->gprs_account.name_length == 0) {
pfnUnicodeStrcpy(((char*)info->name), gDtcnt.defname);
}
else {
AnsiiNToUnicodeString(((char*)info->name), (char*)localPtr->gprs_account.name,localPtr->gprs_account.name_length);
info->name[localPtr->gprs_account.name_length] = 0x0000;
}
}
strcpy (info->user, (char*)localPtr->gprs_account.user_name);
strcpy (info->pass, (char*)localPtr->gprs_account.password);
memcpy (info->num, (char*)localPtr->gprs_account.apn, (int)localPtr->gprs_account.apn_length);
info->num[localPtr->gprs_account.apn_length] = '\0';
#else
if ( info == NULL )
return;
pfnUnicodeStrcpy((char*)info->name, gDtcnt.defname);
strcpy (info->user, "wap");
strcpy (info->pass, "wap");
strcpy (info->num, "cmwap");
#endif
gDtcnt.actInfo = NULL;
if ( gUserNotify.cbAccountInfo ) {
GETDTCNTCALLBACK callback = gUserNotify.cbAccountInfo;
gUserNotify.cbAccountInfo = NULL;
callback ((void*)info);
}
}
static void OnSocDeactivateCnf (void * para);
typedef void (*RELSOCBACK)(void * para);
RELSOCBACK gRelSocBack = NULL;
void ReleaseSocResoure (void (*callback)(void* para))
{
#ifdef UILIB_DEBUG
PlxTrace ("[ReleaseSocResource]");
#endif
#ifdef MMI_ON_HARDWARE_P
/* MYQUEUE Message;
Message.oslSrcId=MOD_MMI;
Message.oslDestId=MOD_SOC;
Message.oslMsgId = MSG_ID_APP_SOC_DEACTIVATE_REQ;
Message.oslDataPtr = NULL;
Message.oslPeerBuffPtr= NULL;
OslMsgSendExtQueue(&Message);
*/
SetProtocolEventHandler (OnSocDeactivateCnf, MSG_ID_APP_SOC_DEACTIVATE_CNF);
gRelSocBack = callback;
soc_close_nwk_account (MOD_MMI);
#else
if ( callback )
callback (NULL);
#endif
}
#include "app2soc_struct.h"
static void OnSocDeactivateCnf (void * para)
{
app_soc_deactivate_cnf_struct * cnf = (app_soc_deactivate_cnf_struct*)para;
#ifdef UILIB_DEBUG
if ( para )
PlxTrace ("[OnSocDeactivateCnf] result[%d] ref_count[%d] conn_time[%d] sent[%d] recv[%d]",
cnf->result, cnf->ref_count, cnf->conn_time, cnf->sent_bytes, cnf->recv_bytes);
else
PlxTrace ("[OnSocDeactivateCnf] NULL");
#endif
if ( gRelSocBack ) {
gRelSocBack (NULL);
gRelSocBack = NULL;
}
}
static void GPRSSetAccountRsp(void* info);
static void GPRSSetAccountReq (int accountID, char* name, char* apn, char* username, char* password)
{
mmi_ps_set_gprs_data_account_req_struct *myMsgPtr;
U8 ref_count;
U16 msg_len;
MYQUEUE Message;
U8 DataAccountName[64];
U8 DataAccountAPN[128];
U8 i=0;
memset(DataAccountName, '\0', sizeof(DataAccountName));
memset(DataAccountAPN,'\0', sizeof(DataAccountAPN));
myMsgPtr = (mmi_ps_set_gprs_data_account_req_struct*) OslConstructDataPtr(sizeof(mmi_ps_set_gprs_data_account_req_struct));
ref_count = myMsgPtr->ref_count;
msg_len = myMsgPtr->msg_len;
memset(myMsgPtr,'\0',sizeof(mmi_ps_set_gprs_data_account_req_struct));
myMsgPtr->ref_count = ref_count;
myMsgPtr->msg_len = msg_len;
myMsgPtr->gprs_account.context_id = accountID-10+1;
myMsgPtr->gprs_account.authentication_type = 0;//PAP_AUTH;
myMsgPtr->gprs_account.name_dcs = 0;//DATA_ACCOUNT_ASCII;
myMsgPtr->gprs_account.name_length = strlen(name);
strcpy ((char*)myMsgPtr->gprs_account.name, name);
strcpy ((char*)myMsgPtr->gprs_account.apn, apn);
myMsgPtr->gprs_account.apn_length = strlen(apn);
strcpy ((char*)myMsgPtr->gprs_account.user_name, username);
strcpy ((char*)myMsgPtr->gprs_account.password, password);
for ( i = 0; i < 4; i++) {
myMsgPtr->gprs_account.dns[i] = 0;
}
ClearAllKeyHandler();
Message.oslSrcId=MOD_MMI;
Message.oslDestId=MOD_L4C;
Message.oslMsgId = PRT_MMI_PS_SET_GPRS_DATA_ACCOUNT_REQ;
Message.oslDataPtr = (oslParaType *)myMsgPtr;
Message.oslPeerBuffPtr= NULL;
SetProtocolEventHandler(GPRSSetAccountRsp,PRT_MMI_PS_SET_GPRS_DATA_ACCOUNT_RSP);
OslMsgSendExtQueue(&Message);
}
static void GPRSSetAccountRsp(void* info)
{
mmi_ps_set_gprs_data_account_rsp_struct *localPtr;
localPtr = (mmi_ps_set_gprs_data_account_rsp_struct *)info;
if (localPtr->result == KAL_TRUE /*OK*/)
{
DisplayPopup((PU8)GetString(STR_GLOBAL_DONE), IMG_GLOBAL_INFO, 1, 1000, SUCCESS_TONE);
}
else
{
DisplayPopup((PU8)GetString(STR_GLOBAL_NOT_DONE) ,IMG_GLOBAL_UNFINISHED, 1,1000, ERROR_TONE);
}
}
void SetOrangeAccount (void)
{
GPRSSetAccountReq (11, "Orange", "orange.acte", "orange", "orange");
}
static void SetDefDataAccountName(char *name, int index)
{
char LocalBuffer[8];
char StrVal[8];
sprintf(LocalBuffer,"%d", index+1);
AnsiiToUnicodeString(StrVal, LocalBuffer);
pfnUnicodeStrcpy(name, (char*) GetString(STR_ID_PLX_UIL_CNTNAME));
pfnUnicodeStrcat(name,(PS8)StrVal);
}
/************************************************************************/
/* Data account config UI implementation */
/************************************************************************/
static void DataAccountEntry (void);
static void DataAccountListEntry (void);
static void DTCNTMenuOnHilight (S32 idx);
static void DTCNTMenuOnOK (void);
static void DTCNTMenuOnCancel (void);
static void DTCNTListOnHilight (S32 idx);
static void DTCNTListOnOK (void);
static void DTCNTListOnCancel (void);
static void BeginWaiting (void);
static void EndWaiting (void);
static void GetInfoCallback (void* info);
static int CanShowWaitingScreen (void);
void PLIB_SelectAccount (int curAccount, void (*callback)(void * info))
{
gUserNotify.cbSetAccount = callback;
gDtcnt.gsmActed = ((curAccount < MAX_DATA_ACCOUNT_GSM_LIMIT) ? UIL_TRUE:UIL_FALSE);
DataAccountEntry ();
}
static void DataAccountEntry (void)
{
unsigned short numItems;
unsigned short nStrItemList[2];
unsigned char* guiBuffer;
EntryNewScreen(SCR_ID_PLX_UIL_DTCTMENU, NULL, DataAccountEntry, NULL);
guiBuffer = GetCurrGuiBuffer (SCR_ID_PLX_UIL_DTCTMENU);
SetParentHandler (MENU_ID_PLX_UIL_DTCNT);
numItems = GetNumOfChild (MENU_ID_PLX_UIL_DTCNT);
GetSequenceStringIds(MENU_ID_PLX_UIL_DTCNT, nStrItemList);
RegisterHighlightHandler (DTCNTMenuOnHilight);
ShowCategory52Screen (STR_ID_PLX_UIL_DTCNT, 0,
STR_GLOBAL_OK, IMG_GLOBAL_OK,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
numItems, nStrItemList, (U16*)gIndexIconsImageList,
NULL, 0, (gDtcnt.gsmActed ? 0:1), guiBuffer);
SetLeftSoftkeyFunction (DTCNTMenuOnOK, KEY_EVENT_UP);
SetKeyHandler (DTCNTMenuOnOK, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
SetRightSoftkeyFunction(DTCNTMenuOnCancel,KEY_EVENT_UP);
}
static void DataAccountListEntry (void)
{
unsigned char* guiBuffer;
int i, count, title;
EntryNewScreen(SCR_ID_PLX_UIL_DTCTLIST, NULL, DataAccountListEntry, NULL);
guiBuffer = GetCurrGuiBuffer(SCR_ID_PLX_UIL_DTCTLIST);
RegisterHighlightHandler (DTCNTListOnHilight);
/* fill list items */
if ( gDtcnt.gsmActed ) {
count = MAX_DATA_ACCOUNT_GSM_LIMIT;
title = STR_ID_PLX_UIL_GSM;
for ( i = 0;i < MAX_DATA_ACCOUNT_GSM_LIMIT; i++ )
pfnUnicodeStrcpy((char*)subMenuDataPtrs[i], (char*)gDtcnt.gsm[i].name);
}
else {
count = MAX_DATA_ACCOUNT_GPRS_LIMIT;
title = STR_ID_PLX_UIL_GPRS;
for ( i = 0;i < MAX_DATA_ACCOUNT_GPRS_LIMIT; i++ )
pfnUnicodeStrcpy((char*)subMenuDataPtrs[i], (char*)gDtcnt.gprs[i].name);
}
ShowCategory53Screen((unsigned short)title, 0,
STR_GLOBAL_OK, IMG_GLOBAL_OK,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
count, (U8**)subMenuDataPtrs,
(PU16)gIndexIconsImageList,
NULL, 0, 0,
guiBuffer );
SetLeftSoftkeyFunction(DTCNTListOnOK,KEY_EVENT_UP);
SetRightSoftkeyFunction(DTCNTListOnCancel,KEY_EVENT_UP);
}
static void DTCNTMenuOnHilight (S32 idx)
{
gDtcnt.gsmActed = ((idx == 0) ? UIL_TRUE:UIL_FALSE);
}
extern void AlmDisableExpiryHandler(void);
extern void AlmEnableExpiryHandler(void);
static void DTCNTMenuOnOK (void)
{
if ( CanShowWaitingScreen() )
BeginWaiting ();
AlmDisableExpiryHandler ();
if ( gDtcnt.gsmActed ) {
PLIB_GetAccountInfo (0, GetInfoCallback);
}
else {
PLIB_GetAccountInfo (MAX_DATA_ACCOUNT_GSM_LIMIT, GetInfoCallback);
}
}
static void DTCNTMenuOnCancel (void) {
if ( gUserNotify.cbSetAccount ) {
SETDTCNTCALLBACK callback = gUserNotify.cbSetAccount;
gUserNotify.cbSetAccount = NULL;
callback (NULL);
}
gDtcnt.actInfo = NULL;
GoBackHistory();
}
static void DTCNTListOnHilight (S32 idx)
{
if ( gDtcnt.gsmActed )
gDtcnt.actInfo = &gDtcnt.gsm[idx];
else
gDtcnt.actInfo = &gDtcnt.gprs[idx];
}
static void DTCNTListOnOK (void)
{
if ( gDtcnt.actInfo == NULL )
return;
if ( gUserNotify.cbSetAccount ) {
SETDTCNTCALLBACK callback = gUserNotify.cbSetAccount;
gUserNotify.cbSetAccount = NULL;
callback ((void*)gDtcnt.actInfo);
}
gDtcnt.actInfo = NULL;
GoBacknHistory (1);
}
static void DTCNTListOnCancel (void)
{
GoBackHistory();
}
/************************************************************************
begin to waiting for asynchronous response
should do something like disable KEY_END function,
show a waiting window etc.
************************************************************************/
static void BeginWaiting (void)
{
ClearKeyEndHandler ();
}
/************************************************************************/
/* end to waiting for asynchronous response
/* should do something like restore KEY_END function,
/* hide the waiting window etc.
/************************************************************************/
static void EndWaiting (void)
{
}
static void GetInfoCallback (void* info)
{
PACCOUNTINFO pinfo = (PACCOUNTINFO)info;
int idx = pinfo->accID;
if ( idx < MAX_DATA_ACCOUNT_GSM_LIMIT ) {
memcpy ((char*)&gDtcnt.gsm[idx], (char*)pinfo, sizeof(*pinfo));
if ( idx < MAX_DATA_ACCOUNT_GSM_LIMIT - 1 )
PLIB_GetAccountInfo (pinfo->accID+1, GetInfoCallback);
else {
AlmEnableExpiryHandler();
EndWaiting ();
DataAccountListEntry ();
}
}
else {
idx -= MAX_DATA_ACCOUNT_GSM_LIMIT;
memcpy ((char*)&gDtcnt.gprs[idx], (char*)pinfo, sizeof(*pinfo));
if ( idx < MAX_DATA_ACCOUNT_GPRS_LIMIT - 1 )
PLIB_GetAccountInfo (pinfo->accID+1, GetInfoCallback);
else {
AlmEnableExpiryHandler();
EndWaiting ();
DataAccountListEntry ();
}
}
}
extern U16 GetTotalCallCount(void);
extern S16 GetOutgoingCallHandle(void);
extern S16 GetIncomingCallHandle(void);
extern unsigned short GetWapCallPres
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -