📄 mfw_sms.c
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) $Workfile:: mfw_sms.c $|
| $Author:: Vo $Revision:: 1 $|
| CREATED: 21.12.98 $Modtime:: 24.03.00 10:25 $|
| STATE : code |
+--------------------------------------------------------------------+
MODULE : MFW_SMS
PURPOSE : This module contains SMS management functions.
*/
#define ENTITY_MFW
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif
#include "cus_aci.h"
#include "message.h"
#include "prim.h"
#include "aci_cmh.h"
#include "ksd.h"
#include "p_sim.h"
#include "pcm.h"
#include "P_MNSMS.val"
#include "psa.h"
#include "psa_sim.h"
#include "mfw_mfw.h"
#include "mfw_nm.h"
#include "mfw_sima.h"
#include "mfw_nmi.h"
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "mfw_cmi.h"
#include "mfw_sim.h"
#include "mfw_simi.h"
#include "mfw_phbi.h"
#include "mfw_sms.h"
#include "mfw_smsi.h"
#include "mfw_win.h"
#include "mfw_cphs.h"
#include "mfw_cphsi.h"
#include "aci_lst.h"
#include "conc_sms.h"
#ifdef SIM_TOOLKIT
#include "mfw_sat.h"
#endif
#include <string.h>
#include <stdio.h>
/* SBH
UBYTE SmsRead_ascii_to_gsm(char* gsm_string, char* ascii_string, USHORT length);
*/
/********* current define *******************************************/
static T_MFW_SMS_MSG msg_info[MAX_MESSAGES]; /* message table */
static T_MFW_SMS_MO sms_mo;
static T_MFW_SMS_MT sms_mt;
static T_MFW_SMS_CB sms_cb;
static T_MFW_SMS_ID sms_id, sms_id_wait;
static T_MFW_MEM_INFO memory;
static SHORT first_id;
static SHORT flag;
static SHORT status_change_index;
static SHORT deleting_index;
static SHORT storage_index;
static SHORT mt_flag;
static UBYTE f_update;
static UBYTE int_req;
static UBYTE smsReady;
static UBYTE phbReady;
static UBYTE sentStatus;
static UBYTE sms_update = FALSE;
static UBYTE coll_sms_send; /* mt sms during send process */
static UBYTE coll_sms_read; /* mt sms during read process */
static UBYTE coll_sms_delete; /* mt sms during delete process */
static UBYTE coll_sms_req; /* mt sms during request process */
static UBYTE data[30];
static UBYTE initialising_flag;
UBYTE sms_type;
UBYTE mt_type;
UBYTE int_init_req;
CHAR *wr_addr;
UBYTE Delete_1_2_1_vm_icon=FALSE;
UBYTE Display_1_2_1_vm_icon =FALSE;
static UBYTE cb_mid[10]; /* cell broadcast message identifier */
static UBYTE fg;
EXTERN MfwHdr * current_mfw_elem;
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : sms_init |
+--------------------------------------------------------------------+
PURPOSE : initialize for SMS management
*/
#define CONC_TEST
#ifdef CONC_TEST
typedef struct
{
USHORT ref;
UBYTE first_index;
} T_MFW_CONCLIST;
T_MFW_CONCLIST concList[MAX_MESSAGES];
#endif
void sms_init(void)
{
UBYTE i;
TRACE_FUNCTION ("sms_init()");
/* Setting the default SMS parameter */
sms_type = MFW_NO_MESSAGE;
mt_type = MFW_NO_MESSAGE;
flag = 0;
status_change_index = 0;
deleting_index = 0;
mt_flag = 0;
smsReady = 0;
phbReady = 0;
sms_id.index = sms_id_wait.index = 0;
for (i=0; i<MAX_MESSAGES; i++)
{
msg_info[i].index = -1;
msg_info[i].addr.number[0] = '\0';
msg_info[i].addr.tag[0] = '\0';
msg_info[i].addr.ton = MFW_TON_UNKNOWN;
msg_info[i].addr.npi = MFW_NPI_UNKNOWN;
#ifdef CONC_TEST
concList[i].ref = 0xFFFF;
concList[i].first_index = 0xFF;
#endif
}
/* PATCH-6363 VO 30.01.01 */
memory.mem = SMS_STOR_Sm;
memory.used = 0;
memory.total = 0;
/* PATCH-6363 end */
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : sms_exit |
+--------------------------------------------------------------------+
PURPOSE : initialize for SMS management
*/
void sms_exit(void)
{
TRACE_FUNCTION ("sms_exit()");
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : sms_phbReady_ind |
+--------------------------------------------------------------------+
PURPOSE : finished initialize from the SIM card
*/
void sms_phbReady_ind(void)
{
if (smsReady)
{
TRACE_FUNCTION("sms_phbReady_ind");
f_update = MFW_SMS_NEW;
TRACE_EVENT("all free");
coll_sms_send = coll_sms_read = coll_sms_delete = coll_sms_req = MFW_SMS_FREE;
sms_read_msg_info();
smsReady = 0;
phbReady = 0;
}
else
phbReady = 1;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : rAT_sms_ready |
+--------------------------------------------------------------------+
PURPOSE : finished initialize from the SIM card
*/
void rAT_sms_ready(void)
{
TRACE_FUNCTION("rAT_sms_ready()");
if (phbReady)
{
f_update = MFW_SMS_NEW;
sms_read_msg_info();
smsReady = 0;
phbReady = 0;
}
else
smsReady = 1;
}
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-F&D (8411) MODULE : MFW_CB |
| STATE : code ROUTINE : rAT_SignalSMS |
+--------------------------------------------------------------------+
PURPOSE : handles rAT_SignalSMS call back
*/
GLOBAL void rAT_SignalSMS ( UBYTE state )
{
TRACE_FUNCTION("rAT_SignalSMS()");
switch (state)
{
case SMS_STATE_INITIALISING: initialising_flag = TRUE; break;
case SMS_STATE_READY: initialising_flag = FALSE; break;
}
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : sms_create |
+--------------------------------------------------------------------+
PURPOSE : create SMS control
*/
T_MFW_HND sms_create(T_MFW_HND hWin, T_MFW_EVENT event, T_MFW_CB cbfunc)
{
T_MFW_HDR *hdr;
T_MFW_SMS *sms_para;
MfwHdr *insert_status =0;
TRACE_FUNCTION ("sms_create()");
hdr = (T_MFW_HDR *) mfwAlloc(sizeof(T_MFW_HDR));
sms_para = (T_MFW_SMS *) mfwAlloc(sizeof(T_MFW_SMS));
if (!hdr OR !sms_para)
{
TRACE_ERROR("ERROR: sms_create() Mem Alloc Failed.");
if(hdr)
mfwFree((U8*)hdr,sizeof(MfwHdr));
if(sms_para)
mfwFree((U8*)sms_para,sizeof(T_MFW_SMS));
return FALSE;
}
/* initialisation of the handler */
sms_para->emask = event;
sms_para->handler = cbfunc;
hdr->data = sms_para; /* store parameter in node */
hdr->type = MFW_TYP_SMS; /* store type of event handler */
/* installation of the handler */
insert_status = mfwInsert((T_MFW_HDR *)hWin, hdr);/*SPR 1968, inserted inadvertently deleted function call*/
if(!insert_status)
{
TRACE_ERROR("ERROR: sms_create() Failed to Install Handler. ");
mfwFree((U8*)hdr,sizeof(MfwHdr));
mfwFree((U8*)sms_para,sizeof(T_MFW_SIM));
return 0;
}
return insert_status;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : sms_delete |
+--------------------------------------------------------------------+
PURPOSE : delete SMS control
*/
T_MFW_RES sms_delete(T_MFW_HND h)
{
TRACE_FUNCTION ("sms_delete()");
if (!h OR !((T_MFW_HDR *)h)->data)
return MFW_RES_ILL_HND;
if (!mfwRemove((T_MFW_HDR *) h))
return MFW_RES_ILL_HND;
mfwFree((U8 *)(((T_MFW_HDR *) h)->data),sizeof(T_MFW_SMS));
mfwFree((U8 *)h,sizeof(T_MFW_HDR));
return MFW_RES_OK;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : sms_signal |
+--------------------------------------------------------------------+
PURPOSE : send a event.
*/
void sms_signal(T_MFW_EVENT event, void * para)
{
UBYTE temp = dspl_Enable(0);
TRACE_FUNCTION ("sms_signal()");
if (mfwSignallingMethod EQ 0)
{
/* focus is on a window */
if (mfwFocus)
/* send event to sim management handler if available */
if (sms_sign_exec (mfwFocus, event, para))
{
dspl_Enable(temp);
return;
}
/* acutal focussed window is not available or has no
* network management registration handler, then search
* all nodes from the root. */
if (mfwRoot)
sms_sign_exec (mfwRoot, event, para);
}
else
{
MfwHdr * h = 0;
/*
* Focus set, then start here
*/
if (mfwFocus)
h = mfwFocus;
/*
* Focus not set, then start root
*/
if (!h)
h = mfwRoot;
/*
* No elements available, return
*/
while (h)
{
/*
* Signal consumed, then return
*/
if (sms_sign_exec (h, event, para))
{
dspl_Enable(temp);
return;
}
/*
* All windows tried inclusive root
*/
if (h == mfwRoot)
{
dspl_Enable(temp);
return;
}
/*
* get parent window
*/
h = mfwParent(mfwParent(h));
if(h)
h = ((MfwWin * )(h->data))->elems;
}
sms_sign_exec (mfwRoot, event, para);
}
dspl_Enable(temp);
return;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_SMS |
| STATE : code ROUTINE : sms_sign_exec |
+--------------------------------------------------------------------+
PURPOSE : Send a signal if there is an SMS management handler.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -