SMSCore.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:111k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*******************************************************************************
  36.  * Filename:
  37.  * ---------
  38.  *  SMSCore.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *  MAUI
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *  
  47.  *
  48.  * Author:
  49.  * -------
  50.  *  
  51.  *
  52.  *==============================================================================
  53.  *             HISTORY
  54.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  55.  *------------------------------------------------------------------------------
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  *
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  *
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  *
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  *
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  *
  90.  * removed!
  91.  * removed!
  92.  * removed!
  93.  *
  94.  * removed!
  95.  * removed!
  96.  * removed!
  97.  *
  98.  * removed!
  99.  * removed!
  100.  * removed!
  101.  *
  102.  * removed!
  103.  * removed!
  104.  * removed!
  105.  *
  106.  * removed!
  107.  * removed!
  108.  * removed!
  109.  *
  110.  * removed!
  111.  * removed!
  112.  * removed!
  113.  *
  114.  * removed!
  115.  * removed!
  116.  * removed!
  117.  *
  118.  * removed!
  119.  * removed!
  120.  * removed!
  121.  *
  122.  * removed!
  123.  * removed!
  124.  * removed!
  125.  *
  126.  * removed!
  127.  * removed!
  128.  * removed!
  129.  *
  130.  * removed!
  131.  * removed!
  132.  * removed!
  133.  *
  134.  * removed!
  135.  * removed!
  136.  * removed!
  137.  *
  138.  * removed!
  139.  * removed!
  140.  * removed!
  141.  *
  142.  * removed!
  143.  * removed!
  144.  * removed!
  145.  *
  146.  * removed!
  147.  * removed!
  148.  * removed!
  149.  *
  150.  * removed!
  151.  * removed!
  152.  * removed!
  153.  *
  154.  * removed!
  155.  * removed!
  156.  * removed!
  157.  *
  158.  * removed!
  159.  * removed!
  160.  * removed!
  161.  *
  162.  *------------------------------------------------------------------------------
  163.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  164.  *==============================================================================
  165.  *******************************************************************************/
  166. #ifdef __MOD_SMSAL__
  167. #include "MMI_features.h"
  168. #include "stdC.h"
  169. #include "L4Dr1.h"
  170. #include "PixtelDataTypes.h"
  171. #include "EventsDef.h"
  172. /* ... Add More MMI header */
  173. #include "EventsGprot.h"
  174. #include "HistoryGprot.h"
  175. #include "GlobalMenuItems.h"
  176. #include "GlobalConstants.h"
  177. #include "Globaldefs.h"
  178. #include "wgui_categories.h"
  179. #include "CustMenuRes.h"
  180. #include "CommonScreens.h"
  181. #include "Unicodexdcl.h"
  182. #include "TimerEvents.h"
  183. #include "DebugInitDef.h"
  184. #include "ProtocolEvents.h"
  185. /* ...Add MSG header */
  186. #include "customer_ps_inc.h"
  187. #include "mmi_msg_context.h"
  188. #include "MessagesL4Def.h"
  189. #include "MessagesResourceData.h"
  190. #include "MessagesMiscell.h"
  191. #include "MessagesExDcl.h"
  192. #include "SmsGuiInterfaceProt.h"
  193. #include "SMsGuiInterfaceType.h"
  194. #include "SmsPsHandler.h"
  195. #include "CellBroadcastType.h"
  196. #ifdef __MMI_MESSAGES_CHAT__
  197. #include "ChatAppGprot.h"
  198. #include "ChatAppDef.h"
  199. #endif /* __MMI_MESSAGES_CHAT__ */ 
  200. /*  */
  201. #include "customer_ps_inc.h"
  202. #include "l4c2smsal_struct.h"
  203. #include "smsal_l4c_enum.h"
  204. #include "ems.h"
  205. /*  */
  206. #include "Gui_ems.h"
  207. #include "wgui_ems.h"
  208. #include "GSM7BitDefaultAlphabet.h"
  209. #include "wgui_categories_inputs.h"
  210. /*  */
  211. #include "CallHistoryGProts.h"
  212. #include "CallManagementGprot.h"
  213. #include "IdleAppProt.h"
  214. #include "SettingProfile.h"
  215. #include "ProfileGprots.h"
  216. #include "AlarmFrameworkProt.h"
  217. #include "PhoneBookTypes.h"
  218. #include "SimDetectionGexdcl.h"
  219. #include "SettingDefs.h"
  220. #include "SettingsGdcl.h"
  221. /*  */
  222. #include "NVRAMEnum.h"
  223. #include "NVRAMProt.h"
  224. #include "NVRAMType.h"
  225. #include "PhoneBookDef.h"
  226. #include "wgui_status_icons.h"
  227. #include "KeyBrd.h"
  228. #include "SMSApi.h"
  229. #include "SMSStruct.h"
  230. #include "SMSFunc.h"
  231. #ifdef __MMI_UNIFIED_MESSAGE__
  232. #include "UnifiedMessageGProt.h"
  233. #endif 
  234. #if 1
  235. #ifndef MMI_FRM_SMS_INVALID_NUM
  236. #define MMI_FRM_SMS_INVALID_NUM     0xff
  237. #endif 
  238. #ifndef MMI_FRM_SMS_ACTION_SIZE
  239. #define MMI_FRM_SMS_ACTION_SIZE     10
  240. #endif 
  241. #ifndef MMI_FRM_SMS_INVALID_INDEX
  242. #define MMI_FRM_SMS_INVALID_INDEX   0xffff
  243. #endif 
  244. #define SWAP(T,A,B) { T TMP = A; A = B; B = TMP; }
  245. static mmi_frm_sms_action_struct mmi_frm_sms_action[MMI_FRM_SMS_ACTION_SIZE];
  246. static U8 mmi_frm_sms_action_head = 0;
  247. static U8 mmi_frm_sms_action_tail = 0;
  248. static U8 mmi_frm_sms_action_num = 0;
  249. static U8 mmi_frm_sms_action_curr = MMI_FRM_SMS_INVALID_NUM;
  250. static mmi_frm_sms_msg_check_struct mmi_frm_sms_msg_check[MMI_FRM_SMS_ACTION_SIZE];
  251. static U8 mmi_frm_sms_msg_check_num = 0;
  252. static mmi_frm_sms_data_check_struct mmi_frm_sms_data_check[MMI_FRM_SMS_ACTION_SIZE];
  253. static U8 mmi_frm_sms_data_check_num = 0;
  254. static U8 mmi_frm_sms_search_phb_type = 0;
  255. mmi_frm_sms_context_struct g_frm_sms_cntx;
  256. #ifdef __MMI_MESSAGES_COPY__
  257. mmi_frm_sms_copy_info_struct g_frm_sms_copy_info;
  258. #endif 
  259. MMI_BOOL g_mmi_frm_sms_change_status = MMI_FALSE;
  260. /*******************************************************
  261.    mmi sms app test code start
  262. *******************************************************/
  263. static msg_ems_data_struct bufForDisplay;
  264. static msg_ems_data_struct bufForEdit;
  265. extern void mmi_phb_frm_enter_send_entry(void);
  266. /*****************************************************************************
  267.  * FUNCTION
  268.  *  InitMessagesEMSBuffer
  269.  * DESCRIPTION
  270.  *  Reset EMS edit/view buffer
  271.  * PARAMETERS
  272.  *  pE          [?]             
  273.  *  force       [IN]            
  274.  *  a(?)        [IN/OUT]        Msg_ems_data_struct EME buffer
  275.  *  b(?)        [IN]            Force to clear
  276.  * RETURNS
  277.  *  EMS buffer valid flag
  278.  *****************************************************************************/
  279. U8 InitMessagesEMSBuffer(msg_ems_data_struct *pE, U8 force)
  280. {
  281.     /*----------------------------------------------------------------*/
  282.     /* Local Variables                                                */
  283.     /*----------------------------------------------------------------*/
  284.     EMSTATUS retVal;
  285.     U8 oldFlag = pE->validFlag;
  286.     /*----------------------------------------------------------------*/
  287.     /* Code Body                                                      */
  288.     /*----------------------------------------------------------------*/
  289.     if ((pE->validFlag == 0) || force)
  290.     {
  291.         if (pE->validFlag)
  292.         {
  293.             retVal = ReleaseEMSData(&pE->emsData);
  294.             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[EmsMiscell.c] InitMessagesEMSBuffer: ReleaseEMSData()"
  295.                                  " returns %d-------*n", (int)retVal));
  296.         }
  297.         retVal = InitializeEMSData(&pE->emsData, 0);    /* = SMSAL_DEFAULT_DCS */
  298.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[EmsMiscell.c] InitMessagesEMSBuffer: InitializeEMSData()"
  299.                              " returns %d, dcs set to 0X%.2X-------*n", (int)retVal, (int)pE->emsData.dcs));
  300.     }
  301.     pE->validFlag = 1;
  302.     return oldFlag;
  303. }
  304. /*****************************************************************************
  305.  * FUNCTION
  306.  *  DeInitMessagesEMSBuffer
  307.  * DESCRIPTION
  308.  *  Releaset EMS buffer
  309.  * PARAMETERS
  310.  *  pE          [?]             
  311.  *  a(?)        [IN/OUT]        Msg_ems_data_struct EMS buffer
  312.  *  b(?)        [IN]            
  313.  * RETURNS
  314.  *  EMS buffer valid flag
  315.  *****************************************************************************/
  316. U8 DeInitMessagesEMSBuffer(msg_ems_data_struct *pE)
  317. {
  318.     /*----------------------------------------------------------------*/
  319.     /* Local Variables                                                */
  320.     /*----------------------------------------------------------------*/
  321.     U8 oldFlag = pE->validFlag;
  322.     EMSTATUS retVal;
  323.     /*----------------------------------------------------------------*/
  324.     /* Code Body                                                      */
  325.     /*----------------------------------------------------------------*/
  326.     if (pE->validFlag)
  327.     {
  328.         retVal = ReleaseEMSData(&pE->emsData);
  329.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*-------[EmsMiscell.c] DeInitMessagesEMSBuffer: ReleaseEMSData()"
  330.                              " returns %d-------*n", (int)retVal));
  331.     }
  332.     pE->validFlag = 0;
  333.     return oldFlag;
  334. }
  335. /*****************************************************************************
  336.  * FUNCTION
  337.  *  GetEMSDataForView
  338.  * DESCRIPTION
  339.  *  Get EMS view buffer
  340.  * PARAMETERS
  341.  *  p           [IN]        EMS data pointer
  342.  *  force       [IN]        Force to clear
  343.  * RETURNS
  344.  *  EMS buffer for display
  345.  *****************************************************************************/
  346. EMSData *GetEMSDataForView(EMSData **p, U8 force)
  347. {
  348.     /*----------------------------------------------------------------*/
  349.     /* Local Variables                                                */
  350.     /*----------------------------------------------------------------*/
  351.     /*----------------------------------------------------------------*/
  352.     /* Code Body                                                      */
  353.     /*----------------------------------------------------------------*/
  354.     if (p)
  355.     {
  356.         *p = &bufForDisplay.emsData;
  357.     }
  358.     InitMessagesEMSBuffer(&bufForDisplay, force);
  359.     return &bufForDisplay.emsData;
  360. }
  361. /*****************************************************************************
  362.  * FUNCTION
  363.  *  GetEMSDataForEdit
  364.  * DESCRIPTION
  365.  *  Get EMS edit buffer
  366.  * PARAMETERS
  367.  *  p           [IN]        EMS data pointer
  368.  *  force       [IN]        Force to clear
  369.  * RETURNS
  370.  *  EMS buffer for edit
  371.  *****************************************************************************/
  372. EMSData *GetEMSDataForEdit(EMSData **p, U8 force)
  373. {
  374.     /*----------------------------------------------------------------*/
  375.     /* Local Variables                                                */
  376.     /*----------------------------------------------------------------*/
  377.     /*----------------------------------------------------------------*/
  378.     /* Code Body                                                      */
  379.     /*----------------------------------------------------------------*/
  380.     if (p)
  381.     {
  382.         *p = &bufForEdit.emsData;
  383.     }
  384.     InitMessagesEMSBuffer(&bufForEdit, force);
  385.     return &bufForEdit.emsData;
  386. }
  387. /*****************************************************************************
  388.  * FUNCTION
  389.  *  CopyEMSViewToEditBuffer
  390.  * DESCRIPTION
  391.  *  Copy EMS view buffer to edit buffer
  392.  * PARAMETERS
  393.  *  void
  394.  * RETURNS
  395.  *  void
  396.  *****************************************************************************/
  397. U8 CopyEMSViewToEditBuffer(void)
  398. {
  399.     /*----------------------------------------------------------------*/
  400.     /* Local Variables                                                */
  401.     /*----------------------------------------------------------------*/
  402.     U8 result = EMS_OK;
  403.     /*----------------------------------------------------------------*/
  404.     /* Code Body                                                      */
  405.     /*----------------------------------------------------------------*/
  406.     ReleaseEMSEditBuffer();
  407.     InitMessagesEMSBuffer(&bufForEdit, 1);
  408.     if (bufForDisplay.validFlag)
  409.     {
  410.         result = CopyEMSData(&bufForEdit.emsData, &bufForDisplay.emsData);
  411.         bufForEdit.validFlag = 1;
  412.         if (result == EMS_OK)
  413.         {
  414.         #ifdef MMI_ON_HARDWARE_P
  415.             EMSResetPortNum(&bufForEdit.emsData);
  416.         #endif 
  417.             GoToEndPosition(&bufForEdit.emsData);
  418.         }
  419.         else
  420.         {
  421.             ReleaseEMSEditBuffer(); /* because validFlag for edit buffer is 1, it is equivalent to force to realease */
  422.         }
  423.     }
  424.     else
  425.     {
  426.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  427.                              "*-------[SMSCore.c] ERROR : CopyEMSViewToEditBuffer: src buffer uninitialized -------*n"));
  428.     }
  429.     return result;
  430. }
  431. /*****************************************************************************
  432.  * FUNCTION
  433.  *  ReleaseEMSViewBuffer
  434.  * DESCRIPTION
  435.  *  Release EMS view buffer
  436.  * PARAMETERS
  437.  *  void
  438.  * RETURNS
  439.  *  void
  440.  *****************************************************************************/
  441. void ReleaseEMSViewBuffer(void)
  442. {
  443.     /*----------------------------------------------------------------*/
  444.     /* Local Variables                                                */
  445.     /*----------------------------------------------------------------*/
  446.     /*----------------------------------------------------------------*/
  447.     /* Code Body                                                      */
  448.     /*----------------------------------------------------------------*/
  449.     DeInitMessagesEMSBuffer(&bufForDisplay);
  450. }
  451. /*****************************************************************************
  452.  * FUNCTION
  453.  *  ReleaseEMSEditBuffer
  454.  * DESCRIPTION
  455.  *  Release EMS edit buffer
  456.  * PARAMETERS
  457.  *  void
  458.  * RETURNS
  459.  *  void
  460.  *****************************************************************************/
  461. void ReleaseEMSEditBuffer(void)
  462. {
  463.     /*----------------------------------------------------------------*/
  464.     /* Local Variables                                                */
  465.     /*----------------------------------------------------------------*/
  466.     /*----------------------------------------------------------------*/
  467.     /* Code Body                                                      */
  468.     /*----------------------------------------------------------------*/
  469.     DeInitMessagesEMSBuffer(&bufForEdit);
  470. }
  471. /*****************************************************************************
  472.  * FUNCTION
  473.  *  GetRefFromNVRAM
  474.  * DESCRIPTION
  475.  *  Get concatenate reference from NVRAM
  476.  * PARAMETERS
  477.  *  void
  478.  * RETURNS
  479.  *  reference
  480.  *****************************************************************************/
  481. U16 GetRefFromNVRAM(void)
  482. {
  483.     /*----------------------------------------------------------------*/
  484.     /* Local Variables                                                */
  485.     /*----------------------------------------------------------------*/
  486.     S16 error;
  487.     U16 ref;
  488.     /*----------------------------------------------------------------*/
  489.     /* Code Body                                                      */
  490.     /*----------------------------------------------------------------*/
  491.     if (ReadValue(NVRAM_SMS_CONCAT_MSG_REF_VALUE, (void*)&ref, DS_SHORT, &error) < 0)
  492.     {
  493.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "GetRefFromNVRAM:: Read from NVRAM failed (ecode == %d)", (int)error));
  494.     }
  495.     return ref;
  496. }
  497. /*****************************************************************************
  498.  * FUNCTION
  499.  *  WriteRefToNVRAM
  500.  * DESCRIPTION
  501.  *  Write referemce to NVRAM
  502.  * PARAMETERS
  503.  *  val     [IN]        Reference
  504.  * RETURNS
  505.  *  void
  506.  *****************************************************************************/
  507. static void WriteRefToNVRAM(U16 val)
  508. {
  509.     /*----------------------------------------------------------------*/
  510.     /* Local Variables                                                */
  511.     /*----------------------------------------------------------------*/
  512.     S16 error;
  513.     /*----------------------------------------------------------------*/
  514.     /* Code Body                                                      */
  515.     /*----------------------------------------------------------------*/
  516.     if (WriteValue(NVRAM_SMS_CONCAT_MSG_REF_VALUE, (void*)&val, DS_SHORT, &error) < 0)
  517.     {
  518.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "WriteRefToNVRAM:: Write to NVRAM failed (ecode == %d)", (int)error));
  519.     }
  520. }
  521. /*****************************************************************************
  522.  * FUNCTION
  523.  *  RefGeneratorCallback
  524.  * DESCRIPTION
  525.  *  Call back for reference generator
  526.  * PARAMETERS
  527.  *  void
  528.  * RETURNS
  529.  *  reference
  530.  *****************************************************************************/
  531. static U16 RefGeneratorCallback(void)
  532. {
  533.     /*----------------------------------------------------------------*/
  534.     /* Local Variables                                                */
  535.     /*----------------------------------------------------------------*/
  536.     U16 static ref = 65534;
  537.     /*----------------------------------------------------------------*/
  538.     /* Code Body                                                      */
  539.     /*----------------------------------------------------------------*/
  540.     if (ref == 65534)
  541.     {
  542.         ref = GetRefFromNVRAM();
  543.     }
  544.     ++ref;
  545.     WriteRefToNVRAM(ref);
  546.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "RefGeneratorCallback:: New ref number %d", (int)ref));
  547.     return ref;
  548. }
  549. /*****************************************************************************
  550.  * FUNCTION
  551.  *  InitEMSDataStruct
  552.  * DESCRIPTION
  553.  *  Init EMS data structure
  554.  * PARAMETERS
  555.  *  void
  556.  * RETURNS
  557.  *  void
  558.  *****************************************************************************/
  559. void InitEMSDataStruct(void)
  560. {
  561.     /*----------------------------------------------------------------*/
  562.     /* Local Variables                                                */
  563.     /*----------------------------------------------------------------*/
  564.     /*----------------------------------------------------------------*/
  565.     /* Code Body                                                      */
  566.     /*----------------------------------------------------------------*/
  567.     EMSInitialize();
  568. #ifdef __EMS_REL5__
  569.     EMSSetCompressMode(TRUE);
  570. #endif 
  571.     EMSConcatMsgRefFunc(RefGeneratorCallback);
  572.     bufForDisplay.validFlag = 0;
  573.     bufForEdit.validFlag = 0;
  574. #ifdef __MMI_MESSAGES_EMS__
  575.     mmi_ems_create_ems_folder();
  576. #endif 
  577. }
  578. /*****************************************************************************
  579.  * FUNCTION
  580.  *  DeInitEMSDataStruct
  581.  * DESCRIPTION
  582.  *  Deinit EMS data structure
  583.  * PARAMETERS
  584.  *  void
  585.  * RETURNS
  586.  *  void
  587.  *****************************************************************************/
  588. void DeInitEMSDataStruct(void)
  589. {
  590.     /*----------------------------------------------------------------*/
  591.     /* Local Variables                                                */
  592.     /*----------------------------------------------------------------*/
  593.     /*----------------------------------------------------------------*/
  594.     /* Code Body                                                      */
  595.     /*----------------------------------------------------------------*/
  596.     EMSDeInitialize();
  597. }
  598. /*****************************************************************************
  599.  * FUNCTION
  600.  *  mmi_frm_sms_reg_interrupt_check
  601.  * DESCRIPTION
  602.  *  Register SMS related interrupt check
  603.  * PARAMETERS
  604.  *  mod             [IN]        Module
  605.  *  msgid           [IN]        Message ID
  606.  *  callback        [IN]        Callback for interrupt
  607.  * RETURNS
  608.  *  void
  609.  *****************************************************************************/
  610. void mmi_frm_sms_reg_interrupt_check(module_type mod, U16 msgid, PsFuncPtrU16 callback)
  611. {
  612.     /*----------------------------------------------------------------*/
  613.     /* Local Variables                                                */
  614.     /*----------------------------------------------------------------*/
  615.     /*----------------------------------------------------------------*/
  616.     /* Code Body                                                      */
  617.     /*----------------------------------------------------------------*/
  618.     mmi_frm_sms_reg_interrupt_handler(mod, msgid, callback);
  619. }
  620. /*****************************************************************************
  621.  * FUNCTION
  622.  *  mmi_frm_sms_reg_msg_check
  623.  * DESCRIPTION
  624.  *  Register SMS check
  625.  * PARAMETERS
  626.  *  action          [IN]        Check action
  627.  *  callback        [IN]        Callback for interrupt
  628.  * RETURNS
  629.  *  void
  630.  *****************************************************************************/
  631. void mmi_frm_sms_reg_msg_check(PsExtPeerIntFuncPtr action, PsFuncPtrFuncPtr callback)
  632. {
  633.     /*----------------------------------------------------------------*/
  634.     /* Local Variables                                                */
  635.     /*----------------------------------------------------------------*/
  636.     /*----------------------------------------------------------------*/
  637.     /* Code Body                                                      */
  638.     /*----------------------------------------------------------------*/
  639.     mmi_frm_sms_msg_check[mmi_frm_sms_msg_check_num].action = action;
  640.     mmi_frm_sms_msg_check[mmi_frm_sms_msg_check_num].callback = callback;
  641.     mmi_frm_sms_msg_check_num++;
  642. }
  643. /*****************************************************************************
  644.  * FUNCTION
  645.  *  mmi_frm_sms_indicate_sms
  646.  * DESCRIPTION
  647.  *  Indicate new SMS
  648.  * PARAMETERS
  649.  *  index           [IN]        
  650.  *  callback(?)     [IN]        Callback for interrupt
  651.  *  action(?)       [IN]        Check action
  652.  * RETURNS
  653.  *  void
  654.  *****************************************************************************/
  655. void mmi_frm_sms_indicate_sms(U16 index)
  656. {
  657.     /*----------------------------------------------------------------*/
  658.     /* Local Variables                                                */
  659.     /*----------------------------------------------------------------*/
  660.     U8 i = 0;
  661.     mmi_frm_sms_deliver_msg_struct *data = OslMalloc(sizeof(mmi_frm_sms_deliver_msg_struct));
  662.     /* MMI could only allocate 2K control buffer, so limit the max allocate buffer to 1600 here */
  663.     U16 content_len =
  664.         ((MMI_FRM_SMS_MSG_LEN * g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) <
  665.          (MMI_FRM_SMS_MSG_LEN * 10)) ? (MMI_FRM_SMS_MSG_LEN *
  666.                                         g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) : (MMI_FRM_SMS_MSG_LEN * 10);
  667.     U8 *content = OslMalloc(content_len);
  668.     U8 withobject;
  669.     U8 updatelist = FALSE;
  670.     /*----------------------------------------------------------------*/
  671.     /* Code Body                                                      */
  672.     /*----------------------------------------------------------------*/
  673.     memset(content, 0x00, content_len);
  674.     withobject = mmi_frm_sms_get_awaited_sms((U8) index, data, content);
  675.     data->msg_data[0] = (U8) index;
  676.     if (data->display_type == SMSAL_MSG_TYPE_UPDATE_ONLY)
  677.     {
  678.         /* default indication here */
  679.         mmi_frm_sms_msgbox_struct *entry = OslMalloc(sizeof(mmi_frm_sms_msgbox_struct));
  680.         //mmi_frm_sms_concat_struct* concatinfo = (mmi_frm_sms_concat_struct*)&(data->concat_info);
  681.         //U8 segment=((concatinfo->seg%g_frm_sms_cntx.mmi_frm_sms_msg_seg_size)==0)?
  682.         //g_frm_sms_cntx.mmi_frm_sms_msg_seg_size:(concatinfo->seg%g_frm_sms_cntx.mmi_frm_sms_msg_seg_size);
  683.         U8 segment = mmi_frm_sms_index_list[data->index].segment;
  684.         mmi_frm_sms_convert_mt_to_entry(data, entry);
  685.     #ifdef __MMI_UNIFIED_MESSAGE__
  686.         memset(entry->content, 0, sizeof(entry->content));
  687.         if (data->dcs == SMSAL_UCS2_DCS)
  688.         {
  689.             if (pfnUnicodeStrlen((S8*) content))
  690.             {
  691.                 mmi_frm_sms_add_content_to_entry(entry, content);
  692.             }
  693.         }
  694.         else
  695.         {
  696.             if (strlen((S8*) content))
  697.             {
  698.                 U8 *ucs2_content = NULL;
  699.                 U16 ucs2_content_len = 0;
  700.                 ucs2_content_len = ((mmi_msg_get_max_content_size() + 1) * ENCODING_LENGTH);
  701.                 ucs2_content = OslMalloc(ucs2_content_len);
  702.                 memset(ucs2_content, 0, ucs2_content_len);
  703.                 AnsiiNToUnicodeString((S8*) ucs2_content, (S8*) content, (U32) mmi_msg_get_max_content_size());
  704.                 mmi_frm_sms_add_content_to_entry(entry, ucs2_content);
  705.                 OslMfree(ucs2_content);
  706.             }
  707.         }
  708.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  709.         mmi_frm_sms_add_sms_to_msgbox(entry, data->index, segment);
  710.         OslMfree(entry);
  711.     }
  712.     else
  713.     {
  714.         while (i < mmi_frm_sms_msg_check_num)
  715.         {
  716.             if (mmi_frm_sms_msg_check[i].action((void*)data, (int)withobject, (void*)content) == TRUE)
  717.             {
  718.                 mmi_frm_sms_convert_time_stamp(data->scts, data->scts);
  719.                 if (mmi_frm_sms_msg_check[i].callback((void*)data, (void*)content))
  720.                 {
  721.                     updatelist = TRUE;
  722.                 }
  723.                 break;
  724.             }
  725.             i++;
  726.         }
  727.         if ((i == mmi_frm_sms_msg_check_num) || (updatelist == TRUE))
  728.         {
  729.             /* default indication here */
  730.             mmi_frm_sms_msgbox_struct *entry = OslMalloc(sizeof(mmi_frm_sms_msgbox_struct));
  731.             //mmi_frm_sms_concat_struct* concatinfo = (mmi_frm_sms_concat_struct*)&(data->concat_info);
  732.             //U8 segment=((concatinfo->seg%g_frm_sms_cntx.mmi_frm_sms_msg_seg_size)==0)?
  733.             //g_frm_sms_cntx.mmi_frm_sms_msg_seg_size:(concatinfo->seg%g_frm_sms_cntx.mmi_frm_sms_msg_seg_size);
  734.             U8 segment = mmi_frm_sms_index_list[data->index].segment;
  735.             U16 msgbox_index;
  736.             mmi_frm_sms_convert_mt_to_entry(data, entry);
  737.         #ifdef __MMI_UNIFIED_MESSAGE__
  738.             memset(entry->content, 0, sizeof(entry->content));
  739.             if (data->dcs == SMSAL_UCS2_DCS)
  740.             {
  741.                 if (pfnUnicodeStrlen((S8*) content))
  742.                 {
  743.                     mmi_frm_sms_add_content_to_entry(entry, content);
  744.                 }
  745.             }
  746.             else
  747.             {
  748.                 if (strlen((S8*) content))
  749.                 {
  750.                     U8 *ucs2_content = NULL;
  751.                     U16 ucs2_content_len = 0;
  752.                     ucs2_content_len = ((mmi_msg_get_max_content_size() + 1) * ENCODING_LENGTH);
  753.                     ucs2_content = OslMalloc(ucs2_content_len);
  754.                     memset(ucs2_content, 0, ucs2_content_len);
  755.                     AnsiiNToUnicodeString((S8*) ucs2_content, (S8*) content, (U32) mmi_msg_get_max_content_size());
  756.                     mmi_frm_sms_add_content_to_entry(entry, ucs2_content);
  757.                     OslMfree(ucs2_content);
  758.                 }
  759.             }
  760.         #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  761.             msgbox_index = mmi_frm_sms_add_sms_to_msgbox(entry, data->index, segment);
  762.             if (i == mmi_frm_sms_msg_check_num)
  763.             {
  764.                 mmi_frm_sms_new_msg_ind(msgbox_index);
  765.             }
  766.             OslMfree(entry);
  767.         }
  768.     }
  769.     mmi_frm_sms_free_awaited((U8) index);
  770.     if (data != NULL)
  771.     {
  772.         OslMfree(data);
  773.         data = NULL;
  774.     }
  775.     if (content != NULL)
  776.     {
  777.         OslMfree(content);
  778.         content = NULL;
  779.     }
  780. }
  781. /*****************************************************************************
  782.  * FUNCTION
  783.  *  mmi_frm_sms_indicate_data
  784.  * DESCRIPTION
  785.  *  Indicate new SMS with port number
  786.  * PARAMETERS
  787.  *  index       [IN]        Data index
  788.  * RETURNS
  789.  *  void
  790.  *****************************************************************************/
  791. void mmi_frm_sms_indicate_data(U8 index)
  792. {
  793.     /*----------------------------------------------------------------*/
  794.     /* Local Variables                                                */
  795.     /*----------------------------------------------------------------*/
  796.     U8 i = 0;
  797.     mmi_frm_sms_deliver_data_struct *data = OslMalloc(sizeof(mmi_frm_sms_deliver_data_struct));
  798.     /* MMI could only allocate 2K control buffer, so limit the max allocate buffer to 1600 here */
  799.     U16 content_len =
  800.         ((MMI_FRM_SMS_MSG_LEN * g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) <
  801.          (MMI_FRM_SMS_MSG_LEN * 10)) ? (MMI_FRM_SMS_MSG_LEN *
  802.                                         g_frm_sms_cntx.mmi_frm_sms_msg_seg_size) : (MMI_FRM_SMS_MSG_LEN * 10);
  803.     U8 *content = OslMalloc(content_len);
  804.     /*----------------------------------------------------------------*/
  805.     /* Code Body                                                      */
  806.     /*----------------------------------------------------------------*/
  807.     memset(content, 0, content_len);
  808.     mmi_frm_sms_set_data_check(index, 0);
  809.     mmi_frm_sms_get_data(index, data, content);
  810.     while (i < mmi_frm_sms_data_check_num)
  811.     {
  812.         if ((mmi_frm_sms_data_check[i].module == data->dest_mod_id)
  813.             && (mmi_frm_sms_data_check[i].desport == data->dest_port))
  814.         {
  815.             mmi_frm_sms_data_check[i].callback(
  816.                                         (void*)data,
  817.                                         (module_type) data->dest_mod_id,
  818.                                         mmi_frm_sms_data_check[i].serial);
  819.             if (mmi_frm_sms_data_check[i].withdata)
  820.             {
  821.                 mmi_frm_sms_free_data(index);
  822.             }
  823.             else
  824.             {
  825.                 mmi_frm_sms_data_check[i].serial++;
  826.                 if (mmi_frm_sms_data_check[i].serial == MMI_FRM_SMS_INVALID_NUM)
  827.                 {
  828.                     mmi_frm_sms_data_check[i].serial = 0;
  829.                 }
  830.                 if (index == MMI_FRM_SMS_ACTION_SIZE)
  831.                 {
  832.                     /* add one entry with index awaited_index in the mmi_frm_sms_data */
  833.                     U8 awaited_index = mmi_frm_sms_add_data_entry();
  834.                     /* find an empty entry in the data list and add successfully */
  835.                     if (awaited_index != MMI_FRM_SMS_INVALID_NUM)
  836.                     {
  837.                         /* Reset the data check bit to zero  */
  838.                         mmi_frm_sms_set_data_check(awaited_index, 0);
  839.                         mmi_frm_sms_free_new_data();
  840.                     }
  841.                 }
  842.             }
  843.             break;
  844.         }
  845.         i++;
  846.     }
  847.     if (i == mmi_frm_sms_data_check_num)
  848.     {
  849.         mmi_frm_sms_free_data(index);
  850.     }
  851.     if (data != NULL)
  852.     {
  853.         OslMfree(data);
  854.         data = NULL;
  855.     }
  856.     if (content != NULL)
  857.     {
  858.         OslMfree(content);
  859.         content = NULL;
  860.     }
  861. }
  862. /*****************************************************************************
  863.  * FUNCTION
  864.  *  mmi_frm_sms_new_sms
  865.  * DESCRIPTION
  866.  *  handle new SMS
  867.  * PARAMETERS
  868.  *  void
  869.  * RETURNS
  870.  *  void
  871.  *****************************************************************************/
  872. void mmi_frm_sms_new_sms(void)
  873. {
  874.     /*----------------------------------------------------------------*/
  875.     /* Local Variables                                                */
  876.     /*----------------------------------------------------------------*/
  877.     U16 index;
  878.     /*----------------------------------------------------------------*/
  879.     /* Code Body                                                      */
  880.     /*----------------------------------------------------------------*/
  881.     /* check segment */
  882.     switch (mmi_frm_sms_check_concatenate_sms(&index))
  883.     {
  884.         case MMI_FRM_SMS_AWAITS:
  885.         {
  886.             mmi_frm_sms_indicate_sms(index);
  887.         }
  888.             break;
  889.         case MMI_FRM_SMS_INBOX:
  890.         {
  891.             /* when there is a new segment coming, always set the status as unread, in case the previous segments in inbox is read */
  892.             mmi_frm_sms_set_sms_status(MMI_FRM_SMS_NOBOX, index, MMI_FRM_SMS_UNREAD);
  893.             mmi_frm_sms_new_msg_ind(index);
  894.             return;
  895.         }
  896.     }
  897. }
  898. /*****************************************************************************
  899.  * FUNCTION
  900.  *  mmi_frm_sms_new_data
  901.  * DESCRIPTION
  902.  *  handle new SMS with port number
  903.  * PARAMETERS
  904.  *  void
  905.  * RETURNS
  906.  *  void
  907.  *****************************************************************************/
  908. void mmi_frm_sms_new_data(void)
  909. {
  910.     /*----------------------------------------------------------------*/
  911.     /* Local Variables                                                */
  912.     /*----------------------------------------------------------------*/
  913.     U8 index;
  914.     /*----------------------------------------------------------------*/
  915.     /* Code Body                                                      */
  916.     /*----------------------------------------------------------------*/
  917.     /* check segment */
  918.     switch (mmi_frm_sms_check_concatenate_data(&index))
  919.     {
  920.         case MMI_FRM_SMS_DATA:
  921.         {
  922.             mmi_frm_sms_indicate_data(index);
  923.         }
  924.             break;
  925.     }
  926. }
  927. /*****************************************************************************
  928.  * FUNCTION
  929.  *  mmi_frm_sms_entry_abort
  930.  * DESCRIPTION
  931.  *  Entry abort screen
  932.  * PARAMETERS
  933.  *  void
  934.  * RETURNS
  935.  *  void
  936.  *****************************************************************************/
  937. void mmi_frm_sms_entry_abort(void)
  938. {
  939.     /*----------------------------------------------------------------*/
  940.     /* Local Variables                                                */
  941.     /*----------------------------------------------------------------*/
  942.     /*----------------------------------------------------------------*/
  943.     /* Code Body                                                      */
  944.     /*----------------------------------------------------------------*/
  945.     EntryNewScreen(SCR_ID_MSG_PROCESSING, NULL, mmi_frm_sms_entry_abort, NULL);
  946.     ShowCategory8Screen(
  947.         STR_ABORT_SENDING_SMS,
  948.         IMG_SMS_ENTRY_SCRN_CAPTION,
  949.         0,
  950.         0,
  951.         0,
  952.         0,
  953.         STR_SENDIING_SMS_BODY,
  954.         IMG_GLOBAL_PROGRESS,
  955.         NULL);
  956.     ClearAllKeyHandler();
  957.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  958.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  959.     ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  960.     ClearKeyHandler(KEY_END, KEY_REPEAT);
  961.     if (isInCall())
  962.     {
  963.         SetKeyHandler(HangupAllCalls, KEY_END, KEY_EVENT_DOWN);
  964.     }
  965. }
  966. /*****************************************************************************
  967.  * FUNCTION
  968.  *  mmi_frm_sms_entry_send
  969.  * DESCRIPTION
  970.  *  Entry send screen
  971.  * PARAMETERS
  972.  *  void
  973.  * RETURNS
  974.  *  void
  975.  *****************************************************************************/
  976. void mmi_frm_sms_entry_send(void)
  977. {
  978.     /*----------------------------------------------------------------*/
  979.     /* Local Variables                                                */
  980.     /*----------------------------------------------------------------*/
  981.     /*----------------------------------------------------------------*/
  982.     /* Code Body                                                      */
  983.     /*----------------------------------------------------------------*/
  984.     EntryNewScreen(SCR_ID_MSG_SENDING, NULL, mmi_frm_sms_entry_send, NULL);
  985.     /* reset the status because sending SMS in the idle screen background is allowable */
  986.     g_msg_cntx.msg_status = MSG_STATUS_IDLE;
  987.     ShowCategory8Screen(
  988.         STR_SENDING_SMS,
  989.         0,
  990.         0,
  991.         0,
  992.         STR_GLOBAL_ABORT,
  993.         IMG_SMS_COMMON_NOIMAGE,
  994.         STR_SENDIING_SMS_BODY,
  995.         IMG_NEW_SMS_SEND,
  996.         NULL);
  997. #ifdef __MMI_UNIFIED_MESSAGE__
  998.     GetCurrEndKeyDownHandler();
  999. #endif 
  1000.     ClearInputEventHandler(MMI_DEVICE_KEY);
  1001.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  1002.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1003.     ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  1004.     ClearKeyHandler(KEY_END, KEY_REPEAT);
  1005. #ifdef __MMI_UNIFIED_MESSAGE__
  1006.     SetKeyHandler(mmi_frm_sms_abort_sms_by_end_key, KEY_END, KEY_EVENT_DOWN);
  1007. #else 
  1008.     SetKeyHandler(mmi_frm_sms_abort_sms, KEY_END, KEY_EVENT_DOWN);
  1009. #endif 
  1010.     SetRightSoftkeyFunction(mmi_frm_sms_abort_sms, KEY_EVENT_UP);
  1011. }
  1012. /*****************************************************************************
  1013.  * FUNCTION
  1014.  *  mmi_frm_sms_entry_save
  1015.  * DESCRIPTION
  1016.  *  Entry save screen
  1017.  * PARAMETERS
  1018.  *  void
  1019.  * RETURNS
  1020.  *  void
  1021.  *****************************************************************************/
  1022. void mmi_frm_sms_entry_save(void)
  1023. {
  1024.     /*----------------------------------------------------------------*/
  1025.     /* Local Variables                                                */
  1026.     /*----------------------------------------------------------------*/
  1027.     /*----------------------------------------------------------------*/
  1028.     /* Code Body                                                      */
  1029.     /*----------------------------------------------------------------*/
  1030.     EntryNewScreen(SCR_ID_MSG_SAVING, NULL, mmi_frm_sms_entry_save, NULL);
  1031.     ShowCategory8Screen(
  1032.         STR_SAVING_SMS,
  1033.         0,
  1034.         0,
  1035.         0,
  1036.         0,
  1037.         IMG_SMS_COMMON_NOIMAGE,
  1038.         STR_SENDIING_SMS_BODY,
  1039.         IMG_GLOBAL_SAVE,
  1040.         NULL);
  1041.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1042.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  1043.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1044.     ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
  1045.     ClearKeyHandler(KEY_END, KEY_REPEAT);
  1046. }
  1047. /*****************************************************************************
  1048.  * FUNCTION
  1049.  *  mmi_frm_sms_get_phb_number
  1050.  * DESCRIPTION
  1051.  *  Get phonebook number
  1052.  * PARAMETERS
  1053.  *  name        [IN]        Name
  1054.  *  number      [IN]        Number
  1055.  * RETURNS
  1056.  *  void
  1057.  *****************************************************************************/
  1058. void mmi_frm_sms_get_phb_number(U8 name[], U8 number[])
  1059. {
  1060.     /*----------------------------------------------------------------*/
  1061.     /* Local Variables                                                */
  1062.     /*----------------------------------------------------------------*/
  1063.     /*----------------------------------------------------------------*/
  1064.     /* Code Body                                                      */
  1065.     /*----------------------------------------------------------------*/
  1066.     if (pfnUnicodeStrlen((PS8) number) > (MAX_DIGITS_SMS - 1))
  1067.     {
  1068.         DisplayPopup(
  1069.             (PU8) GetString(STR_SMS_NUM_LEN_EXCEEDED),
  1070.             IMG_GLOBAL_UNFINISHED,
  1071.             1,
  1072.             PHB_NOTIFY_TIMEOUT,
  1073.             (U8) ERROR_TONE);
  1074.         return;
  1075.     }
  1076.     memset(g_frm_sms_cntx.mmi_frm_sms_number, 0, (MAX_DIGITS_SMS + 1) * ENCODING_LENGTH);
  1077.     if (number)
  1078.     {
  1079.         pfnUnicodeStrcpy((S8*) g_frm_sms_cntx.mmi_frm_sms_number, (PS8) number);
  1080.     }
  1081.     if (mmi_frm_sms_search_phb_type == MMI_FRM_SMS_SC)
  1082.     {
  1083.         HistoryReplace(SCR_ID_MSG_SC_NUMBER, SCR_ID_MSG_SC_NUMBER, mmi_frm_sms_entry_sc);
  1084.         GoBackToHistory(SCR_ID_MSG_SC_NUMBER);
  1085.     }
  1086.     else
  1087.     {
  1088.         HistoryReplace(SCR_ID_MSG_NUMBER, SCR_ID_MSG_NUMBER, mmi_frm_sms_entry_number);
  1089.         GoBackToHistory(SCR_ID_MSG_NUMBER);
  1090.     }
  1091.     /* GoBackHistory (); */
  1092. }
  1093. /*****************************************************************************
  1094.  * FUNCTION
  1095.  *  mmi_frm_sms_search_phb
  1096.  * DESCRIPTION
  1097.  *  Interface to enter phone book
  1098.  * PARAMETERS
  1099.  *  void
  1100.  * RETURNS
  1101.  *  void
  1102.  *****************************************************************************/
  1103. void mmi_frm_sms_search_phb(void)
  1104. {
  1105.     /*----------------------------------------------------------------*/
  1106.     /* Local Variables                                                */
  1107.     /*----------------------------------------------------------------*/
  1108.     /*----------------------------------------------------------------*/
  1109.     /* Code Body                                                      */
  1110.     /*----------------------------------------------------------------*/
  1111.     mmi_phb_frm_enter_send_entry();
  1112. }
  1113. /*****************************************************************************
  1114.  * FUNCTION
  1115.  *  mmi_frm_sms_number_empty
  1116.  * DESCRIPTION
  1117.  *  LSK handle when number input is empty
  1118.  * PARAMETERS
  1119.  *  void
  1120.  * RETURNS
  1121.  *  void
  1122.  *****************************************************************************/
  1123. void mmi_frm_sms_number_empty(void)
  1124. {
  1125.     /*----------------------------------------------------------------*/
  1126.     /* Local Variables                                                */
  1127.     /*----------------------------------------------------------------*/
  1128.     /*----------------------------------------------------------------*/
  1129.     /* Code Body                                                      */
  1130.     /*----------------------------------------------------------------*/
  1131.     mmi_frm_sms_search_phb_type = MMI_FRM_SMS_DA;
  1132.     ChangeLeftSoftkey(STR_SMS_COMMON_SEARCH, IMG_SMS_COMMON_NOIMAGE);
  1133.     SetLeftSoftkeyFunction(mmi_frm_sms_search_phb, KEY_EVENT_UP);
  1134. }
  1135. /*****************************************************************************
  1136.  * FUNCTION
  1137.  *  mmi_frm_sms_number_not_empty
  1138.  * DESCRIPTION
  1139.  *  LSK handle when number input is not empty
  1140.  * PARAMETERS
  1141.  *  void
  1142.  * RETURNS
  1143.  *  void
  1144.  *****************************************************************************/
  1145. void mmi_frm_sms_number_not_empty(void)
  1146. {
  1147.     /*----------------------------------------------------------------*/
  1148.     /* Local Variables                                                */
  1149.     /*----------------------------------------------------------------*/
  1150.     /*----------------------------------------------------------------*/
  1151.     /* Code Body                                                      */
  1152.     /*----------------------------------------------------------------*/
  1153.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  1154.     SetLeftSoftkeyFunction(mmi_frm_sms_entry_number_done, KEY_EVENT_UP);
  1155. }
  1156. /*****************************************************************************
  1157.  * FUNCTION
  1158.  *  mmi_frm_sms_go_back_from_send
  1159.  * DESCRIPTION
  1160.  *  RSK handle in input SC/number screen
  1161.  * PARAMETERS
  1162.  *  void
  1163.  * RETURNS
  1164.  *  void
  1165.  *****************************************************************************/
  1166. void mmi_frm_sms_go_back_from_send(void)
  1167. {
  1168.     /*----------------------------------------------------------------*/
  1169.     /* Local Variables                                                */
  1170.     /*----------------------------------------------------------------*/
  1171.     /*----------------------------------------------------------------*/
  1172.     /* Code Body                                                      */
  1173.     /*----------------------------------------------------------------*/
  1174.     g_msg_cntx.msg_status = MSG_STATUS_IDLE;
  1175.     mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_RETURN);
  1176.     AlmEnableSPOF();
  1177.     GoBackHistory();
  1178. }
  1179. /*****************************************************************************
  1180.  * FUNCTION
  1181.  *  mmi_frm_sms_end_key_from_send
  1182.  * DESCRIPTION
  1183.  *  END key handle in input SC/number screen
  1184.  * PARAMETERS
  1185.  *  void
  1186.  * RETURNS
  1187.  *  void
  1188.  *****************************************************************************/
  1189. void mmi_frm_sms_end_key_from_send(void)
  1190. {
  1191.     /*----------------------------------------------------------------*/
  1192.     /* Local Variables                                                */
  1193.     /*----------------------------------------------------------------*/
  1194.     /*----------------------------------------------------------------*/
  1195.     /* Code Body                                                      */
  1196.     /*----------------------------------------------------------------*/
  1197.     if (isInCall() == FALSE)
  1198.     {
  1199.         g_msg_cntx.msg_status = MSG_STATUS_IDLE;
  1200.         mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_END);
  1201.         AlmEnableSPOF();
  1202.         memset(g_frm_sms_cntx.mmi_frm_sms_number, 0, sizeof(g_frm_sms_cntx.mmi_frm_sms_number));
  1203.     }
  1204.     ExecCurrEndKeyDownHandler();
  1205. }
  1206. /*****************************************************************************
  1207.  * FUNCTION
  1208.  *  mmi_frm_sms_entry_number
  1209.  * DESCRIPTION
  1210.  *  Entry SMS number screen
  1211.  * PARAMETERS
  1212.  *  void
  1213.  * RETURNS
  1214.  *  void
  1215.  *****************************************************************************/
  1216. void mmi_frm_sms_entry_number(void)
  1217. {
  1218.     /*----------------------------------------------------------------*/
  1219.     /* Local Variables                                                */
  1220.     /*----------------------------------------------------------------*/
  1221.     U8 *guiBuffer;
  1222.     /*----------------------------------------------------------------*/
  1223.     /* Code Body                                                      */
  1224.     /*----------------------------------------------------------------*/
  1225.     EntryNewScreen(SCR_ID_MSG_NUMBER, NULL, mmi_frm_sms_entry_number, NULL);
  1226.     AlmDisableSPOF();   /* in case schedule power off in sending a message */
  1227.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_NUMBER);
  1228.     /* keep the status in number editing screen and check the status in idle screeen.
  1229.        in the normal case, the status should be MSG_STATUS_IDLE in idle screen */
  1230.     g_msg_cntx.msg_status = MSG_STATUS_INPUT_NUM;
  1231.     GetCurrEndKeyDownHandler();
  1232.     RegisterInputBoxEmptyFunction(mmi_frm_sms_number_empty);
  1233.     RegisterInputBoxNotEmptyFunction(mmi_frm_sms_number_not_empty);
  1234.     ShowCategory5Screen(
  1235.         STR_ENTER_PHONE_NUMBER_CAPTION,
  1236.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1237.         STR_GLOBAL_OK,
  1238.         IMG_SMS_COMMON_NOIMAGE,
  1239.         STR_GLOBAL_BACK,
  1240.         IMG_SMS_COMMON_NOIMAGE,
  1241.         INPUT_TYPE_PHONE_NUMBER /* |INPUT_TYPE_PLUS_CHARACTER_HANDLING */ ,
  1242.         (U8*) g_frm_sms_cntx.mmi_frm_sms_number,
  1243.         MAX_DIGITS_SMS,
  1244.         guiBuffer);
  1245.     SetKeyHandler(mmi_frm_sms_entry_number_done, KEY_SEND, KEY_EVENT_UP);
  1246.     SetCategory5RightSoftkeyFunction(mmi_frm_sms_go_back_from_send, KEY_EVENT_UP);
  1247.     SetKeyHandler(mmi_frm_sms_end_key_from_send, KEY_END, KEY_EVENT_DOWN);
  1248. }
  1249. /*****************************************************************************
  1250.  * FUNCTION
  1251.  *  mmi_frm_sms_entry_sc_done
  1252.  * DESCRIPTION
  1253.  *  save entered SC number
  1254.  * PARAMETERS
  1255.  *  void
  1256.  * RETURNS
  1257.  *  void
  1258.  *****************************************************************************/
  1259. void mmi_frm_sms_entry_sc_done(void)
  1260. {
  1261.     /*----------------------------------------------------------------*/
  1262.     /* Local Variables                                                */
  1263.     /*----------------------------------------------------------------*/
  1264.     S16 errorCode = 0;
  1265.     S8 nvramActiveProfileIndex = 0;
  1266.     msg_profile_edit_struct *profileSC = OslMalloc(sizeof(msg_profile_edit_struct));
  1267.     /*----------------------------------------------------------------*/
  1268.     /* Code Body                                                      */
  1269.     /*----------------------------------------------------------------*/
  1270.     ReadValue(NVRAM_SMS_ACTIVE_PROFILE_INDEX, &nvramActiveProfileIndex, DS_BYTE, &errorCode);
  1271.     profileSC->profileIndex = nvramActiveProfileIndex;
  1272.     pfnUnicodeStrcpy((S8*) profileSC->scAddress, (S8*) g_frm_sms_cntx.mmi_frm_sms_number);
  1273.     mmi_frm_sms_set_sc_addr_req(profileSC);
  1274.     OslMfree(profileSC);
  1275. }
  1276. /*****************************************************************************
  1277.  * FUNCTION
  1278.  *  mmi_frm_sms_sc_empty
  1279.  * DESCRIPTION
  1280.  *  LSK handle when sc input is empty
  1281.  * PARAMETERS
  1282.  *  void
  1283.  * RETURNS
  1284.  *  void
  1285.  *****************************************************************************/
  1286. void mmi_frm_sms_sc_empty(void)
  1287. {
  1288.     /*----------------------------------------------------------------*/
  1289.     /* Local Variables                                                */
  1290.     /*----------------------------------------------------------------*/
  1291.     /*----------------------------------------------------------------*/
  1292.     /* Code Body                                                      */
  1293.     /*----------------------------------------------------------------*/
  1294.     mmi_frm_sms_search_phb_type = MMI_FRM_SMS_SC;
  1295.     ChangeLeftSoftkey(STR_SMS_COMMON_SEARCH, IMG_SMS_COMMON_NOIMAGE);
  1296.     SetLeftSoftkeyFunction(mmi_frm_sms_search_phb, KEY_EVENT_UP);
  1297. }
  1298. /*****************************************************************************
  1299.  * FUNCTION
  1300.  *  mmi_frm_sms_sc_not_empty
  1301.  * DESCRIPTION
  1302.  *  LSK handle when sc input is not empty
  1303.  * PARAMETERS
  1304.  *  void
  1305.  * RETURNS
  1306.  *  void
  1307.  *****************************************************************************/
  1308. void mmi_frm_sms_sc_not_empty(void)
  1309. {
  1310.     /*----------------------------------------------------------------*/
  1311.     /* Local Variables                                                */
  1312.     /*----------------------------------------------------------------*/
  1313.     /*----------------------------------------------------------------*/
  1314.     /* Code Body                                                      */
  1315.     /*----------------------------------------------------------------*/
  1316.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SMS_COMMON_NOIMAGE);
  1317.     SetLeftSoftkeyFunction(mmi_frm_sms_entry_sc_done, KEY_EVENT_UP);
  1318. }
  1319. /*****************************************************************************
  1320.  * FUNCTION
  1321.  *  mmi_frm_sms_entry_sc
  1322.  * DESCRIPTION
  1323.  *  Entry input SC screen
  1324.  * PARAMETERS
  1325.  *  void
  1326.  * RETURNS
  1327.  *  void
  1328.  *****************************************************************************/
  1329. void mmi_frm_sms_entry_sc(void)
  1330. {
  1331.     /*----------------------------------------------------------------*/
  1332.     /* Local Variables                                                */
  1333.     /*----------------------------------------------------------------*/
  1334.     U8 *guiBuffer;
  1335.     /*----------------------------------------------------------------*/
  1336.     /* Code Body                                                      */
  1337.     /*----------------------------------------------------------------*/
  1338.     EntryNewScreen(SCR_ID_MSG_SC_NUMBER, NULL, mmi_frm_sms_entry_sc, NULL);
  1339.     AlmDisableSPOF();   /* in case schedule power off in sending a message */
  1340.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_SC_NUMBER);
  1341.     /* keep the status in number editing screen and check the status in idle screeen.
  1342.        in the normal case, the status should be MSG_STATUS_IDLE in idle screen */
  1343.     g_msg_cntx.msg_status = MSG_STATUS_INPUT_NUM;
  1344.     GetCurrEndKeyDownHandler();
  1345.     RegisterInputBoxEmptyFunction(mmi_frm_sms_sc_empty);
  1346.     RegisterInputBoxNotEmptyFunction(mmi_frm_sms_sc_not_empty);
  1347.     ShowCategory5Screen(
  1348.         STR_SC_EMPTY_CAPTION_ID,
  1349.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1350.         STR_GLOBAL_OK,
  1351.         IMG_SMS_COMMON_NOIMAGE,
  1352.         STR_GLOBAL_BACK,
  1353.         IMG_SMS_COMMON_NOIMAGE,
  1354.         INPUT_TYPE_PHONE_NUMBER /* |INPUT_TYPE_PLUS_CHARACTER_HANDLING */ ,
  1355.         (U8*) g_frm_sms_cntx.mmi_frm_sms_number,
  1356.         MAX_DIGITS_SMS,
  1357.         guiBuffer);
  1358.     SetCategory5RightSoftkeyFunction(mmi_frm_sms_go_back_from_send, KEY_EVENT_UP);
  1359.     SetKeyHandler(mmi_frm_sms_end_key_from_send, KEY_END, KEY_EVENT_DOWN);
  1360. }
  1361. /*****************************************************************************
  1362.  * FUNCTION
  1363.  *  mmi_frm_sms_write_action
  1364.  * DESCRIPTION
  1365.  *  mmi_frm_sms_write_action
  1366.  * PARAMETERS
  1367.  *  callback        [IN]        
  1368.  *  mod_src         [IN]        
  1369.  *  data            [?]         
  1370.  *  function        [IN]        
  1371.  *  a  action      action(?)
  1372.  * RETURNS
  1373.  *  void
  1374.  *****************************************************************************/
  1375. U8 mmi_frm_sms_write_action(PsFuncPtrU16 callback, module_type mod_src, void *data, PsFuncPtr function)
  1376. {
  1377.     /*----------------------------------------------------------------*/
  1378.     /* Local Variables                                                */
  1379.     /*----------------------------------------------------------------*/
  1380.     mmi_frm_sms_action_struct action;
  1381.     /*----------------------------------------------------------------*/
  1382.     /* Code Body                                                      */
  1383.     /*----------------------------------------------------------------*/
  1384.     action.mod_src = mod_src;
  1385.     action.data = data;
  1386.     action.callback = callback;
  1387.     action.action = function;
  1388.     if (mmi_frm_sms_action_num == MMI_FRM_SMS_ACTION_SIZE)
  1389.     {
  1390.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "mmi_frm_sms_write_action:: mmi_frm_sms_action_num %d",
  1391.                              (int)mmi_frm_sms_action_num));
  1392.         return FALSE;
  1393.     }
  1394.     MMI_ASSERT((mmi_frm_sms_action_tail < MMI_FRM_SMS_ACTION_SIZE));
  1395.     memcpy(&mmi_frm_sms_action[mmi_frm_sms_action_tail], (S8*) & action, sizeof(mmi_frm_sms_action_struct));
  1396.     if (++mmi_frm_sms_action_tail == MMI_FRM_SMS_ACTION_SIZE)
  1397.     {
  1398.         mmi_frm_sms_action_tail = 0;
  1399.     }
  1400.     mmi_frm_sms_action_num++;
  1401.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "mmi_frm_sms_write_action:: mmi_frm_sms_action_curr %d",
  1402.                          (int)mmi_frm_sms_action_curr));
  1403.     if (mmi_frm_sms_action_curr == MMI_FRM_SMS_INVALID_NUM)
  1404.     {
  1405.         mmi_frm_sms_read_action();
  1406.     }
  1407.     return TRUE;
  1408. }
  1409. /*****************************************************************************
  1410.  * FUNCTION
  1411.  *  mmi_frm_sms_read_action
  1412.  * DESCRIPTION
  1413.  *  mmi_frm_sms_read_action
  1414.  * PARAMETERS
  1415.  *  void
  1416.  *  a  action      action(?)
  1417.  * RETURNS
  1418.  *  void
  1419.  *****************************************************************************/
  1420. U8 mmi_frm_sms_read_action(void)
  1421. {
  1422.     /*----------------------------------------------------------------*/
  1423.     /* Local Variables                                                */
  1424.     /*----------------------------------------------------------------*/
  1425.     PsFuncPtr currFuncPtr = mmi_frm_sms_action[mmi_frm_sms_action_head].action;
  1426.     void *currFuncData = mmi_frm_sms_action[mmi_frm_sms_action_head].data;
  1427.     /*----------------------------------------------------------------*/
  1428.     /* Code Body                                                      */
  1429.     /*----------------------------------------------------------------*/
  1430.     if (mmi_frm_sms_action_num == 0)
  1431.     {
  1432.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "mmi_frm_sms_read_action:: mmi_frm_sms_action_num %d",
  1433.                              (int)mmi_frm_sms_action_num));
  1434.         return FALSE;
  1435.     }
  1436.     MMI_ASSERT((mmi_frm_sms_action_head < MMI_FRM_SMS_ACTION_SIZE));
  1437.     mmi_frm_sms_action_curr = mmi_frm_sms_action_head;
  1438.     mmi_frm_sms_action_num--;
  1439.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "mmi_frm_sms_read_action:: mmi_frm_sms_action_curr %d",
  1440.                          (int)mmi_frm_sms_action_curr));
  1441.     if (currFuncPtr != NULL)
  1442.     {
  1443.         (*currFuncPtr) (currFuncData);
  1444.     }
  1445.     if (++mmi_frm_sms_action_head == MMI_FRM_SMS_ACTION_SIZE)
  1446.     {
  1447.         mmi_frm_sms_action_head = 0;
  1448.     }
  1449.     return TRUE;
  1450. }
  1451. /*****************************************************************************
  1452.  * FUNCTION
  1453.  *  mmi_frm_sms_callback_action
  1454.  * DESCRIPTION
  1455.  *  mmi_frm_sms_callback_action
  1456.  * PARAMETERS
  1457.  *  data        [?]         
  1458.  *  result      [IN]        
  1459.  * RETURNS
  1460.  *  void
  1461.  *****************************************************************************/
  1462. void mmi_frm_sms_callback_action(void *data, U16 result)
  1463. {
  1464.     /*----------------------------------------------------------------*/
  1465.     /* Local Variables                                                */
  1466.     /*----------------------------------------------------------------*/
  1467.     PsFuncPtrU16 callback = mmi_frm_sms_action[mmi_frm_sms_action_curr].callback;
  1468.     module_type mod_src = mmi_frm_sms_action[mmi_frm_sms_action_curr].mod_src;
  1469.     /*----------------------------------------------------------------*/
  1470.     /* Code Body                                                      */
  1471.     /*----------------------------------------------------------------*/
  1472.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "mmi_frm_sms_callback_action:: mmi_frm_sms_action_curr %d",
  1473.                          (int)mmi_frm_sms_action_curr));
  1474.     if ((callback != NULL) && (mmi_frm_sms_action_curr != MMI_FRM_SMS_INVALID_NUM))
  1475.     {
  1476.         MMI_ASSERT((mmi_frm_sms_action_curr < MMI_FRM_SMS_ACTION_SIZE));
  1477.         callback(data, (module_type) mod_src, result);
  1478.     }
  1479.     mmi_frm_sms_action_curr = MMI_FRM_SMS_INVALID_NUM;
  1480.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "mmi_frm_sms_callback_action:: mmi_frm_sms_action_curr %d",
  1481.                          (int)mmi_frm_sms_action_curr));
  1482.     mmi_frm_sms_read_action();
  1483. }
  1484. /*****************************************************************************
  1485.  * FUNCTION
  1486.  *  mmi_frm_sms_check_action_pending
  1487.  * DESCRIPTION
  1488.  *  check if there is a pending action in SMS framework
  1489.  * PARAMETERS
  1490.  *  void
  1491.  * RETURNS
  1492.  *  void
  1493.  *****************************************************************************/
  1494. U8 mmi_frm_sms_check_action_pending(void)
  1495. {
  1496.     /*----------------------------------------------------------------*/
  1497.     /* Local Variables                                                */
  1498.     /*----------------------------------------------------------------*/
  1499.     /*----------------------------------------------------------------*/
  1500.     /* Code Body                                                      */
  1501.     /*----------------------------------------------------------------*/
  1502.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "mmi_frm_sms_check_action_pending:: mmi_frm_sms_action_curr %d",
  1503.                          (int)mmi_frm_sms_action_curr));
  1504.     MMI_ASSERT((mmi_frm_sms_action_curr == MMI_FRM_SMS_INVALID_NUM) ||
  1505.                (mmi_frm_sms_action_curr < MMI_FRM_SMS_ACTION_SIZE));
  1506.     if (mmi_frm_sms_action_curr != MMI_FRM_SMS_INVALID_NUM)
  1507.     {
  1508.         return TRUE;
  1509.     }
  1510.     else
  1511.     {
  1512.         return FALSE;
  1513.     }
  1514. }
  1515. /*****************************************************************************
  1516.  * FUNCTION
  1517.  *  mmi_frm_sms_delete_action_pending
  1518.  * DESCRIPTION
  1519.  *  delete the action from queue if SMS application is re-entering
  1520.  * PARAMETERS
  1521.  *  void
  1522.  * RETURNS
  1523.  *  void
  1524.  *****************************************************************************/
  1525. void mmi_frm_sms_delete_action_pending(void)
  1526. {
  1527.     /*----------------------------------------------------------------*/
  1528.     /* Local Variables                                                */
  1529.     /*----------------------------------------------------------------*/
  1530.     /*----------------------------------------------------------------*/
  1531.     /* Code Body                                                      */
  1532.     /*----------------------------------------------------------------*/
  1533.     if (IsScreenPresent(SCR_ID_MSG_SENDING) || IsScreenPresent(SCR_ID_MSG_PROCESSING))
  1534.     {
  1535.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  1536.                              "*-------[SmsCore.c] mmi_frm_sms_delete_action_pending DO NOTHING -------*n"));
  1537.     }
  1538.     else
  1539.     {
  1540.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  1541.                              "*-------[SmsCore.c] mmi_frm_sms_delete_action_pending DELETE ACTION QUEUE -------*n"));
  1542.         /* reset the status after deleting the action queue */
  1543.         g_msg_cntx.msg_status = MSG_STATUS_IDLE;
  1544.         mmi_frm_sms_callback_action(NULL, MMI_FRM_SMS_END);
  1545.     }
  1546. }
  1547. /*****************************************************************************
  1548.  * FUNCTION
  1549.  *  mmi_frm_sms_delete_screen_history
  1550.  * DESCRIPTION
  1551.  *  delete the screen history that is not set to g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes
  1552.  * PARAMETERS
  1553.  *  void
  1554.  * RETURNS
  1555.  *  void
  1556.  *****************************************************************************/
  1557. void mmi_frm_sms_delete_screen_history(void)
  1558. {
  1559.     /*----------------------------------------------------------------*/
  1560.     /* Local Variables                                                */
  1561.     /*----------------------------------------------------------------*/
  1562.     /*----------------------------------------------------------------*/
  1563.     /* Code Body                                                      */
  1564.     /*----------------------------------------------------------------*/
  1565.     DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
  1566.     DeleteScreenIfPresent(SCR_ID_MSG_SENDING);
  1567.     DeleteScreenIfPresent(SCR_ID_MSG_NUMBER);
  1568.     DeleteScreenIfPresent(SCR_ID_MSG_SC_NUMBER);
  1569.     DeleteScreenIfPresent(SCR_ID_MSG_SAVING);
  1570. }
  1571. /*****************************************************************************
  1572.  * FUNCTION
  1573.  *  mmi_frm_sms_check_complete
  1574.  * DESCRIPTION
  1575.  *  Check message completeneww
  1576.  * PARAMETERS
  1577.  *  type        [IN]        Message type
  1578.  *  index       [IN]        Message index
  1579.  * RETURNS
  1580.  *  TRUE: complete; FALSE: not
  1581.  *****************************************************************************/
  1582. U8 mmi_frm_sms_check_complete(U8 type, U16 index)
  1583. {
  1584.     /*----------------------------------------------------------------*/
  1585.     /* Local Variables                                                */
  1586.     /*----------------------------------------------------------------*/
  1587.     /*----------------------------------------------------------------*/
  1588.     /* Code Body                                                      */
  1589.     /*----------------------------------------------------------------*/
  1590.     return mmi_frm_sms_check_sms_complete(type, index);
  1591. }
  1592. /*****************************************************************************
  1593.  * FUNCTION
  1594.  *  mmi_frm_sms_get_status
  1595.  * DESCRIPTION
  1596.  *  Get message status
  1597.  * PARAMETERS
  1598.  *  type        [IN]        Message type
  1599.  *  index       [IN]        Message index
  1600.  * RETURNS
  1601.  *  status
  1602.  *****************************************************************************/
  1603. U8 mmi_frm_sms_get_status(U8 type, U16 index)
  1604. {
  1605.     /*----------------------------------------------------------------*/
  1606.     /* Local Variables                                                */
  1607.     /*----------------------------------------------------------------*/
  1608.     /*----------------------------------------------------------------*/
  1609.     /* Code Body                                                      */
  1610.     /*----------------------------------------------------------------*/
  1611.     return mmi_frm_sms_get_sms_status(type, index);
  1612. }
  1613. /*****************************************************************************
  1614.  * FUNCTION
  1615.  *  mmi_frm_sms_get_dcs
  1616.  * DESCRIPTION
  1617.  *  Get message DCS
  1618.  * PARAMETERS
  1619.  *  type        [IN]        Message type
  1620.  *  index       [IN]        Message index
  1621.  * RETURNS
  1622.  *  dcs
  1623.  *****************************************************************************/
  1624. U8 mmi_frm_sms_get_dcs(U8 type, U16 index)
  1625. {
  1626.     /*----------------------------------------------------------------*/
  1627.     /* Local Variables                                                */
  1628.     /*----------------------------------------------------------------*/
  1629.     /*----------------------------------------------------------------*/
  1630.     /* Code Body                                                      */
  1631.     /*----------------------------------------------------------------*/
  1632.     return mmi_frm_sms_get_sms_dcs(type, index);
  1633. }
  1634. /*****************************************************************************
  1635.  * FUNCTION
  1636.  *  mmi_frm_sms_get_address
  1637.  * DESCRIPTION
  1638.  *  Get message address
  1639.  * PARAMETERS
  1640.  *  type        [IN]        Message type
  1641.  *  index       [IN]        Message index
  1642.  * RETURNS
  1643.  *  address
  1644.  *****************************************************************************/
  1645. U8 *mmi_frm_sms_get_address(U8 type, U16 index)
  1646. {
  1647.     /*----------------------------------------------------------------*/
  1648.     /* Local Variables                                                */
  1649.     /*----------------------------------------------------------------*/
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Code Body                                                      */
  1652.     /*----------------------------------------------------------------*/
  1653.     return mmi_frm_sms_get_sms_address(type, index);
  1654. }
  1655. /*****************************************************************************
  1656.  * FUNCTION
  1657.  *  mmi_frm_sms_get_timestamp
  1658.  * DESCRIPTION
  1659.  *  Get message timestamp
  1660.  * PARAMETERS
  1661.  *  type        [IN]        Message type
  1662.  *  index       [IN]        Message index
  1663.  * RETURNS
  1664.  *  timestamp
  1665.  *****************************************************************************/
  1666. U8 *mmi_frm_sms_get_timestamp(U8 type, U16 index)
  1667. {
  1668.     /*----------------------------------------------------------------*/
  1669.     /* Local Variables                                                */
  1670.     /*----------------------------------------------------------------*/
  1671.     /*----------------------------------------------------------------*/
  1672.     /* Code Body                                                      */
  1673.     /*----------------------------------------------------------------*/
  1674.     return mmi_frm_sms_get_sms_timestamp(type, index);
  1675. }
  1676. /*****************************************************************************
  1677.  * FUNCTION
  1678.  *  mmi_frm_sms_get_list_index
  1679.  * DESCRIPTION
  1680.  *  Get SMS type/index
  1681.  * PARAMETERS
  1682.  *  type                [OUT]       Message type
  1683.  *  index               [OUT]       Message index
  1684.  *  msgbox_index        [IN]        Message index
  1685.  * RETURNS
  1686.  *  void
  1687.  *****************************************************************************/
  1688. void mmi_frm_sms_get_list_index(U8 *type, U16 *index, U16 msgbox_index)
  1689. {
  1690.     /*----------------------------------------------------------------*/
  1691.     /* Local Variables                                                */
  1692.     /*----------------------------------------------------------------*/
  1693.     /*----------------------------------------------------------------*/
  1694.     /* Code Body                                                      */
  1695.     /*----------------------------------------------------------------*/
  1696.     mmi_frm_sms_get_sms_list_index(type, index, msgbox_index);
  1697. }
  1698. /*****************************************************************************
  1699.  * FUNCTION
  1700.  *  mmi_frm_sms_abort_sms
  1701.  * DESCRIPTION
  1702.  *  Abort MO SMS
  1703.  * PARAMETERS
  1704.  *  void
  1705.  * RETURNS
  1706.  *  void
  1707.  *****************************************************************************/
  1708. void mmi_frm_sms_abort_sms(void)
  1709. {
  1710.     /*----------------------------------------------------------------*/
  1711.     /* Local Variables                                                */
  1712.     /*----------------------------------------------------------------*/
  1713.     /*----------------------------------------------------------------*/
  1714.     /* Code Body                                                      */
  1715.     /*----------------------------------------------------------------*/
  1716.     mmi_frm_sms_abort_sms_req(NULL);
  1717. }
  1718. /*****************************************************************************
  1719.  * FUNCTION
  1720.  *  mmi_frm_sms_abort_sending_sms
  1721.  * DESCRIPTION
  1722.  *  Abort sending SMS
  1723.  * PARAMETERS
  1724.  *  void
  1725.  * RETURNS
  1726.  *  void
  1727.  *****************************************************************************/
  1728. void mmi_frm_sms_abort_sending_sms(mmi_frm_sms_abort_enum type)
  1729. {
  1730.     /*----------------------------------------------------------------*/
  1731.     /* Local Variables                                                */
  1732.     /*----------------------------------------------------------------*/
  1733.     /*----------------------------------------------------------------*/
  1734.     /* Code Body                                                      */
  1735.     /*----------------------------------------------------------------*/
  1736.     mmi_frm_sms_abort_sending_sms_req(type);
  1737. }
  1738. #ifdef __MMI_UNIFIED_MESSAGE__
  1739. /*****************************************************************************
  1740.  * FUNCTION
  1741.  *  mmi_frm_sms_abort_sms_by_end_key
  1742.  * DESCRIPTION
  1743.  *  Abort MO SMS by end key
  1744.  * PARAMETERS
  1745.  *  void
  1746.  * RETURNS
  1747.  *  void
  1748.  *****************************************************************************/
  1749. void mmi_frm_sms_abort_sms_by_end_key(void)
  1750. {
  1751.     /*----------------------------------------------------------------*/
  1752.     /* Local Variables                                                */
  1753.     /*----------------------------------------------------------------*/
  1754.     /*----------------------------------------------------------------*/
  1755.     /* Code Body                                                      */
  1756.     /*----------------------------------------------------------------*/
  1757.     if (isInCall() == FALSE)
  1758.     {
  1759.         mmi_frm_sms_abort_sms_req_by_end_key(NULL);
  1760.         mmi_frm_sms_callback_abort_sms_by_end_key();
  1761.         AlmEnableSPOF();
  1762.     }
  1763.     ExecCurrEndKeyDownHandler();
  1764. }
  1765. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1766. /*****************************************************************************
  1767.  * FUNCTION
  1768.  *  mmi_frm_sms_send_sms
  1769.  * DESCRIPTION
  1770.  *  Send SMS
  1771.  * PARAMETERS
  1772.  *  callback        [IN]        Callback after action
  1773.  *  mod_src         [IN]        Callback module
  1774.  *  sendData        [IN]        Send data
  1775.  * RETURNS
  1776.  *  void
  1777.  *****************************************************************************/
  1778. void mmi_frm_sms_send_sms(PsFuncPtrU16 callback, module_type mod_src, mmi_frm_sms_send_struct *sendData)
  1779. {
  1780.     /*----------------------------------------------------------------*/
  1781.     /* Local Variables                                                */
  1782.     /*----------------------------------------------------------------*/
  1783.     mmi_frm_sms_send_struct *data = OslMalloc(sizeof(mmi_frm_sms_send_struct));
  1784.     /*----------------------------------------------------------------*/
  1785.     /* Code Body                                                      */
  1786.     /*----------------------------------------------------------------*/
  1787.     memcpy((S8*) data, (S8*) sendData, sizeof(mmi_frm_sms_send_struct));
  1788.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_pre_send_sms);
  1789. }
  1790. /*****************************************************************************
  1791.  * FUNCTION
  1792.  *  mmi_frm_sms_read_sms
  1793.  * DESCRIPTION
  1794.  *  Read SMS
  1795.  * PARAMETERS
  1796.  *  callback        [IN]        Callback after action
  1797.  *  mod_src         [IN]        Callback module
  1798.  *  type            [IN]        Message type
  1799.  *  index           [IN]        Message index
  1800.  * RETURNS
  1801.  *  void
  1802.  *****************************************************************************/
  1803. void mmi_frm_sms_read_sms(PsFuncPtrU16 callback, module_type mod_src, U8 type, U16 index, MMI_BOOL change_status)
  1804. {
  1805.     /*----------------------------------------------------------------*/
  1806.     /* Local Variables                                                */
  1807.     /*----------------------------------------------------------------*/
  1808.     U16 *data = OslMalloc(sizeof(U16) * (g_frm_sms_cntx.mmi_frm_sms_msg_seg_size + 1));
  1809.     /*----------------------------------------------------------------*/
  1810.     /* Code Body                                                      */
  1811.     /*----------------------------------------------------------------*/
  1812.     g_mmi_frm_sms_change_status = change_status;
  1813.     mmi_frm_sms_get_sms_index((mmi_frm_sms_msgbox_enum) type, index, data);
  1814.     if (g_mmi_frm_sms_change_status)
  1815.     {
  1816.         mmi_frm_sms_set_sms_status(type, index, MMI_FRM_SMS_INBOX);
  1817.     }
  1818.     data[g_frm_sms_cntx.mmi_frm_sms_msg_seg_size] = (U16) mmi_frm_sms_get_sms_size(type, index);
  1819.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_read_sms_req);
  1820. }
  1821. /*****************************************************************************
  1822.  * FUNCTION
  1823.  *  mmi_frm_sms_get_sms
  1824.  * DESCRIPTION
  1825.  *  Get SMS, for AT sync indication
  1826.  * PARAMETERS
  1827.  *  callback        [IN]        Callback after action
  1828.  *  mod_src         [IN]        Callback module
  1829.  *  index           [IN]        Message index
  1830.  * RETURNS
  1831.  *  void
  1832.  *****************************************************************************/
  1833. void mmi_frm_sms_get_sms(PsFuncPtrU16 callback, module_type mod_src, U16 index)
  1834. {
  1835.     /*----------------------------------------------------------------*/
  1836.     /* Local Variables                                                */
  1837.     /*----------------------------------------------------------------*/
  1838.     U16 *data = OslMalloc(sizeof(U16));
  1839.     /*----------------------------------------------------------------*/
  1840.     /* Code Body                                                      */
  1841.     /*----------------------------------------------------------------*/
  1842.     *data = index;
  1843.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_get_sms_req);
  1844. }
  1845. /*****************************************************************************
  1846.  * FUNCTION
  1847.  *  mmi_frm_sms_save_sms
  1848.  * DESCRIPTION
  1849.  *  Save SMS
  1850.  * PARAMETERS
  1851.  *  callback        [IN]        Callback after action
  1852.  *  mod_src         [IN]        Callback module
  1853.  *  sendData        [IN]        Save data
  1854.  * RETURNS
  1855.  *  void
  1856.  *****************************************************************************/
  1857. void mmi_frm_sms_save_sms(PsFuncPtrU16 callback, module_type mod_src, mmi_frm_sms_send_struct *sendData)
  1858. {
  1859.     /*----------------------------------------------------------------*/
  1860.     /* Local Variables                                                */
  1861.     /*----------------------------------------------------------------*/
  1862.     mmi_frm_sms_send_struct *data = OslMalloc(sizeof(mmi_frm_sms_send_struct));
  1863.     /*----------------------------------------------------------------*/
  1864.     /* Code Body                                                      */
  1865.     /*----------------------------------------------------------------*/
  1866.     memcpy((S8*) data, (S8*) sendData, sizeof(mmi_frm_sms_send_struct));
  1867.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_save_sms_req);
  1868. }
  1869. /*****************************************************************************
  1870.  * FUNCTION
  1871.  *  mmi_frm_sms_delete_sms
  1872.  * DESCRIPTION
  1873.  *  Delete SMS
  1874.  * PARAMETERS
  1875.  *  callback        [IN]        Callback after action
  1876.  *  mod_src         [IN]        Callback module
  1877.  *  type            [IN]        Message type
  1878.  *  index           [IN]        Message index
  1879.  * RETURNS
  1880.  *  void
  1881.  *****************************************************************************/
  1882. void mmi_frm_sms_delete_sms(PsFuncPtrU16 callback, module_type mod_src, U8 type, U16 index)
  1883. {
  1884.     /*----------------------------------------------------------------*/
  1885.     /* Local Variables                                                */
  1886.     /*----------------------------------------------------------------*/
  1887.     U8 *data = OslMalloc(sizeof(U8) * 480);
  1888.     /*----------------------------------------------------------------*/
  1889.     /* Code Body                                                      */
  1890.     /*----------------------------------------------------------------*/
  1891.     memset((S8*) data, 0, sizeof(U8) * 480);
  1892.     if (mmi_frm_sms_get_sms_bitmap((U8) type, index, data) == FALSE)
  1893.     {
  1894.         callback(NULL, MOD_MMI, MMI_FRM_SMS_ERROR);
  1895.     }
  1896.     else
  1897.     {
  1898.         mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_delete_sms_req);
  1899.     }
  1900. }
  1901. /*****************************************************************************
  1902.  * FUNCTION
  1903.  *  mmi_frm_sms_delete_sms_by_bitmap
  1904.  * DESCRIPTION
  1905.  *  Delete SMS
  1906.  * PARAMETERS
  1907.  *  callback        [IN]        Callback after action
  1908.  *  mod_src         [IN]        Callback module
  1909.  *  bitmap          [IN]        Bitmap
  1910.  * RETURNS
  1911.  *  void
  1912.  *****************************************************************************/
  1913. void mmi_frm_sms_delete_sms_by_bitmap(PsFuncPtrU16 callback, module_type mod_src, U8 *bitmap)
  1914. {
  1915.     /*----------------------------------------------------------------*/
  1916.     /* Local Variables                                                */
  1917.     /*----------------------------------------------------------------*/
  1918.     U8 *data = OslMalloc(sizeof(U8) * 480);
  1919.     /*----------------------------------------------------------------*/
  1920.     /* Code Body                                                      */
  1921.     /*----------------------------------------------------------------*/
  1922.     memset((S8*) data, 0, sizeof(U8) * 480);
  1923.     memcpy((S8*) data, (S8*) bitmap, sizeof(U8) * 480);
  1924.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_delete_sms_req);
  1925. }
  1926. /*****************************************************************************
  1927.  * FUNCTION
  1928.  *  mmi_frm_sms_reg_port
  1929.  * DESCRIPTION
  1930.  *  Register SMS port
  1931.  * PARAMETERS
  1932.  *  callback        [IN]        Callback after action
  1933.  *  mod_src         [IN]        Callback module
  1934.  *  port_num        [IN]        Port number
  1935.  *  enable          [IN]        Enable/disable
  1936.  *  withdata        [IN]        Indicate with data
  1937.  *  regcallback     [IN]        Regiter callback module
  1938.  * RETURNS
  1939.  *  void
  1940.  *****************************************************************************/
  1941. void mmi_frm_sms_reg_port(
  1942.         PsFuncPtrU16 callback,
  1943.         module_type mod_src,
  1944.         U16 port_num,
  1945.         BOOL enable,
  1946.         BOOL withdata,
  1947.         PsFuncPtrU16 regcallback)
  1948. {
  1949.     /*----------------------------------------------------------------*/
  1950.     /* Local Variables                                                */
  1951.     /*----------------------------------------------------------------*/
  1952.     mmi_sms_reg_port_num_req_struct *data = OslMalloc(sizeof(mmi_sms_reg_port_num_req_struct));
  1953.     /*----------------------------------------------------------------*/
  1954.     /* Code Body                                                      */
  1955.     /*----------------------------------------------------------------*/
  1956.     data->mod_id = mod_src;
  1957.     data->port_num = port_num;
  1958.     data->enable = enable;
  1959.     if (enable)
  1960.     {
  1961.         mmi_frm_sms_data_check[mmi_frm_sms_data_check_num].desport = port_num;
  1962.         mmi_frm_sms_data_check[mmi_frm_sms_data_check_num].module = mod_src;
  1963.         mmi_frm_sms_data_check[mmi_frm_sms_data_check_num].serial = 0;
  1964.         mmi_frm_sms_data_check[mmi_frm_sms_data_check_num].withdata = withdata;
  1965.         mmi_frm_sms_data_check[mmi_frm_sms_data_check_num].callback = regcallback;
  1966.         mmi_frm_sms_data_check_num++;
  1967.     }
  1968.     else
  1969.     {
  1970.         U8 i = mmi_frm_sms_data_check_num;
  1971.         while (i > 0)
  1972.         {
  1973.             i--;
  1974.             if ((mmi_frm_sms_data_check[i].desport == port_num) && (mmi_frm_sms_data_check[i].module == mod_src))
  1975.             {
  1976.                 U8 j = i + 1;
  1977.                 for (j = (i + 1); j < mmi_frm_sms_data_check_num; j++)
  1978.                 {
  1979.                     memcpy(
  1980.                         (S8*) & mmi_frm_sms_data_check[j - 1],
  1981.                         (S8*) & mmi_frm_sms_data_check[j],
  1982.                         sizeof(mmi_frm_sms_data_check_struct));
  1983.                 }
  1984.                 mmi_frm_sms_data_check_num--;
  1985.                 break;
  1986.             }
  1987.         }
  1988.     }
  1989.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_reg_port_req);
  1990. }
  1991. /*****************************************************************************
  1992.  * FUNCTION
  1993.  *  mmi_frm_sms_set_profile_active
  1994.  * DESCRIPTION
  1995.  *  Set active profile
  1996.  * PARAMETERS
  1997.  *  callback        [IN]        Callback after action
  1998.  *  mod_src         [IN]        Callback module
  1999.  *  index           [IN]        Active profile index
  2000.  * RETURNS
  2001.  *  void
  2002.  *****************************************************************************/
  2003. void mmi_frm_sms_set_profile_active(PsFuncPtrU16 callback, module_type mod_src, U8 *index)
  2004. {
  2005.     /*----------------------------------------------------------------*/
  2006.     /* Local Variables                                                */
  2007.     /*----------------------------------------------------------------*/
  2008.     S16 errorCode = 0;
  2009.     /*----------------------------------------------------------------*/
  2010.     /* Code Body                                                      */
  2011.     /*----------------------------------------------------------------*/
  2012.     WriteValue(NVRAM_SMS_ACTIVE_PROFILE_INDEX, index, DS_BYTE, &errorCode);
  2013.     callback(index, mod_src, MMI_FRM_SMS_OK);
  2014. }
  2015. /*****************************************************************************
  2016.  * FUNCTION
  2017.  *  mmi_frm_sms_get_profile_list
  2018.  * DESCRIPTION
  2019.  *  Get profile list, as well as active profile index
  2020.  * PARAMETERS
  2021.  *  callback        [IN]        Callback after action
  2022.  *  mod_src         [IN]        Callback module
  2023.  * RETURNS
  2024.  *  void
  2025.  *****************************************************************************/
  2026. void mmi_frm_sms_get_profile_list(PsFuncPtrU16 callback, module_type mod_src)
  2027. {
  2028.     /*----------------------------------------------------------------*/
  2029.     /* Local Variables                                                */
  2030.     /*----------------------------------------------------------------*/
  2031.     /*----------------------------------------------------------------*/
  2032.     /* Code Body                                                      */
  2033.     /*----------------------------------------------------------------*/
  2034.     mmi_frm_sms_write_action(callback, mod_src, NULL, mmi_frm_sms_get_profile_num_req);
  2035. }
  2036. /*****************************************************************************
  2037.  * FUNCTION
  2038.  *  mmi_frm_sms_get_sc_addr
  2039.  * DESCRIPTION
  2040.  *  Get SC address
  2041.  * PARAMETERS
  2042.  *  callback        [IN]        Callback after action
  2043.  *  mod_src         [IN]        Callback module
  2044.  *  index           [IN]        Profile index
  2045.  * RETURNS
  2046.  *  void
  2047.  *****************************************************************************/
  2048. void mmi_frm_sms_get_sc_addr(PsFuncPtrU16 callback, module_type mod_src, U8 index)
  2049. {
  2050.     /*----------------------------------------------------------------*/
  2051.     /* Local Variables                                                */
  2052.     /*----------------------------------------------------------------*/
  2053.     U8 *data = OslMalloc(sizeof(U8));
  2054.     /*----------------------------------------------------------------*/
  2055.     /* Code Body                                                      */
  2056.     /*----------------------------------------------------------------*/
  2057.     memset(data, index, sizeof(U8));
  2058.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_get_sc_addr_req);
  2059. }
  2060. /*****************************************************************************
  2061.  * FUNCTION
  2062.  *  mmi_frm_sms_set_sc_addr
  2063.  * DESCRIPTION
  2064.  *  handle new SMS
  2065.  * PARAMETERS
  2066.  *  callback        [IN]        Callback after action
  2067.  *  mod_src         [IN]        Callback module
  2068.  *  index           [IN]        Profile index
  2069.  *  scAddr          [IN]        SC address
  2070.  * RETURNS
  2071.  *  void
  2072.  *****************************************************************************/
  2073. void mmi_frm_sms_set_sc_addr(PsFuncPtrU16 callback, module_type mod_src, U8 index, S8 scAddr[])
  2074. {
  2075.     /*----------------------------------------------------------------*/
  2076.     /* Local Variables                                                */
  2077.     /*----------------------------------------------------------------*/
  2078.     msg_profile_edit_struct *data = OslMalloc(sizeof(msg_profile_edit_struct));
  2079.     /*----------------------------------------------------------------*/
  2080.     /* Code Body                                                      */
  2081.     /*----------------------------------------------------------------*/
  2082.     memcpy(data->scAddress, scAddr, MAX_CC_ADDR_LEN * ENCODING_LENGTH);
  2083.     memset(data->scAddress + MAX_CC_ADDR_LEN * ENCODING_LENGTH, 0, ENCODING_LENGTH);
  2084.     data->profileIndex = index;
  2085.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_set_sc_addr_req);
  2086. }
  2087. /*****************************************************************************
  2088.  * FUNCTION
  2089.  *  mmi_frm_sms_get_profile_detail
  2090.  * DESCRIPTION
  2091.  *  Get profile detail info
  2092.  * PARAMETERS
  2093.  *  callback        [IN]        Callback after action
  2094.  *  mod_src         [IN]        Callback module
  2095.  *  index           [IN]        Profile index
  2096.  * RETURNS
  2097.  *  void
  2098.  *****************************************************************************/
  2099. void mmi_frm_sms_get_profile_detail(PsFuncPtrU16 callback, module_type mod_src, U8 index)
  2100. {
  2101.     /*----------------------------------------------------------------*/
  2102.     /* Local Variables                                                */
  2103.     /*----------------------------------------------------------------*/
  2104.     U8 *data = OslMalloc(sizeof(U8));
  2105.     /*----------------------------------------------------------------*/
  2106.     /* Code Body                                                      */
  2107.     /*----------------------------------------------------------------*/
  2108.     memset(data, index, sizeof(U8));
  2109.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_get_profile_detail_req);
  2110. }
  2111. /*****************************************************************************
  2112.  * FUNCTION
  2113.  *  mmi_frm_sms_set_profile_detail
  2114.  * DESCRIPTION
  2115.  *  Set profile detail info
  2116.  * PARAMETERS
  2117.  *  callback        [IN]        Callback after action
  2118.  *  mod_src         [IN]        Callback module
  2119.  *  profile         [IN]        Profile content
  2120.  * RETURNS
  2121.  *  void
  2122.  *****************************************************************************/
  2123. void mmi_frm_sms_set_profile_detail(PsFuncPtrU16 callback, module_type mod_src, void *profile)
  2124. {
  2125.     /*----------------------------------------------------------------*/
  2126.     /* Local Variables                                                */
  2127.     /*----------------------------------------------------------------*/
  2128.     msg_profile_edit_struct *data = OslMalloc(sizeof(msg_profile_edit_struct));
  2129.     /*----------------------------------------------------------------*/
  2130.     /* Code Body                                                      */
  2131.     /*----------------------------------------------------------------*/
  2132.     memcpy(data, profile, sizeof(msg_profile_edit_struct));
  2133.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_set_profile_detail_req);
  2134. }
  2135. /*****************************************************************************
  2136.  * FUNCTION
  2137.  *  mmi_frm_sms_get_common_settings
  2138.  * DESCRIPTION
  2139.  *  Get common setting
  2140.  * PARAMETERS
  2141.  *  callback        [IN]        Callback after action
  2142.  *  mod_src         [IN]        Callback module
  2143.  * RETURNS
  2144.  *  void
  2145.  *****************************************************************************/
  2146. void mmi_frm_sms_get_common_settings(PsFuncPtrU16 callback, module_type mod_src)
  2147. {
  2148.     /*----------------------------------------------------------------*/
  2149.     /* Local Variables                                                */
  2150.     /*----------------------------------------------------------------*/
  2151.     /*----------------------------------------------------------------*/
  2152.     /* Code Body                                                      */
  2153.     /*----------------------------------------------------------------*/
  2154.     mmi_frm_sms_write_action(callback, mod_src, NULL, mmi_frm_sms_get_common_settings_req);
  2155. }
  2156. /*****************************************************************************
  2157.  * FUNCTION
  2158.  *  mmi_frm_sms_set_common_settings
  2159.  * DESCRIPTION
  2160.  *  Set common setting
  2161.  * PARAMETERS
  2162.  *  callback        [IN]        Callback after action
  2163.  *  mod_src         [IN]        Callback module
  2164.  *  setting         [IN]        Settings
  2165.  * RETURNS
  2166.  *  void
  2167.  *****************************************************************************/
  2168. void mmi_frm_sms_set_common_settings(PsFuncPtrU16 callback, module_type mod_src, U8 *setting)
  2169. {
  2170.     /*----------------------------------------------------------------*/
  2171.     /* Local Variables                                                */
  2172.     /*----------------------------------------------------------------*/
  2173.     U8 *data = OslMalloc(sizeof(U8) * 2);
  2174.     /*----------------------------------------------------------------*/
  2175.     /* Code Body                                                      */
  2176.     /*----------------------------------------------------------------*/
  2177.     memcpy(data, setting, sizeof(U8) * 2);
  2178.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_set_common_settings_req);
  2179. }
  2180. #ifdef __MMI_MESSAGES_PREFER_STORAGE_MEMORY_STATUS__
  2181. /*****************************************************************************
  2182.  * FUNCTION
  2183.  *  mmi_frm_sms_get_memory_status
  2184.  * DESCRIPTION
  2185.  *  Get memory status
  2186.  * PARAMETERS
  2187.  *  callback        [IN]        Callback after action
  2188.  *  mod_src         [IN]        Callback module
  2189.  * RETURNS
  2190.  *  void
  2191.  *****************************************************************************/
  2192. void mmi_frm_sms_get_memory_status(PsFuncPtrU16 callback, module_type mod_src)
  2193. {
  2194.     /*----------------------------------------------------------------*/
  2195.     /* Local Variables                                                */
  2196.     /*----------------------------------------------------------------*/
  2197.     /*----------------------------------------------------------------*/
  2198.     /* Code Body                                                      */
  2199.     /*----------------------------------------------------------------*/
  2200.     mmi_frm_sms_write_action(callback, mod_src, NULL, mmi_frm_sms_get_memory_status_req);
  2201. }
  2202. /*****************************************************************************
  2203.  * FUNCTION
  2204.  *  mmi_frm_sms_get_preferred_storage
  2205.  * DESCRIPTION
  2206.  *  Get preferred storage
  2207.  * PARAMETERS
  2208.  *  callback        [IN]        Callback after action
  2209.  *  mod_src         [IN]        Callback module
  2210.  * RETURNS
  2211.  *  void
  2212.  *****************************************************************************/
  2213. void mmi_frm_sms_get_preferred_storage(PsFuncPtrU16 callback, module_type mod_src)
  2214. {
  2215.     /*----------------------------------------------------------------*/
  2216.     /* Local Variables                                                */
  2217.     /*----------------------------------------------------------------*/
  2218.     /*----------------------------------------------------------------*/
  2219.     /* Code Body                                                      */
  2220.     /*----------------------------------------------------------------*/
  2221.     mmi_frm_sms_write_action(callback, mod_src, NULL, mmi_frm_sms_get_preferred_storage_req);
  2222. }
  2223. /*****************************************************************************
  2224.  * FUNCTION
  2225.  *  mmi_frm_sms_set_preferred_storage
  2226.  * DESCRIPTION
  2227.  *  Set preferred storage
  2228.  * PARAMETERS
  2229.  *  callback        [IN]        Callback after action
  2230.  *  mod_src         [IN]        Callback module
  2231.  *  storage         [IN]        Storage
  2232.  * RETURNS
  2233.  *  void
  2234.  *****************************************************************************/
  2235. void mmi_frm_sms_set_preferred_storage(PsFuncPtrU16 callback, module_type mod_src, U8 storage)
  2236. {
  2237.     /*----------------------------------------------------------------*/
  2238.     /* Local Variables                                                */
  2239.     /*----------------------------------------------------------------*/
  2240.     U8 *data = OslMalloc(sizeof(U8));
  2241.     /*----------------------------------------------------------------*/
  2242.     /* Code Body                                                      */
  2243.     /*----------------------------------------------------------------*/
  2244.     memset(data, storage, sizeof(U8));
  2245.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_set_preferred_storage_req);
  2246. }
  2247. #endif /* __MMI_MESSAGES_PREFER_STORAGE_MEMORY_STATUS__ */ 
  2248. #ifdef __MMI_GPRS_FEATURES__
  2249. /*****************************************************************************
  2250.  * FUNCTION
  2251.  *  mmi_frm_sms_get_preferred_bearer
  2252.  * DESCRIPTION
  2253.  *  Get preferred bearer
  2254.  * PARAMETERS
  2255.  *  callback        [IN]        Callback after action
  2256.  *  mod_src         [IN]        Callback module
  2257.  * RETURNS
  2258.  *  void
  2259.  *****************************************************************************/
  2260. void mmi_frm_sms_get_preferred_bearer(PsFuncPtrU16 callback, module_type mod_src)
  2261. {
  2262.     /*----------------------------------------------------------------*/
  2263.     /* Local Variables                                                */
  2264.     /*----------------------------------------------------------------*/
  2265.     /*----------------------------------------------------------------*/
  2266.     /* Code Body                                                      */
  2267.     /*----------------------------------------------------------------*/
  2268.     mmi_frm_sms_write_action(callback, mod_src, NULL, mmi_frm_sms_get_preferred_bearer_req);
  2269. }
  2270. /*****************************************************************************
  2271.  * FUNCTION
  2272.  *  mmi_frm_sms_set_preferred_bearer
  2273.  * DESCRIPTION
  2274.  *  Set preferred bearer
  2275.  * PARAMETERS
  2276.  *  callback        [IN]        Callback after action
  2277.  *  mod_src         [IN]        Callback module
  2278.  *  bearer          [IN]        Bearer
  2279.  * RETURNS
  2280.  *  void
  2281.  *****************************************************************************/
  2282. void mmi_frm_sms_set_preferred_bearer(PsFuncPtrU16 callback, module_type mod_src, U8 bearer)
  2283. {
  2284.     /*----------------------------------------------------------------*/
  2285.     /* Local Variables                                                */
  2286.     /*----------------------------------------------------------------*/
  2287.     U8 *data = OslMalloc(sizeof(U8));
  2288.     /*----------------------------------------------------------------*/
  2289.     /* Code Body                                                      */
  2290.     /*----------------------------------------------------------------*/
  2291.     memset(data, bearer, sizeof(U8));
  2292.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_set_preferred_bearer_req);
  2293. }
  2294. #endif /* __MMI_GPRS_FEATURES__ */ 
  2295. /*****************************************************************************
  2296.  * FUNCTION
  2297.  *  mmi_frm_sms_get_mailbox_info
  2298.  * DESCRIPTION
  2299.  *  Get mailbox info
  2300.  * PARAMETERS
  2301.  *  callback        [IN]        Callback after action
  2302.  *  mod_src         [IN]        Callback module
  2303.  * RETURNS
  2304.  *  void
  2305.  *****************************************************************************/
  2306. void mmi_frm_sms_get_mailbox_info(PsFuncPtrU16 callback, module_type mod_src)
  2307. {
  2308.     /*----------------------------------------------------------------*/
  2309.     /* Local Variables                                                */
  2310.     /*----------------------------------------------------------------*/
  2311.     /*----------------------------------------------------------------*/
  2312.     /* Code Body                                                      */
  2313.     /*----------------------------------------------------------------*/
  2314.     mmi_frm_sms_write_action(callback, mod_src, NULL, mmi_frm_sms_get_mailbox_info_req);
  2315. }
  2316. /*****************************************************************************
  2317.  * FUNCTION
  2318.  *  mmi_frm_sms_set_mailbox_info
  2319.  * DESCRIPTION
  2320.  *  Set mailbox info
  2321.  * PARAMETERS
  2322.  *  callback        [IN]        Callback after action
  2323.  *  mod_src         [IN]        Callback module
  2324.  *  mailbox         [IN]        Mailbox info to be set
  2325.  * RETURNS
  2326.  *  void
  2327.  *****************************************************************************/
  2328. void mmi_frm_sms_set_mailbox_info(PsFuncPtrU16 callback, module_type mod_src, void *mailbox)
  2329. {
  2330.     /*----------------------------------------------------------------*/
  2331.     /* Local Variables                                                */
  2332.     /*----------------------------------------------------------------*/
  2333.     msg_mailbox_edit_struct *data = OslMalloc(sizeof(msg_mailbox_edit_struct));
  2334.     /*----------------------------------------------------------------*/
  2335.     /* Code Body                                                      */
  2336.     /*----------------------------------------------------------------*/
  2337.     memcpy(data, mailbox, sizeof(msg_mailbox_edit_struct));
  2338.     mmi_frm_sms_write_action(callback, mod_src, data, mmi_frm_sms_set_mailbox_info_req);
  2339. }
  2340. #ifdef __MMI_MESSAGES_COPY__
  2341. /*****************************************************************************
  2342.  * FUNCTION
  2343.  *  mmi_frm_sms_get_storage
  2344.  * DESCRIPTION
  2345.  *  get SMS storage type
  2346.  * PARAMETERS
  2347.  *  type        [IN]        mmi_frm_sms_app_msgbox_enum
  2348.  *  index       [IN]        message list index
  2349.  * RETURNS
  2350.  *  smsal_storage_enum (SMSAL_SM or SMSAL_ME)
  2351.  *****************************************************************************/
  2352. U8 mmi_frm_sms_get_storage(U8 type, U16 index)
  2353. {
  2354.     /*----------------------------------------------------------------*/
  2355.     /* Local Variables                                                */
  2356.     /*----------------------------------------------------------------*/
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Code Body                                                      */
  2359.     /*----------------------------------------------------------------*/
  2360.     return mmi_frm_sms_get_sms_storage(type, index);
  2361. }
  2362. /*****************************************************************************
  2363.  * FUNCTION
  2364.  *  mmi_frm_sms_copy_abort
  2365.  * DESCRIPTION
  2366.  *  abort SMS copy action
  2367.  * PARAMETERS
  2368.  *  void
  2369.  * RETURNS
  2370.  *  void
  2371.  *****************************************************************************/
  2372. void mmi_frm_sms_copy_abort(void)
  2373. {
  2374.     /*----------------------------------------------------------------*/
  2375.     /* Local Variables                                                */
  2376.     /*----------------------------------------------------------------*/
  2377.     /*----------------------------------------------------------------*/
  2378.     /* Code Body                                                      */
  2379.     /*----------------------------------------------------------------*/
  2380.     mmi_frm_sms_copy_sms_abort();
  2381.     return;
  2382. }
  2383. /*****************************************************************************
  2384.  * FUNCTION
  2385.  *  mmi_frm_sms_copy_sms
  2386.  * DESCRIPTION
  2387.  *  copy SMS
  2388.  * PARAMETERS
  2389.  *  callback        [IN]        
  2390.  *  mod_src         [IN]        
  2391.  *  type            [IN]        mmi_frm_sms_app_msgbox_enum, (only UNREAD,INBOX,OUTBOX,DRAFTS are valid)
  2392.  *  index           [IN]        message list index, MMI_FRM_SMS_INVALID_INDEX means ALL
  2393.  *  action          [IN]        smsal_copy_action_enum, copy or move
  2394.  *  dst_storage     [IN]        smsal_storage_enum (SMSAL_SM or SMSAL_ME)
  2395.  * RETURNS
  2396.  *  void
  2397.  *****************************************************************************/
  2398. void mmi_frm_sms_copy_sms(PsFuncPtrU16 callback, module_type mod_src, U8 type, U16 index, U8 action, U8 dst_storage)
  2399. {
  2400.     /*----------------------------------------------------------------*/
  2401.     /* Local Variables                                                */
  2402.     /*----------------------------------------------------------------*/
  2403.     /*----------------------------------------------------------------*/
  2404.     /* Code Body                                                      */
  2405.     /*----------------------------------------------------------------*/
  2406.     if (index != MMI_FRM_SMS_INVALID_INDEX)
  2407.     {
  2408.         g_frm_sms_copy_info.total_msg_number = 1;
  2409.         g_frm_sms_copy_info.present_msg_index = index;
  2410.     }
  2411.     else
  2412.     {
  2413.         g_frm_sms_copy_info.total_msg_number = mmi_frm_sms_get_sms_list_size(type);
  2414.         g_frm_sms_copy_info.present_msg_index = 0;  /* first element of list */
  2415.     #ifdef __MMI_UNIFIED_MESSAGE__
  2416.         if (type == MMI_FRM_SMS_UNSENT)
  2417.         {
  2418.             MMI_ASSERT(mmi_frm_sms_get_next_unsent_msg(&g_frm_sms_copy_info.present_msg_index));
  2419.         }
  2420.         else if (type == MMI_FRM_SMS_DRAFTS)
  2421.         {
  2422.             MMI_ASSERT(mmi_frm_sms_get_next_draft_msg(&g_frm_sms_copy_info.present_msg_index));
  2423.         }
  2424.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2425.     }
  2426.     g_frm_sms_copy_info.handled_msg_number = 0;
  2427.     g_frm_sms_copy_info.copy_msg_number = 0;
  2428.     g_frm_sms_copy_info.msg_list_type = type;
  2429.     g_frm_sms_copy_info.present_L4_index = MMI_FRM_SMS_INVALID_INDEX;
  2430.     g_frm_sms_copy_info.dst_storage = dst_storage;
  2431.     g_frm_sms_copy_info.dst_msg_index = MMI_FRM_SMS_INVALID_INDEX;
  2432.     g_frm_sms_copy_info.action = action;
  2433.     g_frm_sms_copy_info.is_aborted = FALSE;
  2434.     g_frm_sms_copy_info.is_memory_full = FALSE;
  2435.     mmi_frm_sms_write_action(callback, mod_src, NULL, mmi_frm_sms_pre_copy_sms_req);
  2436. }
  2437. #endif /* __MMI_MESSAGES_COPY__ */ 
  2438. /*****************************************************************************
  2439.  * FUNCTION
  2440.  *  mmi_frm_sms_api_result_handler
  2441.  * DESCRIPTION
  2442.  *  Handler for applications to process post SMS request actions, such as
  2443.  *  display result popup, delete SMS framework screens, and enable SPOF
  2444.  * PARAMETERS
  2445.  *  result      [?]     
  2446.  * RETURNS
  2447.  *  void
  2448.  *****************************************************************************/
  2449. void mmi_frm_sms_api_result_handler(mmi_frm_sms_api_result_handler_struct *result)
  2450. {
  2451.     /*----------------------------------------------------------------*/
  2452.     /* Local Variables                                                */
  2453.     /*----------------------------------------------------------------*/
  2454.     /*----------------------------------------------------------------*/
  2455.     /* Code Body                                                      */
  2456.     /*----------------------------------------------------------------*/
  2457.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  2458.                          "*[SmsCore.c] mmi_frm_sms_api_result_handler display_popup=%d request_type=%d*n",
  2459.                          result->display_popup, result->request_type));
  2460.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  2461.                          "*[SmsCore.c] mmi_frm_sms_api_result_handler result=%d delete_sms_screen=%d*n",
  2462.                          result->result, result->delete_sms_screen));
  2463.     if (result->display_popup)
  2464.     {
  2465.         switch (result->result)
  2466.         {
  2467.             case MMI_FRM_SMS_OK:
  2468.             {
  2469.                 if (result->request_type == MMI_FRM_SMS_REQ_SEND)
  2470.                 {
  2471.                     DisplayPopup(
  2472.                         (PU8) GetString(STR_SMS_SEND_SUCCESS),
  2473.                         IMG_SEND_SUCCESS_PIC_MSG,
  2474.                         1,
  2475.                         MESSAGES_POPUP_TIME_OUT,
  2476.                         (U8) SUCCESS_TONE);
  2477.                     break;
  2478.                 }
  2479.                 else if (result->request_type == MMI_FRM_SMS_REQ_SAVE)
  2480.                 {
  2481.                     DisplayPopup(
  2482.                         (PU8) GetString(STR_GLOBAL_DONE),
  2483.                         IMG_GLOBAL_ACTIVATED,
  2484.                         1,
  2485.                         MESSAGES_POPUP_TIME_OUT,
  2486.                         (U8) SUCCESS_TONE);
  2487.                     break;
  2488.                 }
  2489.                 else
  2490.                 {
  2491.                     DisplayPopup(
  2492.                         (PU8) GetString(STR_GLOBAL_DONE),
  2493.                         IMG_GLOBAL_ACTIVATED,
  2494.                         1,
  2495.                         MESSAGES_POPUP_TIME_OUT,
  2496.                         (U8) SUCCESS_TONE);
  2497.                     break;
  2498.                 }
  2499.             }
  2500.             case MMI_FRM_SMS_ERROR:
  2501.             {
  2502.                 DisplayPopup(
  2503.                     (PU8) GetString(STR_SMS_SEND_FAILED),
  2504.                     IMG_SEND_FAIL_PIC_MSG,
  2505.                     1,
  2506.                     MESSAGES_POPUP_TIME_OUT,
  2507.                     (U8) ERROR_TONE);
  2508.                 break;
  2509.             }
  2510.             case MMI_FRM_SMS_ABORT:
  2511.             {
  2512.                 DisplayPopup(
  2513.                     (PU8) GetString(STR_ABORT_SENDING_SMS),
  2514.                     IMG_GLOBAL_ACTIVATED,
  2515.                     1,
  2516.                     MESSAGES_POPUP_TIME_OUT,
  2517.                     (U8) SUCCESS_TONE);
  2518.                 break;
  2519.             }
  2520.             case MMI_FRM_SMS_NOTREADY:
  2521.             {
  2522.                 DisplayPopup(
  2523.                     (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  2524.                     IMG_SEND_FAIL_PIC_MSG,
  2525.                     1,
  2526.                     MESSAGES_POPUP_TIME_OUT,
  2527.                     (U8) ERROR_TONE);
  2528.                 break;
  2529.             }
  2530.             case MMI_FRM_SMS_RETURN:
  2531.             case MMI_FRM_SMS_END:
  2532.             {
  2533.                 /* Do nothing due to pressing RSK back from entry destination number screen or entry SC number screen */
  2534.                 break;
  2535.             }
  2536.             case MMI_FRM_SMS_END_FROM_SENDING:
  2537.             {
  2538.             #ifdef __MMI_UNIFIED_MESSAGE__
  2539.                 mmi_msg_set_background_process(KAL_TRUE);
  2540.                 mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, result->number);
  2541.             #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  2542.                 break;
  2543.             }
  2544.             case MMI_FRM_SMS_NUMINVALID:
  2545.             {
  2546.                 DisplayPopup(
  2547.                     (PU8) GetString(STR_ID_PHB_NUM_INVALID),
  2548.                     IMG_GLOBAL_UNFINISHED,
  2549.                     1,
  2550.                     MESSAGES_POPUP_TIME_OUT,
  2551.                     (U8) ERROR_TONE);
  2552.                 break;
  2553.             }
  2554.             case MMI_FRM_SMS_DATAEMPTY:
  2555.             {
  2556.                 DisplayPopup(
  2557.                     (PU8) GetString(STR_SMS_FAILURE_DATA_EMPTY),
  2558.                     IMG_GLOBAL_UNFINISHED,
  2559.                     1,
  2560.                     MESSAGES_POPUP_TIME_OUT,
  2561.                     (U8) ERROR_TONE);
  2562.                 break;
  2563.             }
  2564.             case MMI_FRM_SMS_DATAINVALID:
  2565.             {
  2566.                 DisplayPopup(
  2567.                     (PU8) GetString(STR_SMS_FAILURE_DATA_INVALID),
  2568.                     IMG_GLOBAL_UNFINISHED,
  2569.                     1,
  2570.                     MESSAGES_POPUP_TIME_OUT,
  2571.                     (U8) ERROR_TONE);
  2572.                 break;
  2573.             }
  2574.             case MMI_FRM_SMS_DATAEXCEED:
  2575.             {
  2576.                 DisplayPopup(
  2577.                     (PU8) GetString(STR_SMS_FAILURE_DATA_EXCEED),
  2578.                     IMG_GLOBAL_UNFINISHED,
  2579.                     1,
  2580.                     MESSAGES_POPUP_TIME_OUT,
  2581.                     (U8) ERROR_TONE);
  2582.                 break;
  2583.             }
  2584.             case MMI_FRM_SMS_SC_EMPTY:
  2585.             {
  2586.                 DisplayPopup(
  2587.                     (PU8) GetString(STR_SMS_FAILURE_SC_NUM_EMPTY),
  2588.                     IMG_GLOBAL_UNFINISHED,
  2589.                     1,
  2590.                     MESSAGES_POPUP_TIME_OUT,
  2591.                     (U8) ERROR_TONE);
  2592.                 break;
  2593.             }
  2594.             case MMI_FRM_SMS_MEMFULL:
  2595.             {
  2596.                 DisplayPopup(
  2597.                     (PU8) GetString(STR_SMS_FAILURE_MEM_FULL),
  2598.                     IMG_GLOBAL_UNFINISHED,
  2599.                     1,
  2600.                     MESSAGES_POPUP_TIME_OUT,
  2601.                     (U8) WARNING_TONE);
  2602.                 break;
  2603.             }
  2604.             case MMI_FRM_SMS_MEMINSUFFICIENT:
  2605.             {
  2606.                 DisplayPopup(
  2607.                     (PU8) GetString(STR_SMS_FAILURE_MEM_CAP_EXCEEDED),
  2608.                     IMG_GLOBAL_UNFINISHED,
  2609.                     1,
  2610.                     MESSAGES_POPUP_TIME_OUT,
  2611.                     (U8) ERROR_TONE);
  2612.                 break;
  2613.             }
  2614.             default:
  2615.             {
  2616.                 DisplayPopup(
  2617.                     (PU8) GetString(STR_SMS_SEND_FAILED),
  2618.                     IMG_SEND_FAIL_PIC_MSG,
  2619.                     1,
  2620.                     MESSAGES_POPUP_TIME_OUT,
  2621.                     (U8) ERROR_TONE);
  2622.                 break;
  2623.             }
  2624.         }
  2625.     }
  2626.     if (result->delete_sms_screen)
  2627.     {
  2628.         mmi_frm_sms_delete_screen_history();
  2629.     }
  2630.     AlmEnableSPOF();
  2631. }
  2632. /*****************************************************************************
  2633.  * FUNCTION
  2634.  *  mmi_frm_sms_api_entry_write_msg
  2635.  * DESCRIPTION
  2636.  *  Handler for applications to entry write msg screen with content
  2637.  * PARAMETERS
  2638.  *  data        [?]     
  2639.  * RETURNS
  2640.  *  void
  2641.  *****************************************************************************/
  2642. void mmi_frm_sms_api_entry_write_msg(mmi_frm_sms_api_entry_write_struct *data)
  2643. {
  2644.     /*----------------------------------------------------------------*/
  2645.     /* Local Variables                                                */
  2646.     /*----------------------------------------------------------------*/
  2647.     /*----------------------------------------------------------------*/
  2648.     /* Code Body                                                      */
  2649.     /*----------------------------------------------------------------*/
  2650.     mmi_frm_sms_entry_write_msg_req(data);
  2651. }
  2652. /*****************************************************************************
  2653.  * FUNCTION
  2654.  *  mmi_frm_sms_fill_in_edit_buffer
  2655.  * DESCRIPTION
  2656.  *  Fill in EMS edit buffer
  2657.  * PARAMETERS
  2658.  *  data        [?]     
  2659.  * RETURNS
  2660.  *  void
  2661.  *****************************************************************************/
  2662. BOOL mmi_frm_sms_fill_in_edit_buffer(U8* buffer, U16 char_num, U8 dcs, BOOL is_reset)
  2663. {
  2664.     /*----------------------------------------------------------------*/
  2665.     /* Local Variables                                                */
  2666.     /*----------------------------------------------------------------*/
  2667.     EMSData *pEMS;
  2668.     U16 result;
  2669.     /*----------------------------------------------------------------*/
  2670.     /* Code Body                                                      */
  2671.     /*----------------------------------------------------------------*/
  2672.     if (is_reset)
  2673.     {
  2674.         ReleaseEMSEditBuffer();
  2675.         pEMS = GetEMSDataForEdit(0, 1);
  2676.     }
  2677.     else
  2678.     {
  2679.         pEMS = GetEMSDataForEdit(0, 0);
  2680.     }
  2681.     EMSSetDCS(pEMS, dcs);
  2682.     
  2683.     if (char_num == 0)
  2684.     {
  2685.         return MMI_TRUE;
  2686.     }
  2687.     
  2688.     result = AddString(pEMS, buffer, char_num, NULL);
  2689.     if (result == EMS_OK)
  2690.     {
  2691.         return MMI_TRUE;
  2692.     }
  2693.     else
  2694.     {
  2695.         return MMI_FALSE;
  2696.     }
  2697. }
  2698. /*****************************************************************************
  2699.  * FUNCTION
  2700.  *  mmi_frm_sms_init
  2701.  * DESCRIPTION
  2702.  *  Init framework SMS: protocol event handler and data init
  2703.  * PARAMETERS
  2704.  *  void
  2705.  * RETURNS
  2706.  *  void
  2707.  *****************************************************************************/
  2708. void mmi_frm_sms_init(void)
  2709. {
  2710.     /*----------------------------------------------------------------*/
  2711.     /* Local Variables                                                */
  2712.     /*----------------------------------------------------------------*/
  2713.     /*----------------------------------------------------------------*/
  2714.     /* Code Body                                                      */
  2715.     /*----------------------------------------------------------------*/
  2716.     g_frm_sms_cntx.mmi_frm_sms_ready = FALSE;
  2717.     g_frm_sms_cntx.mmi_frm_sms_msg_box_size = mmi_msg_get_msgbox_size();
  2718.     g_frm_sms_cntx.mmi_frm_sms_msg_seg_size = mmi_msg_get_seg_num();
  2719. #ifdef __MMI_MESSAGES_SINGLE_DELIVERY_REPORT__
  2720.     g_frm_sms_cntx.mmi_frm_sms_delivery_report_setting = FALSE;
  2721. #endif 
  2722. #ifdef __MMI_MESSAGES_COPY__
  2723.     g_frm_sms_copy_info.is_aborted = FALSE;
  2724. #endif 
  2725.     /* init msgbox in case of receiving class 0 message before startup_begin_ind */
  2726.     mmi_frm_sms_init_msgbox();
  2727.     mmi_frm_sms_set_protocol_event_handler();
  2728. }
  2729. #endif /* 1 */ /* __MMI_MESSAGES_VERSION_3__ */
  2730. #endif /* __MOD_SMSAL__ */