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

MTK

开发平台:

C/C++

  1.     }
  2.     else if (strlen((S8*) msgRsp->caller.disp_name))
  3.     {
  4.         strncpy((S8*) list_name, (S8*) msgRsp->caller.disp_name, POC_MAX_DISP_LEN - 1);
  5.     }
  6.     else
  7.     {
  8.         strncpy((S8*) list_name, (S8*) msgRsp->caller.uri, POC_MAX_DISP_LEN - 1);
  9.     }
  10.     strncpy((S8*) uri, (S8*) msgRsp->session_id, POC_MAX_URI_LEN - 1);
  11.     mmi_poc_history_add(POC_INCOMING_CALL, MMI_TRUE, list_name, uri, NULL);
  12.     if (IsScreenPresent(SCR_ID_POC_CM))
  13.     {
  14.         HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_mt_ringing);
  15.     }
  16.     else
  17.     {
  18.         mmi_poc_entry_mt_ringing();
  19.     }
  20. }
  21. /*****************************************************************************
  22.  * FUNCTION
  23.  *  mmi_poc_start_mt_ringing
  24.  * DESCRIPTION
  25.  *  start mt call ringing
  26.  * PARAMETERS
  27.  *  void
  28.  * RETURNS
  29.  *  void
  30.  *****************************************************************************/
  31. void mmi_poc_start_mt_ringing(void)
  32. {
  33.     /*----------------------------------------------------------------*/
  34.     /* Local Variables                                                */
  35.     /*----------------------------------------------------------------*/
  36.     /*----------------------------------------------------------------*/
  37.     /* Code Body                                                      */
  38.     /*----------------------------------------------------------------*/
  39.     if (IsSilentModeActivated() != TRUE)
  40.     {
  41.         switch (GetMtCallAlertTypeEnum())
  42.         {
  43.             case MMI_RING:
  44.                 AudioPlayToneWithCallBack(GetRingToneID(), GetRingTypeEnum(), INCOMING_CALL_TONE);
  45.                 break;
  46.             case MMI_VIBRATION_ONLY:
  47.                 VibratorOn();
  48.                 break;
  49.             case MMI_VIBRATION_AND_RING:
  50.             case MMI_VIBRATION_THEN_RING:
  51.                 VibratorOn();
  52.                 AudioPlayToneWithCallBack(GetRingToneID(), GetRingTypeEnum(), INCOMING_CALL_TONE);
  53.                 break;
  54.             case MMI_SILENT:
  55.                 break;
  56.             case MMI_ALERT_NONE:
  57.                 break;
  58.             default:
  59.                 AudioPlayToneWithCallBack(GetRingToneID(), GetRingTypeEnum(), INCOMING_CALL_TONE);
  60.                 break;
  61.         }
  62.     }
  63. }
  64. /*****************************************************************************
  65.  * FUNCTION
  66.  *  mmi_poc_stop_mt_ringing
  67.  * DESCRIPTION
  68.  *  stop mt call ringing
  69.  * PARAMETERS
  70.  *  void
  71.  * RETURNS
  72.  *  void
  73.  *****************************************************************************/
  74. void mmi_poc_stop_mt_ringing(void)
  75. {
  76.     /*----------------------------------------------------------------*/
  77.     /* Local Variables                                                */
  78.     /*----------------------------------------------------------------*/
  79.     /*----------------------------------------------------------------*/
  80.     /* Code Body                                                      */
  81.     /*----------------------------------------------------------------*/
  82.     switch (GetMtCallAlertTypeEnum())
  83.     {
  84.         case MMI_RING:
  85.             mdi_audio_stop_all();
  86.             break;
  87.         case MMI_VIBRATION_ONLY:
  88.             VibratorOff();
  89.             break;
  90.         case MMI_VIBRATION_AND_RING:
  91.         case MMI_VIBRATION_THEN_RING:
  92.             mdi_audio_stop_all();
  93.             VibratorOff();
  94.             break;
  95.         case MMI_SILENT:
  96.             break;
  97.         case MMI_ALERT_NONE:
  98.             break;
  99.         default:
  100.             break;
  101.     }
  102. }
  103. /*****************************************************************************
  104.  * FUNCTION
  105.  *  mmi_poc_entry_mt_ringing
  106.  * DESCRIPTION
  107.  *  mt ringing screen
  108.  * PARAMETERS
  109.  *  void
  110.  * RETURNS
  111.  *  void
  112.  *****************************************************************************/
  113. void mmi_poc_entry_mt_ringing(void)
  114. {
  115.     /*----------------------------------------------------------------*/
  116.     /* Local Variables                                                */
  117.     /*----------------------------------------------------------------*/
  118.     U8 *guiBuffer;
  119.     U8 cm_len_remain = 0;
  120.     U8 temp_buf[POC_MAX_URI_LEN * ENCODING_LENGTH];
  121.     S8 short_string[10], ucs2_short_string[20];
  122.     /*----------------------------------------------------------------*/
  123.     /* Code Body                                                      */
  124.     /*----------------------------------------------------------------*/
  125.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_MT_RINGING));
  126.     memset(g_poc_cntx_p->cm_disp, 0, sizeof(g_poc_cntx_p->cm_disp));
  127.     if (strlen((S8*) g_poc_cntx_p->cm_talk_group_name))
  128.     {
  129.         AnsiiNToUnicodeString(
  130.             (S8*) g_poc_cntx_p->cm_disp,
  131.             (S8*) g_poc_cntx_p->cm_talk_group_name,
  132.             POC_MAX_DISP_LEN - 1);
  133.     }
  134.     cm_len_remain = POC_MAX_DISP_LEN * 3 / 2 - 1 - strlen((S8*) g_poc_cntx_p->cm_talk_group_name);
  135.     memset(short_string, 0, sizeof(short_string));
  136.     memset(ucs2_short_string, 0, sizeof(ucs2_short_string));
  137.     sprintf(short_string, ", ");
  138.     AnsiiToUnicodeString((PS8) ucs2_short_string, (PS8) short_string);
  139.     if (cm_len_remain > 0)
  140.     {
  141.         if (strlen((S8*) g_poc_cntx_p->calling_disp.name))
  142.         {
  143.             if (g_poc_cntx_p->calling_disp.name[0] == 0xFF)
  144.             {
  145.                 if (!UCS2Strlen(ucs2_short_string))
  146.                 {
  147.                     UCS2Strncat((S8*) g_poc_cntx_p->cm_disp, (S8*) ucs2_short_string, cm_len_remain - 1);
  148.                     cm_len_remain -= UCS2Strlen(ucs2_short_string);
  149.                 }
  150.                 UCS2Strncat((S8*) g_poc_cntx_p->cm_disp, (S8*) GetString(STR_ID_POC_CM_ANONYMOUS), cm_len_remain - 1);
  151.             }
  152.             else
  153.             {
  154.                 if (!UCS2Strlen(ucs2_short_string))
  155.                 {
  156.                     UCS2Strncat((S8*) g_poc_cntx_p->cm_disp, (S8*) ucs2_short_string, cm_len_remain - 1);
  157.                     cm_len_remain -= UCS2Strlen(ucs2_short_string);
  158.                 }
  159.                 memset(temp_buf, 0, sizeof(temp_buf));
  160.                 AnsiiNToUnicodeString((S8*) temp_buf, (S8*) g_poc_cntx_p->calling_disp.name, POC_MAX_DISP_LEN - 1);
  161.                 UCS2Strncat((S8*) g_poc_cntx_p->cm_disp, (S8*) temp_buf, cm_len_remain - 1);
  162.             }
  163.         }
  164.         else
  165.         {
  166.             if (!UCS2Strlen(ucs2_short_string))
  167.             {
  168.                 UCS2Strncat((S8*) g_poc_cntx_p->cm_disp, (S8*) ucs2_short_string, cm_len_remain - 1);
  169.                 cm_len_remain -= UCS2Strlen(ucs2_short_string);
  170.             }
  171.             memset(temp_buf, 0, sizeof(temp_buf));
  172.             AnsiiNToUnicodeString((S8*) temp_buf, (S8*) g_poc_cntx_p->calling_disp.uri, POC_MAX_DISP_LEN - 1);
  173.             UCS2Strncat((S8*) g_poc_cntx_p->cm_disp, (S8*) temp_buf, cm_len_remain - 1);
  174.         }
  175.     }
  176.     EntryNewScreen(SCR_ID_POC_CM, mmi_poc_exit_mt_ringing, mmi_poc_entry_mt_ringing, NULL);
  177.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  178.     mmi_poc_remove_cm_screens();
  179.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  180.     mmi_poc_start_mt_ringing();
  181.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_CM);
  182.     ShowCategory66Screen(
  183.         STR_ID_POC_MAIN,
  184.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  185.         STR_GLOBAL_YES,
  186.         IMG_GLOBAL_YES,
  187.         STR_GLOBAL_NO,
  188.         IMG_GLOBAL_NO,
  189.         (U8*) g_poc_cntx_p->cm_disp,
  190.         IMG_ID_POC_CM_MT_RINGING,
  191.         NULL);
  192.     mmi_poc_enter_cm_key_light();
  193.     SetLeftSoftkeyFunction(mmi_poc_mt_ringing_yes, KEY_EVENT_UP);
  194.     SetKeyHandler(mmi_poc_mt_ringing_yes, KEY_SEND, KEY_EVENT_DOWN);
  195.     SetRightSoftkeyFunction(mmi_poc_mt_ringin_no, KEY_EVENT_UP);
  196.     SetKeyHandler(mmi_poc_mt_ringing_end, KEY_END, KEY_EVENT_DOWN);
  197. }
  198. /*****************************************************************************
  199.  * FUNCTION
  200.  *  mmi_poc_exit_mt_ringing
  201.  * DESCRIPTION
  202.  *  exit function for mt ringing screen
  203.  * PARAMETERS
  204.  *  void
  205.  * RETURNS
  206.  *  void
  207.  *****************************************************************************/
  208. void mmi_poc_exit_mt_ringing(void)
  209. {
  210.     /*----------------------------------------------------------------*/
  211.     /* Local Variables                                                */
  212.     /*----------------------------------------------------------------*/
  213.     /*----------------------------------------------------------------*/
  214.     /* Code Body                                                      */
  215.     /*----------------------------------------------------------------*/
  216.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_MT_RINGING));
  217.     mmi_poc_exit_cm_key_light();
  218.     mmi_poc_stop_mt_ringing();
  219. }
  220. /*****************************************************************************
  221.  * FUNCTION
  222.  *  mmi_poc_mt_ringing_yes
  223.  * DESCRIPTION
  224.  *  yes handler for mt ringing screen
  225.  * PARAMETERS
  226.  *  void
  227.  * RETURNS
  228.  *  void
  229.  *****************************************************************************/
  230. void mmi_poc_mt_ringing_yes(void)
  231. {
  232.     /*----------------------------------------------------------------*/
  233.     /* Local Variables                                                */
  234.     /*----------------------------------------------------------------*/
  235.     /*----------------------------------------------------------------*/
  236.     /* Code Body                                                      */
  237.     /*----------------------------------------------------------------*/
  238.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_MT_RINGING_YES));
  239.     g_poc_cntx_p->abort_type = POC_ABORT_NONE;
  240.     g_poc_cntx_p->call_status = POC_CALL_ACTIVE;
  241.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  242.     ClearInputEventHandler(MMI_DEVICE_ALL);
  243.     mmi_poc_stop_alert_ringing();
  244.     mmi_poc_entry_mt_ringing_answered();
  245.     mmi_poc_talk_answer_req(MMI_TRUE);
  246. }
  247. /*****************************************************************************
  248.  * FUNCTION
  249.  *  mmi_poc_mt_ringin_no
  250.  * DESCRIPTION
  251.  *  no handler for mt ringing screen
  252.  * PARAMETERS
  253.  *  void
  254.  * RETURNS
  255.  *  void
  256.  *****************************************************************************/
  257. void mmi_poc_mt_ringin_no(void)
  258. {
  259.     /*----------------------------------------------------------------*/
  260.     /* Local Variables                                                */
  261.     /*----------------------------------------------------------------*/
  262.     /*----------------------------------------------------------------*/
  263.     /* Code Body                                                      */
  264.     /*----------------------------------------------------------------*/
  265.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_MT_RINGIN_NO));
  266.     g_poc_cntx_p->abort_type = POC_ABORT_BACK;
  267.     ClearInputEventHandler(MMI_DEVICE_ALL);
  268.     mmi_poc_stop_alert_ringing();
  269.     mmi_poc_talk_answer_req(MMI_FALSE);
  270. }
  271. /*****************************************************************************
  272.  * FUNCTION
  273.  *  mmi_poc_mt_ringing_end
  274.  * DESCRIPTION
  275.  *  end handler for mt ringing screen
  276.  * PARAMETERS
  277.  *  void
  278.  * RETURNS
  279.  *  void
  280.  *****************************************************************************/
  281. void mmi_poc_mt_ringing_end(void)
  282. {
  283.     /*----------------------------------------------------------------*/
  284.     /* Local Variables                                                */
  285.     /*----------------------------------------------------------------*/
  286.     /*----------------------------------------------------------------*/
  287.     /* Code Body                                                      */
  288.     /*----------------------------------------------------------------*/
  289.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_MT_RINGING_END));
  290.     g_poc_cntx_p->abort_type = POC_ABORT_END;
  291.     ClearInputEventHandler(MMI_DEVICE_ALL);
  292.     mmi_poc_talk_answer_req(MMI_FALSE);
  293. }
  294. /*****************************************************************************
  295.  * FUNCTION
  296.  *  mmi_poc_entry_mt_ringing_answered
  297.  * DESCRIPTION
  298.  *  answered process screen for mt ringing
  299.  * PARAMETERS
  300.  *  void
  301.  * RETURNS
  302.  *  void
  303.  *****************************************************************************/
  304. void mmi_poc_entry_mt_ringing_answered(void)
  305. {
  306.     /*----------------------------------------------------------------*/
  307.     /* Local Variables                                                */
  308.     /*----------------------------------------------------------------*/
  309.     U8 *guiBuffer;
  310.     /*----------------------------------------------------------------*/
  311.     /* Code Body                                                      */
  312.     /*----------------------------------------------------------------*/
  313.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_MT_RINGING_ANSWERED));
  314.     EntryNewScreen(SCR_ID_POC_CM, mmi_poc_exit_mt_ringing_answered, mmi_poc_entry_mt_ringing_answered, NULL);
  315.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  316.     mmi_poc_remove_cm_screens();
  317.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  318.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_CM);
  319.     ShowCategory66Screen(
  320.         STR_ID_POC_MAIN,
  321.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  322.         0,
  323.         0,
  324.         STR_GLOBAL_ABORT,
  325.         IMG_GLOBAL_BACK,
  326.         (U8*) g_poc_cntx_p->cm_disp,
  327.         IMG_ID_POC_CM_MT_RINGING,
  328.         NULL);
  329.     mmi_poc_enter_cm_key_light();
  330.     SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  331.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  332. }
  333. /*****************************************************************************
  334.  * FUNCTION
  335.  *  mmi_poc_exit_mt_ringing_answered
  336.  * DESCRIPTION
  337.  *  exit function for mt ringing
  338.  * PARAMETERS
  339.  *  void
  340.  * RETURNS
  341.  *  void
  342.  *****************************************************************************/
  343. void mmi_poc_exit_mt_ringing_answered(void)
  344. {
  345.     /*----------------------------------------------------------------*/
  346.     /* Local Variables                                                */
  347.     /*----------------------------------------------------------------*/
  348.     /*----------------------------------------------------------------*/
  349.     /* Code Body                                                      */
  350.     /*----------------------------------------------------------------*/
  351.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_MT_RINGING_ANSWERED));
  352.     mmi_poc_exit_cm_key_light();
  353. }
  354. /*****************************************************************************
  355.  * FUNCTION
  356.  *  mmi_poc_talk_answer_req
  357.  * DESCRIPTION
  358.  *  talk answer request
  359.  * PARAMETERS
  360.  *  accept      [IN]        If user choose yes or no
  361.  * RETURNS
  362.  *  void
  363.  *****************************************************************************/
  364. void mmi_poc_talk_answer_req(U8 accept)
  365. {
  366.     /*----------------------------------------------------------------*/
  367.     /* Local Variables                                                */
  368.     /*----------------------------------------------------------------*/
  369.     MYQUEUE Message;
  370.     poc_talk_answer_req_struct *myMsgPtr;
  371.     /*----------------------------------------------------------------*/
  372.     /* Code Body                                                      */
  373.     /*----------------------------------------------------------------*/
  374.     myMsgPtr = (poc_talk_answer_req_struct*) OslConstructDataPtr(sizeof(poc_talk_answer_req_struct));
  375.     memset(
  376.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  377.         0,
  378.         sizeof(poc_talk_answer_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  379.     myMsgPtr->talk_id = g_poc_cntx_p->active_talk_id;
  380.     myMsgPtr->accept = (kal_bool) accept;
  381.     Message.oslSrcId = MOD_MMI;
  382.     Message.oslDestId = MOD_POC;
  383.     Message.oslMsgId = PRT_POC_TALK_ANSWER_REQ;
  384.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  385.     Message.oslPeerBuffPtr = NULL;
  386.     OslMsgSendExtQueue(&Message);
  387.     SetProtocolEventHandler(mmi_poc_talk_answer_rsp, PRT_POC_TALK_ANSWER_RSP);
  388. }
  389. /*****************************************************************************
  390.  * FUNCTION
  391.  *  mmi_poc_talk_answer_rsp
  392.  * DESCRIPTION
  393.  *  response for talk answer request
  394.  * PARAMETERS
  395.  *  info        [IN]        Local parameters from protocol
  396.  * RETURNS
  397.  *  void
  398.  *****************************************************************************/
  399. void mmi_poc_talk_answer_rsp(void *info)
  400. {
  401.     /*----------------------------------------------------------------*/
  402.     /* Local Variables                                                */
  403.     /*----------------------------------------------------------------*/
  404.     poc_talk_answer_rsp_struct *msgRsp;
  405.     /*----------------------------------------------------------------*/
  406.     /* Code Body                                                      */
  407.     /*----------------------------------------------------------------*/
  408.     msgRsp = (poc_talk_answer_rsp_struct*) info;
  409.     ClearProtocolEventHandler(PRT_POC_TALK_ANSWER_RSP);
  410.     g_poc_cntx_p->floor_idle_recved = MMI_TRUE;
  411.     if (g_poc_cntx_p->abort_type == POC_ABORT_BACK)
  412.     {
  413.         g_poc_cntx_p->call_status = POC_CALL_NONE;
  414.         MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  415.         DeleteScreenIfPresent(SCR_ID_POC_CM);
  416.         mmi_poc_remove_cm_screens();
  417.         if (GetActiveScreenId() == SCR_ID_POC_CM)
  418.         {
  419.             GoBackHistory();
  420.         }
  421.     }
  422.     else if (g_poc_cntx_p->abort_type == POC_ABORT_END)
  423.     {
  424.         g_poc_cntx_p->call_status = POC_CALL_NONE;
  425.         MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  426.         DeleteScreenIfPresent(SCR_ID_POC_CM);
  427.         mmi_poc_remove_cm_screens();
  428.         if (GetActiveScreenId() == SCR_ID_POC_CM)
  429.         {
  430.             DisplayIdleScreen();
  431.         }
  432.     }
  433.     else if (msgRsp->result == POC_OK)
  434.     {
  435.         mmi_poc_entry_connected_idle();
  436.     }
  437. }
  438. /*****************************************************************************
  439.  * FUNCTION
  440.  *  mmi_poc_disconnect_ind
  441.  * DESCRIPTION
  442.  *  disconnect indication handler
  443.  * PARAMETERS
  444.  *  info        [IN]        Local parameters from protocol
  445.  * RETURNS
  446.  *  void
  447.  *****************************************************************************/
  448. void mmi_poc_disconnect_ind(void *info)
  449. {
  450.     /*----------------------------------------------------------------*/
  451.     /* Local Variables                                                */
  452.     /*----------------------------------------------------------------*/
  453.     poc_talk_disconnect_ind_struct *msgRsp;
  454.     /*----------------------------------------------------------------*/
  455.     /* Code Body                                                      */
  456.     /*----------------------------------------------------------------*/
  457.     msgRsp = (poc_talk_disconnect_ind_struct*) info;
  458.     /* Clear all dynamic protocol handler */
  459.     ClearProtocolEventHandler(PRT_POC_REGISTER_RSP);
  460.     g_poc_cntx_p->call_status = POC_CALL_NONE;
  461.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  462.     /* Reset status only, poc task would stop encoding / decoding */
  463.     mmi_poc_reset_all_audio();
  464. }
  465. /*****************************************************************************
  466.  * FUNCTION
  467.  *  mmi_poc_disconnect_callback
  468.  * DESCRIPTION
  469.  *  disconnect call back
  470.  * PARAMETERS
  471.  *  void
  472.  * RETURNS
  473.  *  void
  474.  *****************************************************************************/
  475. void mmi_poc_disconnect_callback(void)
  476. {
  477.     /*----------------------------------------------------------------*/
  478.     /* Local Variables                                                */
  479.     /*----------------------------------------------------------------*/
  480.     /*----------------------------------------------------------------*/
  481.     /* Code Body                                                      */
  482.     /*----------------------------------------------------------------*/
  483.     if ((GetActiveScreenId() >= SCR_ID_POC_MAIN) && (GetActiveScreenId() < SCR_ID_POC_TOTAL))
  484.     {
  485.         DisplayPopup((U8*) GetString(STR_CALL_ENDED), IMG_GLOBAL_ERROR, 1, UI_POPUP_NOTIFYDURATION_TIME, (U8) NULL);
  486.     }
  487.     /* Clear all dynamic PoC screen */
  488.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  489.     mmi_poc_remove_cm_screens();
  490. }
  491. /*****************************************************************************
  492.  * FUNCTION
  493.  *  mmi_poc_entry_connected_idle
  494.  * DESCRIPTION
  495.  *  Connect idle screen
  496.  * PARAMETERS
  497.  *  void
  498.  * RETURNS
  499.  *  void
  500.  *****************************************************************************/
  501. void mmi_poc_entry_connected_idle(void)
  502. {
  503.     /*----------------------------------------------------------------*/
  504.     /* Local Variables                                                */
  505.     /*----------------------------------------------------------------*/
  506.     U8 *guiBuffer;
  507.     U8 i;
  508.     U8 *listItemsIcons[64];
  509.     /*----------------------------------------------------------------*/
  510.     /* Code Body                                                      */
  511.     /*----------------------------------------------------------------*/
  512.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_CONNECTED_IDLE));
  513.     EntryNewScreen(SCR_ID_POC_CM, mmi_poc_exit_connected_idle, mmi_poc_entry_connected_idle, NULL);
  514.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  515.     mmi_poc_remove_cm_screens();
  516.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  517.     memset(g_poc_cntx_p->cm_disp, 0, sizeof(g_poc_cntx_p->cm_disp));
  518.     if (strlen((S8*) g_poc_cntx_p->cm_talk_group_name))
  519.     {
  520.         AnsiiNToUnicodeString(
  521.             (S8*) g_poc_cntx_p->cm_disp,
  522.             (S8*) g_poc_cntx_p->cm_talk_group_name,
  523.             POC_MAX_DISP_LEN - 1);
  524.     }
  525.     else
  526.     {
  527.         UCS2Strcpy((S8*) g_poc_cntx_p->cm_disp, (S8*) GetString(STR_ID_POC_CM_CONNECTED_IDLE));
  528.     }
  529.     for (i = 0; i < g_poc_cntx_p->cm_talk_list_num; i++)
  530.     {
  531.         subMenuDataPtrs[i] = subMenuData[i];
  532.         memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
  533.         if (strlen((S8*) g_poc_cntx_p->cm_talk_list[i].name))
  534.         {
  535.             if (g_poc_cntx_p->cm_talk_list[i].name[0] == 0xFF)
  536.             {
  537.                 UCS2Strcpy((S8*) subMenuDataPtrs[0], (S8*) GetString(STR_ID_POC_CM_ANONYMOUS));
  538.             }
  539.             else
  540.             {
  541.                 mmi_poc_util_copy_with_dot(
  542.                     (S8*) g_poc_cntx_p->cm_talk_list[i].name,
  543.                     (S8*) subMenuDataPtrs[i],
  544.                     MAX_SUBMENU_CHARACTERS - 1);
  545.             }
  546.         }
  547.         else
  548.         {
  549.             mmi_poc_util_copy_with_dot(
  550.                 (S8*) g_poc_cntx_p->cm_talk_list[i].uri,
  551.                 (S8*) subMenuDataPtrs[i],
  552.                 MAX_SUBMENU_CHARACTERS - 1);
  553.         }
  554.     }
  555.     for (i = 0; i < g_poc_cntx_p->cm_talk_list_num; i++)
  556.     {
  557.         listItemsIcons[i] = (U8*) GetImage(gIndexIconsImageList[i]);
  558.     }
  559.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_CM);
  560.     /* RegisterHighlightHandler( ExecuteCurrHiliteHandler); */
  561.     ShowCategory174Screen(
  562.         g_poc_cntx_p->cm_disp,
  563.         (PU8) GetImage(GetRootTitleIcon(MENU_ID_POC_MAIN)),
  564.         (PU8) GetString(STR_GLOBAL_OPTIONS),
  565.         (PU8) GetImage(IMG_GLOBAL_OK),
  566.         (PU8) GetString(STR_GLOBAL_ABORT),
  567.         (PU8) GetImage(IMG_GLOBAL_BACK),
  568.         g_poc_cntx_p->cm_talk_list_num,
  569.         subMenuDataPtrs,
  570.         listItemsIcons,
  571.         NULL,
  572.         0,
  573.         0,
  574.         guiBuffer);
  575.     mmi_poc_enter_cm_key_light();
  576.     SetLeftSoftkeyFunction(mmi_poc_entry_talk_options, KEY_EVENT_UP);
  577.     SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  578.     /* SetKeyHandler(mmi_poc_disconnect_end,KEY_END,KEY_EVENT_DOWN); */
  579.     SetKeyHandler(mmi_poc_disconnect_back, KEY_END, KEY_EVENT_DOWN);
  580.     if (g_poc_cntx_p->floor_idle_recved == MMI_TRUE)
  581.     {
  582.         SetKeyHandler(mmi_poc_floor_take_key, KEY_SEND, KEY_EVENT_DOWN);
  583.     }
  584.     SetKeyHandler(mmi_poc_ptt_release, KEY_SEND, KEY_EVENT_UP);
  585. }
  586. /*****************************************************************************
  587.  * FUNCTION
  588.  *  mmi_poc_exit_connected_idle
  589.  * DESCRIPTION
  590.  *  exit function for connected idle screen
  591.  * PARAMETERS
  592.  *  void
  593.  * RETURNS
  594.  *  void
  595.  *****************************************************************************/
  596. void mmi_poc_exit_connected_idle(void)
  597. {
  598.     /*----------------------------------------------------------------*/
  599.     /* Local Variables                                                */
  600.     /*----------------------------------------------------------------*/
  601.     /*----------------------------------------------------------------*/
  602.     /* Code Body                                                      */
  603.     /*----------------------------------------------------------------*/
  604.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_CONNECTED_IDLE));
  605.     mmi_poc_exit_cm_key_light();
  606. }
  607. /*****************************************************************************
  608.  * FUNCTION
  609.  *  mmi_poc_entry_talk_options
  610.  * DESCRIPTION
  611.  *  talk options screen
  612.  * PARAMETERS
  613.  *  void
  614.  * RETURNS
  615.  *  void
  616.  *****************************************************************************/
  617. void mmi_poc_entry_talk_options(void)
  618. {
  619.     /*----------------------------------------------------------------*/
  620.     /* Local Variables                                                */
  621.     /*----------------------------------------------------------------*/
  622.     U16 nStrItemList[MAX_SUB_MENUS];
  623.     U16 nNumofItem = 0;
  624.     U8 *guiBuffer;
  625.     /*----------------------------------------------------------------*/
  626.     /* Code Body                                                      */
  627.     /*----------------------------------------------------------------*/
  628.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_TALK_OPTIONS));
  629.     EntryNewScreen(SCR_ID_POC_TALK_OPTION, NULL, mmi_poc_entry_talk_options, NULL);
  630.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_TALK_OPTION);
  631.     if (g_poc_cntx_p->talk_pres_ind_recved == POC_TALK_STATUS_NOT_READY)
  632.     {
  633.         nNumofItem = GetNumOfChild(MENU_ID_POC_CM_OPTION_PRES_NOT_READY);
  634.         GetSequenceStringIds(MENU_ID_POC_CM_OPTION_PRES_NOT_READY, nStrItemList);
  635.         SetParentHandler(MENU_ID_POC_CM_OPTION_PRES_NOT_READY);
  636.     }
  637.     else if (g_poc_cntx_p->talk_pres_ind_recved == POC_TALK_STATUS_ON)
  638.     {
  639.         nNumofItem = GetNumOfChild(MENU_ID_POC_CM_OPTION_PRES_UNSUBSCRIBE);
  640.         GetSequenceStringIds(MENU_ID_POC_CM_OPTION_PRES_UNSUBSCRIBE, nStrItemList);
  641.         SetParentHandler(MENU_ID_POC_CM_OPTION_PRES_UNSUBSCRIBE);
  642.     }
  643.     else if (g_poc_cntx_p->talk_pres_ind_recved == POC_TALK_STATUS_OFF)
  644.     {
  645.         nNumofItem = GetNumOfChild(MENU_ID_POC_CM_OPTION_PRES_SUBSCRIBE);
  646.         GetSequenceStringIds(MENU_ID_POC_CM_OPTION_PRES_SUBSCRIBE, nStrItemList);
  647.         SetParentHandler(MENU_ID_POC_CM_OPTION_PRES_SUBSCRIBE);
  648.     }
  649.     else
  650.     {
  651.         ASSERT(0);
  652.     }
  653.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  654.     ShowCategory52Screen(
  655.         STR_GLOBAL_OPTIONS,
  656.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  657.         STR_GLOBAL_OK,
  658.         IMG_GLOBAL_OK,
  659.         STR_GLOBAL_BACK,
  660.         IMG_GLOBAL_BACK,
  661.         nNumofItem,
  662.         nStrItemList,
  663.         (U16*) gIndexIconsImageList,
  664.         0,
  665.         0,
  666.         0,
  667.         guiBuffer);
  668.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  669.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  670. }
  671. /*****************************************************************************
  672.  * FUNCTION
  673.  *  mmi_poc_entry_cm_add_user
  674.  * DESCRIPTION
  675.  *  add user screen
  676.  * PARAMETERS
  677.  *  void
  678.  * RETURNS
  679.  *  void
  680.  *****************************************************************************/
  681. void mmi_poc_entry_cm_add_user(void)
  682. {
  683.     /*----------------------------------------------------------------*/
  684.     /* Local Variables                                                */
  685.     /*----------------------------------------------------------------*/
  686.     U16 nNumofItem;
  687.     U8 i = 0;
  688.     U8 *guiBuffer;
  689.     mmi_poc_contact_list_disp *cont;
  690.     /*----------------------------------------------------------------*/
  691.     /* Code Body                                                      */
  692.     /*----------------------------------------------------------------*/
  693.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_CM_ADD_USER));
  694.     mmi_poc_check_and_update_contact();
  695.     if (g_poc_cntx_p->contact_num == 0)
  696.     {
  697.         DisplayPopup(
  698.             (U8*) GetString(STR_GLOBAL_EMPTY),
  699.             IMG_GLOBAL_WARNING,
  700.             1,
  701.             UI_POPUP_NOTIFYDURATION_TIME,
  702.             (U8) WARNING_TONE);
  703.         return;
  704.     }
  705.     if (g_poc_cntx_p->in_call_inviting == MMI_TRUE)
  706.     {
  707.         DisplayPopup(
  708.             (U8*) GetString(STR_ID_POC_PROCESSING),
  709.             IMG_GLOBAL_WARNING,
  710.             1,
  711.             UI_POPUP_NOTIFYDURATION_TIME,
  712.             (U8) WARNING_TONE);
  713.         return;
  714.     }
  715.     EntryNewScreen(SCR_ID_POC_TALK_OPTION_ADD_USER, NULL, mmi_poc_entry_cm_add_user, NULL);
  716.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_TALK_OPTION_ADD_USER);
  717.     nNumofItem = g_poc_cntx_p->contact_num;
  718.     if (nNumofItem > POC_MAX_CONTACT_DISPLAY_NUM)
  719.     {
  720.         nNumofItem = POC_MAX_CONTACT_DISPLAY_NUM;
  721.     }
  722.     for (i = 0; i < nNumofItem; i++)
  723.     {
  724.         cont = &g_poc_cntx_p->contact_list_disp[i];
  725.         subMenuDataPtrs[i] = subMenuData[i];
  726.         memset((S8*) subMenuDataPtrs[i], 0, MAX_SUB_MENU_SIZE);
  727.         if (strlen((S8*) g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id].display_name))
  728.         {
  729.             AnsiiNToUnicodeString(
  730.                 (S8*) subMenuDataPtrs[i],
  731.                 (S8*) g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id]. display_name,
  732.                 MAX_SUBMENU_CHARACTERS - 1);
  733.         }
  734.         else
  735.         {
  736.             AnsiiNToUnicodeString(
  737.                 (S8*) subMenuDataPtrs[i],
  738.                 (S8*) g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id].uri,
  739.                 MAX_SUBMENU_CHARACTERS - 1);
  740.         }
  741.     }
  742.     SetParentHandler(MENU_ID_POC_CM_ADD_USER);
  743.     /* RegisterHighlightHandler(ExecuteCurrHiliteHandler); */
  744.     if (guiBuffer == NULL)
  745.     {
  746.         memset(g_poc_cntx_p->adhoc_sel_disp, 0, sizeof(U8) * POC_MAX_CONTACT_DISPLAY_NUM);
  747.     }
  748.     SetCheckboxToggleRightSoftkeyFunctions(mmi_poc_entry_cm_add_user_cfrm, GoBackHistory);
  749.     ShowCategory140Screen(
  750.         STR_ID_POC_CONTACTS,
  751.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  752.         nNumofItem,
  753.         (U8 **) subMenuDataPtrs,
  754.         g_poc_cntx_p->adhoc_sel_disp,
  755.         0,
  756.         guiBuffer);
  757.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  758. }
  759. /*****************************************************************************
  760.  * FUNCTION
  761.  *  mmi_poc_entry_cm_add_user_cfrm
  762.  * DESCRIPTION
  763.  *  add user confirm screen
  764.  * PARAMETERS
  765.  *  void
  766.  * RETURNS
  767.  *  void
  768.  *****************************************************************************/
  769. void mmi_poc_entry_cm_add_user_cfrm(void)
  770. {
  771.     /*----------------------------------------------------------------*/
  772.     /* Local Variables                                                */
  773.     /*----------------------------------------------------------------*/
  774.     /*----------------------------------------------------------------*/
  775.     /* Code Body                                                      */
  776.     /*----------------------------------------------------------------*/
  777.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_CM_ADD_USER_CFRM));
  778.     DisplayConfirm(
  779.         STR_GLOBAL_YES,
  780.         IMG_GLOBAL_YES,
  781.         STR_GLOBAL_NO,
  782.         IMG_GLOBAL_NO,
  783.         get_string(STR_GLOBAL_DIAL),
  784.         IMG_GLOBAL_QUESTION,
  785.         WARNING_TONE);
  786.     SetLeftSoftkeyFunction(mmi_poc_cm_add_user, KEY_EVENT_UP);
  787.     SetRightSoftkeyFunction(mmi_poc_cm_add_user_back, KEY_EVENT_UP);
  788. }
  789. /*****************************************************************************
  790.  * FUNCTION
  791.  *  mmi_poc_cm_add_user_back
  792.  * DESCRIPTION
  793.  *  add user back key handler
  794.  * PARAMETERS
  795.  *  void
  796.  * RETURNS
  797.  *  void
  798.  *****************************************************************************/
  799. void mmi_poc_cm_add_user_back(void)
  800. {
  801.     /*----------------------------------------------------------------*/
  802.     /* Local Variables                                                */
  803.     /*----------------------------------------------------------------*/
  804.     /*----------------------------------------------------------------*/
  805.     /* Code Body                                                      */
  806.     /*----------------------------------------------------------------*/
  807.     stopRequestedTone(WARNING_TONE);
  808.     DeleteScreenIfPresent(SCR_ID_POC_TALK_OPTION_ADD_USER);
  809.     GoBackHistory();
  810. }
  811. /*****************************************************************************
  812.  * FUNCTION
  813.  *  mmi_poc_cm_add_user
  814.  * DESCRIPTION
  815.  *  add user request
  816.  * PARAMETERS
  817.  *  void
  818.  * RETURNS
  819.  *  void
  820.  *****************************************************************************/
  821. void mmi_poc_cm_add_user(void)
  822. {
  823.     /*----------------------------------------------------------------*/
  824.     /* Local Variables                                                */
  825.     /*----------------------------------------------------------------*/
  826.     poc_addr_struct callee[POC_MAX_ADDR_NUM];
  827.     U8 i, total_adhoc_num = 0;
  828.     mmi_poc_contact_list_disp *cont;
  829.     /*----------------------------------------------------------------*/
  830.     /* Code Body                                                      */
  831.     /*----------------------------------------------------------------*/
  832.     memset(callee, 0, sizeof(callee));
  833.     for (i = 0; i < POC_MAX_CONTACT_DISPLAY_NUM; i++)
  834.     {
  835.         cont = &g_poc_cntx_p->contact_list_disp[i];
  836.         if (g_poc_cntx_p->adhoc_sel_disp[i] == MMI_TRUE)
  837.         {
  838.             if (total_adhoc_num >= POC_MAX_ADDR_NUM)
  839.             {
  840.                 DisplayPopup(
  841.                     (U8*) GetString(STR_ID_POC_ERR_MAXIMUM_REACHED),
  842.                     IMG_GLOBAL_UNFINISHED,
  843.                     1,
  844.                     UI_POPUP_NOTIFYDURATION_TIME,
  845.                     (U8) ERROR_TONE);
  846.                 DeleteScreenIfPresent(SCR_ID_POC_TALK_OPTION_ADD_USER);
  847.                 return;
  848.             }
  849.             memcpy(
  850.                 &callee[total_adhoc_num].uri,
  851.                 &g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id].uri,
  852.                 sizeof(U8) * POC_MAX_URI_LEN);
  853.             total_adhoc_num++;
  854.         }
  855.     }
  856.     g_poc_cntx_p->in_call_inviting = MMI_TRUE;
  857.     mmi_poc_talk_invite_req(POC_AD_HOC_GROUP_TALK, total_adhoc_num, callee, g_poc_cntx_p->active_talk_id, MMI_TRUE, 0);
  858.     g_poc_cntx_p->floor_idle_recved = MMI_TRUE;
  859.     SetProtocolEventHandler(mmi_poc_in_call_invite_rsp, PRT_POC_TALK_INVITE_RSP);
  860.     DeleteUptoScrID(SCR_ID_POC_CM);
  861.     GoBackHistory();
  862. }
  863. /*****************************************************************************
  864.  * FUNCTION
  865.  *  mmi_poc_in_call_invite_rsp
  866.  * DESCRIPTION
  867.  *  response for call invite
  868.  * PARAMETERS
  869.  *  info        [IN]        Local parameters from protocol
  870.  * RETURNS
  871.  *  void
  872.  *****************************************************************************/
  873. void mmi_poc_in_call_invite_rsp(void *info)
  874. {
  875.     /*----------------------------------------------------------------*/
  876.     /* Local Variables                                                */
  877.     /*----------------------------------------------------------------*/
  878.     poc_talk_invite_rsp_struct *msgRsp;
  879.     /*----------------------------------------------------------------*/
  880.     /* Code Body                                                      */
  881.     /*----------------------------------------------------------------*/
  882.     msgRsp = (poc_talk_invite_rsp_struct*) info;
  883.     g_poc_cntx_p->in_call_inviting = MMI_FALSE;
  884.     ClearProtocolEventHandler(PRT_POC_TALK_INVITE_RSP);
  885.     if (msgRsp->result == POC_OK)
  886.     {
  887.         if (GetActiveScreenId() == SCR_ID_POC_CM)
  888.         {
  889.             DisplayPopup(
  890.                 (U8*) GetString(STR_ID_POC_INVITING_SUCCESS),
  891.                 IMG_GLOBAL_ACTIVATED,
  892.                 1,
  893.                 UI_POPUP_NOTIFYDURATION_TIME,
  894.                 (U8) SUCCESS_TONE);
  895.         }
  896.     }
  897.     else
  898.     {
  899.         if (GetActiveScreenId() == SCR_ID_POC_CM)
  900.         {
  901.             DisplayPopup(
  902.                 (U8*) GetString(STR_ID_POC_INVITING_FAIL),
  903.                 IMG_GLOBAL_UNFINISHED,
  904.                 1,
  905.                 UI_POPUP_NOTIFYDURATION_TIME,
  906.                 (U8) ERROR_TONE);
  907.         }
  908.     }
  909. }
  910. /*****************************************************************************
  911.  * FUNCTION
  912.  *  mmi_poc_floor_take_key
  913.  * DESCRIPTION
  914.  *  floor take key handler
  915.  * PARAMETERS
  916.  *  void
  917.  * RETURNS
  918.  *  void
  919.  *****************************************************************************/
  920. void mmi_poc_floor_take_key(void)
  921. {
  922.     /*----------------------------------------------------------------*/
  923.     /* Local Variables                                                */
  924.     /*----------------------------------------------------------------*/
  925.     /*----------------------------------------------------------------*/
  926.     /* Code Body                                                      */
  927.     /*----------------------------------------------------------------*/
  928.     if (g_poc_cntx_p->ptt_button_status != POC_PTT_DOWN)
  929.     {
  930.         MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_FLOOR_TAKE_KEY));
  931.         ClearInputEventHandler(MMI_DEVICE_ALL);
  932.         SetKeyHandler(mmi_poc_ptt_release, KEY_SEND, KEY_EVENT_UP);
  933.         SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  934.         SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  935.         mmi_poc_floor_take_req();
  936.     }
  937. }
  938. /*****************************************************************************
  939.  * FUNCTION
  940.  *  mmi_poc_floor_grant_ind
  941.  * DESCRIPTION
  942.  *  floor grant indication
  943.  * PARAMETERS
  944.  *  info        [IN]        Local parameters from protocol
  945.  * RETURNS
  946.  *  void
  947.  *****************************************************************************/
  948. void mmi_poc_floor_grant_ind(void *info)
  949. {
  950.     /*----------------------------------------------------------------*/
  951.     /* Local Variables                                                */
  952.     /*----------------------------------------------------------------*/
  953.     poc_floor_grant_ind_struct *msgRsp;
  954.     /*----------------------------------------------------------------*/
  955.     /* Code Body                                                      */
  956.     /*----------------------------------------------------------------*/
  957.     if (isInCall() && (g_poc_cntx_p->call_status != POC_CALL_PROGRESSING))
  958.     {
  959.         switch (g_poc_cntx_p->audio_status)
  960.         {
  961.             case POC_AUDIO_NONE:
  962.                 mmi_poc_talk_disconnect_req();
  963.                 break;
  964.             case POC_AUDIO_ENCODING:
  965.                 mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  966.                 break;
  967.             case POC_AUDIO_DECODING:
  968.                 mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  969.                 break;
  970.             default:
  971.                 break;
  972.         }
  973.         return;
  974.     }
  975.     msgRsp = (poc_floor_grant_ind_struct*) info;
  976.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  977.     if (g_poc_cntx_p->call_status != POC_CALL_ACTIVE)
  978.     {
  979.         return;
  980.     }
  981.     g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  982.     if (g_poc_cntx_p->ptt_button_status != POC_PTT_DOWN)
  983.     {
  984.         SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  985.         SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  986.         mmi_poc_floor_release_req();
  987.         return;
  988.     }
  989.     switch (g_poc_cntx_p->audio_status)
  990.     {
  991.         case POC_AUDIO_NONE:
  992.             mmi_poc_audio_encode_start();
  993.             break;
  994.         case POC_AUDIO_ENCODING:
  995.             break;
  996.         case POC_AUDIO_DECODING:
  997.             mmi_poc_audio_decode_stop(mmi_poc_audio_encode_start);
  998.             break;
  999.         default:
  1000.             break;
  1001.     }
  1002. }
  1003. /*****************************************************************************
  1004.  * FUNCTION
  1005.  *  mmi_poc_floor_deny_ind
  1006.  * DESCRIPTION
  1007.  *  floor deny indication
  1008.  * PARAMETERS
  1009.  *  info        [IN]        Local parameters from protocol
  1010.  * RETURNS
  1011.  *  void
  1012.  *****************************************************************************/
  1013. void mmi_poc_floor_deny_ind(void *info)
  1014. {
  1015.     /*----------------------------------------------------------------*/
  1016.     /* Local Variables                                                */
  1017.     /*----------------------------------------------------------------*/
  1018.     poc_floor_deny_ind_struct *msgRsp;
  1019.     /*----------------------------------------------------------------*/
  1020.     /* Code Body                                                      */
  1021.     /*----------------------------------------------------------------*/
  1022.     if (isInCall() && (g_poc_cntx_p->call_status != POC_CALL_PROGRESSING))
  1023.     {
  1024.         switch (g_poc_cntx_p->audio_status)
  1025.         {
  1026.             case POC_AUDIO_NONE:
  1027.                 mmi_poc_talk_disconnect_req();
  1028.                 break;
  1029.             case POC_AUDIO_ENCODING:
  1030.                 mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  1031.                 break;
  1032.             case POC_AUDIO_DECODING:
  1033.                 mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  1034.                 break;
  1035.             default:
  1036.                 break;
  1037.         }
  1038.         return;
  1039.     }
  1040.     msgRsp = (poc_floor_deny_ind_struct*) info;
  1041.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  1042.     if (g_poc_cntx_p->call_status != POC_CALL_ACTIVE)
  1043.     {
  1044.         return;
  1045.     }
  1046.     g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  1047.     switch (g_poc_cntx_p->audio_status)
  1048.     {
  1049.         case POC_AUDIO_NONE:
  1050.             if (GetActiveScreenId() == SCR_ID_POC_CM)
  1051.             {
  1052.                 mmi_poc_show_error_cause((kal_int32) msgRsp->cause, 0);
  1053.             }
  1054.             if (IsScreenPresent(SCR_ID_POC_CM))
  1055.             {
  1056.                 HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_connected_idle);
  1057.             }
  1058.             else
  1059.             {
  1060.                 mmi_poc_entry_connected_idle();
  1061.             }
  1062.             break;
  1063.         case POC_AUDIO_ENCODING:
  1064.             mmi_poc_audio_encode_stop(NULL);
  1065.             break;
  1066.         case POC_AUDIO_DECODING:
  1067.             break;
  1068.         default:
  1069.             break;
  1070.     }
  1071. }
  1072. /*****************************************************************************
  1073.  * FUNCTION
  1074.  *  mmi_poc_floor_taken_ind
  1075.  * DESCRIPTION
  1076.  *  floor take indication
  1077.  * PARAMETERS
  1078.  *  info        [IN]        Local parameters from protocol
  1079.  * RETURNS
  1080.  *  void
  1081.  *****************************************************************************/
  1082. void mmi_poc_floor_taken_ind(void *info)
  1083. {
  1084.     /*----------------------------------------------------------------*/
  1085.     /* Local Variables                                                */
  1086.     /*----------------------------------------------------------------*/
  1087.     poc_floor_taken_ind_struct *msgRsp;
  1088.     U8 temp_buf[POC_MAX_DISP_LEN * ENCODING_LENGTH];
  1089.     /*----------------------------------------------------------------*/
  1090.     /* Code Body                                                      */
  1091.     /*----------------------------------------------------------------*/
  1092.     if (isInCall() && (g_poc_cntx_p->call_status != POC_CALL_PROGRESSING))
  1093.     {
  1094.         switch (g_poc_cntx_p->audio_status)
  1095.         {
  1096.             case POC_AUDIO_NONE:
  1097.                 mmi_poc_talk_disconnect_req();
  1098.                 break;
  1099.             case POC_AUDIO_ENCODING:
  1100.                 mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  1101.                 break;
  1102.             case POC_AUDIO_DECODING:
  1103.                 mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  1104.                 break;
  1105.             default:
  1106.                 break;
  1107.         }
  1108.         return;
  1109.     }
  1110.     msgRsp = (poc_floor_taken_ind_struct*) info;
  1111.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  1112.     if (g_poc_cntx_p->call_status != POC_CALL_ACTIVE)
  1113.     {
  1114.         return;
  1115.     }
  1116.     g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  1117.     memset(g_poc_cntx_p->cm_disp, 0, sizeof(g_poc_cntx_p->cm_disp));
  1118.     UCS2Strcpy((S8*) g_poc_cntx_p->cm_disp, (S8*) GetString(STR_ID_POC_CM_LISTENING));
  1119.     if (msgRsp->talker_present == KAL_TRUE)
  1120.     {
  1121.         if (msgRsp->talker.disp_charset == 4)
  1122.         {
  1123.             msgRsp->talker.disp_name[POC_MAX_DISP_LEN - 1] = 0;
  1124.             msgRsp->talker.disp_name[POC_MAX_DISP_LEN - 2] = 0;
  1125.             msgRsp->talker.disp_name[POC_MAX_DISP_LEN - 3] = 0;
  1126.             UCS2Strcat((S8*) g_poc_cntx_p->cm_disp, (S8*) msgRsp->talker.disp_name);
  1127.         }
  1128.         else
  1129.         {
  1130.             msgRsp->talker.disp_name[POC_MAX_DISP_LEN / 2] = 0;
  1131.             AnsiiNToUnicodeString((S8*) temp_buf, (S8*) msgRsp->talker.disp_name, POC_MAX_DISP_LEN - 1);
  1132.             UCS2Strcat((S8*) g_poc_cntx_p->cm_disp, (S8*) temp_buf);
  1133.         }
  1134.     }
  1135.     switch (g_poc_cntx_p->audio_status)
  1136.     {
  1137.         case POC_AUDIO_NONE:
  1138.             mmi_poc_audio_decode_start();
  1139.             break;
  1140.         case POC_AUDIO_ENCODING:
  1141.             mmi_poc_audio_encode_stop(mmi_poc_audio_decode_start);
  1142.             break;
  1143.         case POC_AUDIO_DECODING:
  1144.             break;
  1145.         default:
  1146.             break;
  1147.     }
  1148. }
  1149. /*****************************************************************************
  1150.  * FUNCTION
  1151.  *  mmi_poc_floor_idle_ind
  1152.  * DESCRIPTION
  1153.  *  floor idle indication
  1154.  * PARAMETERS
  1155.  *  info        [IN]        Local parameters from protocol
  1156.  * RETURNS
  1157.  *  void
  1158.  *****************************************************************************/
  1159. void mmi_poc_floor_idle_ind(void *info)
  1160. {
  1161.     /*----------------------------------------------------------------*/
  1162.     /* Local Variables                                                */
  1163.     /*----------------------------------------------------------------*/
  1164.     poc_floor_idle_ind_struct *msgRsp;
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Code Body                                                      */
  1167.     /*----------------------------------------------------------------*/
  1168.     if (isInCall() && (g_poc_cntx_p->call_status != POC_CALL_PROGRESSING))
  1169.     {
  1170.         switch (g_poc_cntx_p->audio_status)
  1171.         {
  1172.             case POC_AUDIO_NONE:
  1173.                 mmi_poc_talk_disconnect_req();
  1174.                 break;
  1175.             case POC_AUDIO_ENCODING:
  1176.                 mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  1177.                 break;
  1178.             case POC_AUDIO_DECODING:
  1179.                 mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  1180.                 break;
  1181.             default:
  1182.                 break;
  1183.         }
  1184.         return;
  1185.     }
  1186.     msgRsp = (poc_floor_idle_ind_struct*) info;
  1187.     g_poc_cntx_p->floor_idle_recved = MMI_TRUE;
  1188.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  1189.     if (g_poc_cntx_p->call_status != POC_CALL_ACTIVE)
  1190.     {
  1191.         return;
  1192.     }
  1193.     g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  1194.     switch (g_poc_cntx_p->audio_status)
  1195.     {
  1196.         case POC_AUDIO_NONE:
  1197.             if (IsScreenPresent(SCR_ID_POC_CM))
  1198.             {
  1199.                 HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_connected_idle);
  1200.             }
  1201.             else
  1202.             {
  1203.                 mmi_poc_entry_connected_idle();
  1204.             }
  1205.             break;
  1206.         case POC_AUDIO_ENCODING:
  1207.             mmi_poc_audio_encode_stop(NULL);
  1208.             break;
  1209.         case POC_AUDIO_DECODING:
  1210.             mmi_poc_audio_decode_stop(NULL);
  1211.             break;
  1212.         default:
  1213.             break;
  1214.     }
  1215. }
  1216. /*****************************************************************************
  1217.  * FUNCTION
  1218.  *  mmi_poc_floor_revoke_ind
  1219.  * DESCRIPTION
  1220.  *  floor revoke indication
  1221.  * PARAMETERS
  1222.  *  info        [IN]        Local parameters from protocol
  1223.  * RETURNS
  1224.  *  void
  1225.  *****************************************************************************/
  1226. void mmi_poc_floor_revoke_ind(void *info)
  1227. {
  1228.     /*----------------------------------------------------------------*/
  1229.     /* Local Variables                                                */
  1230.     /*----------------------------------------------------------------*/
  1231.     poc_floor_revoke_ind_struct *msgRsp;
  1232.     /*----------------------------------------------------------------*/
  1233.     /* Code Body                                                      */
  1234.     /*----------------------------------------------------------------*/
  1235.     if (isInCall() && (g_poc_cntx_p->call_status != POC_CALL_PROGRESSING))
  1236.     {
  1237.         switch (g_poc_cntx_p->audio_status)
  1238.         {
  1239.             case POC_AUDIO_NONE:
  1240.                 mmi_poc_talk_disconnect_req();
  1241.                 break;
  1242.             case POC_AUDIO_ENCODING:
  1243.                 mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  1244.                 break;
  1245.             case POC_AUDIO_DECODING:
  1246.                 mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  1247.                 break;
  1248.             default:
  1249.                 break;
  1250.         }
  1251.         return;
  1252.     }
  1253.     msgRsp = (poc_floor_revoke_ind_struct*) info;
  1254.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  1255.     if (g_poc_cntx_p->call_status != POC_CALL_ACTIVE)
  1256.     {
  1257.         return;
  1258.     }
  1259.     g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  1260.     g_poc_cntx_p->general_err_cause = (S32) msgRsp->cause;
  1261.     mmi_poc_entry_revoke();
  1262.     mmi_poc_audio_encode_stop(mmi_poc_floor_release_req);
  1263. }
  1264. /*****************************************************************************
  1265.  * FUNCTION
  1266.  *  mmi_poc_entry_revoke
  1267.  * DESCRIPTION
  1268.  *  handler for floor revoke
  1269.  * PARAMETERS
  1270.  *  void
  1271.  * RETURNS
  1272.  *  void
  1273.  *****************************************************************************/
  1274. void mmi_poc_entry_revoke(void)
  1275. {
  1276.     /*----------------------------------------------------------------*/
  1277.     /* Local Variables                                                */
  1278.     /*----------------------------------------------------------------*/
  1279.     /*----------------------------------------------------------------*/
  1280.     /* Code Body                                                      */
  1281.     /*----------------------------------------------------------------*/
  1282.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_REVOKE));
  1283.     EntryNewScreen(SCR_ID_POC_CM, NULL, mmi_poc_entry_revoke, NULL);
  1284.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  1285.     mmi_poc_remove_cm_screens();
  1286.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  1287.     switch (g_poc_cntx_p->general_err_cause)
  1288.     {
  1289.         case POC_FLOOR_ALREADY_IN_USE:
  1290.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_FLOOR_ALREADY_IN_USE), IMG_GLOBAL_ERROR, NULL);
  1291.             break;
  1292.         case POC_SERVER_INT_ERROR:
  1293.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_SERVER_INT_ERROR), IMG_GLOBAL_ERROR, NULL);
  1294.             break;
  1295.         case POC_ONLY_ONE_USER:
  1296.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_ONLY_ONE_USER), IMG_GLOBAL_ERROR, NULL);
  1297.             break;
  1298.         case POC_FLOOR_RETRY_AFTER:
  1299.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_FLOOR_RETRY_AFTER), IMG_GLOBAL_ERROR, NULL);
  1300.             break;
  1301.         case POC_LISTEN_ONLY:
  1302.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_LISTEN_ONLY), IMG_GLOBAL_ERROR, NULL);
  1303.             break;
  1304.         case POC_TALK_TOO_LONG:
  1305.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_TALK_TOO_LONG), IMG_GLOBAL_ERROR, NULL);
  1306.             break;
  1307.         case POC_NO_FLOOR_PERMISSION:
  1308.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_NO_FLOOR_PERMISSION), IMG_GLOBAL_ERROR, NULL);
  1309.             break;
  1310.         case POC_FLOOR_PREEMPTED:
  1311.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_FLOOR_PREEMPTED), IMG_GLOBAL_ERROR, NULL);
  1312.             break;
  1313.         default:
  1314.             ShowCategory65Screen((U8*) GetString(STR_ID_POC_ERR_FLOOR_LOST), IMG_GLOBAL_ERROR, NULL);
  1315.             break;
  1316.     }
  1317.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1318.     SetKeyHandler(0, KEY_END, KEY_EVENT_DOWN);
  1319. }
  1320. /*****************************************************************************
  1321.  * FUNCTION
  1322.  *  mmi_poc_floor_take_req
  1323.  * DESCRIPTION
  1324.  *  floor take request
  1325.  * PARAMETERS
  1326.  *  void
  1327.  * RETURNS
  1328.  *  void
  1329.  *****************************************************************************/
  1330. void mmi_poc_floor_take_req(void)
  1331. {
  1332.     /*----------------------------------------------------------------*/
  1333.     /* Local Variables                                                */
  1334.     /*----------------------------------------------------------------*/
  1335.     MYQUEUE Message;
  1336.     poc_floor_take_req_struct *myMsgPtr;
  1337.     /*----------------------------------------------------------------*/
  1338.     /* Code Body                                                      */
  1339.     /*----------------------------------------------------------------*/
  1340.     g_poc_cntx_p->ptt_button_status = POC_PTT_DOWN;
  1341.     myMsgPtr = (poc_floor_take_req_struct*) OslConstructDataPtr(sizeof(poc_floor_take_req_struct));
  1342.     memset(
  1343.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1344.         0,
  1345.         sizeof(poc_floor_take_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1346.     myMsgPtr->talk_id = g_poc_cntx_p->active_talk_id;
  1347.     Message.oslSrcId = MOD_MMI;
  1348.     Message.oslDestId = MOD_POC;
  1349.     Message.oslMsgId = PRT_POC_FLOOR_TAKE_REQ;
  1350.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1351.     Message.oslPeerBuffPtr = NULL;
  1352.     OslMsgSendExtQueue(&Message);
  1353. }
  1354. /*****************************************************************************
  1355.  * FUNCTION
  1356.  *  mmi_poc_floor_release_req
  1357.  * DESCRIPTION
  1358.  *  floor release request
  1359.  * PARAMETERS
  1360.  *  void
  1361.  * RETURNS
  1362.  *  void
  1363.  *****************************************************************************/
  1364. void mmi_poc_floor_release_req(void)
  1365. {
  1366.     /*----------------------------------------------------------------*/
  1367.     /* Local Variables                                                */
  1368.     /*----------------------------------------------------------------*/
  1369.     MYQUEUE Message;
  1370.     poc_floor_release_req_struct *myMsgPtr;
  1371.     /*----------------------------------------------------------------*/
  1372.     /* Code Body                                                      */
  1373.     /*----------------------------------------------------------------*/
  1374.     ClearInputEventHandler(MMI_DEVICE_ALL); /* Assumption: There must be indications coming back. */
  1375.     g_poc_cntx_p->ptt_button_status = POC_PTT_UP;
  1376.     myMsgPtr = (poc_floor_release_req_struct*) OslConstructDataPtr(sizeof(poc_floor_release_req_struct));
  1377.     memset(
  1378.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1379.         0,
  1380.         sizeof(poc_floor_release_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1381.     myMsgPtr->talk_id = g_poc_cntx_p->active_talk_id;
  1382.     Message.oslSrcId = MOD_MMI;
  1383.     Message.oslDestId = MOD_POC;
  1384.     Message.oslMsgId = PRT_POC_FLOOR_RELEASE_REQ;
  1385.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1386.     Message.oslPeerBuffPtr = NULL;
  1387.     OslMsgSendExtQueue(&Message);
  1388. }
  1389. /*****************************************************************************
  1390.  * FUNCTION
  1391.  *  mmi_poc_audio_encode_start
  1392.  * DESCRIPTION
  1393.  *  audio encode start
  1394.  * PARAMETERS
  1395.  *  void
  1396.  * RETURNS
  1397.  *  void
  1398.  *****************************************************************************/
  1399. void mmi_poc_audio_encode_start(void)
  1400. {
  1401.     /*----------------------------------------------------------------*/
  1402.     /* Local Variables                                                */
  1403.     /*----------------------------------------------------------------*/
  1404.     /*----------------------------------------------------------------*/
  1405.     /* Code Body                                                      */
  1406.     /*----------------------------------------------------------------*/
  1407.     AudioPlayReq(POC_TALK_TONE, DEVICE_AUDIO_PLAY_ONCE);
  1408.     StartTimer(POC_IND_TIMER, 300, mmi_poc_media_start_encode);
  1409. }
  1410. /*****************************************************************************
  1411.  * FUNCTION
  1412.  *  mmi_poc_audio_encode_stop
  1413.  * DESCRIPTION
  1414.  *  audio encode stop
  1415.  * PARAMETERS
  1416.  *  callback        [IN]        
  1417.  * RETURNS
  1418.  *  void
  1419.  *****************************************************************************/
  1420. void mmi_poc_audio_encode_stop(FuncPtr callback)
  1421. {
  1422.     /*----------------------------------------------------------------*/
  1423.     /* Local Variables                                                */
  1424.     /*----------------------------------------------------------------*/
  1425.     /*----------------------------------------------------------------*/
  1426.     /* Code Body                                                      */
  1427.     /*----------------------------------------------------------------*/
  1428.     g_poc_cntx_p->media_stop_encode_callback = callback;
  1429.     mmi_poc_media_stop_encode();
  1430. }
  1431. /*****************************************************************************
  1432.  * FUNCTION
  1433.  *  mmi_poc_audio_decode_start
  1434.  * DESCRIPTION
  1435.  *  audio decode start
  1436.  * PARAMETERS
  1437.  *  void
  1438.  * RETURNS
  1439.  *  void
  1440.  *****************************************************************************/
  1441. void mmi_poc_audio_decode_start(void)
  1442. {
  1443.     /*----------------------------------------------------------------*/
  1444.     /* Local Variables                                                */
  1445.     /*----------------------------------------------------------------*/
  1446.     /*----------------------------------------------------------------*/
  1447.     /* Code Body                                                      */
  1448.     /*----------------------------------------------------------------*/
  1449.     mdi_audio_set_headset_mode_output_path(MDI_DEVICE_SPEAKER2);
  1450.     mmi_poc_media_start_decode();
  1451. }
  1452. /*****************************************************************************
  1453.  * FUNCTION
  1454.  *  mmi_poc_audio_decode_stop
  1455.  * DESCRIPTION
  1456.  *  audio decode stop
  1457.  * PARAMETERS
  1458.  *  callback        [IN]        
  1459.  * RETURNS
  1460.  *  void
  1461.  *****************************************************************************/
  1462. void mmi_poc_audio_decode_stop(FuncPtr callback)
  1463. {
  1464.     /*----------------------------------------------------------------*/
  1465.     /* Local Variables                                                */
  1466.     /*----------------------------------------------------------------*/
  1467.     /*----------------------------------------------------------------*/
  1468.     /* Code Body                                                      */
  1469.     /*----------------------------------------------------------------*/
  1470.     g_poc_cntx_p->media_stop_decode_callback = callback;
  1471.     mmi_poc_media_stop_decode();
  1472. }
  1473. /*****************************************************************************
  1474.  * FUNCTION
  1475.  *  mmi_poc_media_start_encode
  1476.  * DESCRIPTION
  1477.  *  media start encode
  1478.  * PARAMETERS
  1479.  *  void
  1480.  * RETURNS
  1481.  *  void
  1482.  *****************************************************************************/
  1483. void mmi_poc_media_start_encode(void)
  1484. {
  1485.     /*----------------------------------------------------------------*/
  1486.     /* Local Variables                                                */
  1487.     /*----------------------------------------------------------------*/
  1488.     mdi_result mdi_res;
  1489.     /*----------------------------------------------------------------*/
  1490.     /* Code Body                                                      */
  1491.     /*----------------------------------------------------------------*/
  1492.     AudioStopReq(POC_TALK_TONE);
  1493.     if (g_poc_cntx_p->ptt_button_status != POC_PTT_DOWN)
  1494.     {
  1495.         SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  1496.         SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  1497.         mmi_poc_floor_release_req();
  1498.         return;
  1499.     }
  1500.     g_poc_cntx_p->audio_status = POC_AUDIO_ENCODING;
  1501.     mdi_res = mdi_audio_poc_start_encode(mmi_poc_mdi_start_encode_callback);
  1502.     if (mdi_res == MDI_AUDIO_SUCCESS)
  1503.     {
  1504.         if (g_poc_cntx_p->ptt_button_status == POC_PTT_UP)
  1505.         {
  1506.             SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  1507.             SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  1508.             mmi_poc_audio_encode_stop(mmi_poc_floor_release_req);
  1509.         }
  1510.         else
  1511.         {
  1512.             if (IsScreenPresent(SCR_ID_POC_CM))
  1513.             {
  1514.                 HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_talking);
  1515.             }
  1516.             else
  1517.             {
  1518.                 mmi_poc_entry_talking();
  1519.             }
  1520.         }
  1521.     }
  1522.     else
  1523.     {
  1524.         g_poc_cntx_p->audio_status = POC_AUDIO_NONE;
  1525.         if (GetActiveScreenId() == SCR_ID_POC_CM)
  1526.         {
  1527.             DisplayPopup(
  1528.                 (U8*) GetString(STR_GLOBAL_ERROR),
  1529.                 IMG_GLOBAL_ERROR,
  1530.                 1,
  1531.                 UI_POPUP_NOTIFYDURATION_TIME,
  1532.                 (U8) ERROR_TONE);
  1533.         }
  1534.     }
  1535. }
  1536. /*****************************************************************************
  1537.  * FUNCTION
  1538.  *  mmi_poc_mdi_start_encode_callback
  1539.  * DESCRIPTION
  1540.  *  mdi start encode callback
  1541.  * PARAMETERS
  1542.  *  result      [IN]        
  1543.  * RETURNS
  1544.  *  void
  1545.  *****************************************************************************/
  1546. void mmi_poc_mdi_start_encode_callback(mdi_result result)
  1547. {
  1548.     /*----------------------------------------------------------------*/
  1549.     /* Local Variables                                                */
  1550.     /*----------------------------------------------------------------*/
  1551.     /*----------------------------------------------------------------*/
  1552.     /* Code Body                                                      */
  1553.     /*----------------------------------------------------------------*/
  1554. }
  1555. /*****************************************************************************
  1556.  * FUNCTION
  1557.  *  mmi_poc_media_stop_encode
  1558.  * DESCRIPTION
  1559.  *  media stop encode
  1560.  * PARAMETERS
  1561.  *  void
  1562.  * RETURNS
  1563.  *  void
  1564.  *****************************************************************************/
  1565. void mmi_poc_media_stop_encode(void)
  1566. {
  1567.     /*----------------------------------------------------------------*/
  1568.     /* Local Variables                                                */
  1569.     /*----------------------------------------------------------------*/
  1570.     mdi_result mdi_res;
  1571.     /*----------------------------------------------------------------*/
  1572.     /* Code Body                                                      */
  1573.     /*----------------------------------------------------------------*/
  1574.     g_poc_cntx_p->audio_status = POC_AUDIO_NONE;
  1575.     mdi_res = mdi_audio_poc_stop_encode();
  1576.     if (mdi_res == MDI_AUDIO_SUCCESS)
  1577.     {
  1578.         if (g_poc_cntx_p->media_stop_encode_callback)
  1579.         {
  1580.             g_poc_cntx_p->media_stop_encode_callback();
  1581.             g_poc_cntx_p->media_stop_encode_callback = NULL;
  1582.         }
  1583.         else
  1584.         {
  1585.             if (IsScreenPresent(SCR_ID_POC_CM))
  1586.             {
  1587.                 HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_connected_idle);
  1588.             }
  1589.             else
  1590.             {
  1591.                 mmi_poc_entry_connected_idle();
  1592.             }
  1593.         }
  1594.     }
  1595.     else
  1596.     {
  1597.         ASSERT(0);
  1598.     }
  1599. }
  1600. /*****************************************************************************
  1601.  * FUNCTION
  1602.  *  mmi_poc_media_start_decode
  1603.  * DESCRIPTION
  1604.  *  medie start decode
  1605.  * PARAMETERS
  1606.  *  void
  1607.  * RETURNS
  1608.  *  void
  1609.  *****************************************************************************/
  1610. void mmi_poc_media_start_decode(void)
  1611. {
  1612.     /*----------------------------------------------------------------*/
  1613.     /* Local Variables                                                */
  1614.     /*----------------------------------------------------------------*/
  1615.     mdi_result mdi_res;
  1616.     /*----------------------------------------------------------------*/
  1617.     /* Code Body                                                      */
  1618.     /*----------------------------------------------------------------*/
  1619.     g_poc_cntx_p->audio_status = POC_AUDIO_DECODING;
  1620.     mdi_res = mdi_audio_poc_start_decode(mmi_poc_mdi_start_decode_callback);
  1621.     if (mdi_res == MDI_AUDIO_SUCCESS)
  1622.     {
  1623.         if (IsScreenPresent(SCR_ID_POC_CM))
  1624.         {
  1625.             HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_listening);
  1626.         }
  1627.         else
  1628.         {
  1629.             mmi_poc_entry_listening();
  1630.         }
  1631.     }
  1632.     else
  1633.     {
  1634.         g_poc_cntx_p->audio_status = POC_AUDIO_NONE;
  1635.         if (GetActiveScreenId() == SCR_ID_POC_CM)
  1636.         {
  1637.             DisplayPopup(
  1638.                 (U8*) GetString(STR_GLOBAL_ERROR),
  1639.                 IMG_GLOBAL_ERROR,
  1640.                 1,
  1641.                 UI_POPUP_NOTIFYDURATION_TIME,
  1642.                 (U8) ERROR_TONE);
  1643.         }
  1644.     }
  1645. }
  1646. /*****************************************************************************
  1647.  * FUNCTION
  1648.  *  mmi_poc_mdi_start_decode_callback
  1649.  * DESCRIPTION
  1650.  *  start decode callback
  1651.  * PARAMETERS
  1652.  *  result      [IN]        
  1653.  * RETURNS
  1654.  *  void
  1655.  *****************************************************************************/
  1656. void mmi_poc_mdi_start_decode_callback(mdi_result result)
  1657. {
  1658.     /*----------------------------------------------------------------*/
  1659.     /* Local Variables                                                */
  1660.     /*----------------------------------------------------------------*/
  1661.     /*----------------------------------------------------------------*/
  1662.     /* Code Body                                                      */
  1663.     /*----------------------------------------------------------------*/
  1664. }
  1665. /*****************************************************************************
  1666.  * FUNCTION
  1667.  *  mmi_poc_media_stop_decode
  1668.  * DESCRIPTION
  1669.  *  media stop decode
  1670.  * PARAMETERS
  1671.  *  void
  1672.  * RETURNS
  1673.  *  void
  1674.  *****************************************************************************/
  1675. void mmi_poc_media_stop_decode(void)
  1676. {
  1677.     /*----------------------------------------------------------------*/
  1678.     /* Local Variables                                                */
  1679.     /*----------------------------------------------------------------*/
  1680.     mdi_result mdi_res;
  1681.     /*----------------------------------------------------------------*/
  1682.     /* Code Body                                                      */
  1683.     /*----------------------------------------------------------------*/
  1684.     g_poc_cntx_p->audio_status = POC_AUDIO_NONE;
  1685.     mdi_res = mdi_audio_poc_stop_decode();
  1686.     if (mdi_res == MDI_AUDIO_SUCCESS)
  1687.     {
  1688.         if (g_poc_cntx_p->media_stop_decode_callback)
  1689.         {
  1690.             g_poc_cntx_p->media_stop_decode_callback();
  1691.             g_poc_cntx_p->media_stop_decode_callback = NULL;
  1692.         }
  1693.         else
  1694.         {
  1695.             if (IsScreenPresent(SCR_ID_POC_CM))
  1696.             {
  1697.                 HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_connected_idle);
  1698.             }
  1699.             else
  1700.             {
  1701.                 mmi_poc_entry_connected_idle();
  1702.             }
  1703.         }
  1704.     }
  1705.     else
  1706.     {
  1707.         ASSERT(0);
  1708.     }
  1709. }
  1710. /*****************************************************************************
  1711.  * FUNCTION
  1712.  *  mmi_poc_entry_talking
  1713.  * DESCRIPTION
  1714.  *  talking entry screen
  1715.  * PARAMETERS
  1716.  *  void
  1717.  * RETURNS
  1718.  *  void
  1719.  *****************************************************************************/
  1720. void mmi_poc_entry_talking(void)
  1721. {
  1722.     /*----------------------------------------------------------------*/
  1723.     /* Local Variables                                                */
  1724.     /*----------------------------------------------------------------*/
  1725.     U8 *guiBuffer;
  1726.     /*----------------------------------------------------------------*/
  1727.     /* Code Body                                                      */
  1728.     /*----------------------------------------------------------------*/
  1729.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_TALKING));
  1730.     EntryNewScreen(SCR_ID_POC_CM, mmi_poc_exit_talking, mmi_poc_entry_media_processing, NULL);
  1731.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  1732.     mmi_poc_remove_cm_screens();
  1733.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  1734.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_CM);
  1735.     if (g_poc_cntx_p->ptt_button_status == POC_PTT_UP)
  1736.     {
  1737.         mmi_poc_talking_release_ptt();
  1738.     }
  1739.     memset(g_poc_cntx_p->cm_disp, 0, sizeof(g_poc_cntx_p->cm_disp));
  1740.     UCS2Strcpy((S8*) g_poc_cntx_p->cm_disp, (S8*) GetString(STR_ID_POC_CM_TALKING));
  1741.     ShowCategory66Screen(
  1742.         STR_ID_POC_MAIN,
  1743.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  1744.         0,
  1745.         0,
  1746.         0,
  1747.         0,
  1748.         (U8*) g_poc_cntx_p->cm_disp,
  1749.         IMG_ID_POC_CM_TALKING,
  1750.         NULL);
  1751.     mmi_poc_enter_cm_key_light();
  1752.     SetKeyHandler(mmi_poc_talking_release_ptt, KEY_SEND, KEY_EVENT_UP);
  1753. }
  1754. /*****************************************************************************
  1755.  * FUNCTION
  1756.  *  mmi_poc_exit_talking
  1757.  * DESCRIPTION
  1758.  *  exit screen for talking screen
  1759.  * PARAMETERS
  1760.  *  void
  1761.  * RETURNS
  1762.  *  void
  1763.  *****************************************************************************/
  1764. void mmi_poc_exit_talking(void)
  1765. {
  1766.     /*----------------------------------------------------------------*/
  1767.     /* Local Variables                                                */
  1768.     /*----------------------------------------------------------------*/
  1769.     /*----------------------------------------------------------------*/
  1770.     /* Code Body                                                      */
  1771.     /*----------------------------------------------------------------*/
  1772.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_TALKING));
  1773.     mmi_poc_exit_cm_key_light();
  1774.     mmi_poc_talking_release_ptt();
  1775. }
  1776. /*****************************************************************************
  1777.  * FUNCTION
  1778.  *  mmi_poc_entry_media_processing
  1779.  * DESCRIPTION
  1780.  *  media processing screen
  1781.  * PARAMETERS
  1782.  *  void
  1783.  * RETURNS
  1784.  *  void
  1785.  *****************************************************************************/
  1786. void mmi_poc_entry_media_processing(void)
  1787. {
  1788.     /*----------------------------------------------------------------*/
  1789.     /* Local Variables                                                */
  1790.     /*----------------------------------------------------------------*/
  1791.     /*----------------------------------------------------------------*/
  1792.     /* Code Body                                                      */
  1793.     /*----------------------------------------------------------------*/
  1794.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_MEDIA_PROCESSING));
  1795.     EntryNewScreen(SCR_ID_POC_CM, NULL, mmi_poc_entry_media_processing, NULL);
  1796.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  1797.     mmi_poc_remove_cm_screens();
  1798.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  1799.     ShowCategory65Screen((U8*) GetString(STR_ID_POC_PROCESSING), IMG_GLOBAL_WARNING, NULL);
  1800.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1801. }
  1802. /*****************************************************************************
  1803.  * FUNCTION
  1804.  *  mmi_poc_talking_release_ptt
  1805.  * DESCRIPTION
  1806.  *  talking release ptt key
  1807.  * PARAMETERS
  1808.  *  void
  1809.  * RETURNS
  1810.  *  void
  1811.  *****************************************************************************/
  1812. void mmi_poc_talking_release_ptt(void)
  1813. {
  1814.     /*----------------------------------------------------------------*/
  1815.     /* Local Variables                                                */
  1816.     /*----------------------------------------------------------------*/
  1817.     /*----------------------------------------------------------------*/
  1818.     /* Code Body                                                      */
  1819.     /*----------------------------------------------------------------*/
  1820.     if (g_poc_cntx_p->audio_status != POC_AUDIO_NONE)
  1821.     {
  1822.         MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_TALKING_RELEASE_PTT));
  1823.         ClearInputEventHandler(MMI_DEVICE_ALL);
  1824.         SetKeyHandler(0, KEY_END, KEY_EVENT_DOWN);
  1825.         mmi_poc_audio_encode_stop(mmi_poc_floor_release_req);
  1826.     }
  1827. }
  1828. /*****************************************************************************
  1829.  * FUNCTION
  1830.  *  mmi_poc_entry_listening
  1831.  * DESCRIPTION
  1832.  *  listening entry screen
  1833.  * PARAMETERS
  1834.  *  void
  1835.  * RETURNS
  1836.  *  void
  1837.  *****************************************************************************/
  1838. void mmi_poc_entry_listening(void)
  1839. {
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Local Variables                                                */
  1842.     /*----------------------------------------------------------------*/
  1843.     U8 *guiBuffer;
  1844.     /*----------------------------------------------------------------*/
  1845.     /* Code Body                                                      */
  1846.     /*----------------------------------------------------------------*/
  1847.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_LISTENING));
  1848.     EntryNewScreen(SCR_ID_POC_CM, mmi_poc_exit_listening, mmi_poc_entry_listening, NULL);
  1849.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  1850.     mmi_poc_remove_cm_screens();
  1851.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  1852.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_CM);
  1853.     ShowCategory66Screen(
  1854.         STR_ID_POC_MAIN,
  1855.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  1856.         0,
  1857.         0,
  1858.         STR_GLOBAL_ABORT,
  1859.         IMG_GLOBAL_BACK,
  1860.         (U8*) g_poc_cntx_p->cm_disp,
  1861.         IMG_ID_POC_CM_LISTENING,
  1862.         NULL);
  1863.     mmi_poc_enter_cm_key_light();
  1864.     SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  1865.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  1866. }
  1867. /*****************************************************************************
  1868.  * FUNCTION
  1869.  *  mmi_poc_exit_listening
  1870.  * DESCRIPTION
  1871.  *  exit screen for listen screen
  1872.  * PARAMETERS
  1873.  *  void
  1874.  * RETURNS
  1875.  *  void
  1876.  *****************************************************************************/
  1877. void mmi_poc_exit_listening(void)
  1878. {
  1879.     /*----------------------------------------------------------------*/
  1880.     /* Local Variables                                                */
  1881.     /*----------------------------------------------------------------*/
  1882.     /*----------------------------------------------------------------*/
  1883.     /* Code Body                                                      */
  1884.     /*----------------------------------------------------------------*/
  1885.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_LISTENING));
  1886.     mmi_poc_exit_cm_key_light();
  1887. }
  1888. /*****************************************************************************
  1889.  * FUNCTION
  1890.  *  mmi_poc_reset_all_audio
  1891.  * DESCRIPTION
  1892.  *  reset all audio
  1893.  * PARAMETERS
  1894.  *  void
  1895.  * RETURNS
  1896.  *  void
  1897.  *****************************************************************************/
  1898. void mmi_poc_reset_all_audio(void)
  1899. {
  1900.     /*----------------------------------------------------------------*/
  1901.     /* Local Variables                                                */
  1902.     /*----------------------------------------------------------------*/
  1903.     /*----------------------------------------------------------------*/
  1904.     /* Code Body                                                      */
  1905.     /*----------------------------------------------------------------*/
  1906.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_RESET_ALL_AUDIO));
  1907.     g_poc_cntx_p->audio_status = POC_AUDIO_NONE;
  1908.     mmi_poc_disconnect_callback();
  1909.     //poc task would reset audio status
  1910.     //mdi_switch_device_ownership(MOD_MMI, MDI_DEVICE_AUDIO|MDI_DEVICE_CAMER|MDI_DEVICE_VIDEO);
  1911.     mdi_audio_start_background_timer();
  1912. }
  1913. /*****************************************************************************
  1914.  * FUNCTION
  1915.  *  mmi_poc_show_error_cause
  1916.  * DESCRIPTION
  1917.  *  show error cause
  1918.  * PARAMETERS
  1919.  *  result      [IN]        
  1920.  *  cause       [IN]        
  1921.  * RETURNS
  1922.  *  void
  1923.  *****************************************************************************/
  1924. void mmi_poc_show_error_cause(kal_int32 result, kal_int32 cause)
  1925. {
  1926.     /*----------------------------------------------------------------*/
  1927.     /* Local Variables                                                */
  1928.     /*----------------------------------------------------------------*/
  1929.     /*----------------------------------------------------------------*/
  1930.     /* Code Body                                                      */
  1931.     /*----------------------------------------------------------------*/
  1932.     switch (result)
  1933.     {
  1934.             /* FS error */
  1935.         case POC_FS_ERROR:
  1936.             DisplayPopup(
  1937.                 (U8*) GetString(STR_ID_POC_ERR_FS_ERROR),
  1938.                 IMG_GLOBAL_UNFINISHED,
  1939.                 1,
  1940.                 UI_POPUP_NOTIFYDURATION_TIME,
  1941.                 (U8) ERROR_TONE);
  1942.             break;
  1943.             /* Floor Error */
  1944.         case POC_FLOOR_ALREADY_IN_USE:
  1945.             DisplayPopup(
  1946.                 (U8*) GetString(STR_ID_POC_ERR_FLOOR_ALREADY_IN_USE),
  1947.                 IMG_GLOBAL_UNFINISHED,
  1948.                 1,
  1949.                 UI_POPUP_NOTIFYDURATION_TIME,
  1950.                 (U8) ERROR_TONE);
  1951.             break;
  1952.         case POC_SERVER_INT_ERROR:
  1953.             DisplayPopup(
  1954.                 (U8*) GetString(STR_ID_POC_ERR_SERVER_INT_ERROR),
  1955.                 IMG_GLOBAL_UNFINISHED,
  1956.                 1,
  1957.                 UI_POPUP_NOTIFYDURATION_TIME,
  1958.                 (U8) ERROR_TONE);
  1959.             break;
  1960.         case POC_ONLY_ONE_USER:
  1961.             DisplayPopup(
  1962.                 (U8*) GetString(STR_ID_POC_ERR_ONLY_ONE_USER),
  1963.                 IMG_GLOBAL_UNFINISHED,
  1964.                 1,
  1965.                 UI_POPUP_NOTIFYDURATION_TIME,
  1966.                 (U8) ERROR_TONE);
  1967.             break;
  1968.         case POC_FLOOR_RETRY_AFTER:
  1969.             DisplayPopup(
  1970.                 (U8*) GetString(STR_ID_POC_ERR_FLOOR_RETRY_AFTER),
  1971.                 IMG_GLOBAL_UNFINISHED,
  1972.                 1,
  1973.                 UI_POPUP_NOTIFYDURATION_TIME,
  1974.                 (U8) ERROR_TONE);
  1975.             break;
  1976.         case POC_LISTEN_ONLY:
  1977.             DisplayPopup(
  1978.                 (U8*) GetString(STR_ID_POC_ERR_LISTEN_ONLY),
  1979.                 IMG_GLOBAL_UNFINISHED,
  1980.                 1,
  1981.                 UI_POPUP_NOTIFYDURATION_TIME,
  1982.                 (U8) ERROR_TONE);
  1983.             break;
  1984.         case POC_TALK_TOO_LONG:
  1985.             DisplayPopup(
  1986.                 (U8*) GetString(STR_ID_POC_ERR_TALK_TOO_LONG),
  1987.                 IMG_GLOBAL_UNFINISHED,
  1988.                 1,
  1989.                 UI_POPUP_NOTIFYDURATION_TIME,
  1990.                 (U8) ERROR_TONE);
  1991.             break;
  1992.         case POC_NO_FLOOR_PERMISSION:
  1993.             DisplayPopup(
  1994.                 (U8*) GetString(STR_ID_POC_ERR_NO_FLOOR_PERMISSION),
  1995.                 IMG_GLOBAL_UNFINISHED,
  1996.                 1,
  1997.                 UI_POPUP_NOTIFYDURATION_TIME,
  1998.                 (U8) ERROR_TONE);
  1999.             break;
  2000.         case POC_FLOOR_PREEMPTED:
  2001.             DisplayPopup(
  2002.                 (U8*) GetString(STR_ID_POC_ERR_FLOOR_PREEMPTED),
  2003.                 IMG_GLOBAL_UNFINISHED,
  2004.                 1,
  2005.                 UI_POPUP_NOTIFYDURATION_TIME,
  2006.                 (U8) ERROR_TONE);
  2007.             break;
  2008.             /* Misc */
  2009.         case POC_INVALID_SETTING:
  2010.             DisplayPopup(
  2011.                 (U8*) GetString(STR_ID_POC_ERR_INVALID_SETTING),
  2012.                 IMG_GLOBAL_UNFINISHED,
  2013.                 1,
  2014.                 UI_POPUP_NOTIFYDURATION_TIME,
  2015.                 (U8) ERROR_TONE);
  2016.             break;
  2017.         case POC_NOT_REGISTER:
  2018.             DisplayPopup(
  2019.                 (U8*) GetString(STR_ID_POC_ERR_NOT_REGISTERED),
  2020.                 IMG_GLOBAL_UNFINISHED,
  2021.                 1,
  2022.                 UI_POPUP_NOTIFYDURATION_TIME,
  2023.                 (U8) ERROR_TONE);
  2024.             break;
  2025.         case POC_NO_RESOURCE:
  2026.             DisplayPopup(
  2027.                 (U8*) GetString(STR_ID_POC_ERR_NO_RESOURCE),
  2028.                 IMG_GLOBAL_UNFINISHED,
  2029.                 1,
  2030.                 UI_POPUP_NOTIFYDURATION_TIME,
  2031.                 (U8) ERROR_TONE);
  2032.             break;
  2033.         case POC_INVALID_URI:
  2034.             DisplayPopup(
  2035.                 (U8*) GetString(STR_ID_POC_ERR_INVALID_URI),
  2036.                 IMG_GLOBAL_UNFINISHED,
  2037.                 1,
  2038.                 UI_POPUP_NOTIFYDURATION_TIME,
  2039.                 (U8) ERROR_TONE);
  2040.             break;
  2041.         case POC_TIMEOUT_ERROR:
  2042.             DisplayPopup(
  2043.                 (U8*) GetString(STR_ID_POC_ERR_TIMEOUT_ERROR),
  2044.                 IMG_GLOBAL_UNFINISHED,
  2045.                 1,
  2046.                 UI_POPUP_NOTIFYDURATION_TIME,
  2047.                 (U8) ERROR_TONE);
  2048.             break;
  2049.             /* SIP error */
  2050.         case POC_SIP_ERROR:
  2051.             switch (cause)
  2052.             {
  2053.                 case 408:   /* request time out */
  2054.                     DisplayPopup(
  2055.                         (U8*) GetString(STR_ID_POC_ERR_TIMEOUT_ERROR),
  2056.                         IMG_GLOBAL_UNFINISHED,
  2057.                         1,
  2058.                         UI_POPUP_NOTIFYDURATION_TIME,
  2059.                         (U8) ERROR_TONE);
  2060.                     break;
  2061.                 case 404:   /* not found */
  2062.                     DisplayPopup(
  2063.                         (U8*) GetString(STR_ID_POC_ERR_NOT_FOUND),
  2064.                         IMG_GLOBAL_UNFINISHED,
  2065.                         1,
  2066.                         UI_POPUP_NOTIFYDURATION_TIME,
  2067.                         (U8) ERROR_TONE);
  2068.                     break;
  2069.                 case 486:   /* busy here */
  2070.                     DisplayPopup(
  2071.                         (U8*) GetString(STR_ID_POC_ERR_BUSY),
  2072.                         IMG_GLOBAL_UNFINISHED,
  2073.                         1,
  2074.                         UI_POPUP_NOTIFYDURATION_TIME,
  2075.                         (U8) ERROR_TONE);
  2076.                     break;
  2077.                 case 480:   /* busy here */
  2078.                     DisplayPopup(
  2079.                         (U8*) GetString(STR_GLOBAL_NOT_AVAILABLE),
  2080.                         IMG_GLOBAL_UNFINISHED,
  2081.                         1,
  2082.                         UI_POPUP_NOTIFYDURATION_TIME,
  2083.                         (U8) ERROR_TONE);
  2084.                     break;
  2085.                 case 401:
  2086.                 case 407:
  2087.                     DisplayPopup(
  2088.                         (U8*) GetString(STR_ID_POC_ERR_AUTH_REQ),
  2089.                         IMG_GLOBAL_UNFINISHED,
  2090.                         1,
  2091.                         UI_POPUP_NOTIFYDURATION_TIME,
  2092.                         (U8) ERROR_TONE);
  2093.                     break;
  2094.                 case 403:
  2095.                     DisplayPopup(
  2096.                         (U8*) GetString(STR_ID_POC_ERR_FORBIDDEN),
  2097.                         IMG_GLOBAL_UNFINISHED,
  2098.                         1,
  2099.                         UI_POPUP_NOTIFYDURATION_TIME,
  2100.                         (U8) ERROR_TONE);
  2101.                     break;
  2102.                 default:
  2103.                     DisplayPopup(
  2104.                         (U8*) GetString(STR_GLOBAL_NOT_DONE),
  2105.                         IMG_GLOBAL_UNFINISHED,
  2106.                         1,
  2107.                         UI_POPUP_NOTIFYDURATION_TIME,
  2108.                         (U8) ERROR_TONE);
  2109.                     break;
  2110.             }
  2111.             break;
  2112.         case POC_RECV_SIP_BYE:
  2113.             DisplayPopup(
  2114.                 (U8*) GetString(STR_ID_POC_ERR_RECV_SIP_BYE),
  2115.                 IMG_GLOBAL_UNFINISHED,
  2116.                 1,
  2117.                 UI_POPUP_NOTIFYDURATION_TIME,
  2118.                 (U8) ERROR_TONE);
  2119.             break;
  2120.         case POC_TALK_ABORTED:
  2121.             DisplayPopup(
  2122.                 (U8*) GetString(STR_ID_POC_ERR_TALK_ABORTED),
  2123.                 IMG_GLOBAL_UNFINISHED,
  2124.                 1,
  2125.                 UI_POPUP_NOTIFYDURATION_TIME,
  2126.                 (U8) ERROR_TONE);
  2127.             break;
  2128.             /* XDM error */
  2129.         case POC_XDM_ERROR:
  2130.             DisplayPopup(
  2131.                 (U8*) GetString(STR_ID_POC_ERR_XDM_ERROR),
  2132.                 IMG_GLOBAL_UNFINISHED,
  2133.                 1,
  2134.                 UI_POPUP_NOTIFYDURATION_TIME,
  2135.                 (U8) ERROR_TONE);
  2136.             break;
  2137.         default:
  2138.             DisplayPopup(
  2139.                 (U8*) GetString(STR_GLOBAL_NOT_DONE),
  2140.                 IMG_GLOBAL_UNFINISHED,
  2141.                 1,
  2142.                 UI_POPUP_NOTIFYDURATION_TIME,
  2143.                 (U8) ERROR_TONE);
  2144.             break;
  2145.     }
  2146. }
  2147. /*****************************************************************************
  2148.  * FUNCTION
  2149.  *  mmi_poc_enter_cm_key_light
  2150.  * DESCRIPTION
  2151.  *  call management key light enabler
  2152.  * PARAMETERS
  2153.  *  void
  2154.  * RETURNS
  2155.  *  void
  2156.  *****************************************************************************/
  2157. void mmi_poc_enter_cm_key_light(void)
  2158. {
  2159.     /*----------------------------------------------------------------*/
  2160.     /* Local Variables                                                */
  2161.     /*----------------------------------------------------------------*/
  2162.     /*----------------------------------------------------------------*/
  2163.     /* Code Body                                                      */
  2164.     /*----------------------------------------------------------------*/
  2165.     mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED);
  2166.     TurnOnBacklight(0);
  2167. }
  2168. /*****************************************************************************
  2169.  * FUNCTION
  2170.  *  mmi_poc_exit_cm_key_light
  2171.  * DESCRIPTION
  2172.  *  call management key light disable
  2173.  * PARAMETERS
  2174.  *  void
  2175.  * RETURNS
  2176.  *  void
  2177.  *****************************************************************************/
  2178. void mmi_poc_exit_cm_key_light(void)
  2179. {
  2180.     /*----------------------------------------------------------------*/
  2181.     /* Local Variables                                                */
  2182.     /*----------------------------------------------------------------*/
  2183.     /*----------------------------------------------------------------*/
  2184.     /* Code Body                                                      */
  2185.     /*----------------------------------------------------------------*/
  2186.     mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_ENABLED);
  2187.     TurnOffBacklight();
  2188. }
  2189. /*****************************************************************************
  2190.  * FUNCTION
  2191.  *  mmi_poc_remove_cm_screens
  2192.  * DESCRIPTION
  2193.  *  remove poc call management screens
  2194.  * PARAMETERS
  2195.  *  void
  2196.  * RETURNS
  2197.  *  void
  2198.  *****************************************************************************/
  2199. void mmi_poc_remove_cm_screens(void)
  2200. {
  2201.     /*----------------------------------------------------------------*/
  2202.     /* Local Variables                                                */
  2203.     /*----------------------------------------------------------------*/
  2204.     /*----------------------------------------------------------------*/
  2205.     /* Code Body                                                      */
  2206.     /*----------------------------------------------------------------*/
  2207.     DeleteScreenIfPresent(SCR_ID_POC_TALK_OPTION);
  2208.     DeleteScreenIfPresent(SCR_ID_POC_TALK_OPTION_ADD_USER);
  2209. }
  2210. /*****************************************************************************
  2211.  * FUNCTION
  2212.  *  mmi_poc_talk_status_notify_ind
  2213.  * DESCRIPTION
  2214.  *  talk status notify indication handler
  2215.  * PARAMETERS
  2216.  *  info        [?]     
  2217.  * RETURNS
  2218.  *  void
  2219.  *****************************************************************************/
  2220. void mmi_poc_talk_status_notify_ind(void *info)
  2221. {
  2222.     /*----------------------------------------------------------------*/
  2223.     /* Local Variables                                                */
  2224.     /*----------------------------------------------------------------*/
  2225.     U8 i, j;
  2226.     poc_talk_status_notify_ind_struct *msgRsp;
  2227.     /*----------------------------------------------------------------*/
  2228.     /* Code Body                                                      */
  2229.     /*----------------------------------------------------------------*/
  2230.     msgRsp = (poc_talk_status_notify_ind_struct*) info;
  2231.     if (msgRsp->result == POC_OK)
  2232.     {
  2233.         g_poc_cntx_p->talk_pres_ind_recved = POC_TALK_STATUS_ON;
  2234.         if (msgRsp->full_state == MMI_TRUE)
  2235.         {
  2236.             memset(g_poc_cntx_p->cm_talk_list, 0, sizeof(g_poc_cntx_p->cm_talk_list));
  2237.             g_poc_cntx_p->cm_talk_list_num = 0;
  2238.         }
  2239.         for (i = 0; i < msgRsp->num_status; i++)
  2240.         {
  2241.             if ((msgRsp->status[i].status == POC_TS_DELETED) || (msgRsp->status[i].status == POC_TS_DISCONNECTED))
  2242.             {
  2243.                 for (j = 0; j < g_poc_cntx_p->cm_talk_list_num; j++)
  2244.                 {
  2245.                     if (!strncmp
  2246.                         ((S8*) msgRsp->status[i].user.uri, (S8*) g_poc_cntx_p->cm_talk_list[j].uri,
  2247.                          POC_MAX_URI_LEN - 1))
  2248.                     {
  2249.                         memcpy(
  2250.                             &g_poc_cntx_p->cm_talk_list[j],
  2251.                             &g_poc_cntx_p->cm_talk_list[g_poc_cntx_p->cm_talk_list_num - 1],
  2252.                             sizeof(mmi_poc_talk_list_struct));
  2253.                         memset(
  2254.                             &g_poc_cntx_p->cm_talk_list[g_poc_cntx_p->cm_talk_list_num - 1],
  2255.                             0,
  2256.                             sizeof(mmi_poc_talk_list_struct));
  2257.                         g_poc_cntx_p->cm_talk_list_num--;
  2258.                         break;
  2259.                     }
  2260.                 }
  2261.             }
  2262.             else
  2263.             {
  2264.                 for (j = 0; j < g_poc_cntx_p->cm_talk_list_num; j++)
  2265.                 {
  2266.                     if (!strncmp
  2267.                         ((S8*) msgRsp->status[i].user.uri, (S8*) g_poc_cntx_p->cm_talk_list[j].uri,
  2268.                          POC_MAX_URI_LEN - 1))
  2269.                     {
  2270.                         g_poc_cntx_p->cm_talk_list[j].status = msgRsp->status[i].status;
  2271.                         strncpy(
  2272.                             (S8*) g_poc_cntx_p->cm_talk_list[j].name,
  2273.                             (S8*) msgRsp->status[i].user.disp_name,
  2274.                             POC_MAX_DISP_LEN - 1);
  2275.                         break;
  2276.                     }
  2277.                 }
  2278.                 if ((j == g_poc_cntx_p->cm_talk_list_num) && (j < POC_MAX_TALK_STATUS_ENTRY_NUM))
  2279.                 {
  2280.                     memset(&g_poc_cntx_p->cm_talk_list[j], 0, sizeof(mmi_poc_talk_list_struct));
  2281.                     g_poc_cntx_p->cm_talk_list[j].status = msgRsp->status[i].status;
  2282.                     strncpy(
  2283.                         (S8*) g_poc_cntx_p->cm_talk_list[j].name,
  2284.                         (S8*) msgRsp->status[i].user.disp_name,
  2285.                         POC_MAX_DISP_LEN - 1);
  2286.                     strncpy(
  2287.                         (S8*) g_poc_cntx_p->cm_talk_list[j].uri,
  2288.                         (S8*) msgRsp->status[i].user.uri,
  2289.                         POC_MAX_URI_LEN - 1);
  2290.                     g_poc_cntx_p->cm_talk_list_num++;
  2291.                 }
  2292.             }
  2293.         }
  2294.         if (msgRsp->more_data == MMI_FALSE)
  2295.         {
  2296.             if (((GetActiveScreenId() == SCR_ID_POC_CM) || (GetActiveScreenId() == SCR_ID_POC_TALK_OPTION)) &&
  2297.                 (g_poc_cntx_p->audio_status == POC_AUDIO_NONE))
  2298.             {
  2299.                 DisplayPopup(
  2300.                     (U8*) GetString(STR_ID_POC_PRESENCE_UPDATED),
  2301.                     IMG_GLOBAL_ACTIVATED,
  2302.                     1,
  2303.                     UI_POPUP_NOTIFYDURATION_TIME,
  2304.                     (U8) SUCCESS_TONE);
  2305.             }
  2306.         }
  2307.     }
  2308.     else
  2309.     {
  2310.         g_poc_cntx_p->talk_pres_ind_recved = POC_TALK_STATUS_OFF;
  2311.     }
  2312.     mmi_poc_talk_status_notify_res();
  2313. }
  2314. /*****************************************************************************
  2315.  * FUNCTION
  2316.  *  mmi_poc_talk_status_notify_res
  2317.  * DESCRIPTION
  2318.  *  res send to protocol for talk status notify
  2319.  * PARAMETERS
  2320.  *  void
  2321.  * RETURNS
  2322.  *  void
  2323.  *****************************************************************************/
  2324. void mmi_poc_talk_status_notify_res(void)
  2325. {
  2326.     /*----------------------------------------------------------------*/
  2327.     /* Local Variables                                                */
  2328.     /*----------------------------------------------------------------*/
  2329.     MYQUEUE Message;
  2330.     poc_talk_status_notify_res_struct *myMsgPtr;
  2331.     /*----------------------------------------------------------------*/
  2332.     /* Code Body                                                      */
  2333.     /*----------------------------------------------------------------*/
  2334.     myMsgPtr = (poc_talk_status_notify_res_struct*) OslConstructDataPtr(sizeof(poc_talk_status_notify_res_struct));
  2335.     memset(
  2336.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  2337.         0,
  2338.         sizeof(poc_talk_status_notify_res_struct) - sizeof(mmi_poc_dummy_req_struct));
  2339.     Message.oslSrcId = MOD_MMI;
  2340.     Message.oslDestId = MOD_POC;
  2341.     Message.oslMsgId = MSG_ID_POC_TALK_STATUS_NOTIFY_RES;
  2342.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  2343.     Message.oslPeerBuffPtr = NULL;
  2344.     OslMsgSendExtQueue(&Message);
  2345. }
  2346. /*****************************************************************************
  2347.  * FUNCTION
  2348.  *  mmi_poc_talk_status_subscribe
  2349.  * DESCRIPTION
  2350.  *  talk status subscribe
  2351.  * PARAMETERS
  2352.  *  void
  2353.  * RETURNS
  2354.  *  void
  2355.  *****************************************************************************/
  2356. void mmi_poc_talk_status_subscribe(void)
  2357. {
  2358.     /*----------------------------------------------------------------*/
  2359.     /* Local Variables                                                */
  2360.     /*----------------------------------------------------------------*/
  2361.     /*----------------------------------------------------------------*/
  2362.     /* Code Body                                                      */
  2363.     /*----------------------------------------------------------------*/
  2364.     g_poc_cntx_p->curr_talk_staus_subscribe = MMI_TRUE;
  2365.     mmi_poc_talk_status_subscribe_req(MMI_TRUE);
  2366. }
  2367. /*****************************************************************************
  2368.  * FUNCTION
  2369.  *  mmi_poc_talk_status_unsubscribe
  2370.  * DESCRIPTION
  2371.  *  talk status unsubscribe
  2372.  * PARAMETERS
  2373.  *  void
  2374.  * RETURNS
  2375.  *  void
  2376.  *****************************************************************************/
  2377. void mmi_poc_talk_status_unsubscribe(void)
  2378. {
  2379.     /*----------------------------------------------------------------*/
  2380.     /* Local Variables                                                */
  2381.     /*----------------------------------------------------------------*/
  2382.     /*----------------------------------------------------------------*/
  2383.     /* Code Body                                                      */
  2384.     /*----------------------------------------------------------------*/
  2385.     g_poc_cntx_p->curr_talk_staus_subscribe = MMI_FALSE;
  2386.     mmi_poc_talk_status_subscribe_req(MMI_FALSE);
  2387. }
  2388. /*****************************************************************************
  2389.  * FUNCTION
  2390.  *  mmi_poc_talk_status_subscribe_req
  2391.  * DESCRIPTION
  2392.  *  talk status subscribe request
  2393.  * PARAMETERS
  2394.  *  subscribe       [IN]        
  2395.  * RETURNS
  2396.  *  void
  2397.  *****************************************************************************/
  2398. void mmi_poc_talk_status_subscribe_req(U8 subscribe)
  2399. {
  2400.     /*----------------------------------------------------------------*/
  2401.     /* Local Variables                                                */
  2402.     /*----------------------------------------------------------------*/
  2403.     MYQUEUE Message;
  2404.     poc_talk_status_subscribe_req_struct *myMsgPtr;
  2405.     /*----------------------------------------------------------------*/
  2406.     /* Code Body                                                      */
  2407.     /*----------------------------------------------------------------*/
  2408.     myMsgPtr =
  2409.         (poc_talk_status_subscribe_req_struct*) OslConstructDataPtr(sizeof(poc_talk_status_subscribe_req_struct));
  2410.     memset(
  2411.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  2412.         0,
  2413.         sizeof(poc_talk_status_subscribe_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  2414.     g_poc_cntx_p->talk_pres_ind_recved = POC_TALK_STATUS_NOT_READY;
  2415.     myMsgPtr->talk_id = g_poc_cntx_p->active_talk_id;
  2416.     myMsgPtr->subscribe = subscribe;
  2417.     SetProtocolEventHandler(mmi_poc_talk_status_subscribe_rsp, MSG_ID_POC_TALK_STATUS_SUBSCRIBE_RSP);
  2418.     DeleteUptoScrID(SCR_ID_POC_CM);
  2419.     GoBackHistory();
  2420.     Message.oslSrcId = MOD_MMI;
  2421.     Message.oslDestId = MOD_POC;
  2422.     Message.oslMsgId = MSG_ID_POC_TALK_STATUS_SUBSCRIBE_REQ;
  2423.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  2424.     Message.oslPeerBuffPtr = NULL;
  2425.     OslMsgSendExtQueue(&Message);
  2426. }
  2427. /*****************************************************************************
  2428.  * FUNCTION
  2429.  *  mmi_poc_talk_status_subscribe_rsp
  2430.  * DESCRIPTION
  2431.  *  response handler for talk status subscribe
  2432.  * PARAMETERS
  2433.  *  info        [IN]        Local parameters from protocol
  2434.  * RETURNS
  2435.  *  void
  2436.  *****************************************************************************/
  2437. void mmi_poc_talk_status_subscribe_rsp(void *info)
  2438. {
  2439.     /*----------------------------------------------------------------*/
  2440.     /* Local Variables                                                */
  2441.     /*----------------------------------------------------------------*/
  2442.     poc_talk_invite_rsp_struct *msgRsp;
  2443.     /*----------------------------------------------------------------*/
  2444.     /* Code Body                                                      */
  2445.     /*----------------------------------------------------------------*/
  2446.     msgRsp = (poc_talk_invite_rsp_struct*) info;
  2447.     ClearProtocolEventHandler(MSG_ID_POC_TALK_STATUS_SUBSCRIBE_RSP);
  2448.     if (msgRsp->result == POC_OK)
  2449.     {
  2450.         if (g_poc_cntx_p->curr_talk_staus_subscribe)
  2451.         {
  2452.             g_poc_cntx_p->talk_pres_ind_recved = POC_TALK_STATUS_ON;
  2453.         }
  2454.         else
  2455.         {
  2456.             g_poc_cntx_p->talk_pres_ind_recved = POC_TALK_STATUS_OFF;
  2457.         }
  2458.         if ((GetActiveScreenId() == SCR_ID_POC_CM) || (GetActiveScreenId() == SCR_ID_POC_TALK_OPTION))
  2459.         {
  2460.             DisplayPopup(
  2461.                 (U8*) GetString(STR_ID_POC_STATUS_MODE_MODIFIED),
  2462.                 IMG_GLOBAL_ACTIVATED,
  2463.                 1,
  2464.                 UI_POPUP_NOTIFYDURATION_TIME,
  2465.                 (U8) SUCCESS_TONE);
  2466.         }
  2467.     }
  2468.     else
  2469.     {
  2470.         if ((GetActiveScreenId() == SCR_ID_POC_CM) || (GetActiveScreenId() == SCR_ID_POC_TALK_OPTION))
  2471.         {
  2472.             DisplayPopup(
  2473.                 (U8*) GetString(STR_ID_POC_STATUS_MODE_NOT_MODIFIED),
  2474.                 IMG_GLOBAL_UNFINISHED,
  2475.                 1,
  2476.                 UI_POPUP_NOTIFYDURATION_TIME,
  2477.                 (U8) ERROR_TONE);
  2478.         }
  2479.     }
  2480. }
  2481. /*****************************************************************************
  2482.  * FUNCTION
  2483.  *  mmi_poc_mdi_background_handler
  2484.  * DESCRIPTION
  2485.  *  mdi background handler
  2486.  * PARAMETERS
  2487.  *  result      [IN]        
  2488.  * RETURNS
  2489.  *  void
  2490.  *****************************************************************************/
  2491. BOOL mmi_poc_mdi_background_handler(mdi_result result)
  2492. {
  2493.     /*----------------------------------------------------------------*/
  2494.     /* Local Variables                                                */
  2495.     /*----------------------------------------------------------------*/
  2496.     /*----------------------------------------------------------------*/
  2497.     /* Code Body                                                      */
  2498.     /*----------------------------------------------------------------*/
  2499.     switch (g_poc_cntx_p->audio_status)
  2500.     {
  2501.         case POC_AUDIO_NONE:
  2502.             return (MMI_FALSE);
  2503.         case POC_AUDIO_ENCODING:
  2504.             mmi_poc_audio_encode_start();
  2505.             return (MMI_TRUE);
  2506.         case POC_AUDIO_DECODING:
  2507.             mmi_poc_audio_decode_start();
  2508.             return (MMI_TRUE);
  2509.         default:
  2510.             return (MMI_FALSE);
  2511.     }
  2512. }
  2513. /*****************************************************************************
  2514.  * FUNCTION
  2515.  *  mmi_poc_new_personal_alert_ind
  2516.  * DESCRIPTION
  2517.  *  handler for new personal alert indication
  2518.  * PARAMETERS
  2519.  *  info        [IN]        Local parameters from protocol
  2520.  * RETURNS
  2521.  *  void
  2522.  *****************************************************************************/
  2523. void mmi_poc_new_personal_alert_ind(void *info)
  2524. {
  2525.     /*----------------------------------------------------------------*/
  2526.     /* Local Variables                                                */
  2527.     /*----------------------------------------------------------------*/
  2528.     U8 message[MMI_POC_MAX_MSG_LEN];
  2529.     U8 message_ucs2[MMI_POC_MAX_MSG_LEN * ENCODING_LENGTH];
  2530.     poc_new_personal_alert_ind_struct *msgRsp;
  2531.     /*----------------------------------------------------------------*/
  2532.     /* Code Body                                                      */
  2533.     /*----------------------------------------------------------------*/
  2534.     msgRsp = (poc_new_personal_alert_ind_struct*) info;
  2535.     msgRsp->content[MMI_POC_MAX_MSG_LEN] = 0;
  2536.     strncpy((S8*) message, (S8*) msgRsp->content, MMI_POC_MAX_MSG_LEN - 1);
  2537.     mmi_poc_history_add(
  2538.         POC_INCOMING_ALERT,
  2539.         MMI_FALSE,
  2540.         (U8*) msgRsp->sender.disp_name,
  2541.         (U8*) msgRsp->sender.uri,
  2542.         message);
  2543.     if (isInCall())
  2544.     {
  2545.         return;
  2546.     }
  2547.     memset(g_poc_cntx_p->cm_disp, 0, sizeof(g_poc_cntx_p->cm_disp));
  2548.     UCS2Strcpy((S8*) g_poc_cntx_p->cm_disp, (S8*) GetString(STR_ID_POC_ALERT_FROM));
  2549.     if (strlen((S8*) msgRsp->sender.disp_name))
  2550.     {
  2551.         mmi_poc_util_copy_with_dot((S8*) msgRsp->sender.disp_name, (S8*) message_ucs2, POC_MAX_DISP_LEN - 1);
  2552.     }
  2553.     else
  2554.     {
  2555.         mmi_poc_util_copy_with_dot((S8*) msgRsp->sender.uri, (S8*) message_ucs2, POC_MAX_DISP_LEN - 1);
  2556.     }
  2557.     UCS2Strcat((S8*) g_poc_cntx_p->cm_disp, (S8*) message_ucs2);
  2558.     mmi_poc_entry_personal_alert();
  2559. }
  2560. /*****************************************************************************
  2561.  * FUNCTION
  2562.  *  mmi_poc_entry_personal_alert
  2563.  * DESCRIPTION
  2564.  *  entry screen for poc personal alert
  2565.  * PARAMETERS
  2566.  *  void
  2567.  * RETURNS
  2568.  *  void
  2569.  *****************************************************************************/
  2570. void mmi_poc_entry_personal_alert(void)
  2571. {
  2572.     /*----------------------------------------------------------------*/
  2573.     /* Local Variables                                                */
  2574.     /*----------------------------------------------------------------*/
  2575.     U8 *guiBuffer;
  2576.     /*----------------------------------------------------------------*/
  2577.     /* Code Body                                                      */
  2578.     /*----------------------------------------------------------------*/
  2579.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_PERSONAL_ALERT));
  2580.     EntryNewScreen(SCR_ID_POC_INCOMING_ALERT, mmi_poc_exit_personal_alert, mmi_poc_entry_personal_alert, NULL);
  2581.     mmi_poc_start_alert_ringing();
  2582.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_INCOMING_ALERT);
  2583.     ShowCategory66Screen(
  2584.         STR_ID_POC_ALERT,
  2585.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  2586.         STR_GLOBAL_VIEW,
  2587.         IMG_GLOBAL_YES,
  2588.         STR_GLOBAL_BACK,
  2589.         IMG_GLOBAL_NO,
  2590.         (U8*) g_poc_cntx_p->cm_disp,
  2591.         IMG_ID_POC_CM_MT_RINGING,
  2592.         NULL);
  2593.     mmi_poc_enter_cm_key_light();
  2594.     StartTimer(POC_IND_TIMER, 5000, mmi_poc_exit_personal_alert);
  2595.     SetLeftSoftkeyFunction(mmi_poc_alert_ringing_view, KEY_EVENT_UP);
  2596.     SetRightSoftkeyFunction(mmi_poc_alert_ringing_back, KEY_EVENT_UP);
  2597.     SetKeyHandler(mmi_poc_alert_ringing_end, KEY_END, KEY_EVENT_DOWN);
  2598. }
  2599. /*****************************************************************************
  2600.  * FUNCTION
  2601.  *  mmi_poc_exit_personal_alert
  2602.  * DESCRIPTION
  2603.  *  exit function for poc personal alert
  2604.  * PARAMETERS
  2605.  *  void
  2606.  * RETURNS
  2607.  *  void
  2608.  *****************************************************************************/
  2609. void mmi_poc_exit_personal_alert(void)
  2610. {
  2611.     /*----------------------------------------------------------------*/
  2612.     /* Local Variables                                                */
  2613.     /*----------------------------------------------------------------*/
  2614.     /*----------------------------------------------------------------*/
  2615.     /* Code Body                                                      */
  2616.     /*----------------------------------------------------------------*/
  2617.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_PERSONAL_ALERT));
  2618.     StopTimer(POC_IND_TIMER);
  2619.     if (GetActiveScreenId() == SCR_ID_POC_INCOMING_ALERT)
  2620.     {
  2621.         mmi_poc_exit_cm_key_light();
  2622.         mmi_poc_stop_alert_ringing();
  2623.     }
  2624. }
  2625. /*****************************************************************************
  2626.  * FUNCTION
  2627.  *  mmi_poc_alert_ringing_view
  2628.  * DESCRIPTION
  2629.  *  view poc alert
  2630.  * PARAMETERS
  2631.  *  void
  2632.  * RETURNS
  2633.  *  void
  2634.  *****************************************************************************/
  2635. void mmi_poc_alert_ringing_view(void)
  2636. {
  2637.     /*----------------------------------------------------------------*/
  2638.     /* Local Variables                                                */
  2639.     /*----------------------------------------------------------------*/
  2640.     /*----------------------------------------------------------------*/
  2641.     /* Code Body                                                      */
  2642.     /*----------------------------------------------------------------*/
  2643.     mmi_poc_exit_personal_alert();
  2644.     g_poc_cntx_p->call_history_selected = 0;
  2645.     mmi_poc_entry_call_history_info();
  2646.     DeleteScreenIfPresent(SCR_ID_POC_INCOMING_ALERT);
  2647.     DeleteScreenIfPresent(SCR_ID_POC_HISTORY_INFO);
  2648.     DeleteScreenIfPresent(SCR_ID_POC_HISTORY_OPT);
  2649. }
  2650. /*****************************************************************************
  2651.  * FUNCTION
  2652.  *  mmi_poc_alert_ringing_back
  2653.  * DESCRIPTION
  2654.  *  back from alert ringing
  2655.  * PARAMETERS
  2656.  *  void
  2657.  * RETURNS
  2658.  *  void
  2659.  *****************************************************************************/
  2660. void mmi_poc_alert_ringing_back(void)
  2661. {
  2662.     /*----------------------------------------------------------------*/
  2663.     /* Local Variables                                                */
  2664.     /*----------------------------------------------------------------*/
  2665.     /*----------------------------------------------------------------*/
  2666.     /* Code Body                                                      */
  2667.     /*----------------------------------------------------------------*/
  2668.     mmi_poc_exit_personal_alert();
  2669.     GoBackHistory();
  2670. }
  2671. /*****************************************************************************
  2672.  * FUNCTION
  2673.  *  mmi_poc_alert_ringing_end
  2674.  * DESCRIPTION
  2675.  *  end from alert ringing
  2676.  * PARAMETERS
  2677.  *  void
  2678.  * RETURNS
  2679.  *  void
  2680.  *****************************************************************************/
  2681. void mmi_poc_alert_ringing_end(void)
  2682. {
  2683.     /*----------------------------------------------------------------*/
  2684.     /* Local Variables                                                */
  2685.     /*----------------------------------------------------------------*/
  2686.     /*----------------------------------------------------------------*/
  2687.     /* Code Body                                                      */
  2688.     /*----------------------------------------------------------------*/
  2689.     mmi_poc_exit_personal_alert();
  2690.     DisplayIdleScreen();
  2691. }
  2692. /*****************************************************************************
  2693.  * FUNCTION
  2694.  *  mmi_poc_start_alert_ringing
  2695.  * DESCRIPTION
  2696.  *  start alert ringing
  2697.  * PARAMETERS
  2698.  *  void
  2699.  * RETURNS
  2700.  *  void
  2701.  *****************************************************************************/
  2702. void mmi_poc_start_alert_ringing(void)
  2703. {
  2704.     /*----------------------------------------------------------------*/
  2705.     /* Local Variables                                                */
  2706.     /*----------------------------------------------------------------*/
  2707.     /*----------------------------------------------------------------*/
  2708.     /* Code Body                                                      */
  2709.     /*----------------------------------------------------------------*/
  2710.     if (IsSilentModeActivated() != TRUE)
  2711.     {
  2712.         switch (GetMtCallAlertTypeEnum())
  2713.         {
  2714.             case MMI_RING:
  2715.                 AudioPlayToneWithCallBack(GetRingToneID(), GetRingTypeEnum(), MESSAGE_TONE);
  2716.                 break;
  2717.             case MMI_VIBRATION_ONLY:
  2718.                 VibratorOn();
  2719.                 break;
  2720.             case MMI_VIBRATION_AND_RING:
  2721.             case MMI_VIBRATION_THEN_RING:
  2722.                 VibratorOn();
  2723.                 AudioPlayToneWithCallBack(GetRingToneID(), GetRingTypeEnum(), MESSAGE_TONE);
  2724.                 break;
  2725.             case MMI_SILENT:
  2726.                 break;
  2727.             case MMI_ALERT_NONE:
  2728.                 break;
  2729.             default:
  2730.                 AudioPlayToneWithCallBack(GetRingToneID(), GetRingTypeEnum(), MESSAGE_TONE);
  2731.                 break;
  2732.         }
  2733.     }
  2734. }
  2735. /*****************************************************************************
  2736.  * FUNCTION
  2737.  *  mmi_poc_stop_alert_ringing
  2738.  * DESCRIPTION
  2739.  *  stop alert ringing
  2740.  * PARAMETERS
  2741.  *  void
  2742.  * RETURNS
  2743.  *  void
  2744.  *****************************************************************************/
  2745. void mmi_poc_stop_alert_ringing(void)
  2746. {
  2747.     /*----------------------------------------------------------------*/
  2748.     /* Local Variables                                                */
  2749.     /*----------------------------------------------------------------*/
  2750.     /*----------------------------------------------------------------*/
  2751.     /* Code Body                                                      */
  2752.     /*----------------------------------------------------------------*/
  2753.     switch (GetMtCallAlertTypeEnum())
  2754.     {
  2755.         case MMI_RING:
  2756.             mdi_audio_stop_all();
  2757.             break;
  2758.         case MMI_VIBRATION_ONLY:
  2759.             VibratorOff();
  2760.             break;
  2761.         case MMI_VIBRATION_AND_RING:
  2762.         case MMI_VIBRATION_THEN_RING:
  2763.             mdi_audio_stop_all();
  2764.             VibratorOff();
  2765.             break;
  2766.         case MMI_SILENT:
  2767.             break;
  2768.         case MMI_ALERT_NONE:
  2769.             break;
  2770.         default:
  2771.             break;
  2772.     }
  2773. }
  2774. /*****************************************************************************
  2775.  * FUNCTION
  2776.  *  mmi_poc_cm_history_del_handler
  2777.  * DESCRIPTION
  2778.  *  poc call management screen delete handler
  2779.  * PARAMETERS
  2780.  *  in_param        [?]     
  2781.  * RETURNS
  2782.  *  void
  2783.  *****************************************************************************/
  2784. U8 mmi_poc_cm_history_del_handler(void *in_param)
  2785. {
  2786.     /*----------------------------------------------------------------*/
  2787.     /* Local Variables                                                */
  2788.     /*----------------------------------------------------------------*/
  2789.     /*----------------------------------------------------------------*/
  2790.     /* Code Body                                                      */
  2791.     /*----------------------------------------------------------------*/
  2792.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  2793.     if ((GetActiveScreenId() != SCR_ID_POC_CM) && (g_poc_cntx_p->call_status == POC_CALL_ACTIVE))
  2794.     {
  2795.         mmi_poc_disconnect_end();
  2796.     }
  2797.     return FALSE;
  2798. }
  2799. #endif /* __MMI_POC__ */