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

MTK

开发平台:

C/C++

  1. }
  2. #endif /* __MMI_MESSAGES_TEMPLATE__ */ 
  3. /*****************************************************************************
  4.  * FUNCTION
  5.  *  mmi_msg_check_interrupt
  6.  * DESCRIPTION
  7.  *  check if there is an interrupt (incoming call ringing or alarm playing).
  8.  * PARAMETERS
  9.  *  void
  10.  * RETURNS
  11.  *  1: interrupt existed, 0: interrupt not existed
  12.  *****************************************************************************/
  13. U8 mmi_msg_check_interrupt(void)
  14. {
  15.     /*----------------------------------------------------------------*/
  16.     /* Local Variables                                                */
  17.     /*----------------------------------------------------------------*/
  18.     /*----------------------------------------------------------------*/
  19.     /* Code Body                                                      */
  20.     /*----------------------------------------------------------------*/
  21.     if (isIncomingCall() || AlmIsTonePlaying())
  22.     {
  23.         PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  24.                              "*-------[MessagesMiscell.c] mmi_msg_check_interrupt return TRUE -------*n"));
  25.         return TRUE;
  26.     }
  27.     else
  28.     {
  29.         return FALSE;
  30.     }
  31. }
  32. /*****************************************************************************
  33.  * FUNCTION
  34.  *  mmi_msg_check_ascii_number
  35.  * DESCRIPTION
  36.  *  check if the encoding of number string is ascii or not
  37.  * PARAMETERS
  38.  *  number_string       [?]         
  39.  *  length              [IN]        
  40.  * RETURNS
  41.  *  KAL_TRUE: ascii encoding, KAL_FALSE: Otherwise
  42.  *****************************************************************************/
  43. kal_bool mmi_msg_check_ascii_number(U8 *number_string, U16 length)
  44. {
  45.     /*----------------------------------------------------------------*/
  46.     /* Local Variables                                                */
  47.     /*----------------------------------------------------------------*/
  48.     U8 *number = number_string;
  49.     U16 len = length;
  50.     int i = 0;
  51.     /*----------------------------------------------------------------*/
  52.     /* Code Body                                                      */
  53.     /*----------------------------------------------------------------*/
  54.     for (i = 0; i < len; i++)
  55.     {
  56.         if (number[i] == 0)
  57.         {
  58.             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  59.                                  "*-------[MessagesMiscell.c] mmi_msg_check_ascii_number return FALSE -------*n"));
  60.             return KAL_FALSE;
  61.         }
  62.     }
  63.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  64.                          "*-------[MessagesMiscell.c] mmi_msg_check_ascii_number return TRUE -------*n"));
  65.     return KAL_TRUE;
  66. }
  67. /*****************************************************************************
  68.  * FUNCTION
  69.  *  mmi_msg_need_clear_action_queue
  70.  * DESCRIPTION
  71.  *  check if the action queue is needed to be cleared to avoid the case that the screen
  72.  *  is back to idle from input number editor without clearing the action queue.
  73.  * PARAMETERS
  74.  *  void
  75.  * RETURNS
  76.  *  1: cleared required, 0: cleared not required
  77.  *****************************************************************************/
  78. U8 mmi_msg_need_clear_action_queue(void)
  79. {
  80.     /*----------------------------------------------------------------*/
  81.     /* Local Variables                                                */
  82.     /*----------------------------------------------------------------*/
  83.     /*----------------------------------------------------------------*/
  84.     /* Code Body                                                      */
  85.     /*----------------------------------------------------------------*/
  86.     if (g_msg_cntx.msg_status != MSG_STATUS_IDLE)
  87.     {
  88.         return TRUE;
  89.     }
  90.     else
  91.     {
  92.         return FALSE;
  93.     }
  94. }
  95. /*****************************************************************************
  96.  * FUNCTION
  97.  *  mmi_msg_need_new_msg_ind
  98.  * DESCRIPTION
  99.  *  check if new msg indication is required
  100.  * PARAMETERS
  101.  *  void
  102.  * RETURNS
  103.  *  1: indication required, 0: indication not required
  104.  *****************************************************************************/
  105. U8 mmi_msg_need_new_msg_ind(void)
  106. {
  107.     /*----------------------------------------------------------------*/
  108.     /* Local Variables                                                */
  109.     /*----------------------------------------------------------------*/
  110.     /*----------------------------------------------------------------*/
  111.     /* Code Body                                                      */
  112.     /*----------------------------------------------------------------*/
  113.     /* Return false if the new msg is deleted by AT */
  114.     if (mmi_frm_sms_msg_box[g_msg_cntx.msg_ind_index].startindex == MMI_FRM_SMS_INVALID_INDEX)
  115.     {
  116.         g_msg_cntx.msg_ind_in_idle = FALSE;
  117.         g_msg_cntx.msg_ind_after_call = FALSE;
  118.         return KAL_FALSE;
  119.     }
  120.     else
  121.     {
  122.         return g_msg_cntx.msg_ind_in_idle;
  123.     }
  124. }
  125. /*****************************************************************************
  126.  * FUNCTION
  127.  *  mmi_msg_need_new_msg_ind_call_end
  128.  * DESCRIPTION
  129.  *  Check if new msg indication after call end is required
  130.  * PARAMETERS
  131.  *  void
  132.  * RETURNS
  133.  *  1: indication required, 0: indication not required
  134.  *****************************************************************************/
  135. U8 mmi_msg_need_new_msg_ind_call_end(void)
  136. {
  137.     /*----------------------------------------------------------------*/
  138.     /* Local Variables                                                */
  139.     /*----------------------------------------------------------------*/
  140.     /*----------------------------------------------------------------*/
  141.     /* Code Body                                                      */
  142.     /*----------------------------------------------------------------*/
  143.     return g_msg_cntx.msg_ind_after_call;
  144. }
  145. /*****************************************************************************
  146.  * FUNCTION
  147.  *  mmi_msg_reset_new_msg_ind_call_end
  148.  * DESCRIPTION
  149.  *  Reset new msg indication after call end
  150.  * PARAMETERS
  151.  *  void
  152.  * RETURNS
  153.  *  void
  154.  *****************************************************************************/
  155. void mmi_msg_reset_new_msg_ind_call_end(void)
  156. {
  157.     /*----------------------------------------------------------------*/
  158.     /* Local Variables                                                */
  159.     /*----------------------------------------------------------------*/
  160.     /*----------------------------------------------------------------*/
  161.     /* Code Body                                                      */
  162.     /*----------------------------------------------------------------*/
  163.     g_msg_cntx.msg_ind_after_call = FALSE;
  164. }
  165. /*****************************************************************************
  166.  * FUNCTION
  167.  *  mmi_msg_need_class0_msg_ind
  168.  * DESCRIPTION
  169.  *  Check if class 0 message indication is required
  170.  * PARAMETERS
  171.  *  void
  172.  * RETURNS
  173.  *  1: indication required, 0: indication not required
  174.  *****************************************************************************/
  175. U8 mmi_msg_need_class0_msg_ind(void)
  176. {
  177.     /*----------------------------------------------------------------*/
  178.     /* Local Variables                                                */
  179.     /*----------------------------------------------------------------*/
  180.     /*----------------------------------------------------------------*/
  181.     /* Code Body                                                      */
  182.     /*----------------------------------------------------------------*/
  183.     return g_msg_cntx.msg_class0_ind;
  184. }
  185. /*****************************************************************************
  186.  * FUNCTION
  187.  *  mmi_msg_need_mem_full_ind
  188.  * DESCRIPTION
  189.  *  Check if msg full indication is required
  190.  * PARAMETERS
  191.  *  void
  192.  * RETURNS
  193.  *  1: indication required, 0: indication not required
  194.  *****************************************************************************/
  195. U8 mmi_msg_need_mem_full_ind(void)
  196. {
  197.     /*----------------------------------------------------------------*/
  198.     /* Local Variables                                                */
  199.     /*----------------------------------------------------------------*/
  200.     /*----------------------------------------------------------------*/
  201.     /* Code Body                                                      */
  202.     /*----------------------------------------------------------------*/
  203.     return g_msg_cntx.msg_full_ind;
  204. }
  205. /*****************************************************************************
  206.  * FUNCTION
  207.  *  mmi_msg_need_mem_exceed_ind
  208.  * DESCRIPTION
  209.  *  Check if msg exceed indication is required
  210.  * PARAMETERS
  211.  *  void
  212.  * RETURNS
  213.  *  1: indication required, 0: indication not required
  214.  *****************************************************************************/
  215. U8 mmi_msg_need_mem_exceed_ind(void)
  216. {
  217.     /*----------------------------------------------------------------*/
  218.     /* Local Variables                                                */
  219.     /*----------------------------------------------------------------*/
  220.     /*----------------------------------------------------------------*/
  221.     /* Code Body                                                      */
  222.     /*----------------------------------------------------------------*/
  223.     return g_msg_cntx.msg_exceed_ind;
  224. }
  225. /*****************************************************************************
  226.  * FUNCTION
  227.  *  mmi_msg_need_delivery_report_ind
  228.  * DESCRIPTION
  229.  *  Check if delivery report indication is required
  230.  * PARAMETERS
  231.  *  void
  232.  * RETURNS
  233.  *  non-0: indication required, 0: indication not required
  234.  *****************************************************************************/
  235. U8 mmi_msg_need_delivery_report_ind(void)
  236. {
  237.     /*----------------------------------------------------------------*/
  238.     /* Local Variables                                                */
  239.     /*----------------------------------------------------------------*/
  240.     /*----------------------------------------------------------------*/
  241.     /* Code Body                                                      */
  242.     /*----------------------------------------------------------------*/
  243.     return g_msg_cntx.msg_deliver_ind;
  244. }
  245. /*****************************************************************************
  246.  * FUNCTION
  247.  *  mmi_msg_need_waiting_ind
  248.  * DESCRIPTION
  249.  *  Check if msg waiting indication is required
  250.  * PARAMETERS
  251.  *  void
  252.  * RETURNS
  253.  *  non-0: indication required, 0: indication not required
  254.  *****************************************************************************/
  255. U8 mmi_msg_need_waiting_ind(void)
  256. {
  257.     /*----------------------------------------------------------------*/
  258.     /* Local Variables                                                */
  259.     /*----------------------------------------------------------------*/
  260.     /*----------------------------------------------------------------*/
  261.     /* Code Body                                                      */
  262.     /*----------------------------------------------------------------*/
  263.     return g_msg_cntx.msg_waiting_ind;
  264. }
  265. /*****************************************************************************
  266.  * FUNCTION
  267.  *  mmi_msg_msg_waiting_ind
  268.  * DESCRIPTION
  269.  *  Indicate msg waiting
  270.  * PARAMETERS
  271.  *  type        [IN]        
  272.  *  a(?)        [IN]        Waiting msg type
  273.  * RETURNS
  274.  *  void
  275.  *****************************************************************************/
  276. void mmi_msg_msg_waiting_ind(U8 type)
  277. {
  278.     /*----------------------------------------------------------------*/
  279.     /* Local Variables                                                */
  280.     /*----------------------------------------------------------------*/
  281.     /*----------------------------------------------------------------*/
  282.     /* Code Body                                                      */
  283.     /*----------------------------------------------------------------*/
  284.     g_msg_cntx.msg_waiting_ind = type + 1;
  285.     TurnOnBacklight(1);
  286.     if (IsMMIInIdleState() || (GetMessagesCurrScrnID() == SCR_ID_MSG_MSG_WAITING_IND))
  287.     {
  288.         PlayMessageArrivalTone();
  289.         ClearKeyEvents();
  290.         if (IsKeyPadLockState())
  291.         {
  292.             EntryIdleScreen();
  293.         }
  294.         else
  295.         {
  296.             mmi_msg_entry_msg_waiting_ind();
  297.         }
  298.     }
  299.     else
  300.     {
  301.         /* do not interrupt a call, otherwise, incoming call's video and sound may be interrupted */
  302.         if (!isInCall() && !AlmIsTonePlaying())
  303.         {
  304.             mmi_msg_entry_new_msg_popup(g_msg_cntx.msg_waiting_ind);
  305.         }
  306.     }
  307. }
  308. /*****************************************************************************
  309.  * FUNCTION
  310.  *  mmi_msg_go_back_from_msg_waiting_ind
  311.  * DESCRIPTION
  312.  *  Reset msg waiting ind before go back screen
  313.  * PARAMETERS
  314.  *  void
  315.  * RETURNS
  316.  *  void
  317.  *****************************************************************************/
  318. void mmi_msg_go_back_from_msg_waiting_ind(void)
  319. {
  320.     /*----------------------------------------------------------------*/
  321.     /* Local Variables                                                */
  322.     /*----------------------------------------------------------------*/
  323.     /*----------------------------------------------------------------*/
  324.     /* Code Body                                                      */
  325.     /*----------------------------------------------------------------*/
  326.     g_msg_cntx.msg_waiting_ind = 0;
  327.     if (strBuff != NULL)
  328.     {
  329.         OslMfree(strBuff);
  330.         strBuff = NULL;
  331.     }
  332.     GoBackHistory();
  333. }
  334. /*****************************************************************************
  335.  * FUNCTION
  336.  *  mmi_msg_end_key_from_msg_waiting_ind
  337.  * DESCRIPTION
  338.  *  Reset msg waiting ind before go to idle
  339.  * PARAMETERS
  340.  *  void
  341.  * RETURNS
  342.  *  void
  343.  *****************************************************************************/
  344. void mmi_msg_end_key_from_msg_waiting_ind(void)
  345. {
  346.     /*----------------------------------------------------------------*/
  347.     /* Local Variables                                                */
  348.     /*----------------------------------------------------------------*/
  349.     /*----------------------------------------------------------------*/
  350.     /* Code Body                                                      */
  351.     /*----------------------------------------------------------------*/
  352.     g_msg_cntx.msg_waiting_ind = 0;
  353.     if (strBuff != NULL)
  354.     {
  355.         OslMfree(strBuff);
  356.         strBuff = NULL;
  357.     }
  358.     ExecCurrEndKeyDownHandler();
  359. }
  360. /*****************************************************************************
  361.  * FUNCTION
  362.  *  mmi_msg_get_msg_waiting_msg
  363.  * DESCRIPTION
  364.  *  Get msg waiting msg
  365.  * PARAMETERS
  366.  *  void
  367.  * RETURNS
  368.  *  string for msg waiting indication
  369.  *****************************************************************************/
  370. U8 *mmi_msg_get_msg_waiting_msg(void)
  371. {
  372.     /*----------------------------------------------------------------*/
  373.     /* Local Variables                                                */
  374.     /*----------------------------------------------------------------*/
  375.     U8 *tempStr = NULL;
  376.     U8 ascii_num[16];
  377.     U16 num = g_msg_cntx.msg_waiting_info[g_msg_cntx.msg_waiting_line_number].number[g_msg_cntx.msg_waiting_ind - 1];
  378.     /*----------------------------------------------------------------*/
  379.     /* Code Body                                                      */
  380.     /*----------------------------------------------------------------*/
  381.     if (strBuff != NULL)
  382.     {
  383.         OslMfree(strBuff);
  384.         strBuff = NULL;
  385.     }
  386.     strBuff = OslMalloc(64);
  387. if (num > 0)
  388. {
  389.         memset(ascii_num, 0, 16);
  390.         sprintf((S8*) ascii_num, "%d ", num);
  391.         AnsiiToUnicodeString((S8*) strBuff, (S8*) ascii_num);
  392.         switch (g_msg_cntx.msg_waiting_ind)
  393.         {
  394.             case MSG_NEW_VOICEMAIL:
  395.                 tempStr = (U8*) GetString((U16) STR_VOICEMAIL_NUM_IND);
  396.                 break;
  397.             case MSG_NEW_FAX:
  398.                 tempStr = (U8*) GetString((U16) STR_FAX_NUM_IND);
  399.                 break;
  400.             case MSG_NEW_EMAIL:
  401.                 tempStr = (U8*) GetString((U16) STR_EMAIL_NUM_IND);
  402.                 break;
  403.             default:
  404.                 tempStr = (U8*) GetString((U16) STR_VOICEMAIL_NUM_IND);
  405.                 break;
  406.         }
  407.         pfnUnicodeStrcat((S8*) strBuff, (S8*) tempStr);
  408.     }
  409.     else
  410.     {
  411.         switch (g_msg_cntx.msg_waiting_ind)
  412.         {
  413.             case MSG_NEW_VOICEMAIL:
  414.                 tempStr = (U8*) GetString((U16) STR_VOICEMAIL_IND);
  415.                 break;
  416.             case MSG_NEW_FAX:
  417.                 tempStr = (U8*) GetString((U16) STR_FAX_IND);
  418.                 break;
  419.             case MSG_NEW_EMAIL:
  420.                 tempStr = (U8*) GetString((U16) STR_EMAIL_IND);
  421.                 break;
  422.             default:
  423.                 tempStr = (U8*) GetString((U16) STR_VOICEMAIL_IND);
  424.                 break;
  425.         }
  426.         pfnUnicodeStrcpy((S8*) strBuff, (S8*) tempStr);    
  427.     }
  428.     
  429.     return strBuff;
  430. }
  431. /*****************************************************************************
  432.  * FUNCTION
  433.  *  mmi_msg_entry_msg_waiting_ind
  434.  * DESCRIPTION
  435.  *  Entry msg waiting indication screen
  436.  * PARAMETERS
  437.  *  void
  438.  * RETURNS
  439.  *  void
  440.  *****************************************************************************/
  441. void mmi_msg_entry_msg_waiting_ind(void)
  442. {
  443.     /*----------------------------------------------------------------*/
  444.     /* Local Variables                                                */
  445.     /*----------------------------------------------------------------*/
  446.     U8 *tempstr = mmi_msg_get_msg_waiting_msg();
  447.     /*----------------------------------------------------------------*/
  448.     /* Code Body                                                      */
  449.     /*----------------------------------------------------------------*/
  450.     EntryNewScreen(SCR_ID_MSG_MSG_WAITING_IND, mmi_msg_stop_msg_sub_anm, NULL, NULL);
  451.     SetMessagesCurrScrnID(SCR_ID_MSG_MSG_WAITING_IND);
  452.     ForceSubLCDScreen(mmi_msg_start_msg_sub_anm);
  453.     
  454.     if (IsKeyPadLockState() == 0)
  455.     {
  456.         GetCurrEndKeyDownHandler();
  457.         ShowCategory141Screen(
  458.             0,
  459.             0,
  460.             0,
  461.             0,
  462.             STR_GLOBAL_BACK,
  463.             IMG_GLOBAL_BACK,
  464.             (U8*) tempstr,
  465.             IMG_NEW_VOICEMAIL_NOTIFICATION_MSG,
  466.             NULL);
  467.         SetRightSoftkeyFunction(mmi_msg_go_back_from_msg_waiting_ind, KEY_EVENT_UP);
  468.         SetKeyHandler(mmi_msg_end_key_from_msg_waiting_ind, KEY_END, KEY_EVENT_DOWN);
  469.     }
  470.     else
  471.     {
  472.         ShowCategory141Screen(
  473.             0,
  474.             0,
  475.             g_keylock_context.KeyLockLSKStringID,
  476.             g_keylock_context.KeyLockLSKIconID,
  477.             g_keylock_context.KeyLockRSKStringID,
  478.             g_keylock_context.KeyLockRSKIconID,
  479.             (U8*) tempstr,
  480.             IMG_NEW_VOICEMAIL_NOTIFICATION_MSG,
  481.             NULL);
  482.     }
  483. }
  484. /*****************************************************************************
  485.  * FUNCTION
  486.  *  mmi_msg_deliver_report_ind
  487.  * DESCRIPTION
  488.  *  Indicate delivery report
  489.  * PARAMETERS
  490.  *  void
  491.  * RETURNS
  492.  *  void
  493.  *****************************************************************************/
  494. void mmi_msg_deliver_report_ind(void)
  495. {
  496.     /*----------------------------------------------------------------*/
  497.     /* Local Variables                                                */
  498.     /*----------------------------------------------------------------*/
  499.     /*----------------------------------------------------------------*/
  500.     /* Code Body                                                      */
  501.     /*----------------------------------------------------------------*/
  502.     g_msg_cntx.msg_deliver_ind++;
  503.     TurnOnBacklight(1);
  504.     if (IsMMIInIdleState() || (GetMessagesCurrScrnID() == SCR_ID_MSG_DELIVER_REPORT))
  505.     {
  506.         PlayMessageArrivalTone();
  507.         ClearKeyEvents();
  508.         if (IsKeyPadLockState())
  509.         {
  510.             EntryIdleScreen();
  511.         }
  512.         else
  513.         {
  514.             mmi_msg_entry_deliver_report_ind();
  515.         }
  516.     }
  517.     else
  518.     {
  519.         /* do not interrupt a call, otherwise, incoming call's video and sound may be interrupted */
  520.         if (!isInCall() && !AlmIsTonePlaying())
  521.         {
  522.             mmi_msg_entry_new_msg_popup(MSG_NEW_DELIVERY_REPORT);
  523.         }
  524.     }
  525. }
  526. /*****************************************************************************
  527.  * FUNCTION
  528.  *  mmi_msg_go_back_from_deliver_report_ind
  529.  * DESCRIPTION
  530.  *  Free delivery report before go back screen
  531.  * PARAMETERS
  532.  *  void
  533.  * RETURNS
  534.  *  void
  535.  *****************************************************************************/
  536. void mmi_msg_go_back_from_deliver_report_ind(void)
  537. {
  538.     /*----------------------------------------------------------------*/
  539.     /* Local Variables                                                */
  540.     /*----------------------------------------------------------------*/
  541.     /*----------------------------------------------------------------*/
  542.     /* Code Body                                                      */
  543.     /*----------------------------------------------------------------*/
  544.     if (g_msg_cntx.msg_deliver_ind != 0)
  545.     {
  546.         g_msg_cntx.msg_deliver_ind--;
  547.     }
  548.     if (g_msg_cntx.msg_deliver_report[g_msg_cntx.msg_deliver_ind] != NULL)
  549.     {
  550.         OslMfree(g_msg_cntx.msg_deliver_report[g_msg_cntx.msg_deliver_ind]);
  551.         g_msg_cntx.msg_deliver_report[g_msg_cntx.msg_deliver_ind] = NULL;
  552.     }
  553.     GoBackHistory();
  554. }
  555. /*****************************************************************************
  556.  * FUNCTION
  557.  *  mmi_msg_end_key_from_deliver_report_ind
  558.  * DESCRIPTION
  559.  *  Free delivery report before go to idle
  560.  * PARAMETERS
  561.  *  void
  562.  * RETURNS
  563.  *  void
  564.  *****************************************************************************/
  565. void mmi_msg_end_key_from_deliver_report_ind(void)
  566. {
  567.     /*----------------------------------------------------------------*/
  568.     /* Local Variables                                                */
  569.     /*----------------------------------------------------------------*/
  570.     /*----------------------------------------------------------------*/
  571.     /* Code Body                                                      */
  572.     /*----------------------------------------------------------------*/
  573.     if (g_msg_cntx.msg_deliver_ind != 0)
  574.     {
  575.         g_msg_cntx.msg_deliver_ind--;
  576.     }
  577.     if (g_msg_cntx.msg_deliver_report[g_msg_cntx.msg_deliver_ind] != NULL)
  578.     {
  579.         OslMfree(g_msg_cntx.msg_deliver_report[g_msg_cntx.msg_deliver_ind]);
  580.         g_msg_cntx.msg_deliver_report[g_msg_cntx.msg_deliver_ind] = NULL;
  581.     }
  582.     ExecCurrEndKeyDownHandler();
  583. }
  584. /*****************************************************************************
  585.  * FUNCTION
  586.  *  mmi_msg_get_deliver_report_status
  587.  * DESCRIPTION
  588.  *  Get delivery report status
  589.  * PARAMETERS
  590.  *  status      [?]             
  591.  *  imgID       [?]             
  592.  *  strID       [?]             
  593.  *  a(?)        [IN/OUT]        Status
  594.  *  c(?)        [IN/OUT]        String ID
  595.  *  b(?)        [IN/OUT]        Image ID
  596.  * RETURNS
  597.  *  void
  598.  *****************************************************************************/
  599. void mmi_msg_get_deliver_report_status(U32 *status, U16 *imgID, U16 *strID)
  600. {
  601.     /*----------------------------------------------------------------*/
  602.     /* Local Variables                                                */
  603.     /*----------------------------------------------------------------*/
  604.     /*----------------------------------------------------------------*/
  605.     /* Code Body                                                      */
  606.     /*----------------------------------------------------------------*/
  607.     if (g_msg_cntx.msg_deliver_report[(g_msg_cntx.msg_deliver_ind - 1)]->delivered == ST_COMP_MSG_RECV_BY_SME)
  608.     {
  609.         *status = 1;
  610.         *imgID = IMG_MESSAGE_SENT;
  611.         *strID = STR_SUCCESS_CAPTION;
  612.     }
  613.     else
  614.     {
  615.         *status = 0;
  616.         *imgID = IMG_MESSAGE_UNSENT;
  617.         *strID = STR_FAILURE_CAPTION;
  618.     }
  619. }
  620. /*****************************************************************************
  621.  * FUNCTION
  622.  *  mmi_msg_get_deliver_report_msg
  623.  * DESCRIPTION
  624.  *  Get delivery report msg
  625.  * PARAMETERS
  626.  *  void
  627.  * RETURNS
  628.  *  string for delivery report indication
  629.  *****************************************************************************/
  630. U8 *mmi_msg_get_deliver_report_msg(void)
  631. {
  632.     /*----------------------------------------------------------------*/
  633.     /* Local Variables                                                */
  634.     /*----------------------------------------------------------------*/
  635.     static S8 buffer[120 * ENCODING_LENGTH];
  636.     S8 buf2[10];
  637.     S8 temp[MAX_DIGITS * ENCODING_LENGTH];
  638.     S8 *name;
  639.     S8 ts_date[(MAX_TIMESTAMP_SIZE + 1) * ENCODING_LENGTH];
  640.     S8 ts_time[(MAX_TIMESTAMP_SIZE + 1) * ENCODING_LENGTH];
  641.     U8 type = g_msg_cntx.msg_deliver_report[(g_msg_cntx.msg_deliver_ind - 1)]->type;
  642.     /*----------------------------------------------------------------*/
  643.     /* Code Body                                                      */
  644.     /*----------------------------------------------------------------*/
  645.     AnsiiToUnicodeString(buf2, "n");
  646.     memset(temp, 0, MAX_DIGITS * ENCODING_LENGTH);
  647.     if (type)
  648.     {
  649.         AnsiiToUnicodeString(temp, "+");
  650.     }
  651.     AnsiiNToUnicodeString(
  652.         (temp + type * ENCODING_LENGTH),
  653.         (S8*) g_msg_cntx.msg_deliver_report[(g_msg_cntx.msg_deliver_ind - 1)]->number,
  654.         MSG_NUM_LEN);
  655.     name = lookUpNumber(temp);
  656.     if (pfnUnicodeStrlen(name))
  657.     {
  658.         pfnUnicodeStrcpy(buffer, name);
  659.     }
  660.     else
  661.     {
  662.         pfnUnicodeStrcpy(buffer, temp);
  663.     }
  664.     mmi_msg_get_msg_date_time(
  665.         ts_date,
  666.         ts_time,
  667.         g_msg_cntx.msg_deliver_report[(g_msg_cntx.msg_deliver_ind - 1)]->timestamp);
  668.     pfnUnicodeStrcat(buffer, buf2);
  669.     pfnUnicodeStrcat(buffer, ts_date);
  670.     pfnUnicodeStrcat(buffer, buf2);
  671.     pfnUnicodeStrcat(buffer, ts_time);
  672.     pfnUnicodeStrcat(buffer, buf2);
  673.     return (U8*) buffer;
  674. }
  675. /*****************************************************************************
  676.  * FUNCTION
  677.  *  mmi_msg_entry_deliver_report_ind
  678.  * DESCRIPTION
  679.  *  Entry delivery report indication screen
  680.  * PARAMETERS
  681.  *  void
  682.  * RETURNS
  683.  *  void
  684.  *****************************************************************************/
  685. void mmi_msg_entry_deliver_report_ind(void)
  686. {
  687.     /*----------------------------------------------------------------*/
  688.     /* Local Variables                                                */
  689.     /*----------------------------------------------------------------*/
  690.     U8 *guiBuffer = NULL;
  691.     U16 drStatusIconID = 0;
  692.     U16 drStatusStrID = 0;
  693.     U32 drStatus = 0;
  694.     /*----------------------------------------------------------------*/
  695.     /* Code Body                                                      */
  696.     /*----------------------------------------------------------------*/
  697.     EntryNewScreen(SCR_ID_MSG_DELIVER_REPORT, mmi_msg_exit_generic, NULL, NULL);
  698.     SetMessagesCurrScrnID(SCR_ID_MSG_DELIVER_REPORT);
  699.     
  700.     if (IsKeyPadLockState() == 0)
  701.     {
  702.         mmi_msg_get_deliver_report_status(&drStatus, &drStatusIconID, &drStatusStrID);
  703.         guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_DELIVER_REPORT);
  704.         GetCurrEndKeyDownHandler();
  705.         ShowCategory145Screen(
  706.             ((U8*) GetString(STR_STATUS_REPORT_MESSAGE_DELIVERD_MSG)),
  707.             IMG_SMS_ENTRY_SCRN_CAPTION,
  708.             STR_GLOBAL_OK,
  709.             IMG_GLOBAL_OK,
  710.             0,
  711.             0,
  712.             drStatusIconID,
  713.             ((U8*) GetString(drStatusStrID)),
  714.             mmi_msg_get_deliver_report_msg(),
  715.             drStatus,
  716.             guiBuffer);
  717.         SetLeftSoftkeyFunction(mmi_msg_go_back_from_deliver_report_ind, KEY_EVENT_UP);
  718.         SetKeyHandler(mmi_msg_end_key_from_deliver_report_ind, KEY_END, KEY_EVENT_DOWN);
  719.     }
  720.     else    /* keypad is locked */
  721.     {
  722.         mmi_msg_get_deliver_report_status(&drStatus, &drStatusIconID, &drStatusStrID);
  723.         ShowCategory145Screen(
  724.             ((PU8) GetString(STR_STATUS_REPORT_MESSAGE_DELIVERD_MSG)),
  725.             IMG_SMS_ENTRY_SCRN_CAPTION,
  726.             g_keylock_context.KeyLockLSKStringID,
  727.             g_keylock_context.KeyLockLSKIconID,
  728.             g_keylock_context.KeyLockRSKStringID,
  729.             g_keylock_context.KeyLockRSKIconID,
  730.             drStatusIconID,
  731.             ((PU8) GetString(drStatusStrID)),
  732.             mmi_msg_get_deliver_report_msg(),
  733.             drStatus,
  734.             NULL);
  735.     }
  736. }
  737. /*****************************************************************************
  738.  * FUNCTION
  739.  *  mmi_msg_mem_exceed_ind
  740.  * DESCRIPTION
  741.  *  Indicate memory exceed
  742.  * PARAMETERS
  743.  *  void
  744.  * RETURNS
  745.  *  void
  746.  *****************************************************************************/
  747. void mmi_msg_mem_exceed_ind(void)
  748. {
  749.     /*----------------------------------------------------------------*/
  750.     /* Local Variables                                                */
  751.     /*----------------------------------------------------------------*/
  752.     /*----------------------------------------------------------------*/
  753.     /* Code Body                                                      */
  754.     /*----------------------------------------------------------------*/
  755.     g_msg_cntx.msg_exceed_ind = TRUE;
  756.     TurnOnBacklight(1);
  757.     if (IsMMIInIdleState())
  758.     {
  759.         ClearKeyEvents();
  760.         if (IsKeyPadLockState())
  761.         {
  762.             EntryIdleScreen();
  763.         }
  764.         else
  765.         {
  766.             mmi_msg_entry_mem_exceed_ind();
  767.         }
  768.     }
  769. #ifdef __MMI_MESSAGES_CHAT__
  770.     else
  771.     {
  772.         EntrySmsMemoryFullIndInChatApp();
  773.     }
  774. #endif /* __MMI_MESSAGES_CHAT__ */ 
  775. }
  776. /*****************************************************************************
  777.  * FUNCTION
  778.  *  mmi_msg_go_back_from_mem_exceed_ind
  779.  * DESCRIPTION
  780.  *  Reset msg exceed flag before go back screen
  781.  * PARAMETERS
  782.  *  void
  783.  * RETURNS
  784.  *  void
  785.  *****************************************************************************/
  786. void mmi_msg_go_back_from_mem_exceed_ind(void)
  787. {
  788.     /*----------------------------------------------------------------*/
  789.     /* Local Variables                                                */
  790.     /*----------------------------------------------------------------*/
  791.     /*----------------------------------------------------------------*/
  792.     /* Code Body                                                      */
  793.     /*----------------------------------------------------------------*/
  794.     g_msg_cntx.msg_exceed_ind = FALSE;
  795.     GoBackHistory();
  796. }
  797. /*****************************************************************************
  798.  * FUNCTION
  799.  *  mmi_msg_end_key_from_mem_exceed_ind
  800.  * DESCRIPTION
  801.  *  Reset msg exceed flag before go to idle
  802.  * PARAMETERS
  803.  *  void
  804.  *  nnoe(?)
  805.  * RETURNS
  806.  *  void
  807.  *****************************************************************************/
  808. void mmi_msg_end_key_from_mem_exceed_ind(void)
  809. {
  810.     /*----------------------------------------------------------------*/
  811.     /* Local Variables                                                */
  812.     /*----------------------------------------------------------------*/
  813.     /*----------------------------------------------------------------*/
  814.     /* Code Body                                                      */
  815.     /*----------------------------------------------------------------*/
  816.     g_msg_cntx.msg_exceed_ind = FALSE;
  817.     ExecCurrEndKeyDownHandler();
  818. }
  819. /*****************************************************************************
  820.  * FUNCTION
  821.  *  mmi_msg_entry_mem_exceed_ind
  822.  * DESCRIPTION
  823.  *  Entry memory exceed indication
  824.  * PARAMETERS
  825.  *  void
  826.  * RETURNS
  827.  *  void
  828.  *****************************************************************************/
  829. void mmi_msg_entry_mem_exceed_ind(void)
  830. {
  831.     /*----------------------------------------------------------------*/
  832.     /* Local Variables                                                */
  833.     /*----------------------------------------------------------------*/
  834.     U16 str_id = 0;
  835.     /*----------------------------------------------------------------*/
  836.     /* Code Body                                                      */
  837.     /*----------------------------------------------------------------*/
  838.     if (g_msg_cntx.msg_exceed_type == SMSAL_MEM_EXCEED_NORMAL)
  839.     {
  840.         str_id = STR_SMS_MEMORY_EXCEEDED;
  841.     }
  842.     else if (g_msg_cntx.msg_exceed_type == SMSAL_SM_EXCEED_WITH_CLASS2)
  843.     {
  844.         str_id = STR_SMS_SIM_MEMORY_EXCEEDED;
  845.     }
  846.     EntryNewScreen(SCR_ID_MSG_EXCEED_IND, NULL, NULL, NULL);
  847.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
  848.                          "*-------[MessagesIdleApp.c] EntryDisplaySmsMemoryExceededIndication -------*n"));
  849.     if (IsKeyPadLockState() == 0)
  850.     {
  851.         GetCurrEndKeyDownHandler();
  852.         ShowCategory2Screen(
  853.             STR_SCR6042_CAPTION,
  854.             IMG_SMS_ENTRY_SCRN_CAPTION,
  855.             0,
  856.             0,
  857.             STR_GLOBAL_BACK,
  858.             IMG_GLOBAL_BACK,
  859.             str_id,
  860.             NULL);
  861.         SetRightSoftkeyFunction(mmi_msg_go_back_from_mem_exceed_ind, KEY_EVENT_UP);
  862.         SetKeyHandler(mmi_msg_go_back_from_mem_exceed_ind, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  863.         SetKeyHandler(mmi_msg_end_key_from_mem_exceed_ind, KEY_END, KEY_EVENT_DOWN);
  864.     }
  865.     else
  866.     {
  867.         ShowCategory2Screen(
  868.             STR_SCR6042_CAPTION,
  869.             IMG_SMS_ENTRY_SCRN_CAPTION,
  870.             g_keylock_context.KeyLockLSKStringID,
  871.             g_keylock_context.KeyLockLSKIconID,
  872.             g_keylock_context.KeyLockRSKStringID,
  873.             g_keylock_context.KeyLockRSKIconID,
  874.             str_id,
  875.             NULL);
  876.     }
  877. }
  878. /*****************************************************************************
  879.  * FUNCTION
  880.  *  mmi_msg_class0_msg_ind
  881.  * DESCRIPTION
  882.  *  Indicate class 0 message
  883.  * PARAMETERS
  884.  *  void
  885.  * RETURNS
  886.  *  void
  887.  *****************************************************************************/
  888. void mmi_msg_class0_msg_ind(void)
  889. {
  890.     /*----------------------------------------------------------------*/
  891.     /* Local Variables                                                */
  892.     /*----------------------------------------------------------------*/
  893.     /*----------------------------------------------------------------*/
  894.     /* Code Body                                                      */
  895.     /*----------------------------------------------------------------*/
  896.     g_msg_cntx.msg_class0_ind = TRUE;
  897.     TurnOnBacklight(1);
  898.     if (IsMMIInIdleState() || GetMessagesCurrScrnID() == SCR_ID_MSG_CLASS0_MSG)
  899.     {
  900.         PlayMessageArrivalTone();
  901.         ClearKeyEvents();
  902.         if (IsKeyPadLockState())
  903.         {
  904.             EntryIdleScreen();
  905.         }
  906.         else
  907.         {
  908.             mmi_msg_entry_class0_msg_ind();
  909.         }
  910.     }
  911.     else
  912.     {
  913.         /* do not interrupt a call, otherwise, incoming call's video and sound may be interrupted */
  914.         if (!isInCall() && !AlmIsTonePlaying())
  915.         {
  916.             mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_CLASS0);
  917.         }
  918.         /* In option, use number, or any other screen after class 0 messages screens*/
  919.         if (IsScreenPresent(SCR_ID_MSG_CLASS0_MSG))
  920.         {
  921.             DeleteScreenIfPresent(SCR_ID_MSG_CLASS0_MSG);
  922.             DeleteScreenIfPresent(SCR_ID_MSG_CLASS0_OPTION);
  923.             DeleteScreenIfPresent(SCR_ID_MSG_CLASS0_OPTION_USE_NUMBER_LIST);            
  924.         }
  925.     }
  926. }
  927. /*****************************************************************************
  928.  * FUNCTION
  929.  *  mmi_msg_get_class0_msg
  930.  * DESCRIPTION
  931.  *  Get class 0 message
  932.  * PARAMETERS
  933.  *  void
  934.  * RETURNS
  935.  *  EMSData bufForDisplay
  936.  *****************************************************************************/
  937. EMSData *mmi_msg_get_class0_msg(void)
  938. {
  939.     /*----------------------------------------------------------------*/
  940.     /* Local Variables                                                */
  941.     /*----------------------------------------------------------------*/
  942.     EMSData *pEms;
  943.     U16 textLen = g_msg_cntx.msg_class0_p->length;
  944.     /*----------------------------------------------------------------*/
  945.     /* Code Body                                                      */
  946.     /*----------------------------------------------------------------*/
  947.     textLen = (textLen / 2);
  948.     GetEMSDataForView(&pEms, 1);
  949.     AddString(pEms, g_msg_cntx.msg_class0_p->data, textLen, NULL);
  950.     GetEMSDataForView(&pEms, 0);
  951.     return pEms;
  952. }
  953. /*****************************************************************************
  954.  * FUNCTION
  955.  *  mmi_msg_get_class0_header
  956.  * DESCRIPTION
  957.  *  Get class 0 message header
  958.  * PARAMETERS
  959.  *  void
  960.  * RETURNS
  961.  *  class 0 message header
  962.  *****************************************************************************/
  963. U8 *mmi_msg_get_class0_header(void)
  964. {
  965.     /*----------------------------------------------------------------*/
  966.     /* Local Variables                                                */
  967.     /*----------------------------------------------------------------*/
  968.     static S8 buffer[120 * ENCODING_LENGTH];
  969.     S8 buf2[10];
  970.     S8 temp[MAX_DIGITS * ENCODING_LENGTH];
  971.     S8 *name;
  972.     S8 ts_date[(MAX_TIMESTAMP_SIZE + 1) * ENCODING_LENGTH];
  973.     S8 ts_time[(MAX_TIMESTAMP_SIZE + 1) * ENCODING_LENGTH];
  974.     /*----------------------------------------------------------------*/
  975.     /* Code Body                                                      */
  976.     /*----------------------------------------------------------------*/
  977.     AnsiiToUnicodeString(buf2, "n");
  978.     pfnUnicodeStrcpy(buffer, GetString(STR_CLASS0_MESSAGE_CAPTION));
  979.     pfnUnicodeStrcat(buffer, buf2);
  980.     pfnUnicodeStrcpy(temp, (S8*) g_msg_cntx.msg_class0_p->number);
  981.     name = lookUpNumber(temp);
  982.     if (pfnUnicodeStrlen(name))
  983.     {
  984.         pfnUnicodeStrcat(buffer, name);
  985.     }
  986.     else
  987.     {
  988.         pfnUnicodeStrcat(buffer, temp);
  989.     }
  990.     mmi_msg_get_msg_date_time(ts_date, ts_time, g_msg_cntx.msg_class0_p->timestamp);
  991.     pfnUnicodeStrcat(buffer, buf2);
  992.     pfnUnicodeStrcat(buffer, ts_date);
  993.     pfnUnicodeStrcat(buffer, buf2);
  994.     pfnUnicodeStrcat(buffer, ts_time);
  995.     pfnUnicodeStrcat(buffer, buf2);
  996.     return (U8*) buffer;
  997. }
  998. /*****************************************************************************
  999.  * FUNCTION
  1000.  *  mmi_msg_go_back_from_class0_msg_ind
  1001.  * DESCRIPTION
  1002.  *  Reset class 0 message before go back screen
  1003.  * PARAMETERS
  1004.  *  void
  1005.  * RETURNS
  1006.  *  void
  1007.  *****************************************************************************/
  1008. void mmi_msg_go_back_from_class0_msg_ind(void)
  1009. {
  1010.     /*----------------------------------------------------------------*/
  1011.     /* Local Variables                                                */
  1012.     /*----------------------------------------------------------------*/
  1013.     /*----------------------------------------------------------------*/
  1014.     /* Code Body                                                      */
  1015.     /*----------------------------------------------------------------*/
  1016.     g_msg_cntx.msg_class0_ind = FALSE;
  1017.     if (g_msg_cntx.msg_class0_p != NULL)
  1018.     {
  1019.         if (g_msg_cntx.msg_class0_p->data != NULL)
  1020.         {
  1021.             OslMfree(g_msg_cntx.msg_class0_p->data);
  1022.             g_msg_cntx.msg_class0_p->data = NULL;
  1023.         }
  1024.         OslMfree(g_msg_cntx.msg_class0_p);
  1025.         g_msg_cntx.msg_class0_p = NULL;
  1026.     }
  1027.     GoBackHistory();
  1028. }
  1029. /*****************************************************************************
  1030.  * FUNCTION
  1031.  *  mmi_msg_end_key_from_class0_msg_ind
  1032.  * DESCRIPTION
  1033.  *  Reset class 0 message before go to idle
  1034.  * PARAMETERS
  1035.  *  void
  1036.  * RETURNS
  1037.  *  void
  1038.  *****************************************************************************/
  1039. void mmi_msg_end_key_from_class0_msg_ind(void)
  1040. {
  1041.     /*----------------------------------------------------------------*/
  1042.     /* Local Variables                                                */
  1043.     /*----------------------------------------------------------------*/
  1044.     /*----------------------------------------------------------------*/
  1045.     /* Code Body                                                      */
  1046.     /*----------------------------------------------------------------*/
  1047.     g_msg_cntx.msg_class0_ind = FALSE;
  1048.     if (g_msg_cntx.msg_class0_p != NULL)
  1049.     {
  1050.         if (g_msg_cntx.msg_class0_p->data != NULL)
  1051.         {
  1052.             OslMfree(g_msg_cntx.msg_class0_p->data);
  1053.             g_msg_cntx.msg_class0_p->data = NULL;
  1054.         }
  1055.         OslMfree(g_msg_cntx.msg_class0_p);
  1056.         g_msg_cntx.msg_class0_p = NULL;
  1057.     }
  1058.     ExecCurrEndKeyDownHandler();
  1059. }
  1060. /*****************************************************************************
  1061.  * FUNCTION
  1062.  *  mmi_msg_entry_class0_msg_option
  1063.  * DESCRIPTION
  1064.  *  Entry class 0 msg option screen
  1065.  * PARAMETERS
  1066.  *  void
  1067.  * RETURNS
  1068.  *  void
  1069.  *****************************************************************************/
  1070. void mmi_msg_entry_class0_msg_option(void)
  1071. {
  1072.     /*----------------------------------------------------------------*/
  1073.     /* Local Variables                                                */
  1074.     /*----------------------------------------------------------------*/
  1075.     U8 *guiBuffer = NULL;
  1076.     U16 numItems = 0;
  1077.     U16 nStrItemList[MAX_SUB_MENUS];
  1078.     /*----------------------------------------------------------------*/
  1079.     /* Code Body                                                      */
  1080.     /*----------------------------------------------------------------*/
  1081.     EntryNewScreen(SCR_ID_MSG_CLASS0_OPTION, mmi_msg_exit_generic, mmi_msg_entry_class0_msg_option, NULL);
  1082.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[MessagesMiscell.c] mmi_msg_entry_class0_msg_option *n"));
  1083.     GetCurrEndKeyDownHandler();
  1084.     
  1085.     SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_CLASS0_OPTION);
  1086.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CLASS0_OPTION);
  1087.     numItems = GetNumOfChild_Ext(SMS_CLSASS0_OPT_MENUID);
  1088.     GetSequenceStringIds_Ext(SMS_CLSASS0_OPT_MENUID, nStrItemList);
  1089.     SetParentHandler(SMS_CLSASS0_OPT_MENUID);
  1090.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1091.     SetMessagesCurrScrnID(SCR_ID_MSG_CLASS0_OPTION);
  1092.     ShowCategory52Screen(
  1093.         STR_SCR6028_CAPTION,
  1094.         IMG_SMS_ENTRY_SCRN_CAPTION,
  1095.         STR_GLOBAL_OK,
  1096.         IMG_GLOBAL_OK,
  1097.         STR_GLOBAL_BACK,
  1098.         IMG_GLOBAL_BACK,
  1099.         numItems,
  1100.         nStrItemList,
  1101.         (U16*) gIndexIconsImageList,
  1102.         NULL,
  1103.         0,
  1104.         0,
  1105.         guiBuffer);
  1106.     
  1107.     SetKeyHandler(mmi_msg_end_key_from_class0_msg_ind, KEY_END, KEY_EVENT_DOWN);
  1108. }
  1109. /*****************************************************************************
  1110.  * FUNCTION
  1111.  *  mmi_msg_pre_entry_class0_msg_option
  1112.  * DESCRIPTION
  1113.  *  Pre entry class 0 option
  1114.  * PARAMETERS
  1115.  *  void
  1116.  * RETURNS
  1117.  *  void
  1118.  *****************************************************************************/
  1119. void mmi_msg_pre_entry_class0_msg_option(void)
  1120. {
  1121.     /*----------------------------------------------------------------*/
  1122.     /* Local Variables                                                */
  1123.     /*----------------------------------------------------------------*/
  1124.     history h;
  1125.     S16 nHistory = 0;
  1126.     /*----------------------------------------------------------------*/
  1127.     /* Code Body                                                      */
  1128.     /*----------------------------------------------------------------*/
  1129.     h.scrnID = SCR_ID_MSG_CLASS0_MSG;
  1130.     h.entryFuncPtr = mmi_msg_entry_class0_msg_ind;
  1131.     pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  1132.     GetCategoryHistory(h.guiBuffer);
  1133.     AddHistory(h);
  1134.     mmi_msg_entry_class0_msg_option();
  1135. }
  1136.     
  1137. /*****************************************************************************
  1138.  * FUNCTION
  1139.  *  mmi_msg_entry_class_0_opt_use_number
  1140.  * DESCRIPTION
  1141.  *  Entry function for class 0 use number
  1142.  * PARAMETERS
  1143.  *  void
  1144.  * RETURNS
  1145.  *  void
  1146.  *****************************************************************************/
  1147. void mmi_msg_entry_class_0_opt_use_number(void)
  1148. {
  1149.     /*----------------------------------------------------------------*/
  1150.     /* Local Variables                                                */
  1151.     /*----------------------------------------------------------------*/
  1152.     U16 numbersCount = 0;
  1153.     U8 *guiBuffer = NULL;
  1154.     S8 number[MAX_DIGITS_SMS * ENCODING_LENGTH];
  1155.     /*----------------------------------------------------------------*/
  1156.     /* Code Body                                                      */
  1157.     /*----------------------------------------------------------------*/
  1158.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "*[MessagesMiscell.c] mmi_msg_entry_class_0_opt_use_number *n"));
  1159.     memset((S8*) number, 0, sizeof(number));
  1160.     numbersCount = ObtainNumbersFromMessageText((S8*) g_msg_cntx.msg_class0_p->number, 
  1161.                                                 g_msg_cntx.msg_class0_p->data, 
  1162.                                                 (U16) g_msg_cntx.msg_class0_p->length, 
  1163.                                                 0);
  1164.     if (numbersCount > 0)
  1165.     {
  1166.         EntryNewScreen(SCR_ID_MSG_CLASS0_OPTION_USE_NUMBER_LIST, mmi_msg_exit_generic, mmi_msg_entry_class_0_opt_use_number, NULL);
  1167.         GetCurrEndKeyDownHandler();
  1168.         guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CLASS0_OPTION_USE_NUMBER_LIST);
  1169.         RegisterHighlightHandler(GetHiliteIndex);
  1170.         SetMessagesCurrScrnID(SCR_ID_MSG_CLASS0_OPTION_USE_NUMBER_LIST);
  1171.         ShowCategory53Screen(
  1172.             STR_USE_NUMBER_CAPTION,
  1173.             IMG_SMS_ENTRY_SCRN_CAPTION,
  1174.             STR_GLOBAL_DIAL,
  1175.             IMG_SMS_COMMON_NOIMAGE,
  1176.             STR_GLOBAL_BACK,
  1177.             IMG_GLOBAL_BACK,
  1178.             numbersCount,
  1179.             (U8 **) g_msg_cntx.numbersList,
  1180.             (U16*) gIndexIconsImageList,
  1181.             NULL,
  1182.             0,
  1183.             0,
  1184.             guiBuffer);
  1185.         
  1186.         SetLeftSoftkeyFunction(mmi_msg_dial_use_number, KEY_EVENT_UP);
  1187.         SetKeyHandler(mmi_msg_dial_use_number, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1188.         SetKeyHandler(mmi_msg_dial_use_number, KEY_SEND, KEY_EVENT_UP);
  1189.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1190.         SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1191.         SetKeyHandler(mmi_msg_end_key_from_class0_msg_ind, KEY_END, KEY_EVENT_DOWN);
  1192.     }
  1193.     else
  1194.     {
  1195.         DisplayPopup(
  1196.             (PU8) GetString(STR_NONUMBER_NOTIFICATION),
  1197.             IMG_GLOBAL_EMPTY,
  1198.             1,
  1199.             MESSAGES_POPUP_TIME_OUT,
  1200.             (U8) EMPTY_LIST_TONE);
  1201.     }
  1202. }
  1203. /*****************************************************************************
  1204.  * FUNCTION
  1205.  *  mmi_msg_highlight_class0_opt_use_number
  1206.  * DESCRIPTION
  1207.  *  Highlight class 0 use number handler
  1208.  * PARAMETERS
  1209.  *  void
  1210.  * RETURNS
  1211.  *  void
  1212.  *****************************************************************************/
  1213. void mmi_msg_highlight_class0_opt_use_number(void)
  1214. {
  1215.     /*----------------------------------------------------------------*/
  1216.     /* Local Variables                                                */
  1217.     /*----------------------------------------------------------------*/
  1218.     /*----------------------------------------------------------------*/
  1219.     /* Code Body                                                      */
  1220.     /*----------------------------------------------------------------*/
  1221.     mmi_msg_highlight_generic(
  1222.         STR_GLOBAL_OK,
  1223.         IMG_GLOBAL_OK,
  1224.         STR_GLOBAL_BACK,
  1225.         IMG_GLOBAL_BACK,
  1226.         mmi_msg_entry_class_0_opt_use_number,
  1227.         GoBackHistory);
  1228. }
  1229. /*****************************************************************************
  1230.  * FUNCTION
  1231.  *  mmi_msg_entry_class0_msg_ind
  1232.  * DESCRIPTION
  1233.  *  Entry class 0 message indication
  1234.  * PARAMETERS
  1235.  *  void
  1236.  * RETURNS
  1237.  *  void
  1238.  *****************************************************************************/
  1239. void mmi_msg_entry_class0_msg_ind(void)
  1240. {
  1241.     /*----------------------------------------------------------------*/
  1242.     /* Local Variables                                                */
  1243.     /*----------------------------------------------------------------*/
  1244.     U8 *guiBuffer = NULL;
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     EntryNewScreen(SCR_ID_MSG_CLASS0_MSG, mmi_msg_stop_msg_sub_anm, NULL, NULL);
  1249.     SetMessagesCurrScrnID(SCR_ID_MSG_CLASS0_MSG);    
  1250.     ForceSubLCDScreen(mmi_msg_start_msg_sub_anm);
  1251.     if (IsKeyPadLockState() == 0)
  1252.     {
  1253.         guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CLASS0_MSG);
  1254.         GetCurrEndKeyDownHandler();
  1255.         ShowCategory39Screen(
  1256.             STR_CLASS0_MESSAGE_CAPTION,
  1257.             IMG_SMS_ENTRY_SCRN_CAPTION,
  1258.             STR_GLOBAL_OPTIONS,
  1259.             IMG_SMS_COMMON_NOIMAGE,
  1260.             STR_GLOBAL_BACK,
  1261.             IMG_SMS_COMMON_NOIMAGE,
  1262.             mmi_msg_get_class0_msg(),
  1263.             mmi_msg_get_class0_header(),
  1264.             guiBuffer);
  1265.         SetLeftSoftkeyFunction(mmi_msg_pre_entry_class0_msg_option, KEY_EVENT_UP);
  1266.         SetRightSoftkeyFunction(mmi_msg_go_back_from_class0_msg_ind, KEY_EVENT_UP);
  1267.         SetKeyHandler(mmi_msg_end_key_from_class0_msg_ind, KEY_END, KEY_EVENT_DOWN);
  1268.     }
  1269.     else
  1270.     {
  1271.         ShowCategory39Screen(
  1272.             STR_CLASS0_MESSAGE_CAPTION,
  1273.             IMG_SMS_ENTRY_SCRN_CAPTION,
  1274.             g_keylock_context.KeyLockLSKStringID,
  1275.             g_keylock_context.KeyLockLSKIconID,
  1276.             g_keylock_context.KeyLockRSKStringID,
  1277.             g_keylock_context.KeyLockRSKIconID,
  1278.             mmi_msg_get_class0_msg(),
  1279.             mmi_msg_get_class0_header(),
  1280.             NULL);
  1281.         /* prevent category scrolling */
  1282.         SetKeyHandler(NULL, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1283.         SetKeyHandler(NULL, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1284.         SetKeyHandler(NULL, KEY_VOL_UP, KEY_EVENT_DOWN);
  1285.         SetKeyHandler(NULL, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1286.     }
  1287. }
  1288. /*****************************************************************************
  1289.  * FUNCTION
  1290.  *  mmi_msg_new_msg_ind
  1291.  * DESCRIPTION
  1292.  *  Indicate new message
  1293.  * PARAMETERS
  1294.  *  index       [IN]        
  1295.  *  a(?)        [IN]        L4 index of new message
  1296.  * RETURNS
  1297.  *  void
  1298.  *****************************************************************************/
  1299. void mmi_msg_new_msg_ind(U16 index)
  1300. {
  1301.     /*----------------------------------------------------------------*/
  1302.     /* Local Variables                                                */
  1303.     /*----------------------------------------------------------------*/
  1304.     /*----------------------------------------------------------------*/
  1305.     /* Code Body                                                      */
  1306.     /*----------------------------------------------------------------*/
  1307.     g_msg_cntx.msg_ind_index = index;   /* it should be sms frm index, not l4 index */
  1308.     g_msg_cntx.msg_ind_in_idle = TRUE;
  1309.     if (isInCall())
  1310.     {
  1311.         g_msg_cntx.msg_ind_after_call = TRUE;
  1312.     }
  1313.     TurnOnBacklight(1);
  1314.     mmi_msg_set_msg_icon(FALSE, FALSE);
  1315. #ifdef __MMI_UNIFIED_MESSAGE__
  1316.     if (IsMMIInIdleState() || GetExitScrnID() == SCR_ID_UM_NEW_MSG_IND)
  1317. #else   /* __MMI_UNIFIED_MESSAGE__ */ 
  1318.     if (IsMMIInIdleState() || GetMessagesCurrScrnID() == SCR_ID_MSG_NEW_MSG_IND)
  1319. #endif  /* __MMI_UNIFIED_MESSAGE__ */         
  1320.     {
  1321.     #ifndef __MMI_UNIFIED_MESSAGE__
  1322.         PlayMessageArrivalTone();
  1323.         StartLEDPatternMessageIn();
  1324.         StartTimer(MESSAGES_SUBLCD_TIMER_ID, MESSAGES_SUBLCD_TIME_OUT, mmi_msg_callback_msg_sub_anm);
  1325.         ClearKeyEvents();
  1326.         if (IsKeyPadLockState())
  1327.         {
  1328.             EntryIdleScreen();
  1329.         }
  1330.         else
  1331.         {
  1332.             mmi_msg_entry_new_msg_ind();
  1333.         }
  1334.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1335.     }
  1336.     else
  1337.     {
  1338.     #ifndef __MMI_UNIFIED_MESSAGE__
  1339.         /* it is in the inbox list or the inbox list screen is in the history */
  1340.         if (GetMessagesCurrScrnID() == SCR_ID_MSG_INBOX_LIST || IsScreenPresent(SCR_ID_MSG_INBOX_LIST))
  1341.     #else /* __MMI_UNIFIED_MESSAGE__ */ 
  1342.     
  1343.     #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
  1344.         if (GetExitScrnID() == SCR_ID_MSG_INBOX_LIST_OPTION || IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
  1345.     #else /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
  1346.         if (GetExitScrnID() == SCR_ID_MSG_INBOX_MSG || IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
  1347.     #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
  1348.         
  1349.     #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1350.         {
  1351.             U8 type;
  1352.             U16 list_index;
  1353.             mmi_frm_sms_get_list_index(&type, &list_index, g_msg_cntx.msg_ind_index);
  1354.             /* highlighter will be moved one position down only when the new message lists in front of the current highlighter and the new message does not make any incomplete message complete in inbox */
  1355.             if (type == MMI_FRM_SMS_APP_INBOX && list_index <= g_msg_cntx.currBoxIndex &&
  1356.                 msgbox_info.totalinbox < mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_INBOX))
  1357.             {
  1358.                 g_msg_cntx.currBoxIndex++;
  1359.                 /* Update msgbox_info.totalinbox immediately. */
  1360.                 msgbox_info.totalinbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_INBOX);
  1361.             }
  1362.         }
  1363.         /* do not interrupt a call, otherwise, incoming call's video and sound may be interrupted */
  1364.         if (isInCall())
  1365.         {
  1366.             /* in case it is in the sms main menu from the in-call option */
  1367.             if (mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_NOBOX) != MMI_FRM_SMS_INVALID_INDEX)
  1368.             {
  1369.                 msgbox_info.totalinbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_INBOX);
  1370.                 msgbox_info.totaloutbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_OUTBOX);
  1371.                 msgbox_info.totaldraftbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_DRAFTS);
  1372.                 mmi_msg_set_msg_num_hint(msgbox_info.totalinbox, msgbox_info.totaloutbox, msgbox_info.totaldraftbox);
  1373.                 RefreshMessagesMenuList();
  1374.             }
  1375.             /* If current screen is inbox list, refresh the inbox list */
  1376.             if (GetExitScrnID() == SCR_ID_MSG_INBOX_LIST)
  1377.             {
  1378.                 mmi_msg_entry_inbox_list();
  1379.                 DeleteScreenIfPresent(SCR_ID_MSG_INBOX_LIST);
  1380.             }
  1381.             playRequestedTone(SMS_IN_CALL_TONE);
  1382.         }
  1383.         else if (!AlmIsTonePlaying())
  1384.         {
  1385.         #if defined (__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
  1386.             switch (g_msg_cntx.dest_port)
  1387.             {
  1388.                 case 0x1581:
  1389.                     mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_RINGTONE);
  1390.                     break;
  1391.                 case 0x158A:
  1392.                     mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_PICTURE);
  1393.                     break;
  1394.                 default:
  1395.                     mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_NORMAL);
  1396.                     break;
  1397.             }
  1398.         #else /* defined (__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */ 
  1399.             mmi_msg_entry_new_msg_popup(MSG_NEW_MSG_NORMAL);
  1400.         #endif /* defined (__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */ 
  1401.         #ifdef __MMI_MESSAGES_PREFER_STORAGE_MEMORY_STATUS__
  1402.             mmi_msg_refresh_memory_status();
  1403.         #endif 
  1404.         }
  1405.     }
  1406. #ifdef __MMI_UNIFIED_MESSAGE__
  1407.     {
  1408.         U8 type;
  1409.         U16 list_index;
  1410.         U8 *timestamp = NULL;
  1411.         UI_time datetime;
  1412.         U32 converted_timestamp = 0;
  1413.         mmi_frm_sms_get_list_index(&type, &list_index, index);
  1414.         timestamp = mmi_frm_sms_get_timestamp(MMI_FRM_SMS_INBOX, list_index);
  1415.         datetime.nYear = timestamp[0] + 2000;
  1416.         if (datetime.nYear > 2090)
  1417.         {
  1418.             datetime.nYear = datetime.nYear - 100;
  1419.         }
  1420.         datetime.nMonth = timestamp[1];
  1421.         datetime.nDay = timestamp[2];
  1422.         datetime.nHour = timestamp[3];
  1423.         datetime.nMin = timestamp[4];
  1424.         datetime.nSec = timestamp[5];
  1425.     #ifdef MMI_ON_HARDWARE_P
  1426.         converted_timestamp = mmi_dt_mytime_2_utc_sec((MYTIME*) & datetime, MMI_TRUE);
  1427.     #endif 
  1428.         mmi_msg_send_new_msg_ind(UM_MSG_BOX_TYPE_INBOX, list_index, converted_timestamp);
  1429.     }
  1430.     mmi_msg_send_refresh_ind(UM_MSG_BOX_TYPE_INBOX);
  1431. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  1432. }
  1433. /*****************************************************************************
  1434.  * FUNCTION
  1435.  *  mmi_msg_get_new_msg_ind_string
  1436.  * DESCRIPTION
  1437.  *  Get new msg indication string
  1438.  * PARAMETERS
  1439.  *  void
  1440.  * RETURNS
  1441.  *  new msg indication string
  1442.  *****************************************************************************/
  1443. U8 *mmi_msg_get_new_msg_ind_string(void)
  1444. {
  1445.     /*----------------------------------------------------------------*/
  1446.     /* Local Variables                                                */
  1447.     /*----------------------------------------------------------------*/
  1448.     static S8 buffer[120 * ENCODING_LENGTH];
  1449.     S8 temp[MAX_DIGITS * ENCODING_LENGTH];
  1450.     S8 *name;
  1451.     /*----------------------------------------------------------------*/
  1452.     /* Code Body                                                      */
  1453.     /*----------------------------------------------------------------*/
  1454.     memset(buffer, 0, 120 * ENCODING_LENGTH);
  1455.     memset(temp, 0, MAX_DIGITS * ENCODING_LENGTH);
  1456.     AnsiiToUnicodeString(temp, (S8*) mmi_frm_sms_get_address(MMI_FRM_SMS_APP_NOBOX, g_msg_cntx.msg_ind_index));
  1457.     name = lookUpNumber(temp);
  1458.     if (pfnUnicodeStrlen(name))
  1459.     {
  1460.         pfnUnicodeStrcpy(buffer, name);
  1461.     }
  1462.     else
  1463.     {
  1464.         pfnUnicodeStrcpy(buffer, temp);
  1465.     }
  1466.     return (U8*) buffer;
  1467. }
  1468. /*****************************************************************************
  1469.  * FUNCTION
  1470.  *  mmi_msg_go_back_from_new_msg_ind
  1471.  * DESCRIPTION
  1472.  *  Reset new msg indication before go back screen
  1473.  * PARAMETERS
  1474.  *  void
  1475.  * RETURNS
  1476.  *  void
  1477.  *****************************************************************************/
  1478. void mmi_msg_go_back_from_new_msg_ind(void)
  1479. {
  1480.     /*----------------------------------------------------------------*/
  1481.     /* Local Variables                                                */
  1482.     /*----------------------------------------------------------------*/
  1483.     /*----------------------------------------------------------------*/
  1484.     /* Code Body                                                      */
  1485.     /*----------------------------------------------------------------*/
  1486.     g_msg_cntx.msg_ind_in_idle = FALSE;
  1487.     GoBackHistory();
  1488. }
  1489. /*****************************************************************************
  1490.  * FUNCTION
  1491.  *  mmi_msg_end_key_from_new_msg_ind
  1492.  * DESCRIPTION
  1493.  *  Reset new msg indication before go to idle
  1494.  * PARAMETERS
  1495.  *  void
  1496.  * RETURNS
  1497.  *  void
  1498.  *****************************************************************************/
  1499. void mmi_msg_end_key_from_new_msg_ind(void)
  1500. {
  1501.     /*----------------------------------------------------------------*/
  1502.     /* Local Variables                                                */
  1503.     /*----------------------------------------------------------------*/
  1504.     /*----------------------------------------------------------------*/
  1505.     /* Code Body                                                      */
  1506.     /*----------------------------------------------------------------*/
  1507.     g_msg_cntx.msg_ind_in_idle = FALSE;
  1508.     ExecCurrEndKeyDownHandler();
  1509. }
  1510. /*****************************************************************************
  1511.  * FUNCTION
  1512.  *  mmi_msg_entry_new_msg_ind
  1513.  * DESCRIPTION
  1514.  *  Entry new message indication
  1515.  * PARAMETERS
  1516.  *  void
  1517.  * RETURNS
  1518.  *  void
  1519.  *****************************************************************************/
  1520. void mmi_msg_entry_new_msg_ind(void)
  1521. {
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Local Variables                                                */
  1524.     /*----------------------------------------------------------------*/
  1525.     /*----------------------------------------------------------------*/
  1526.     /* Code Body                                                      */
  1527.     /*----------------------------------------------------------------*/
  1528.     EntryNewScreen(SCR_ID_MSG_NEW_MSG_IND, mmi_msg_stop_msg_sub_anm, NULL, NULL);
  1529.     SetMessagesCurrScrnID(SCR_ID_MSG_NEW_MSG_IND);
  1530.     ForceSubLCDScreen(mmi_msg_start_msg_sub_anm);
  1531.     GetCurrEndKeyDownHandler();
  1532.     g_msg_cntx.msg_ind_after_call = FALSE;
  1533.     if (IsKeyPadLockState() == 0)
  1534.     {
  1535.         ShowCategory154Screen(
  1536.             0,
  1537.             0,
  1538.             STR_SCR6035_LSK,
  1539.             IMG_SMS_COMMON_NOIMAGE,
  1540.             STR_GLOBAL_BACK,
  1541.             IMG_SMS_COMMON_NOIMAGE,
  1542.             (PU8) GetString(STR_NEW_MESSAGE_FROM_ID),
  1543.             (PU8) mmi_msg_get_new_msg_ind_string(),
  1544.             IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  1545.             NULL);
  1546.         SetRightSoftkeyFunction(mmi_msg_go_back_from_new_msg_ind, KEY_EVENT_UP);
  1547.         SetLeftSoftkeyFunction(mmi_msg_get_msg_new, KEY_EVENT_UP);
  1548.         SetKeyHandler(mmi_msg_end_key_from_new_msg_ind, KEY_END, KEY_EVENT_DOWN);
  1549.     }
  1550.     else    /* keypad is locked */
  1551.     {
  1552.         ShowCategory154Screen(
  1553.             0,
  1554.             0,
  1555.             g_keylock_context.KeyLockLSKStringID,
  1556.             g_keylock_context.KeyLockLSKIconID,
  1557.             g_keylock_context.KeyLockRSKStringID,
  1558.             g_keylock_context.KeyLockRSKIconID,
  1559.             (PU8) GetString(STR_NEW_MESSAGE_FROM_ID),
  1560.             (PU8) mmi_msg_get_new_msg_ind_string(),
  1561.             IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  1562.             NULL);
  1563.         ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1564.     }
  1565. //KP Jerry add for changing the style of message tone list on 2007-4-10 start
  1566. #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
  1567. gui_start_timer(10000, StopExtMSTone);
  1568. #endif
  1569. //KP Jerry add for changing the style of message tone list on 2007-4-10 end
  1570. }
  1571. /*****************************************************************************
  1572.  * FUNCTION
  1573.  *  mmi_msg_start_msg_sub_anm
  1574.  * DESCRIPTION
  1575.  *  Start sub-LCD msg animation
  1576.  * PARAMETERS
  1577.  *  void
  1578.  * RETURNS
  1579.  *  void
  1580.  *****************************************************************************/
  1581. void mmi_msg_start_msg_sub_anm(void)
  1582. {
  1583.     /*----------------------------------------------------------------*/
  1584.     /* Local Variables                                                */
  1585.     /*----------------------------------------------------------------*/
  1586.     /*----------------------------------------------------------------*/
  1587.     /* Code Body                                                      */
  1588.     /*----------------------------------------------------------------*/
  1589.     if (!isInCall())
  1590.     {
  1591.         ExecSubLCDCurrExitHandler();
  1592.         if (GetMessagesCurrScrnID() == SCR_ID_MSG_MSG_WAITING_IND)
  1593.         {
  1594.             ShowCategory304Screen(IMG_NEW_VOICEMAIL_PIC_SUBLCD_MSG, NULL);
  1595.         }
  1596.         else
  1597.         {
  1598.             ShowCategory304Screen(IMG_NEW_SMS_PIC_SUBLCD_MSG, NULL);
  1599.         }
  1600.         SetSubLCDExitHandler(mmi_msg_callback_msg_sub_anm);
  1601.         //              StartLEDPatternMessageIn ();
  1602.         //              StartTimer(MESSAGES_SUBLCD_TIMER_ID, MESSAGES_SUBLCD_TIME_OUT, mmi_msg_callback_msg_sub_anm);
  1603.     }
  1604. }
  1605. /*****************************************************************************
  1606.  * FUNCTION
  1607.  *  mmi_msg_stop_msg_sub_anm
  1608.  * DESCRIPTION
  1609.  *  Stop sub-LCD msg animation
  1610.  * PARAMETERS
  1611.  *  void
  1612.  * RETURNS
  1613.  *  void
  1614.  *****************************************************************************/
  1615. void mmi_msg_stop_msg_sub_anm(void)
  1616. {
  1617.     /*----------------------------------------------------------------*/
  1618.     /* Local Variables                                                */
  1619.     /*----------------------------------------------------------------*/
  1620.     /*----------------------------------------------------------------*/
  1621.     /* Code Body                                                      */
  1622.     /*----------------------------------------------------------------*/
  1623.     SetMessagesCurrScrnID(0);   /* messagesCurrScrnID */
  1624.     mmi_msg_callback_msg_sub_anm();
  1625.     GoBackSubLCDHistory();
  1626. }
  1627. /*****************************************************************************
  1628.  * FUNCTION
  1629.  *  mmi_msg_callback_msg_sub_anm
  1630.  * DESCRIPTION
  1631.  *  Call back sub-LCD msg animation
  1632.  * PARAMETERS
  1633.  *  void
  1634.  * RETURNS
  1635.  *  void
  1636.  *****************************************************************************/
  1637. void mmi_msg_callback_msg_sub_anm(void)
  1638. {
  1639.     /*----------------------------------------------------------------*/
  1640.     /* Local Variables                                                */
  1641.     /*----------------------------------------------------------------*/
  1642.     /*----------------------------------------------------------------*/
  1643.     /* Code Body                                                      */
  1644.     /*----------------------------------------------------------------*/
  1645.     StopLEDPatternMessageIn();
  1646.     StopTimer(MESSAGES_SUBLCD_TIMER_ID);
  1647. }
  1648. /*****************************************************************************
  1649.  * FUNCTION
  1650.  *  mmi_msg_exit_inbox_list_dummy
  1651.  * DESCRIPTION
  1652.  *  Dummy exit inbox list, for new message indication
  1653.  * PARAMETERS
  1654.  *  void
  1655.  * RETURNS
  1656.  *  void
  1657.  *****************************************************************************/
  1658. void mmi_msg_exit_inbox_list_dummy(void)
  1659. {
  1660.     /*----------------------------------------------------------------*/
  1661.     /* Local Variables                                                */
  1662.     /*----------------------------------------------------------------*/
  1663.     history currHistory;
  1664.     /*----------------------------------------------------------------*/
  1665.     /* Code Body                                                      */
  1666.     /*----------------------------------------------------------------*/
  1667.     memset(&currHistory, 0, sizeof(currHistory));
  1668.     currHistory.scrnID = SCR_ID_MSG_INBOX_LIST;
  1669.     SetMessagesCurrScrnID(0);
  1670.     g_msg_cntx.MessagesScrnIdToDelHistoryNodes = SCR_ID_MSG_INBOX_LIST;
  1671.     g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes = SCR_ID_MSG_INBOX_LIST;
  1672.     currHistory.entryFuncPtr = mmi_msg_entry_inbox_list;
  1673.     memset((S8*) currHistory.inputBuffer, 0, ENCODING_LENGTH);
  1674.     AddHistory(currHistory);
  1675. }
  1676. #ifdef __MMI_MESSAGES_CLUB__
  1677. #include "ProfileGprots.h"
  1678. #include "Wgui_categories_inputs.h"
  1679. #ifndef NVRAM_MSG_CLUB_RECORD_SIZE
  1680. #define NVRAM_MSG_CLUB_RECORD_SIZE  10
  1681. #endif 
  1682. #ifndef NVRAM_MSG_CLUB_RECORD_TOTAL
  1683. #define NVRAM_MSG_CLUB_RECORD_TOTAL 1
  1684. #endif 
  1685. #ifndef NVRAM_MSG_CLUB_NUM_RECORD_SIZE
  1686. #define NVRAM_MSG_CLUB_NUM_RECORD_SIZE 5
  1687. #endif 
  1688. #ifndef NVRAM_MSG_CLUB_NUM_RECORD_TOTAL
  1689. #define NVRAM_MSG_CLUB_NUM_RECORD_TOTAL   1
  1690. #endif 
  1691. #define MSG_CLUB_SCREEN_NUM      6
  1692. #define MSG_CLUB_MENUITEM_NUM 25
  1693. #define MSG_CLUB_INPUT_BUFF_LEN  50
  1694. #define MSG_CLUB_INPUT_DA_LEN    15
  1695. #define MSG_CLUB_INPUT_NAME_LEN  30
  1696. #define MSG_CLUB_INPUT_SMS_LEN   120
  1697. #define MSG_CLUB_INPUT_PWD_LEN   16
  1698. #define MSG_CLUB_INPUT_SEPEATE    "#"
  1699. U8 msg_club_level_1_index = 0;
  1700. U8 msg_club_level_2_index = 0;
  1701. U8 msg_club_level_3_index = 0;
  1702. static msg_club_entry_menu_struct MSGClubScreen[MSG_CLUB_SCREEN_NUM];
  1703. static msg_club_entry_menu_struct MSGClubMenuItem[MSG_CLUB_MENUITEM_NUM];
  1704. static msg_club_entry_dy_db_zf_struct MSGClubSMSItem;
  1705. static msg_club_code_enum MSGClubInputType;
  1706. static msg_club_network_enum MSGClubNetwork;
  1707. static S8 *MSGClubInputBuff;
  1708. static S8 *MSGClubInputBuff2;
  1709. static U8 MSGClubInputLen;
  1710. static U8 MSGClubInputLen2;
  1711. static U16 MSGClubTitle;
  1712. static U16 MSGClubTitle2;
  1713. static U8 MSGClubCount = 0;
  1714. extern S8 gHomePLMNNum[];
  1715. extern const msg_club_entry_menu_struct MenuMSGClub[];
  1716. extern const msg_club_entry_menu_struct MenuVoice[];
  1717. extern const msg_club_service_num_struct NumService[];
  1718. extern const msg_club_entry_dy_db_zf_struct MenuExtra[];
  1719. extern const U16 InputString[];
  1720. extern UI_string_type get_string_lang(MMI_ID_TYPE i, S8 *ssc_str);
  1721. /*****************************************************************************
  1722.  * FUNCTION
  1723.  *  mmi_msg_club_make_call
  1724.  * DESCRIPTION
  1725.  *  
  1726.  * PARAMETERS
  1727.  *  void
  1728.  * RETURNS
  1729.  *  void
  1730.  *****************************************************************************/
  1731. void mmi_msg_club_make_call(void)
  1732. {
  1733.     /*----------------------------------------------------------------*/
  1734.     /* Local Variables                                                */
  1735.     /*----------------------------------------------------------------*/
  1736.     /*----------------------------------------------------------------*/
  1737.     /* Code Body                                                      */
  1738.     /*----------------------------------------------------------------*/
  1739.     MakeCall(g_msg_cntx.smsPhoneNumber);
  1740. }
  1741. /*****************************************************************************
  1742.  * FUNCTION
  1743.  *  mmi_msg_club_exit_make_call
  1744.  * DESCRIPTION
  1745.  *  
  1746.  * PARAMETERS
  1747.  *  void
  1748.  * RETURNS
  1749.  *  void
  1750.  *****************************************************************************/
  1751. void mmi_msg_club_exit_make_call(void)
  1752. {
  1753.     /*----------------------------------------------------------------*/
  1754.     /* Local Variables                                                */
  1755.     /*----------------------------------------------------------------*/
  1756.     /*----------------------------------------------------------------*/
  1757.     /* Code Body                                                      */
  1758.     /*----------------------------------------------------------------*/
  1759.     stopRequestedTone(WARNING_TONE);
  1760. }
  1761. /*****************************************************************************
  1762.  * FUNCTION
  1763.  *  mmi_msg_club_entry_make_call
  1764.  * DESCRIPTION
  1765.  *  
  1766.  * PARAMETERS
  1767.  *  void
  1768.  * RETURNS
  1769.  *  void
  1770.  *****************************************************************************/
  1771. void mmi_msg_club_entry_make_call(void)
  1772. {
  1773.     /*----------------------------------------------------------------*/
  1774.     /* Local Variables                                                */
  1775.     /*----------------------------------------------------------------*/
  1776.     S8 textbuf[MSG_CLUB_CODE_LENGTH];
  1777.     S8 textbufucs2[MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH];
  1778.     S16 error;
  1779.     msg_club_entry_voice_struct *itemInfo = (msg_club_entry_voice_struct*) MSGClubScreen[MSGClubCount].childEntry;
  1780.     U16 numType = itemInfo[msg_club_level_2_index].codeType;
  1781.     /*----------------------------------------------------------------*/
  1782.     /* Code Body                                                      */
  1783.     /*----------------------------------------------------------------*/
  1784.     EntryNewScreen(SCR_ID_MSG_CONFIRMATION, mmi_msg_club_exit_make_call, NULL, NULL);
  1785.     memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  1786.     memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  1787.     memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
  1788.     AnsiiToUnicodeString(textbufucs2, (S8*) itemInfo[msg_club_level_2_index].codeVoice.codeNum);
  1789.     pfnUnicodeStrcpy(g_msg_cntx.smsPhoneNumber, textbufucs2);
  1790.     if ((numType & NUMBER_END) == NUMBER_END)
  1791.     {
  1792.         memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  1793.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  1794.         ReadRecord(NVRAM_EF_MSG_CLUB_NUM_LID, 1, textbuf, NVRAM_MSG_CLUB_NUM_RECORD_SIZE, &error);
  1795.         AnsiiToUnicodeString(textbufucs2, textbuf);
  1796.         pfnUnicodeStrcat(g_msg_cntx.smsPhoneNumber, textbufucs2);
  1797.     }
  1798.     ShowCategory154Screen(
  1799.         0,
  1800.         0,
  1801.         STR_GLOBAL_YES,
  1802.         IMG_SMS_COMMON_NOIMAGE,
  1803.         STR_GLOBAL_NO,
  1804.         IMG_SMS_COMMON_NOIMAGE,
  1805.         (PU8) get_string_lang(STR_GLOBAL_DIAL, SSC_SCHINESE),
  1806.         (PU8) g_msg_cntx.smsPhoneNumber,
  1807.         IMG_GLOBAL_QUESTION,
  1808.         NULL);
  1809.     /*
  1810.      * ShowCategory164Screen(STR_GLOBAL_YES, IMG_GLOBAL_YES,
  1811.      * STR_GLOBAL_NO, IMG_GLOBAL_NO,
  1812.      * STR_GLOBAL_DIAL, IMG_GLOBAL_QUESTION, NULL); 
  1813.      */
  1814.     SetLeftSoftkeyFunction(mmi_msg_club_make_call, KEY_EVENT_UP);
  1815.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1816.     playRequestedTone(WARNING_TONE);
  1817. }
  1818. /*****************************************************************************
  1819.  * FUNCTION
  1820.  *  mmi_msg_club_send_msg_rsp
  1821.  * DESCRIPTION
  1822.  *  
  1823.  * PARAMETERS
  1824.  *  number      [?]         
  1825.  *  mod         [IN]        
  1826.  *  result      [IN]        
  1827.  * RETURNS
  1828.  *  void
  1829.  *****************************************************************************/
  1830. void mmi_msg_club_send_msg_rsp(void *number, module_type mod, U16 result)
  1831. {
  1832.     /*----------------------------------------------------------------*/
  1833.     /* Local Variables                                                */
  1834.     /*----------------------------------------------------------------*/
  1835.     /*----------------------------------------------------------------*/
  1836.     /* Code Body                                                      */
  1837.     /*----------------------------------------------------------------*/
  1838.     switch (result)
  1839.     {
  1840.         case MMI_FRM_SMS_OK:
  1841.             DisplayPopup(
  1842.                 (PU8) GetString(STR_SMS_SEND_SUCCESS),
  1843.                 IMG_SEND_SUCCESS_PIC_MSG,
  1844.                 1,
  1845.                 MESSAGES_POPUP_TIME_OUT,
  1846.                 (U8) SUCCESS_TONE);
  1847.             mmi_frm_sms_delete_screen_history();
  1848.             AlmEnableSPOF();
  1849.             break;
  1850.         case MMI_FRM_SMS_ABORT:
  1851.             DisplayPopup(
  1852.                 (PU8) GetString(STR_ABORT_SENDING_SMS),
  1853.                 IMG_GLOBAL_ACTIVATED,
  1854.                 1,
  1855.                 MESSAGES_POPUP_TIME_OUT,
  1856.                 (U8) SUCCESS_TONE);
  1857.             mmi_frm_sms_delete_screen_history();
  1858.             AlmEnableSPOF();
  1859.             break;
  1860.         case MMI_FRM_SMS_NOTREADY:
  1861.             DisplayPopup(
  1862.                 (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
  1863.                 IMG_SEND_FAIL_PIC_MSG,
  1864.                 1,
  1865.                 MESSAGES_POPUP_TIME_OUT,
  1866.                 (U8) ERROR_TONE);
  1867.             AlmEnableSPOF();
  1868.             break;
  1869.         case MMI_FRM_SMS_RETURN:
  1870.         case MMI_FRM_SMS_END:
  1871.             break;
  1872.         default:
  1873.             DisplayPopup(
  1874.                 (PU8) GetString(STR_SMS_SEND_FAILED),
  1875.                 IMG_SEND_FAIL_PIC_MSG,
  1876.                 1,
  1877.                 MESSAGES_POPUP_TIME_OUT,
  1878.                 (U8) ERROR_TONE);
  1879.             mmi_frm_sms_delete_screen_history();
  1880.             AlmEnableSPOF();
  1881.             break;
  1882.     }
  1883. }
  1884. /*****************************************************************************
  1885.  * FUNCTION
  1886.  *  mmi_msg_club_send_msg_req
  1887.  * DESCRIPTION
  1888.  *  
  1889.  * PARAMETERS
  1890.  *  void
  1891.  * RETURNS
  1892.  *  void
  1893.  *****************************************************************************/
  1894. void mmi_msg_club_send_msg_req(void)
  1895. {
  1896.     /*----------------------------------------------------------------*/
  1897.     /* Local Variables                                                */
  1898.     /*----------------------------------------------------------------*/
  1899.     S8 textbuf[MSG_CLUB_CODE_LENGTH];
  1900.     S8 textbufucs2[MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH];
  1901.     S8 codebufucs2[(MSG_CLUB_CODE_LENGTH + MSG_CLUB_INPUT_BUFF_LEN) * ENCODING_LENGTH];
  1902.     EMSData *pEMS;
  1903.     S16 error;
  1904.     U8 result;
  1905.     history temphistory;
  1906.     U8 service = msg_club_level_3_index;
  1907.     U8 serviceNum[MSG_CLUB_LONG_CODE_LENGTH + 1];
  1908.     U16 serviceType;
  1909.     U8 codeNum[MSG_CLUB_LONG_CODE_LENGTH];
  1910.     U16 codeType;
  1911.     U8 serviceCode[MSG_CLUB_SHORT_CODE_LENGTH * ENCODING_LENGTH];
  1912.     U8 servicePrefix = 0;
  1913.     /*----------------------------------------------------------------*/
  1914.     /* Code Body                                                      */
  1915.     /*----------------------------------------------------------------*/
  1916.    /****************phone number********************/
  1917.     memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  1918.     memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  1919.     memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
  1920.     memset(serviceNum, 0, MSG_CLUB_LONG_CODE_LENGTH + 1);
  1921.     if ((MSGClubNetwork == MSG_CLUB_CU) && ((MSGClubSMSItem.strInput_codeCU & 0x0f) > 1))
  1922.     {
  1923.         memcpy(
  1924.             (S8*) & MSGClubSMSItem,
  1925.             (S8*) & MenuExtra[(MSGClubSMSItem.strInput_codeCU & 0x0f)],
  1926.             sizeof(msg_club_entry_dy_db_zf_struct));
  1927.     }
  1928.     PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "service=%d*n", service));
  1929.     switch (service)
  1930.     {
  1931.         case MSG_CLUB_SERVICE_SUBSCRIBE:
  1932.             memcpy(
  1933.                 serviceNum,
  1934.                 NumService[MSGClubSMSItem.serverType].serverDY[MSGClubNetwork].codeNum,
  1935.                 MSG_CLUB_LONG_CODE_LENGTH);
  1936.             serviceType = NumService[MSGClubSMSItem.serverType].serverDY[MSGClubNetwork].codeType;
  1937.             break;
  1938.         case MSG_CLUB_SERVICE_ORDER:
  1939.             memcpy(
  1940.                 serviceNum,
  1941.                 NumService[MSGClubSMSItem.serverType].serverDB[MSGClubNetwork].codeNum,
  1942.                 MSG_CLUB_LONG_CODE_LENGTH);
  1943.             serviceType = NumService[MSGClubSMSItem.serverType].serverDB[MSGClubNetwork].codeType;
  1944.             PRINT_INFORMATION_2((MMI_TRACE_G6_SMS, "serviceType=%d*n", serviceType));
  1945.             break;
  1946.         case MSG_CLUB_SERVICE_EXPLAIN:
  1947.             memcpy(
  1948.                 serviceNum,
  1949.                 NumService[MSGClubSMSItem.serverType].serverZF[MSGClubNetwork].codeNum,
  1950.                 MSG_CLUB_LONG_CODE_LENGTH);
  1951.             serviceType = NumService[MSGClubSMSItem.serverType].serverZF[MSGClubNetwork].codeType;
  1952.             break;
  1953.         case MSG_CLUB_SERVICE_CANCEL:
  1954.             memcpy(
  1955.                 serviceNum,
  1956.                 NumService[MSGClubSMSItem.serverType].serverTD[MSGClubNetwork].codeNum,
  1957.                 MSG_CLUB_LONG_CODE_LENGTH);
  1958.             serviceType = NumService[MSGClubSMSItem.serverType].serverTD[MSGClubNetwork].codeType;
  1959.             break;
  1960.     }
  1961.     /* service number */
  1962.     AnsiiToUnicodeString((S8*) textbufucs2, (S8*) serviceNum);
  1963.     pfnUnicodeStrcat(g_msg_cntx.smsPhoneNumber, textbufucs2);
  1964.     if ((serviceType & NUMBER_END) == NUMBER_END)
  1965.     {
  1966.         /* handset number */
  1967.         memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  1968.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  1969.         ReadRecord(NVRAM_EF_MSG_CLUB_NUM_LID, 1, textbuf, NVRAM_MSG_CLUB_NUM_RECORD_SIZE, &error);
  1970.         AnsiiToUnicodeString(textbufucs2, textbuf);
  1971.         pfnUnicodeStrcat(g_msg_cntx.smsPhoneNumber, textbufucs2);
  1972.     }
  1973.     if ((serviceType & CODE_END) == CODE_END)
  1974.     {
  1975.         memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  1976.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  1977.         AnsiiToUnicodeString(textbufucs2, mmi_msg_club_get_number_end());
  1978.         pfnUnicodeStrcat(g_msg_cntx.smsPhoneNumber, textbufucs2);
  1979.     }
  1980.     /* product code */
  1981.     ReleaseEMSEditBuffer();
  1982.     memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  1983.     memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  1984.     memset(codebufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  1985.     memset(serviceCode, 0, MSG_CLUB_SHORT_CODE_LENGTH * ENCODING_LENGTH);
  1986.     memset(codeNum, 0, MSG_CLUB_LONG_CODE_LENGTH - 1);
  1987.     switch (service)
  1988.     {
  1989.         case MSG_CLUB_SERVICE_SUBSCRIBE:
  1990.             memcpy(codeNum, MSGClubSMSItem.codeDY.codeNum, MSG_CLUB_LONG_CODE_LENGTH - 1);
  1991.             AnsiiToUnicodeString((S8*) serviceCode, mmi_msg_club_get_code_subscribe());
  1992.             codeType = MSGClubSMSItem.codeDY.codeType;
  1993.             break;
  1994.         case MSG_CLUB_SERVICE_ORDER:
  1995.             memcpy(codeNum, MSGClubSMSItem.codeDB.codeNum, MSG_CLUB_LONG_CODE_LENGTH - 1);
  1996.             AnsiiToUnicodeString((S8*) serviceCode, mmi_msg_club_get_code_order());
  1997.             codeType = MSGClubSMSItem.codeDB.codeType;
  1998.             break;
  1999.         case MSG_CLUB_SERVICE_EXPLAIN:
  2000.             memcpy(codeNum, MSGClubSMSItem.codeZF.codeNum, MSG_CLUB_LONG_CODE_LENGTH - 1);
  2001.             AnsiiToUnicodeString((S8*) serviceCode, mmi_msg_club_get_code_explain());
  2002.             codeType = MSGClubSMSItem.codeZF.codeType;
  2003.             break;
  2004.         case MSG_CLUB_SERVICE_CANCEL:
  2005.             memcpy(codeNum, MSGClubSMSItem.codeTD.codeNum, MSG_CLUB_SHORT_CODE_LENGTH);
  2006.             codeType = 0;
  2007.             break;
  2008.     }
  2009.     if ((codeType & PHONE_PRE) == PHONE_PRE)
  2010.     {
  2011.         memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  2012.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2013.         memset(codebufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2014.         ReadRecord(NVRAM_EF_MSG_CLUB_LID, 1, textbuf, NVRAM_MSG_CLUB_RECORD_SIZE, &error);
  2015.         AnsiiToUnicodeString(codebufucs2, textbuf);
  2016.         servicePrefix = 1;
  2017.     }
  2018.     if ((codeType & NUMBER_PRE) == NUMBER_PRE)
  2019.     {
  2020.         memset(textbuf, 0, MSG_CLUB_CODE_LENGTH);
  2021.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2022.         ReadRecord(NVRAM_EF_MSG_CLUB_NUM_LID, 1, textbuf, NVRAM_MSG_CLUB_NUM_RECORD_SIZE, &error);
  2023.         AnsiiToUnicodeString(textbufucs2, textbuf);
  2024.         pfnUnicodeStrcat(codebufucs2, textbufucs2);
  2025.         servicePrefix = 1;
  2026.     }
  2027.     if (servicePrefix == 1)
  2028.     {
  2029.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2030.         AnsiiToUnicodeString(textbufucs2, mmi_msg_club_get_code_sms());
  2031.         pfnUnicodeStrcat(codebufucs2, textbufucs2);
  2032.     }
  2033.     if ((codeType & CODE_PRE) == CODE_PRE)
  2034.     {
  2035.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2036.         AnsiiToUnicodeString(textbufucs2, mmi_msg_club_get_code_dummy());
  2037.         pfnUnicodeStrcat(codebufucs2, textbufucs2);
  2038.     }
  2039.     if (servicePrefix == 1)
  2040.     {
  2041.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2042.         AnsiiToUnicodeString(textbufucs2, mmi_msg_club_get_code_devide());
  2043.         pfnUnicodeStrcat(codebufucs2, textbufucs2);
  2044.     }
  2045.     if ((codeType & SERVICE_PRE) == SERVICE_PRE)
  2046.     {
  2047.         pfnUnicodeStrcat(codebufucs2, (S8*) serviceCode);
  2048.     }
  2049.     memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2050.     AnsiiToUnicodeString(textbufucs2, (S8*) codeNum);
  2051.     pfnUnicodeStrcat(codebufucs2, textbufucs2);
  2052.     if ((codeType & SER_END) == SER_END)
  2053.     {
  2054.         pfnUnicodeStrcat(codebufucs2, (S8*) serviceCode);
  2055.     }
  2056.     if ((MSGClubInputType & INPUT_CODE) == INPUT_CODE)
  2057.     {
  2058.         pfnUnicodeStrcat(codebufucs2, MSGClubInputBuff);
  2059.     }
  2060.     if (MSGClubInputLen2)
  2061.     {
  2062.         memset(textbufucs2, 0, MSG_CLUB_CODE_LENGTH * ENCODING_LENGTH);
  2063.         AnsiiToUnicodeString((S8*) textbufucs2, MSG_CLUB_INPUT_SEPEATE);
  2064.         pfnUnicodeStrcat(codebufucs2, textbufucs2);
  2065.         pfnUnicodeStrcat(codebufucs2, MSGClubInputBuff2);
  2066.     }
  2067.     memset(&temphistory, 0, sizeof(temphistory));
  2068.     GetHistory(SCR_ID_MSG_WRITE, &temphistory);
  2069.     pEMS = GetEMSDataForEdit(0, 0);
  2070.     /* NOTE: change function name to a general one!!!! */
  2071.     if ((MSGClubInputType & INPUT_CHI) == INPUT_CHI)
  2072.     {
  2073.         result = AppendEMSString(
  2074.                     INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  2075.                     pEMS,
  2076.                     (U8*) codebufucs2,
  2077.                     SMSAL_UCS2_DCS,
  2078.                     temphistory.guiBuffer);
  2079.     }
  2080.     else
  2081.     {
  2082.         result = AppendEMSString(
  2083.                     INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  2084.                     pEMS,
  2085.                     (U8*) codebufucs2,
  2086.                     SMSAL_DEFAULT_DCS,
  2087.                     temphistory.guiBuffer);
  2088.     }
  2089.     if (result)
  2090.     {
  2091.         mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
  2092.         memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
  2093.         memset(sendData->number, 0, MAX_DIGITS_SMS);
  2094.         if (pfnUnicodeStrlen((S8*) smsPhoneNumber))
  2095.         {
  2096.             UnicodeToAnsii((S8*) sendData->number, (S8*) smsPhoneNumber);
  2097.         }
  2098.         mmi_frm_sms_send_sms(mmi_msg_club_send_msg_rsp, MOD_MMI, sendData);
  2099.         OslMfree(sendData);
  2100.     }
  2101.     else
  2102.     {
  2103.         DisplayPopup(
  2104.             (PU8) GetString(STR_SMS_DOES_NOT_SUPPORT),
  2105.             IMG_GLOBAL_UNFINISHED,
  2106.             1,
  2107.             MESSAGES_POPUP_TIME_OUT,
  2108.             (U8) ERROR_TONE);
  2109.     }
  2110. }
  2111. /*****************************************************************************
  2112.  * FUNCTION
  2113.  *  mmi_msg_club_entry_input_sms
  2114.  * DESCRIPTION
  2115.  *  
  2116.  * PARAMETERS
  2117.  *  void
  2118.  * RETURNS
  2119.  *  void
  2120.  *****************************************************************************/
  2121. void mmi_msg_club_entry_input_sms(void)
  2122. {
  2123.     /*----------------------------------------------------------------*/
  2124.     /* Local Variables                                                */
  2125.     /*----------------------------------------------------------------*/
  2126.     U8 *guiBuffer;
  2127.     /*----------------------------------------------------------------*/
  2128.     /* Code Body                                                      */
  2129.     /*----------------------------------------------------------------*/
  2130.     EntryNewScreen(SCR_ID_MSG_CLUB_SMS_INPUT, NULL, mmi_msg_club_entry_input_sms, NULL);
  2131.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CLUB_SMS_INPUT);
  2132.     if ((MSGClubInputType & INPUT_PWD) == INPUT_PWD)
  2133.     {
  2134.         ShowCategory5Screen(
  2135.             MSGClubTitle2,
  2136.             IMG_MESSAGE_CLUB_ID,
  2137.             STR_GLOBAL_OK,
  2138.             IMG_GLOBAL_OK,
  2139.             STR_GLOBAL_BACK,
  2140.             IMG_GLOBAL_BACK,
  2141.             INPUT_TYPE_PHONE_NUMBER,
  2142.             (U8*) MSGClubInputBuff2,
  2143.             MSGClubInputLen2 + 1,
  2144.             guiBuffer);
  2145.     }
  2146.     else
  2147.     {
  2148.         ShowCategory5Screen(
  2149.             MSGClubTitle2,
  2150.             IMG_MESSAGE_CLUB_ID,
  2151.             STR_GLOBAL_OK,
  2152.             IMG_GLOBAL_OK,
  2153.             STR_GLOBAL_BACK,
  2154.             IMG_GLOBAL_BACK,
  2155.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  2156.             (U8*) MSGClubInputBuff2,
  2157.             MSGClubInputLen2 + 1,
  2158.             guiBuffer);
  2159.     }
  2160.     SetLeftSoftkeyFunction(mmi_msg_club_send_msg, KEY_EVENT_UP);
  2161.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2162.     SetKeyHandler(mmi_msg_club_send_msg, KEY_SEND, KEY_EVENT_UP);
  2163. }
  2164. /*****************************************************************************
  2165.  * FUNCTION
  2166.  *  mmi_msg_club_entry_input_done
  2167.  * DESCRIPTION
  2168.  *  
  2169.  * PARAMETERS
  2170.  *  void
  2171.  * RETURNS
  2172.  *  void
  2173.  *****************************************************************************/
  2174. void mmi_msg_club_entry_input_done(void)
  2175. {
  2176.     /*----------------------------------------------------------------*/
  2177.     /* Local Variables                                                */
  2178.     /*----------------------------------------------------------------*/
  2179.     /*----------------------------------------------------------------*/
  2180.     /* Code Body                                                      */
  2181.     /*----------------------------------------------------------------*/
  2182.     if (MSGClubInputLen2)
  2183.     {
  2184.         mmi_msg_club_entry_input_sms();
  2185.     }
  2186.     else
  2187.     {
  2188.         mmi_msg_club_send_msg();
  2189.     }
  2190. }
  2191. /*****************************************************************************
  2192.  * FUNCTION
  2193.  *  mmi_msg_club_entry_input
  2194.  * DESCRIPTION
  2195.  *  
  2196.  * PARAMETERS
  2197.  *  void
  2198.  * RETURNS
  2199.  *  void
  2200.  *****************************************************************************/
  2201. void mmi_msg_club_entry_input(void)
  2202. {
  2203.     /*----------------------------------------------------------------*/
  2204.     /* Local Variables                                                */
  2205.     /*----------------------------------------------------------------*/
  2206.     U8 *guiBuffer;
  2207.     /*----------------------------------------------------------------*/
  2208.     /* Code Body                                                      */
  2209.     /*----------------------------------------------------------------*/
  2210.     EntryNewScreen(SCR_ID_MSG_CLUB_NUM_INPUT, NULL, mmi_msg_club_entry_input, NULL);
  2211.     guiBuffer = GetCurrGuiBuffer(SCR_ID_MSG_CLUB_NUM_INPUT);
  2212.     if (((MSGClubInputType & INPUT_NUM) == INPUT_NUM) || ((MSGClubInputType & INPUT_DA) == INPUT_DA))
  2213.     {
  2214.         ShowCategory5Screen(
  2215.             MSGClubTitle,
  2216.             IMG_MESSAGE_CLUB_ID,
  2217.             STR_GLOBAL_OK,
  2218.             IMG_GLOBAL_OK,
  2219.             STR_GLOBAL_BACK,
  2220.             IMG_GLOBAL_BACK,
  2221.             INPUT_TYPE_PHONE_NUMBER,
  2222.             (U8*) MSGClubInputBuff,
  2223.             MSGClubInputLen + 1,
  2224.             guiBuffer);
  2225.     }
  2226.     else
  2227.     {
  2228.         ShowCategory5Screen(
  2229.             MSGClubTitle,
  2230.             IMG_MESSAGE_CLUB_ID,
  2231.             STR_GLOBAL_OK,
  2232.             IMG_GLOBAL_OK,
  2233.             STR_GLOBAL_BACK,
  2234.             IMG_GLOBAL_BACK,
  2235.             INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
  2236.             (U8*) MSGClubInputBuff,
  2237.             MSGClubInputLen + 1,
  2238.             guiBuffer);
  2239.     }
  2240.     SetLeftSoftkeyFunction(mmi_msg_club_entry_input_done, KEY_EVENT_UP);
  2241.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2242.     SetKeyHandler(mmi_msg_club_entry_input_done, KEY_SEND, KEY_EVENT_UP);
  2243. }
  2244. /*****************************************************************************
  2245.  * FUNCTION
  2246.  *  mmi_msg_club_pre_entry_send_msg
  2247.  * DESCRIPTION
  2248.  *  
  2249.  * PARAMETERS
  2250.  *  void
  2251.  * RETURNS
  2252.  *  void
  2253.  *****************************************************************************/
  2254. void mmi_msg_club_pre_entry_send_msg(void)
  2255. {
  2256.     /*----------------------------------------------------------------*/
  2257.     /* Local Variables                                                */
  2258.     /*----------------------------------------------------------------*/
  2259.     /*----------------------------------------------------------------*/
  2260.     /* Code Body                                                      */
  2261.     /*----------------------------------------------------------------*/
  2262.     MSGClubInputType = 0;
  2263.     if (MSGClubInputBuff != NULL)
  2264.     {
  2265.         OslMfree(MSGClubInputBuff);
  2266.         MSGClubInputBuff = NULL;
  2267.     }
  2268.     if (MSGClubInputBuff2 != NULL)
  2269.     {
  2270.         OslMfree(MSGClubInputBuff2);
  2271.         MSGClubInputBuff2 = NULL;
  2272.     }
  2273.     if ((msg_club_level_3_index == MSG_CLUB_SERVICE_SUBSCRIBE)
  2274.         && ((MSGClubSMSItem.codeDY.codeType & INPUT_CODE) == INPUT_CODE))
  2275.     {
  2276.         MSGClubInputType = MSGClubSMSItem.codeDY.codeType;
  2277.     }
  2278.     if ((msg_club_level_3_index == MSG_CLUB_SERVICE_ORDER)
  2279.         && ((MSGClubSMSItem.codeDB.codeType & INPUT_CODE) == INPUT_CODE))
  2280.     {
  2281.         MSGClubInputType = MSGClubSMSItem.codeDB.codeType;
  2282.     }
  2283.     if ((msg_club_level_3_index == MSG_CLUB_SERVICE_EXPLAIN)
  2284.         && ((MSGClubSMSItem.codeZF.codeType & INPUT_CODE) == INPUT_CODE))
  2285.     {
  2286.         MSGClubInputType = MSGClubSMSItem.codeZF.codeType;
  2287.     }
  2288.     if (MSGClubInputType)
  2289.     {
  2290.         if ((MSGClubInputType & INPUT_DA) == INPUT_DA)
  2291.         {
  2292.             MSGClubInputLen = MSG_CLUB_INPUT_DA_LEN;
  2293.             MSGClubTitle = STR_MSG_CLUB_ENTER_QQ;
  2294.         }
  2295.         else if ((MSGClubInputType & INPUT_NAME) == INPUT_NAME)
  2296.         {
  2297.             MSGClubInputLen = MSG_CLUB_INPUT_NAME_LEN;
  2298.             MSGClubTitle = STR_MSG_CLUB_ENTER_NICKNAME;
  2299.         }
  2300.         else
  2301.         {
  2302.             MSGClubInputLen = MSG_CLUB_INPUT_BUFF_LEN;
  2303.             if ((MSGClubInputType & INPUT_NUM) == INPUT_NUM)
  2304.             {
  2305.                 MSGClubTitle = STR_MSG_CLUB_ENTER_NUMBER;
  2306.             }
  2307.             else
  2308.             {
  2309.                 MSGClubTitle = STR_MSG_CLUB_ENTER_NAME;
  2310.             }
  2311.         }
  2312.         MSGClubInputBuff = OslMalloc((MSGClubInputLen + 1) * ENCODING_LENGTH);
  2313.         memset(MSGClubInputBuff, 0, (MSGClubInputLen + 1) * ENCODING_LENGTH);
  2314.         if ((MSGClubInputType & INPUT_SMS) == INPUT_SMS)
  2315.         {
  2316.             MSGClubInputLen2 = MSG_CLUB_INPUT_SMS_LEN;
  2317.             MSGClubTitle2 = STR_MSG_CLUB_ENTER_MSG;
  2318.         }
  2319.         else if ((MSGClubInputType & INPUT_PWD) == INPUT_PWD)
  2320.         {
  2321.             MSGClubInputLen2 = MSG_CLUB_INPUT_PWD_LEN;
  2322.             MSGClubTitle2 = STR_MSG_CLUB_ENTER_PWD;
  2323.         }
  2324.         else
  2325.         {
  2326.             MSGClubInputLen2 = 0;
  2327.         }
  2328.         if (MSGClubInputLen2)
  2329.         {
  2330.             MSGClubInputBuff2 = OslMalloc((MSGClubInputLen2 + 1) * ENCODING_LENGTH);
  2331.             memset(MSGClubInputBuff2, 0, (MSGClubInputLen2 + 1) * ENCODING_LENGTH);
  2332.         }
  2333.         if ((MSGClubSMSItem.strInput_codeCU & 0xf0) > 0)
  2334.         {
  2335.             mmi_msg_club_pre_entry_input();
  2336.         }
  2337.         else
  2338.         {
  2339.             mmi_msg_club_entry_input();
  2340.         }
  2341.     }
  2342.     else
  2343.     {
  2344.         mmi_msg_club_send_msg();
  2345.     }
  2346. }
  2347. /*****************************************************************************
  2348.  * FUNCTION
  2349.  *  mmi_msg_club_highlight_subscribe
  2350.  * DESCRIPTION
  2351.  *  
  2352.  * PARAMETERS
  2353.  *  void
  2354.  * RETURNS
  2355.  *  void
  2356.  *****************************************************************************/
  2357. void mmi_msg_club_highlight_subscribe(void)
  2358. {
  2359.     /*----------------------------------------------------------------*/
  2360.     /* Local Variables                                                */
  2361.     /*----------------------------------------------------------------*/
  2362.     /*----------------------------------------------------------------*/
  2363.     /* Code Body                                                      */
  2364.     /*----------------------------------------------------------------*/
  2365.     mmi_msg_highlight_generic(
  2366.         STR_GLOBAL_OK,
  2367.         IMG_GLOBAL_OK,
  2368.         STR_GLOBAL_BACK,
  2369.         IMG_GLOBAL_BACK,
  2370.         mmi_msg_club_pre_entry_send_msg,
  2371.         GoBackHistory);
  2372.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2373.     msg_club_level_3_index = MSG_CLUB_SERVICE_SUBSCRIBE;
  2374. }
  2375. /*****************************************************************************
  2376.  * FUNCTION
  2377.  *  mmi_msg_club_highlight_order
  2378.  * DESCRIPTION
  2379.  *  
  2380.  * PARAMETERS
  2381.  *  void
  2382.  * RETURNS
  2383.  *  void
  2384.  *****************************************************************************/
  2385. void mmi_msg_club_highlight_order(void)
  2386. {
  2387.     /*----------------------------------------------------------------*/
  2388.     /* Local Variables                                                */
  2389.     /*----------------------------------------------------------------*/
  2390.     /*----------------------------------------------------------------*/
  2391.     /* Code Body                                                      */
  2392.     /*----------------------------------------------------------------*/
  2393.     mmi_msg_highlight_generic(
  2394.         STR_GLOBAL_OK,
  2395.         IMG_GLOBAL_OK,
  2396.         STR_GLOBAL_BACK,
  2397.         IMG_GLOBAL_BACK,
  2398.         mmi_msg_club_pre_entry_send_msg,
  2399.         GoBackHistory);
  2400.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2401.     msg_club_level_3_index = MSG_CLUB_SERVICE_ORDER;
  2402. }
  2403. /*****************************************************************************
  2404.  * FUNCTION
  2405.  *  mmi_msg_club_highlight_explain
  2406.  * DESCRIPTION
  2407.  *  
  2408.  * PARAMETERS
  2409.  *  void
  2410.  * RETURNS
  2411.  *  void
  2412.  *****************************************************************************/
  2413. void mmi_msg_club_highlight_explain(void)
  2414. {
  2415.     /*----------------------------------------------------------------*/
  2416.     /* Local Variables                                                */
  2417.     /*----------------------------------------------------------------*/
  2418.     /*----------------------------------------------------------------*/
  2419.     /* Code Body                                                      */
  2420.     /*----------------------------------------------------------------*/
  2421.     mmi_msg_highlight_generic(
  2422.         STR_GLOBAL_OK,
  2423.         IMG_GLOBAL_OK,
  2424.         STR_GLOBAL_BACK,
  2425.         IMG_GLOBAL_BACK,
  2426.         mmi_msg_club_pre_entry_send_msg,
  2427.         GoBackHistory);
  2428.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2429.     msg_club_level_3_index = MSG_CLUB_SERVICE_EXPLAIN;
  2430. }
  2431. /*****************************************************************************
  2432.  * FUNCTION
  2433.  *  mmi_msg_club_highlight_quit
  2434.  * DESCRIPTION
  2435.  *  
  2436.  * PARAMETERS
  2437.  *  void
  2438.  * RETURNS
  2439.  *  void
  2440.  *****************************************************************************/
  2441. void mmi_msg_club_highlight_quit(void)