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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * PoCCallManagement.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  This file implements poc management functions
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53. ==============================================================
  54.  *              HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  * removed!
  59.  * removed!
  60.  *
  61.  * removed!
  62.  * removed!
  63.  * removed!
  64.  *
  65.  * removed!
  66.  * removed!
  67.  * removed!
  68.  *
  69.  * removed!
  70.  * removed!
  71.  * removed!
  72.  *
  73.  * removed!
  74.  * removed!
  75.  * removed!
  76.  *
  77.  * removed!
  78.  * removed!
  79.  * removed!
  80.  *
  81.  * removed!
  82.  * removed!
  83.  * removed!
  84.  *
  85.  * removed!
  86.  * removed!
  87.  * removed!
  88.  *
  89.  * removed!
  90.  * removed!
  91.  * removed!
  92.  *
  93.  * removed!
  94.  * removed!
  95.  * removed!
  96.  *
  97.  * removed!
  98.  * removed!
  99.  * removed!
  100.  *
  101.  * removed!
  102.  * removed!
  103.  * removed!
  104.  *
  105.  * removed!
  106.  * removed!
  107.  * removed!
  108.  *
  109.  * removed!
  110.  * removed!
  111.  * removed!
  112.  *
  113.  * removed!
  114.  * removed!
  115.  * removed!
  116.  *
  117.  * removed!
  118.  * removed!
  119.  * removed!
  120.  *
  121.  * removed!
  122.  * removed!
  123.  * removed!
  124.  *
  125.  * removed!
  126.  * removed!
  127.  * removed!
  128.  *
  129.  * removed!
  130.  * removed!
  131.  * removed!
  132.  *
  133.  * removed!
  134.  * removed!
  135.  * removed!
  136.  *
  137.  * removed!
  138.  * removed!
  139.  * removed!
  140.  *
  141.  * removed!
  142.  * removed!
  143.  * removed!
  144.  *
  145.  * removed!
  146.  * removed!
  147.  * removed!
  148.  *
  149.  *------------------------------------------------------------------------------
  150.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  151.  *=============================================================
  152.  *******************************************************************************/
  153. #include "MMI_features.h"
  154. /* micha_PoC */
  155. #ifdef __MMI_POC__
  156. #ifndef __MTK_TARGET__
  157. #include <Windows.h>
  158. #endif
  159. #include "stdC.h"
  160. #include "L4Dr1.h"
  161. #include "mdi_datatype.h"
  162. #include "DebugInitDef.h"
  163. #include "mmi_trc.h"    /* debug info */
  164. #include "GlobalMenuItems.h"
  165. #include "CustMenuRes.h"
  166. #include "CustDataRes.h"
  167. #include "ProtocolEvents.h"
  168. #include "CommonScreens.h"
  169. #include "EventsGprot.h"
  170. #include "SettingProfile.h"
  171. #include "wgui_categories_popup.h"
  172. #include "wgui_categories_inputs.h"
  173. #include "wgui_status_icons.h"  /* for STATUS_ICON */
  174. #include "mdi_include.h"
  175. #include "mdi_audio.h"
  176. #include "CallmanagementIdDef.h"
  177. #include "custom_data_account.h"
  178. #include "DataAccountGProt.h"
  179. #include "KeyBrd.h"
  180. #include "gpioInc.h"
  181. #include "AudioInc.h"
  182. #include "TimerEvents.h"
  183. #include "ProfileGprots.h"
  184. #include "sip_msg_api.h"
  185. #include "sip_ua_api.h"
  186. #include "app2soc_struct.h"
  187. #include "soc_api.h"
  188. #include "app2sip_struct.h"
  189. #include "app2xdm_struct.h"
  190. #include "mmi2poc_struct.h"
  191. #include "custom_poc_config.h"
  192. #include "PoCGprot.h"
  193. #include "PoCProt.h"
  194. #include "wap_ps_struct.h"
  195. #include "CallManagementGprot.h"
  196. #define WT_SERVER "http://xdm-devel.wt.fi"
  197. // #define WT_SERVER "http://xdm.wt.fi"
  198. /*****************************************************************************
  199.  * FUNCTION
  200.  *  mmi_poc_highlight_cm_add_user
  201.  * DESCRIPTION
  202.  *  Highlight handler of PoC menu
  203.  * PARAMETERS
  204.  *  void
  205.  * RETURNS
  206.  *  void
  207.  *****************************************************************************/
  208. void mmi_poc_highlight_cm_add_user(void)
  209. {
  210.     /*----------------------------------------------------------------*/
  211.     /* Local Variables                                                */
  212.     /*----------------------------------------------------------------*/
  213.     /*----------------------------------------------------------------*/
  214.     /* Code Body                                                      */
  215.     /*----------------------------------------------------------------*/
  216.     SetLeftSoftkeyFunction(mmi_poc_entry_cm_add_user, KEY_EVENT_UP);
  217.     SetKeyHandler(mmi_poc_entry_cm_add_user, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  218.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  219.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  220.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  221. }
  222. /*****************************************************************************
  223.  * FUNCTION
  224.  *  mmi_poc_highlight_cm_subscribe
  225.  * DESCRIPTION
  226.  *  Highlight handler of PoC menu
  227.  * PARAMETERS
  228.  *  void
  229.  * RETURNS
  230.  *  void
  231.  *****************************************************************************/
  232. void mmi_poc_highlight_cm_subscribe(void)
  233. {
  234.     /*----------------------------------------------------------------*/
  235.     /* Local Variables                                                */
  236.     /*----------------------------------------------------------------*/
  237.     /*----------------------------------------------------------------*/
  238.     /* Code Body                                                      */
  239.     /*----------------------------------------------------------------*/
  240.     SetLeftSoftkeyFunction(mmi_poc_talk_status_subscribe, KEY_EVENT_UP);
  241.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  242.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  243.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  244.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  245. }
  246. /*****************************************************************************
  247.  * FUNCTION
  248.  *  mmi_poc_highlight_cm_unsubscribe
  249.  * DESCRIPTION
  250.  *  Highlight handler of PoC menu
  251.  * PARAMETERS
  252.  *  void
  253.  * RETURNS
  254.  *  void
  255.  *****************************************************************************/
  256. void mmi_poc_highlight_cm_unsubscribe(void)
  257. {
  258.     /*----------------------------------------------------------------*/
  259.     /* Local Variables                                                */
  260.     /*----------------------------------------------------------------*/
  261.     /*----------------------------------------------------------------*/
  262.     /* Code Body                                                      */
  263.     /*----------------------------------------------------------------*/
  264.     SetLeftSoftkeyFunction(mmi_poc_talk_status_unsubscribe, KEY_EVENT_UP);
  265.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  266.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  267.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  268.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  269. }
  270. /*****************************************************************************
  271.  * FUNCTION
  272.  *  mmi_poc_highlight_cm_talk_group
  273.  * DESCRIPTION
  274.  *  Highlight handler of PoC menu
  275.  * PARAMETERS
  276.  *  void
  277.  * RETURNS
  278.  *  void
  279.  *****************************************************************************/
  280. void mmi_poc_highlight_cm_talk_group(void)
  281. {
  282.     /*----------------------------------------------------------------*/
  283.     /* Local Variables                                                */
  284.     /*----------------------------------------------------------------*/
  285.     /*----------------------------------------------------------------*/
  286.     /* Code Body                                                      */
  287.     /*----------------------------------------------------------------*/
  288.     SetLeftSoftkeyFunction(mmi_poc_entry_talk_groups, KEY_EVENT_UP);
  289.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  290.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  291.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  292.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  293. }
  294. /*****************************************************************************
  295.  * FUNCTION
  296.  *  mmi_poc_entry_status
  297.  * DESCRIPTION
  298.  *  Entry function when user select Status in PoC Menu
  299.  * PARAMETERS
  300.  *  void
  301.  * RETURNS
  302.  *  void
  303.  *****************************************************************************/
  304. void mmi_poc_entry_status(void)
  305. {
  306.     /*----------------------------------------------------------------*/
  307.     /* Local Variables                                                */
  308.     /*----------------------------------------------------------------*/
  309.     /*----------------------------------------------------------------*/
  310.     /* Code Body                                                      */
  311.     /*----------------------------------------------------------------*/
  312.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_STATUS));
  313.     if (g_poc_cntx_p->call_status != POC_CALL_NONE)
  314.     {
  315.         MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  316.         DisplayPopup(
  317.             (U8*) GetString(STR_ID_POC_ERR_TERMINATE_CALL_FIRST),
  318.             IMG_GLOBAL_WARNING,
  319.             1,
  320.             UI_POPUP_NOTIFYDURATION_TIME,
  321.             (U8) WARNING_TONE);
  322.         return;
  323.     }
  324.     ClearInputEventHandler(MMI_DEVICE_ALL);
  325.     switch (g_poc_cntx_p->curr_reg_state)
  326.     {
  327.         case POC_REG_NONE:
  328.             g_poc_cntx_p->curr_reg_state = POC_REG_REGING;
  329.             mmi_poc_entry_registering();
  330.             mmi_poc_wps_query_req();
  331.             break;
  332.         case POC_REG_REGED:
  333.             g_poc_cntx_p->curr_reg_state = POC_REG_DEREGING;
  334.             mmi_poc_entry_registering();
  335.             if (g_poc_cntx_p->curr_use_pres_mode == MMI_TRUE)
  336.             {
  337.                 mmi_poc_dereg_pres_unsubscribe_req();
  338.             }
  339.             else
  340.             {
  341.                 mmi_poc_deregister_req();
  342.             }
  343.             break;
  344.         case POC_REG_REGING:
  345.         case POC_REG_DEREGING:
  346.             DisplayPopup(
  347.                 (U8*) GetString(STR_ID_POC_PROCESSING),
  348.                 IMG_GLOBAL_WARNING,
  349.                 1,
  350.                 UI_POPUP_NOTIFYDURATION_TIME,
  351.                 (U8) WARNING_TONE);
  352.             break;
  353.         default:
  354.             break;
  355.     }
  356. }
  357. /*****************************************************************************
  358.  * FUNCTION
  359.  *  mmi_poc_poweron_reg
  360.  * DESCRIPTION
  361.  *  Power on registration
  362.  * PARAMETERS
  363.  *  void
  364.  * RETURNS
  365.  *  void
  366.  *****************************************************************************/
  367. void mmi_poc_poweron_reg(void)
  368. {
  369.     /*----------------------------------------------------------------*/
  370.     /* Local Variables                                                */
  371.     /*----------------------------------------------------------------*/
  372.     /*----------------------------------------------------------------*/
  373.     /* Code Body                                                      */
  374.     /*----------------------------------------------------------------*/
  375.     mmi_poc_init_prof_setting_check(NULL);
  376.     if ((g_poc_cntx_p->power_on_reg_sent == POC_BOOTREG_NONE) && (g_poc_cntx_p->curr_boot_start_mode == MMI_TRUE) &&
  377.         (g_poc_cntx_p->curr_reg_state == POC_REG_NONE))
  378.     {
  379.         g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_SENT;
  380.         g_poc_cntx_p->curr_reg_state = POC_REG_REGING;
  381.         mmi_poc_wps_query_req();
  382.     }
  383. }
  384. /*****************************************************************************
  385.  * FUNCTION
  386.  *  mmi_poc_poweroff_dereg
  387.  * DESCRIPTION
  388.  *  Power off deregistration
  389.  * PARAMETERS
  390.  *  void
  391.  * RETURNS
  392.  *  void
  393.  *****************************************************************************/
  394. void mmi_poc_poweroff_dereg(void)
  395. {
  396.     /*----------------------------------------------------------------*/
  397.     /* Local Variables                                                */
  398.     /*----------------------------------------------------------------*/
  399.     /*----------------------------------------------------------------*/
  400.     /* Code Body                                                      */
  401.     /*----------------------------------------------------------------*/
  402.     if (g_poc_cntx_p->curr_reg_state == POC_REG_REGED)
  403.     {
  404.         g_poc_cntx_p->curr_reg_state = POC_REG_DEREGING;
  405.         mmi_poc_register_req();
  406.         ClearProtocolEventHandler(PRT_POC_REGISTER_RSP);
  407.     }
  408. }
  409. /*****************************************************************************
  410.  * FUNCTION
  411.  *  mmi_poc_wps_query_req
  412.  * DESCRIPTION
  413.  *  send request to query wps state
  414.  * PARAMETERS
  415.  *  void
  416.  * RETURNS
  417.  *  void
  418.  *****************************************************************************/
  419. void mmi_poc_wps_query_req(void)
  420. {
  421.     /*----------------------------------------------------------------*/
  422.     /* Local Variables                                                */
  423.     /*----------------------------------------------------------------*/
  424.     MYQUEUE Message;
  425.     /*----------------------------------------------------------------*/
  426.     /* Code Body                                                      */
  427.     /*----------------------------------------------------------------*/
  428.     memset(&g_poc_cntx_p->progressing, 0, sizeof(g_poc_cntx_p->progressing));
  429.     memset(g_poc_cntx_p->contact_list, 0, sizeof(g_poc_cntx_p->contact_list));
  430.     memset(g_poc_cntx_p->talk_group_list, 0, sizeof(g_poc_cntx_p->talk_group_list));
  431.     g_poc_cntx_p->contact_local_updated = MMI_FALSE;
  432.     g_poc_cntx_p->talk_group_local_updated = MMI_FALSE;
  433.     SetProtocolEventHandler(mmi_poc_wps_query_rsp, MSG_ID_WPS_STATUS_QUERY_RSP);
  434.     SetProtocolEventHandler(mmi_poc_wps_ready_ind, MSG_ID_WPS_READY_IND);
  435.     Message.oslSrcId = MOD_MMI;
  436.     Message.oslDestId = MOD_WPS;
  437.     Message.oslMsgId = MSG_ID_WPS_STATUS_QUERY_REQ;
  438.     Message.oslDataPtr = NULL;
  439.     Message.oslPeerBuffPtr = NULL;
  440.     OslMsgSendExtQueue(&Message);
  441. }
  442. /*****************************************************************************
  443.  * FUNCTION
  444.  *  mmi_poc_wps_query_rsp
  445.  * DESCRIPTION
  446.  *  Response for wps query
  447.  * PARAMETERS
  448.  *  info        [IN]        Local parameters from protocol
  449.  * RETURNS
  450.  *  void
  451.  *****************************************************************************/
  452. void mmi_poc_wps_query_rsp(void *info)
  453. {
  454.     /*----------------------------------------------------------------*/
  455.     /* Local Variables                                                */
  456.     /*----------------------------------------------------------------*/
  457.     wps_status_query_rsp_struct *msgRsp;
  458.     /*----------------------------------------------------------------*/
  459.     /* Code Body                                                      */
  460.     /*----------------------------------------------------------------*/
  461.     msgRsp = (wps_status_query_rsp_struct*) info;
  462.     ClearProtocolEventHandler(MSG_ID_WPS_STATUS_QUERY_RSP);
  463.     if (msgRsp->status == KAL_TRUE)
  464.     {
  465.         ClearProtocolEventHandler(MSG_ID_WPS_READY_IND);
  466.         if (g_poc_cntx_p->curr_use_xdm_mode == MMI_TRUE)
  467.         {
  468.             mmi_poc_group_init_req();
  469.         }
  470.         else
  471.         {
  472.             mmi_poc_register_req();
  473.         }
  474.     }
  475. }
  476. /*****************************************************************************
  477.  * FUNCTION
  478.  *  mmi_poc_wps_ready_ind
  479.  * DESCRIPTION
  480.  *  wps ready indication
  481.  * PARAMETERS
  482.  *  info        [IN]        Local parameters from protocol
  483.  * RETURNS
  484.  *  void
  485.  *****************************************************************************/
  486. void mmi_poc_wps_ready_ind(void *info)
  487. {
  488.     /*----------------------------------------------------------------*/
  489.     /* Local Variables                                                */
  490.     /*----------------------------------------------------------------*/
  491.     /*----------------------------------------------------------------*/
  492.     /* Code Body                                                      */
  493.     /*----------------------------------------------------------------*/
  494.     ClearProtocolEventHandler(MSG_ID_WPS_STATUS_QUERY_RSP);
  495.     ClearProtocolEventHandler(MSG_ID_WPS_READY_IND);
  496.     if (g_poc_cntx_p->curr_use_xdm_mode == MMI_TRUE)
  497.     {
  498.         mmi_poc_group_init_req();
  499.     }
  500.     else
  501.     {
  502.         mmi_poc_register_req();
  503.     }
  504. }
  505. /*****************************************************************************
  506.  * FUNCTION
  507.  *  mmi_poc_group_init_req
  508.  * DESCRIPTION
  509.  *  PoC group init request
  510.  * PARAMETERS
  511.  *  void
  512.  * RETURNS
  513.  *  void
  514.  *****************************************************************************/
  515. void mmi_poc_group_init_req(void)
  516. {
  517.     /*----------------------------------------------------------------*/
  518.     /* Local Variables                                                */
  519.     /*----------------------------------------------------------------*/
  520.     MYQUEUE Message;
  521.     poc_group_init_req_struct *myMsgPtr;
  522.     /*----------------------------------------------------------------*/
  523.     /* Code Body                                                      */
  524.     /*----------------------------------------------------------------*/
  525.     myMsgPtr = (poc_group_init_req_struct*) OslConstructDataPtr(sizeof(poc_group_init_req_struct));
  526.     memset(
  527.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  528.         0,
  529.         sizeof(poc_group_init_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  530.     myMsgPtr->net_id = g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].data_account;
  531.     memcpy(
  532.         myMsgPtr->root_uri,
  533.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].xdm_addr,
  534.         XDM_ROOT_URI_LEN * sizeof(U8));
  535.     memcpy(myMsgPtr->xui, g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].uri, XDM_XUI_LEN * sizeof(U8));
  536.     memcpy(
  537.         myMsgPtr->password,
  538.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].password,
  539.         XDM_PASSWD_LEN * sizeof(U8));
  540.     myMsgPtr->use_proxy = g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].use_proxy;
  541.     memcpy(
  542.         myMsgPtr->prx_ip,
  543.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].proxy_ip,
  544.         XDM_MAX_IP_LEN * sizeof(U8));
  545.     myMsgPtr->prx_port = g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].proxy_port;
  546.     memcpy(
  547.         myMsgPtr->proxy_username,
  548.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].proxy_username,
  549.         XDM_MAX_PROXY_USERNAME_LEN * sizeof(U8));
  550.     memcpy(
  551.         myMsgPtr->proxy_pass,
  552.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].proxy_password,
  553.         XDM_MAX_PROXY_PASS_LEN * sizeof(U8));
  554.     SetProtocolEventHandler(mmi_poc_group_init_rsp, MSG_ID_POC_GROUP_INIT_RSP);
  555.     Message.oslSrcId = MOD_MMI;
  556.     Message.oslDestId = MOD_POC;
  557.     Message.oslMsgId = MSG_ID_POC_GROUP_INIT_REQ;
  558.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  559.     Message.oslPeerBuffPtr = NULL;
  560.     OslMsgSendExtQueue(&Message);
  561. }
  562. /*****************************************************************************
  563.  * FUNCTION
  564.  *  mmi_poc_group_init_rsp
  565.  * DESCRIPTION
  566.  *  PoC group init response
  567.  * PARAMETERS
  568.  *  info        [IN]        Local parameters from protocol
  569.  * RETURNS
  570.  *  void
  571.  *****************************************************************************/
  572. void mmi_poc_group_init_rsp(void *info)
  573. {
  574.     /*----------------------------------------------------------------*/
  575.     /* Local Variables                                                */
  576.     /*----------------------------------------------------------------*/
  577.     poc_group_init_rsp_struct *msgRsp;
  578.     /*----------------------------------------------------------------*/
  579.     /* Code Body                                                      */
  580.     /*----------------------------------------------------------------*/
  581.     msgRsp = (poc_group_init_rsp_struct*) info;
  582.     ClearProtocolEventHandler(MSG_ID_POC_GROUP_INIT_RSP);
  583.     if (msgRsp->result == POC_OK)
  584.     {
  585.         g_poc_cntx_p->curr_group_id = 0;
  586.         g_poc_cntx_p->curr_entry_id = 0;
  587.         memset(
  588.             g_poc_cntx_p->contact_list,
  589.             0,
  590.             sizeof(mmi_poc_contact_struct) * MAX_POC_GROUP_FILE_NUM * MAX_POC_GROUPS_PER_FILE_NUM);
  591.         mmi_poc_get_group_list_req();
  592.     }
  593.     else
  594.     {
  595.         if (g_poc_cntx_p->power_on_reg_sent == POC_BOOTREG_SENT)
  596.         {
  597.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_NONE;
  598.         }
  599.         else
  600.         {
  601.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_FINISH;
  602.         }
  603.         if (((GetActiveScreenId() == SCR_ID_POC_REG) || (GetActiveScreenId() == SCR_ID_POC_MAIN)))
  604.         {
  605.             mmi_poc_show_error_cause(POC_XDM_ERROR, 0);
  606.         }
  607.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  608.         g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  609.     }
  610. }
  611. /*****************************************************************************
  612.  * FUNCTION
  613.  *  mmi_poc_get_group_list_req
  614.  * DESCRIPTION
  615.  *  Get contact list request
  616.  * PARAMETERS
  617.  *  void
  618.  * RETURNS
  619.  *  void
  620.  *****************************************************************************/
  621. void mmi_poc_get_group_list_req(void)
  622. {
  623.     /*----------------------------------------------------------------*/
  624.     /* Local Variables                                                */
  625.     /*----------------------------------------------------------------*/
  626.     MYQUEUE Message;
  627.     poc_get_group_list_req_struct *myMsgPtr;
  628.     /*----------------------------------------------------------------*/
  629.     /* Code Body                                                      */
  630.     /*----------------------------------------------------------------*/
  631.     myMsgPtr = (poc_get_group_list_req_struct*) OslConstructDataPtr(sizeof(poc_get_group_list_req_struct));
  632.     memset(
  633.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  634.         0,
  635.         sizeof(poc_get_group_list_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  636.     myMsgPtr->request_id = POC_REQUEST_ID;
  637.     myMsgPtr->start_group = g_poc_cntx_p->curr_group_id;
  638.     myMsgPtr->start_entry = g_poc_cntx_p->curr_entry_id;
  639.     if (g_poc_cntx_p->curr_use_pres_mode == MMI_TRUE)
  640.     {
  641.         myMsgPtr->xdm_item = POC_XDM_GL_PRESENT | POC_XDM_AL_PRESENT | POC_XDM_AR_PRESENT | POC_XDM_RLS_PRESENT;
  642.     }
  643.     else
  644.     {
  645.         myMsgPtr->xdm_item = POC_XDM_GL_PRESENT | POC_XDM_AL_PRESENT;
  646.     }
  647.     g_poc_cntx_p->contact_local_updated = MMI_FALSE;
  648.     SetProtocolEventHandler(mmi_poc_get_group_list_rsp, MSG_ID_POC_GET_GROUP_LIST_RSP);
  649.     Message.oslSrcId = MOD_MMI;
  650.     Message.oslDestId = MOD_POC;
  651.     Message.oslMsgId = MSG_ID_POC_GET_GROUP_LIST_REQ;
  652.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  653.     Message.oslPeerBuffPtr = NULL;
  654.     OslMsgSendExtQueue(&Message);
  655. }
  656. /*****************************************************************************
  657.  * FUNCTION
  658.  *  mmi_poc_get_group_list_rsp
  659.  * DESCRIPTION
  660.  *  Get contact list response
  661.  * PARAMETERS
  662.  *  info        [IN]        Local parameters from protocol
  663.  * RETURNS
  664.  *  void
  665.  *****************************************************************************/
  666. void mmi_poc_get_group_list_rsp(void *info)
  667. {
  668.     /*----------------------------------------------------------------*/
  669.     /* Local Variables                                                */
  670.     /*----------------------------------------------------------------*/
  671.     U8 i, temp_idx;
  672.     poc_get_group_list_rsp_struct *msgRsp;
  673.     /*----------------------------------------------------------------*/
  674.     /* Code Body                                                      */
  675.     /*----------------------------------------------------------------*/
  676.     msgRsp = (poc_get_group_list_rsp_struct*) info;
  677.     ClearProtocolEventHandler(MSG_ID_POC_GET_GROUP_LIST_RSP);
  678.     if (msgRsp->result == POC_OK)
  679.     {
  680.         if (g_poc_cntx_p->curr_entry_id == 0)
  681.         {
  682.             g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].valid = MMI_TRUE;
  683.             memcpy(
  684.                 g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].list_name,
  685.                 msgRsp->list_name,
  686.                 POC_MAX_DISP_LEN * sizeof(U8));
  687.         }
  688.         for (i = 0; i < msgRsp->no_entries; i++)
  689.         {
  690.             if (g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].no_entries < POC_GROUP_LOCAL_MAX_ENTRIES_NUM)
  691.             {
  692.                 temp_idx = g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].no_entries;
  693.                 g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].allow_invite =
  694.                     msgRsp->entries[i].allow_invite;
  695.                 g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].sub_pres =
  696.                     msgRsp->entries[i].sub_pres;
  697.                 memcpy(
  698.                     &g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].auth_rule,
  699.                     &(msgRsp->entries[i].auth_rule),
  700.                     sizeof(poc_pres_authrule_struct));
  701.                 switch (g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].auth_rule.
  702.                         sub_handling)
  703.                 {
  704.                     case POC_PRES_ACTION_BLOCK:
  705.                     case POC_PRES_ACTION_POLITE_BLOCK:
  706.                     case POC_PRES_ACTION_ALLOW:
  707.                         g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].auth_rule.
  708.                             sub_handling++;
  709.                         break;
  710.                     default:
  711.                         g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].auth_rule.
  712.                             sub_handling = POC_MMI_SUB_EMPTY;
  713.                         break;
  714.                 }
  715.                 memcpy(
  716.                     g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].uri,
  717.                     msgRsp->entries[i].uri,
  718.                     sizeof(U8) * POC_MAX_URI_LEN);
  719.                 memcpy(
  720.                     g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].entries[temp_idx].display_name,
  721.                     msgRsp->entries[i].disp_name,
  722.                     sizeof(U8) * POC_MAX_DISP_LEN);
  723.                 g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].no_entries++;
  724.             }
  725.         }
  726.         g_poc_cntx_p->curr_entry_id = g_poc_cntx_p->contact_list[g_poc_cntx_p->curr_group_id].no_entries;
  727.         if (msgRsp->more_data == KAL_TRUE)
  728.         {
  729.             mmi_poc_get_group_list_req();
  730.         }
  731.         else if ((msgRsp->more_list == KAL_TRUE)
  732.                  && (g_poc_cntx_p->curr_group_id < MAX_POC_GROUP_FILE_NUM * MAX_POC_GROUPS_PER_FILE_NUM))
  733.         {
  734.             g_poc_cntx_p->curr_group_id++;
  735.             g_poc_cntx_p->curr_entry_id = 0;
  736.             mmi_poc_get_group_list_req();
  737.         }
  738.         else
  739.         {
  740.             g_poc_cntx_p->curr_group_id = 0;
  741.             g_poc_cntx_p->curr_entry_id = 0;
  742.             memset(
  743.                 g_poc_cntx_p->talk_group_list,
  744.                 0,
  745.                 sizeof(poc_talk_group_struct) * MAX_POC_TALK_GROUP_FILE_NUM * MAX_POC_TALK_GROUPS_PER_FILE_NUM);
  746.             mmi_poc_get_talk_group_list_req();
  747.         }
  748.     }
  749.     else if ((msgRsp->result == POC_XDM_ERROR) && (msgRsp->cause == POC_GRP_CAUSE_EMPTY_DIR))
  750.     {
  751.         mmi_poc_get_talk_group_list_req();
  752.     }
  753.     else
  754.     {
  755.         if (g_poc_cntx_p->power_on_reg_sent == POC_BOOTREG_SENT)
  756.         {
  757.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_NONE;
  758.         }
  759.         else
  760.         {
  761.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_FINISH;
  762.         }
  763.         if (((GetActiveScreenId() == SCR_ID_POC_REG) || (GetActiveScreenId() == SCR_ID_POC_MAIN)))
  764.         {
  765.             mmi_poc_show_error_cause(POC_XDM_ERROR, 0);
  766.         }
  767.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  768.         g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  769.         mmi_poc_group_deinit_req();
  770.         ClearProtocolEventHandler(MSG_ID_POC_GROUP_DEINIT_RSP);
  771.     }
  772. }
  773. /*****************************************************************************
  774.  * FUNCTION
  775.  *  mmi_poc_get_talk_group_list_req
  776.  * DESCRIPTION
  777.  *  Get talk group list request
  778.  * PARAMETERS
  779.  *  void
  780.  * RETURNS
  781.  *  void
  782.  *****************************************************************************/
  783. void mmi_poc_get_talk_group_list_req(void)
  784. {
  785.     /*----------------------------------------------------------------*/
  786.     /* Local Variables                                                */
  787.     /*----------------------------------------------------------------*/
  788.     MYQUEUE Message;
  789.     poc_get_talk_group_list_req_struct *myMsgPtr;
  790.     /*----------------------------------------------------------------*/
  791.     /* Code Body                                                      */
  792.     /*----------------------------------------------------------------*/
  793.     myMsgPtr = (poc_get_talk_group_list_req_struct*) OslConstructDataPtr(sizeof(poc_get_talk_group_list_req_struct));
  794.     memset(
  795.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  796.         0,
  797.         sizeof(poc_get_talk_group_list_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  798.     myMsgPtr->request_id = POC_REQUEST_ID;
  799.     myMsgPtr->start_group = g_poc_cntx_p->curr_group_id;
  800.     myMsgPtr->start_entry = g_poc_cntx_p->curr_entry_id;
  801.     SetProtocolEventHandler(mmi_poc_get_talk_group_list_rsp, MSG_ID_POC_GET_TALK_GROUP_LIST_RSP);
  802.     Message.oslSrcId = MOD_MMI;
  803.     Message.oslDestId = MOD_POC;
  804.     Message.oslMsgId = MSG_ID_POC_GET_TALK_GROUP_LIST_REQ;
  805.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  806.     Message.oslPeerBuffPtr = NULL;
  807.     OslMsgSendExtQueue(&Message);
  808. }
  809. /*****************************************************************************
  810.  * FUNCTION
  811.  *  mmi_poc_get_talk_group_list_rsp
  812.  * DESCRIPTION
  813.  *  Get talk group list response
  814.  * PARAMETERS
  815.  *  info        [IN]        Local parameters from protocol
  816.  * RETURNS
  817.  *  void
  818.  *****************************************************************************/
  819. void mmi_poc_get_talk_group_list_rsp(void *info)
  820. {
  821.     /*----------------------------------------------------------------*/
  822.     /* Local Variables                                                */
  823.     /*----------------------------------------------------------------*/
  824.     U8 i, temp_idx;
  825.     poc_get_talk_group_list_rsp_struct *msgRsp;
  826.     /*----------------------------------------------------------------*/
  827.     /* Code Body                                                      */
  828.     /*----------------------------------------------------------------*/
  829.     msgRsp = (poc_get_talk_group_list_rsp_struct*) info;
  830.     ClearProtocolEventHandler(MSG_ID_POC_GET_TALK_GROUP_LIST_RSP);
  831.     if (msgRsp->result == POC_OK)
  832.     {
  833.         if (g_poc_cntx_p->curr_entry_id == 0)
  834.         {
  835.             g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].valid = MMI_TRUE;
  836.             memcpy(
  837.                 g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].list_uri,
  838.                 msgRsp->list_uri,
  839.                 POC_MAX_URI_LEN * sizeof(U8));
  840.             g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].display_name_lang = msgRsp->display_name_lang;
  841.             memcpy(
  842.                 g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].display_name,
  843.                 msgRsp->display_name,
  844.                 POC_MAX_DISP_LEN * sizeof(U8));
  845.             g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].max_participant_count =
  846.                 msgRsp->max_participant_count;
  847.             g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].invite_member = msgRsp->invite_member;
  848.             memcpy(
  849.                 &g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].default_rule,
  850.                 &msgRsp->default_rule,
  851.                 sizeof(poc_group_param_struct));
  852.         }
  853.         for (i = 0; i < msgRsp->no_entries; i++)
  854.         {
  855.             if (g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].no_entries <
  856.                 POC_TALK_GROUP_LOCAL_MAX_ENTRIES_NUM)
  857.             {
  858.                 temp_idx = g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].no_entries;
  859.                 memcpy(
  860.                     &(g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].entries[temp_idx]),
  861.                     &(msgRsp->entries[i]),
  862.                     sizeof(poc_talk_group_entry_struct));
  863.                 g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].no_entries++;
  864.             }
  865.         }
  866.         g_poc_cntx_p->curr_entry_id = g_poc_cntx_p->talk_group_list[g_poc_cntx_p->curr_group_id].no_entries;
  867.         if (msgRsp->more_data == KAL_TRUE)
  868.         {
  869.             mmi_poc_get_talk_group_list_req();
  870.         }
  871.         else if ((msgRsp->more_group == KAL_TRUE)
  872.                  && (g_poc_cntx_p->curr_group_id < MAX_POC_TALK_GROUP_FILE_NUM * MAX_POC_TALK_GROUPS_PER_FILE_NUM))
  873.         {
  874.             g_poc_cntx_p->curr_group_id++;
  875.             g_poc_cntx_p->curr_entry_id = 0;
  876.             mmi_poc_get_talk_group_list_req();
  877.         }
  878.         else
  879.         {
  880.             mmi_poc_register_req();
  881.         }
  882.     }
  883.     else if (msgRsp->result == POC_XDM_ERROR && msgRsp->cause == POC_GRP_CAUSE_EMPTY_DIR)
  884.     {
  885.         mmi_poc_register_req();
  886.     }
  887.     else
  888.     {
  889.         if (g_poc_cntx_p->power_on_reg_sent == POC_BOOTREG_SENT)
  890.         {
  891.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_NONE;
  892.         }
  893.         else
  894.         {
  895.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_FINISH;
  896.         }
  897.         if (((GetActiveScreenId() == SCR_ID_POC_REG) || (GetActiveScreenId() == SCR_ID_POC_MAIN)))
  898.         {
  899.             mmi_poc_show_error_cause(POC_XDM_ERROR, 0);
  900.         }
  901.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  902.         g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  903.         mmi_poc_group_deinit_req();
  904.         ClearProtocolEventHandler(MSG_ID_POC_GROUP_DEINIT_RSP);
  905.     }
  906. }
  907. /*****************************************************************************
  908.  * FUNCTION
  909.  *  mmi_poc_register_req
  910.  * DESCRIPTION
  911.  *  PoC register request
  912.  * PARAMETERS
  913.  *  void
  914.  * RETURNS
  915.  *  void
  916.  *****************************************************************************/
  917. void mmi_poc_register_req(void)
  918. {
  919. #ifdef __POC_MMI_TEST_XDM_ONLY__
  920.     /*----------------------------------------------------------------*/
  921.     /* Local Variables                                                */
  922.     /*----------------------------------------------------------------*/
  923.     /*----------------------------------------------------------------*/
  924.     /* Code Body                                                      */
  925.     /*----------------------------------------------------------------*/
  926.     if (GetActiveScreenId() == SCR_ID_POC_REG)
  927.     {
  928.         DisplayPopup(
  929.             (U8*) GetString(STR_GLOBAL_DONE),
  930.             IMG_GLOBAL_ACTIVATED,
  931.             1,
  932.             UI_POPUP_NOTIFYDURATION_TIME,
  933.             (U8) SUCCESS_TONE);
  934.     }
  935.     else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  936.     {
  937.         DisplayPopup(
  938.             (U8*) GetString(STR_ID_POC_REGISTERED),
  939.             IMG_GLOBAL_ACTIVATED,
  940.             1,
  941.             UI_POPUP_NOTIFYDURATION_TIME,
  942.             (U8) SUCCESS_TONE);
  943.     }
  944.     DeleteScreenIfPresent(SCR_ID_POC_REG);
  945.     g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_FINISH;
  946.     g_poc_cntx_p->curr_reg_state = POC_REG_REGED;
  947.     ShowStatusIcon(STATUS_ICON_POC);
  948.     UpdateStatusIcons();
  949. #else /* __POC_MMI_TEST_XDM_ONLY__ */ 
  950.     MYQUEUE Message;
  951.     poc_register_req_struct *myMsgPtr;
  952.     myMsgPtr = (poc_register_req_struct*) OslConstructDataPtr(sizeof(poc_register_req_struct));
  953.     memset(
  954.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  955.         0,
  956.         sizeof(poc_register_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  957.     ASSERT(g_poc_cntx_p->curr_reg_state == POC_REG_REGING || g_poc_cntx_p->curr_reg_state == POC_REG_DEREGING);
  958.     myMsgPtr->action = POC_REGISTER_ACTION;
  959.     UnicodeToAnsii(
  960.         (S8*) myMsgPtr->contact.disp_name,
  961.         (S8*) g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].disp_name);
  962.     memcpy(
  963.         myMsgPtr->contact.uri,
  964.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].uri,
  965.         POC_MAX_URI_LEN * sizeof(U8));
  966.     myMsgPtr->contact.disp_charset = 0;
  967.     myMsgPtr->data_account = g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].data_account;
  968.     memcpy(
  969.         myMsgPtr->proxy_addr,
  970.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].poc_addr,
  971.         POC_PROXY_ADDR_LEN * sizeof(U8));
  972.     myMsgPtr->proxy_port = g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].poc_port;
  973.     memcpy(
  974.         myMsgPtr->password,
  975.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].password,
  976.         POC_MAX_PASSWORD_LEN * sizeof(U8));
  977.     Message.oslSrcId = MOD_MMI;
  978.     Message.oslDestId = MOD_POC;
  979.     Message.oslMsgId = PRT_POC_REGISTER_REQ;
  980.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  981.     Message.oslPeerBuffPtr = NULL;
  982.     OslMsgSendExtQueue(&Message);
  983.     SetProtocolEventHandler(mmi_poc_register_rsp, PRT_POC_REGISTER_RSP);
  984. #endif /* __POC_MMI_TEST_XDM_ONLY__ */ 
  985. }
  986. /*****************************************************************************
  987.  * FUNCTION
  988.  *  mmi_poc_register_rsp
  989.  * DESCRIPTION
  990.  *  PoC register response
  991.  * PARAMETERS
  992.  *  info        [IN]        Local parameters from protocol
  993.  * RETURNS
  994.  *  void
  995.  *****************************************************************************/
  996. void mmi_poc_register_rsp(void *info)
  997. {
  998.     /*----------------------------------------------------------------*/
  999.     /* Local Variables                                                */
  1000.     /*----------------------------------------------------------------*/
  1001.     poc_register_rsp_struct *msgRsp;
  1002.     /*----------------------------------------------------------------*/
  1003.     /* Code Body                                                      */
  1004.     /*----------------------------------------------------------------*/
  1005.     msgRsp = (poc_register_rsp_struct*) info;
  1006.     ASSERT(g_poc_cntx_p->curr_reg_state == POC_REG_REGING || g_poc_cntx_p->curr_reg_state == POC_REG_DEREGING);
  1007.     ClearProtocolEventHandler(PRT_POC_REGISTER_RSP);
  1008.     if (msgRsp->result == POC_OK)
  1009.     {
  1010.         mmi_poc_reg_send_setting_req();
  1011.     }
  1012.     else
  1013.     {
  1014.         g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  1015.         if (g_poc_cntx_p->curr_use_xdm_mode == MMI_TRUE)
  1016.         {
  1017.             mmi_poc_group_deinit_req();
  1018.             ClearProtocolEventHandler(MSG_ID_POC_GROUP_DEINIT_RSP);
  1019.         }
  1020.         if (g_poc_cntx_p->power_on_reg_sent == POC_BOOTREG_SENT)
  1021.         {
  1022.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_NONE;
  1023.         }
  1024.         else
  1025.         {
  1026.             g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_FINISH;
  1027.         }
  1028.         if (((GetActiveScreenId() == SCR_ID_POC_REG) || (GetActiveScreenId() == SCR_ID_POC_MAIN)))
  1029.         {
  1030.             mmi_poc_show_error_cause(msgRsp->result, msgRsp->cause);
  1031.         }
  1032.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  1033.         g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  1034.     }
  1035. }
  1036. /*****************************************************************************
  1037.  * FUNCTION
  1038.  *  mmi_poc_register_ind
  1039.  * DESCRIPTION
  1040.  *  PoC periodically registration info update indication
  1041.  * PARAMETERS
  1042.  *  info        [IN]        Local parameters from protocol
  1043.  * RETURNS
  1044.  *  void
  1045.  *****************************************************************************/
  1046. void mmi_poc_register_ind(void *info)
  1047. {
  1048.     /*----------------------------------------------------------------*/
  1049.     /* Local Variables                                                */
  1050.     /*----------------------------------------------------------------*/
  1051.     poc_register_ind_struct *msgRsp;
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055.     msgRsp = (poc_register_ind_struct*) info;
  1056.     if (msgRsp->result != POC_OK)
  1057.     {
  1058.         ClearProtocolEventHandler(PRT_POC_REGISTER_RSP);
  1059.         ClearProtocolEventHandler(MSG_ID_POC_SETTING_RSP);
  1060.         ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1061.         ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_PUBLISH_RSP);
  1062.         if ((GetActiveScreenId() >= SCR_ID_POC_MAIN) && (GetActiveScreenId() < SCR_ID_POC_TOTAL))
  1063.         {
  1064.             TurnOnBacklight(1);
  1065.             DisplayPopup(
  1066.                 (U8*) GetString(STR_ID_POC_ERR_NOT_REGISTERED),
  1067.                 IMG_GLOBAL_ERROR,
  1068.                 1,
  1069.                 UI_POPUP_NOTIFYDURATION_TIME,
  1070.                 (U8) ERROR_TONE);
  1071.         }
  1072.         DeleteScreenIfPresent(SCR_ID_POC_CM);
  1073.         mmi_poc_remove_cm_screens();
  1074.         if (IsScreenPresent(SCR_ID_POC_MAIN))
  1075.         {
  1076.             DeleteUptoScrID(SCR_ID_POC_MAIN);
  1077.         }
  1078.         /* Reset reg status */
  1079.         g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  1080.         HideStatusIcon(STATUS_ICON_POC);
  1081.         UpdateStatusIcons();
  1082.         if (g_poc_cntx_p->curr_use_xdm_mode == MMI_TRUE)
  1083.         {
  1084.             mmi_poc_group_deinit_req();
  1085.             ClearProtocolEventHandler(MSG_ID_POC_GROUP_DEINIT_RSP);
  1086.         }
  1087.     }
  1088. }
  1089. /*****************************************************************************
  1090.  * FUNCTION
  1091.  *  mmi_poc_entry_registering
  1092.  * DESCRIPTION
  1093.  *  poc registering screen
  1094.  * PARAMETERS
  1095.  *  void
  1096.  * RETURNS
  1097.  *  void
  1098.  *****************************************************************************/
  1099. void mmi_poc_entry_registering(void)
  1100. {
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Local Variables                                                */
  1103.     /*----------------------------------------------------------------*/
  1104.     U8 *guiBuffer;
  1105.     U16 caption;
  1106.     /*----------------------------------------------------------------*/
  1107.     /* Code Body                                                      */
  1108.     /*----------------------------------------------------------------*/
  1109.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_REGISTERING));
  1110.     EntryNewScreen(SCR_ID_POC_REG, NULL, mmi_poc_entry_registering, NULL);
  1111.     DeleteScreenIfPresent(SCR_ID_POC_REG);
  1112.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_REG);
  1113.     if (g_poc_cntx_p->curr_reg_state == POC_REG_REGING)
  1114.     {
  1115.         caption = STR_ID_POC_REGISTERING;
  1116.     }
  1117.     else
  1118.     {
  1119.         caption = STR_ID_POC_DEREGISTERING;
  1120.     }
  1121.     ShowCategory66Screen(
  1122.         STR_ID_POC_MAIN,
  1123.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  1124.         0,
  1125.         0,
  1126.         STR_GLOBAL_BACK,
  1127.         IMG_GLOBAL_BACK,
  1128.         (U8*) GetString(caption),
  1129.         IMG_GLOBAL_PROGRESS,
  1130.         NULL);
  1131.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1132. }
  1133. /*****************************************************************************
  1134.  * FUNCTION
  1135.  *  mmi_poc_reg_send_setting_req
  1136.  * DESCRIPTION
  1137.  *  Send poc setting when registration
  1138.  * PARAMETERS
  1139.  *  void
  1140.  * RETURNS
  1141.  *  void
  1142.  *****************************************************************************/
  1143. void mmi_poc_reg_send_setting_req(void)
  1144. {
  1145.     /*----------------------------------------------------------------*/
  1146.     /* Local Variables                                                */
  1147.     /*----------------------------------------------------------------*/
  1148.     MYQUEUE Message;
  1149.     poc_setting_req_struct *myMsgPtr;
  1150.     /*----------------------------------------------------------------*/
  1151.     /* Code Body                                                      */
  1152.     /*----------------------------------------------------------------*/
  1153.     myMsgPtr = (poc_setting_req_struct*) OslConstructDataPtr(sizeof(poc_setting_req_struct));
  1154.     memset(
  1155.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1156.         0,
  1157.         sizeof(poc_setting_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1158.     g_poc_cntx_p->reg_error = MMI_FALSE;
  1159.     myMsgPtr->data.auto_answer = g_poc_cntx_p->curr_ans_mode;
  1160.     myMsgPtr->data.isb = g_poc_cntx_p->curr_call_bar_mode;
  1161.     myMsgPtr->data.ipab = g_poc_cntx_p->curr_alert_bar_mode;
  1162.     myMsgPtr->data.enable_mao = g_poc_cntx_p->curr_mao_mode;
  1163.     myMsgPtr->data.enable_privacy = g_poc_cntx_p->curr_privacy_mode;
  1164.     memcpy(&myMsgPtr->data.privacy_addr, &g_poc_cntx_p->privacy_addr, sizeof(poc_addr_struct));
  1165.     Message.oslSrcId = MOD_MMI;
  1166.     Message.oslDestId = MOD_POC;
  1167.     Message.oslMsgId = PRT_POC_SETTING_REQ;
  1168.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1169.     Message.oslPeerBuffPtr = NULL;
  1170.     OslMsgSendExtQueue(&Message);
  1171.     SetProtocolEventHandler(mmi_poc_reg_send_setting_rsp, PRT_POC_SETTING_RSP);
  1172. }
  1173. /*****************************************************************************
  1174.  * FUNCTION
  1175.  *  mmi_poc_reg_send_setting_rsp
  1176.  * DESCRIPTION
  1177.  *  Response for send PoC settings
  1178.  * PARAMETERS
  1179.  *  info        [IN]        Local parameters from protocol
  1180.  * RETURNS
  1181.  *  void
  1182.  *****************************************************************************/
  1183. void mmi_poc_reg_send_setting_rsp(void *info)
  1184. {
  1185.     /*----------------------------------------------------------------*/
  1186.     /* Local Variables                                                */
  1187.     /*----------------------------------------------------------------*/
  1188.     poc_setting_rsp_struct *msgRsp;
  1189.     /*----------------------------------------------------------------*/
  1190.     /* Code Body                                                      */
  1191.     /*----------------------------------------------------------------*/
  1192.     msgRsp = (poc_setting_rsp_struct*) info;
  1193.     ClearProtocolEventHandler(PRT_POC_SETTING_RSP);
  1194.     if (msgRsp->result != POC_OK)
  1195.     {
  1196.         g_poc_cntx_p->reg_error = MMI_TRUE;
  1197.     }
  1198.     if (g_poc_cntx_p->curr_use_pres_mode == MMI_TRUE)
  1199.     {
  1200.         if (g_poc_cntx_p->curr_use_xdm_mode == MMI_TRUE)
  1201.         {
  1202.             mmi_poc_reg_pres_subscribe_req();
  1203.         }
  1204.         else
  1205.         {
  1206.             mmi_poc_reg_pres_publish_req();
  1207.         }
  1208.     }
  1209.     else
  1210.     {
  1211.         if (g_poc_cntx_p->reg_error == MMI_TRUE)
  1212.         {
  1213.             if (GetActiveScreenId() == SCR_ID_POC_REG)
  1214.             {
  1215.                 DisplayPopup(
  1216.                     (U8*) GetString(STR_ID_POC_ERR_REG_PARTIAL_SUCCESS),
  1217.                     IMG_GLOBAL_ACTIVATED,
  1218.                     1,
  1219.                     UI_POPUP_NOTIFYDURATION_TIME,
  1220.                     (U8) SUCCESS_TONE);
  1221.             }
  1222.             else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  1223.             {
  1224.                 DisplayPopup(
  1225.                     (U8*) GetString(STR_ID_POC_ERR_REG_PARTIAL_SUCCESS),
  1226.                     IMG_GLOBAL_ACTIVATED,
  1227.                     1,
  1228.                     UI_POPUP_NOTIFYDURATION_TIME,
  1229.                     (U8) SUCCESS_TONE);
  1230.             }
  1231.         }
  1232.         else
  1233.         {
  1234.             if (GetActiveScreenId() == SCR_ID_POC_REG)
  1235.             {
  1236.                 DisplayPopup(
  1237.                     (U8*) GetString(STR_GLOBAL_DONE),
  1238.                     IMG_GLOBAL_ACTIVATED,
  1239.                     1,
  1240.                     UI_POPUP_NOTIFYDURATION_TIME,
  1241.                     (U8) SUCCESS_TONE);
  1242.             }
  1243.             else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  1244.             {
  1245.                 DisplayPopup(
  1246.                     (U8*) GetString(STR_ID_POC_REGISTERED),
  1247.                     IMG_GLOBAL_ACTIVATED,
  1248.                     1,
  1249.                     UI_POPUP_NOTIFYDURATION_TIME,
  1250.                     (U8) SUCCESS_TONE);
  1251.             }
  1252.         }
  1253.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  1254.         g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_FINISH;
  1255.         g_poc_cntx_p->curr_reg_state = POC_REG_REGED;
  1256.         ShowStatusIcon(STATUS_ICON_POC);
  1257.         UpdateStatusIcons();
  1258.     }
  1259. }
  1260. #ifndef __POC_NON_RLS__
  1261. /*****************************************************************************
  1262.  * FUNCTION
  1263.  *  mmi_poc_reg_pres_subscribe_req
  1264.  * DESCRIPTION
  1265.  *  presence subscribe request
  1266.  * PARAMETERS
  1267.  *  void
  1268.  * RETURNS
  1269.  *  void
  1270.  *****************************************************************************/
  1271. void mmi_poc_reg_pres_subscribe_req(void)
  1272. {
  1273.     /*----------------------------------------------------------------*/
  1274.     /* Local Variables                                                */
  1275.     /*----------------------------------------------------------------*/
  1276.     MYQUEUE Message;
  1277.     poc_presence_subscribe_req_struct *myMsgPtr;
  1278.     /*----------------------------------------------------------------*/
  1279.     /* Code Body                                                      */
  1280.     /*----------------------------------------------------------------*/
  1281.     myMsgPtr = (poc_presence_subscribe_req_struct*) OslConstructDataPtr(sizeof(poc_presence_subscribe_req_struct));
  1282.     memset(
  1283.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1284.         0,
  1285.         sizeof(poc_presence_subscribe_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1286.     myMsgPtr->action = POC_SUBSCRIBE_ACTION;
  1287.     myMsgPtr->use_presence_list = MMI_TRUE;
  1288.     memcpy(myMsgPtr->uri, POC_MMI_MTK_RLS_URI, POC_MAX_URI_LEN * sizeof(U8));
  1289.     strncat(
  1290.         (S8*) myMsgPtr->uri,
  1291.         (S8*) g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].uri,
  1292.         POC_MAX_URI_LEN - sizeof(POC_MMI_MTK_RLS_URI) - 1);
  1293.     Message.oslSrcId = MOD_MMI;
  1294.     Message.oslDestId = MOD_POC;
  1295.     Message.oslMsgId = MSG_ID_POC_PRESENCE_SUBSCRIBE_REQ;
  1296.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1297.     Message.oslPeerBuffPtr = NULL;
  1298.     OslMsgSendExtQueue(&Message);
  1299.     SetProtocolEventHandler(mmi_poc_reg_pres_subscribe_rsp, MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1300. }
  1301. /*****************************************************************************
  1302.  * FUNCTION
  1303.  *  mmi_poc_reg_pres_subscribe_rsp
  1304.  * DESCRIPTION
  1305.  *  presense subscribe response
  1306.  * PARAMETERS
  1307.  *  info        [IN]        Local parameters from protocol
  1308.  * RETURNS
  1309.  *  void
  1310.  *****************************************************************************/
  1311. void mmi_poc_reg_pres_subscribe_rsp(void *info)
  1312. {
  1313.     /*----------------------------------------------------------------*/
  1314.     /* Local Variables                                                */
  1315.     /*----------------------------------------------------------------*/
  1316.     poc_presence_subscribe_rsp_struct *msgRsp;
  1317.     /*----------------------------------------------------------------*/
  1318.     /* Code Body                                                      */
  1319.     /*----------------------------------------------------------------*/
  1320.     msgRsp = (poc_presence_subscribe_rsp_struct*) info;
  1321.     ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1322.     if (msgRsp->result != POC_OK)
  1323.     {
  1324.         g_poc_cntx_p->reg_error = MMI_TRUE;
  1325.     }
  1326.     mmi_poc_reg_pres_publish_req();
  1327. }
  1328. #else /* __POC_NON_RLS__ */ 
  1329. /*****************************************************************************
  1330.  * FUNCTION
  1331.  *  mmi_poc_reg_pres_subscribe_req
  1332.  * DESCRIPTION
  1333.  *  presence subscribe request
  1334.  * PARAMETERS
  1335.  *  void
  1336.  * RETURNS
  1337.  *  void
  1338.  *****************************************************************************/
  1339. void mmi_poc_reg_pres_subscribe_req(void)
  1340. {
  1341.     /*----------------------------------------------------------------*/
  1342.     /* Local Variables                                                */
  1343.     /*----------------------------------------------------------------*/
  1344.     MYQUEUE Message;
  1345.     poc_presence_subscribe_req_struct *myMsgPtr;
  1346.     static U8 curr_group = 0, curr_entry = 0;
  1347.     /*----------------------------------------------------------------*/
  1348.     /* Code Body                                                      */
  1349.     /*----------------------------------------------------------------*/
  1350.     for (; (g_poc_cntx_p->contact_list[curr_group].valid == MMI_TRUE) &&
  1351.          (curr_group < MAX_POC_GROUP_FILE_NUM * MAX_POC_GROUPS_PER_FILE_NUM); curr_group++)
  1352.     {
  1353.         for (; curr_entry < g_poc_cntx_p->contact_list[curr_group].no_entries; curr_entry++)
  1354.         {
  1355.             if (g_poc_cntx_p->contact_list[curr_group].entries[curr_entry].sub_pres == MMI_TRUE)
  1356.             {
  1357.                 myMsgPtr =
  1358.                     (poc_presence_subscribe_req_struct*)
  1359.                     OslConstructDataPtr(sizeof(poc_presence_subscribe_req_struct));
  1360.                 memset(
  1361.                     (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1362.                     0,
  1363.                     sizeof(poc_presence_subscribe_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1364.                 myMsgPtr->action = POC_SUBSCRIBE_ACTION;
  1365.                 myMsgPtr->use_presence_list = MMI_FALSE;
  1366.                 memcpy(
  1367.                     myMsgPtr->uri,
  1368.                     g_poc_cntx_p->contact_list[curr_group].entries[curr_entry].uri,
  1369.                     POC_MAX_URI_LEN * sizeof(U8));
  1370.                 Message.oslSrcId = MOD_MMI;
  1371.                 Message.oslDestId = MOD_POC;
  1372.                 Message.oslMsgId = MSG_ID_POC_PRESENCE_SUBSCRIBE_REQ;
  1373.                 Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1374.                 Message.oslPeerBuffPtr = NULL;
  1375.                 OslMsgSendExtQueue(&Message);
  1376.                 SetProtocolEventHandler(mmi_poc_reg_pres_subscribe_rsp, MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1377.                 curr_entry++;
  1378.                 return;
  1379.             }
  1380.         }
  1381.         curr_entry = 0;
  1382.     }
  1383.     curr_group = 0;
  1384.     curr_entry = 0;
  1385.     mmi_poc_reg_pres_publish_req();
  1386. }
  1387. /*****************************************************************************
  1388.  * FUNCTION
  1389.  *  mmi_poc_reg_pres_subscribe_rsp
  1390.  * DESCRIPTION
  1391.  *  presence subscribe response
  1392.  * PARAMETERS
  1393.  *  info        [?]     
  1394.  * RETURNS
  1395.  *  void
  1396.  *****************************************************************************/
  1397. void mmi_poc_reg_pres_subscribe_rsp(void *info)
  1398. {
  1399.     /*----------------------------------------------------------------*/
  1400.     /* Local Variables                                                */
  1401.     /*----------------------------------------------------------------*/
  1402.     poc_presence_subscribe_rsp_struct *msgRsp;
  1403.     /*----------------------------------------------------------------*/
  1404.     /* Code Body                                                      */
  1405.     /*----------------------------------------------------------------*/
  1406.     msgRsp = (poc_presence_subscribe_rsp_struct*) info;
  1407.     ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1408.     if (msgRsp->result != POC_OK)
  1409.     {
  1410.         g_poc_cntx_p->reg_error = MMI_TRUE;
  1411.     }
  1412.     mmi_poc_reg_pres_subscribe_req();
  1413. }
  1414. #endif /* __POC_NON_RLS__ */ 
  1415. /*****************************************************************************
  1416.  * FUNCTION
  1417.  *  mmi_poc_reg_pres_publish_req
  1418.  * DESCRIPTION
  1419.  *  presence publish request
  1420.  * PARAMETERS
  1421.  *  void
  1422.  * RETURNS
  1423.  *  void
  1424.  *****************************************************************************/
  1425. void mmi_poc_reg_pres_publish_req(void)
  1426. {
  1427.     /*----------------------------------------------------------------*/
  1428.     /* Local Variables                                                */
  1429.     /*----------------------------------------------------------------*/
  1430.     MYQUEUE Message;
  1431.     poc_presence_publish_req_struct *myMsgPtr;
  1432.     /*----------------------------------------------------------------*/
  1433.     /* Code Body                                                      */
  1434.     /*----------------------------------------------------------------*/
  1435.     myMsgPtr = (poc_presence_publish_req_struct*) OslConstructDataPtr(sizeof(poc_presence_publish_req_struct));
  1436.     memset(
  1437.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1438.         0,
  1439.         sizeof(poc_presence_publish_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1440.     myMsgPtr->remove = MMI_FALSE;
  1441.     memcpy(
  1442.         myMsgPtr->pinfo.entity,
  1443.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].uri,
  1444.         POC_MAX_URI_LEN * sizeof(U8));
  1445.     myMsgPtr->pinfo.is_active = MMI_TRUE;
  1446.     myMsgPtr->pinfo.person.activity_present = g_poc_cntx_p->person_pres.activity_present;
  1447.     myMsgPtr->pinfo.person.activity = g_poc_cntx_p->person_pres.activity;
  1448.     myMsgPtr->pinfo.person.mood_present = g_poc_cntx_p->person_pres.mood_present;
  1449.     myMsgPtr->pinfo.person.mood = g_poc_cntx_p->person_pres.mood;
  1450.     myMsgPtr->pinfo.num_service = 0;
  1451.     Message.oslSrcId = MOD_MMI;
  1452.     Message.oslDestId = MOD_POC;
  1453.     Message.oslMsgId = MSG_ID_POC_PRESENCE_PUBLISH_REQ;
  1454.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1455.     Message.oslPeerBuffPtr = NULL;
  1456.     OslMsgSendExtQueue(&Message);
  1457.     SetProtocolEventHandler(mmi_poc_reg_pres_publish_rsp, MSG_ID_POC_PRESENCE_PUBLISH_RSP);
  1458. }
  1459. /*****************************************************************************
  1460.  * FUNCTION
  1461.  *  mmi_poc_reg_pres_publish_rsp
  1462.  * DESCRIPTION
  1463.  *  presence publish response
  1464.  * PARAMETERS
  1465.  *  info        [IN]        Local parameters from protocol
  1466.  * RETURNS
  1467.  *  void
  1468.  *****************************************************************************/
  1469. void mmi_poc_reg_pres_publish_rsp(void *info)
  1470. {
  1471.     /*----------------------------------------------------------------*/
  1472.     /* Local Variables                                                */
  1473.     /*----------------------------------------------------------------*/
  1474.     poc_presence_publish_rsp_struct *msgRsp;
  1475.     /*----------------------------------------------------------------*/
  1476.     /* Code Body                                                      */
  1477.     /*----------------------------------------------------------------*/
  1478.     msgRsp = (poc_presence_publish_rsp_struct*) info;
  1479.     ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_PUBLISH_RSP);
  1480.     g_poc_cntx_p->power_on_reg_sent = POC_BOOTREG_FINISH;
  1481.     g_poc_cntx_p->curr_reg_state = POC_REG_REGED;
  1482.     ShowStatusIcon(STATUS_ICON_POC);
  1483.     UpdateStatusIcons();
  1484.     mdi_audio_set_background_handler(MDI_BACKGROUND_APP_POC, mmi_poc_mdi_background_handler);
  1485.     if (msgRsp->result != POC_OK)
  1486.     {
  1487.         g_poc_cntx_p->reg_error = MMI_TRUE;
  1488.     }
  1489.     if (g_poc_cntx_p->reg_error == MMI_TRUE)
  1490.     {
  1491.         if (GetActiveScreenId() == SCR_ID_POC_REG)
  1492.         {
  1493.             DisplayPopup(
  1494.                 (U8*) GetString(STR_ID_POC_ERR_REG_PARTIAL_SUCCESS),
  1495.                 IMG_GLOBAL_ACTIVATED,
  1496.                 1,
  1497.                 UI_POPUP_NOTIFYDURATION_TIME,
  1498.                 (U8) SUCCESS_TONE);
  1499.         }
  1500.         else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  1501.         {
  1502.             DisplayPopup(
  1503.                 (U8*) GetString(STR_ID_POC_ERR_REG_PARTIAL_SUCCESS),
  1504.                 IMG_GLOBAL_ACTIVATED,
  1505.                 1,
  1506.                 UI_POPUP_NOTIFYDURATION_TIME,
  1507.                 (U8) SUCCESS_TONE);
  1508.         }
  1509.     }
  1510.     else
  1511.     {
  1512.         if (GetActiveScreenId() == SCR_ID_POC_REG)
  1513.         {
  1514.             DisplayPopup(
  1515.                 (U8*) GetString(STR_GLOBAL_DONE),
  1516.                 IMG_GLOBAL_ACTIVATED,
  1517.                 1,
  1518.                 UI_POPUP_NOTIFYDURATION_TIME,
  1519.                 (U8) SUCCESS_TONE);
  1520.         }
  1521.         else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  1522.         {
  1523.             DisplayPopup(
  1524.                 (U8*) GetString(STR_ID_POC_REGISTERED),
  1525.                 IMG_GLOBAL_ACTIVATED,
  1526.                 1,
  1527.                 UI_POPUP_NOTIFYDURATION_TIME,
  1528.                 (U8) SUCCESS_TONE);
  1529.         }
  1530.     }
  1531.     DeleteScreenIfPresent(SCR_ID_POC_REG);
  1532. }
  1533. #ifndef __POC_NON_RLS__
  1534. /*****************************************************************************
  1535.  * FUNCTION
  1536.  *  mmi_poc_dereg_pres_unsubscribe_req
  1537.  * DESCRIPTION
  1538.  *  presence unsubscribe request for deregistration
  1539.  * PARAMETERS
  1540.  *  void
  1541.  * RETURNS
  1542.  *  void
  1543.  *****************************************************************************/
  1544. void mmi_poc_dereg_pres_unsubscribe_req(void)
  1545. {
  1546.     /*----------------------------------------------------------------*/
  1547.     /* Local Variables                                                */
  1548.     /*----------------------------------------------------------------*/
  1549.     MYQUEUE Message;
  1550.     poc_presence_subscribe_req_struct *myMsgPtr;
  1551.     /*----------------------------------------------------------------*/
  1552.     /* Code Body                                                      */
  1553.     /*----------------------------------------------------------------*/
  1554.     myMsgPtr = (poc_presence_subscribe_req_struct*) OslConstructDataPtr(sizeof(poc_presence_subscribe_req_struct));
  1555.     memset(
  1556.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1557.         0,
  1558.         sizeof(poc_presence_subscribe_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1559.     g_poc_cntx_p->reg_error = MMI_FALSE;
  1560.     myMsgPtr->action = POC_UNSUBSCRIBE_ACTION;
  1561.     myMsgPtr->use_presence_list = MMI_TRUE;
  1562.     memcpy(myMsgPtr->uri, POC_MMI_MTK_RLS_URI, POC_MAX_URI_LEN * sizeof(U8));
  1563.     strncat(
  1564.         (S8*) myMsgPtr->uri,
  1565.         (S8*) g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].uri,
  1566.         POC_MAX_URI_LEN - sizeof(POC_MMI_MTK_RLS_URI) - 1);
  1567.     Message.oslSrcId = MOD_MMI;
  1568.     Message.oslDestId = MOD_POC;
  1569.     Message.oslMsgId = MSG_ID_POC_PRESENCE_SUBSCRIBE_REQ;
  1570.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1571.     Message.oslPeerBuffPtr = NULL;
  1572.     OslMsgSendExtQueue(&Message);
  1573.     SetProtocolEventHandler(mmi_poc_dereg_pres_unsubscribe_rsp, MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1574. }
  1575. /*****************************************************************************
  1576.  * FUNCTION
  1577.  *  mmi_poc_dereg_pres_unsubscribe_rsp
  1578.  * DESCRIPTION
  1579.  *  response for presence unsubscribe when deregistering
  1580.  * PARAMETERS
  1581.  *  info        [IN]        Local parameters from protocol
  1582.  * RETURNS
  1583.  *  void
  1584.  *****************************************************************************/
  1585. void mmi_poc_dereg_pres_unsubscribe_rsp(void *info)
  1586. {
  1587.     /*----------------------------------------------------------------*/
  1588.     /* Local Variables                                                */
  1589.     /*----------------------------------------------------------------*/
  1590.     poc_presence_subscribe_rsp_struct *msgRsp;
  1591.     /*----------------------------------------------------------------*/
  1592.     /* Code Body                                                      */
  1593.     /*----------------------------------------------------------------*/
  1594.     msgRsp = (poc_presence_subscribe_rsp_struct*) info;
  1595.     ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1596. #if (0)
  1597. /* under construction !*/
  1598. /* under construction !*/
  1599. /* under construction !*/
  1600. #endif /* (0) */ 
  1601.     mmi_poc_dereg_pres_unpublish_req();
  1602. }
  1603. #else /* __POC_NON_RLS__ */ 
  1604. /*****************************************************************************
  1605.  * FUNCTION
  1606.  *  mmi_poc_dereg_pres_unsubscribe_req
  1607.  * DESCRIPTION
  1608.  *  Presence unscribe when deregistration
  1609.  * PARAMETERS
  1610.  *  void
  1611.  *  info(?)     [IN]        Local parameters from protocol
  1612.  * RETURNS
  1613.  *  void
  1614.  *****************************************************************************/
  1615. void mmi_poc_dereg_pres_unsubscribe_req(void)
  1616. {
  1617.     /*----------------------------------------------------------------*/
  1618.     /* Local Variables                                                */
  1619.     /*----------------------------------------------------------------*/
  1620.     MYQUEUE Message;
  1621.     poc_presence_subscribe_req_struct *myMsgPtr;
  1622.     static U8 curr_group = 0, curr_entry = 0;
  1623.     /*----------------------------------------------------------------*/
  1624.     /* Code Body                                                      */
  1625.     /*----------------------------------------------------------------*/
  1626.     for (; (g_poc_cntx_p->contact_list[curr_group].valid == MMI_TRUE) &&
  1627.          (curr_group < MAX_POC_GROUP_FILE_NUM * MAX_POC_GROUPS_PER_FILE_NUM); curr_group++)
  1628.     {
  1629.         for (; curr_entry < g_poc_cntx_p->contact_list[curr_group].no_entries; curr_entry++)
  1630.         {
  1631.             if (g_poc_cntx_p->contact_list[curr_group].entries[curr_entry].sub_pres == MMI_TRUE)
  1632.             {
  1633.                 myMsgPtr =
  1634.                     (poc_presence_subscribe_req_struct*)
  1635.                     OslConstructDataPtr(sizeof(poc_presence_subscribe_req_struct));
  1636.                 memset(
  1637.                     (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1638.                     0,
  1639.                     sizeof(poc_presence_subscribe_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1640.                 myMsgPtr->action = POC_UNSUBSCRIBE_ACTION;
  1641.                 myMsgPtr->use_presence_list = MMI_FALSE;
  1642.                 memcpy(
  1643.                     myMsgPtr->uri,
  1644.                     g_poc_cntx_p->contact_list[curr_group].entries[curr_entry].uri,
  1645.                     POC_MAX_URI_LEN * sizeof(U8));
  1646.                 Message.oslSrcId = MOD_MMI;
  1647.                 Message.oslDestId = MOD_POC;
  1648.                 Message.oslMsgId = MSG_ID_POC_PRESENCE_SUBSCRIBE_REQ;
  1649.                 Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1650.                 Message.oslPeerBuffPtr = NULL;
  1651.                 OslMsgSendExtQueue(&Message);
  1652.                 SetProtocolEventHandler(mmi_poc_dereg_pres_unsubscribe_rsp, MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1653.                 curr_entry++;
  1654.                 return;
  1655.             }
  1656.         }
  1657.         curr_entry = 0;
  1658.     }
  1659.     curr_group = 0;
  1660.     curr_entry = 0;
  1661.     mmi_poc_dereg_pres_unpublish_req();
  1662. }
  1663. /*****************************************************************************
  1664.  * FUNCTION
  1665.  *  mmi_poc_dereg_pres_unsubscribe_rsp
  1666.  * DESCRIPTION
  1667.  *  Presence unsubscribe response when deregistering
  1668.  * PARAMETERS
  1669.  *  info        [IN]        Local parameters from protocol
  1670.  * RETURNS
  1671.  *  void
  1672.  *****************************************************************************/
  1673. void mmi_poc_dereg_pres_unsubscribe_rsp(void *info)
  1674. {
  1675.     /*----------------------------------------------------------------*/
  1676.     /* Local Variables                                                */
  1677.     /*----------------------------------------------------------------*/
  1678.     poc_presence_subscribe_rsp_struct *msgRsp;
  1679.     /*----------------------------------------------------------------*/
  1680.     /* Code Body                                                      */
  1681.     /*----------------------------------------------------------------*/
  1682.     msgRsp = (poc_presence_subscribe_rsp_struct*) info;
  1683.     ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_SUBSCRIBE_RSP);
  1684. #if (0)
  1685. /* under construction !*/
  1686. /* under construction !*/
  1687. /* under construction !*/
  1688. #endif /* (0) */ 
  1689.     mmi_poc_dereg_pres_unsubscribe_req();
  1690. }
  1691. #endif /* __POC_NON_RLS__ */ 
  1692. /*****************************************************************************
  1693.  * FUNCTION
  1694.  *  mmi_poc_dereg_pres_unpublish_req
  1695.  * DESCRIPTION
  1696.  *  presence unpublish request for deregistering
  1697.  * PARAMETERS
  1698.  *  void
  1699.  * RETURNS
  1700.  *  void
  1701.  *****************************************************************************/
  1702. void mmi_poc_dereg_pres_unpublish_req(void)
  1703. {
  1704.     /*----------------------------------------------------------------*/
  1705.     /* Local Variables                                                */
  1706.     /*----------------------------------------------------------------*/
  1707.     MYQUEUE Message;
  1708.     poc_presence_publish_req_struct *myMsgPtr;
  1709.     /*----------------------------------------------------------------*/
  1710.     /* Code Body                                                      */
  1711.     /*----------------------------------------------------------------*/
  1712.     myMsgPtr = (poc_presence_publish_req_struct*) OslConstructDataPtr(sizeof(poc_presence_publish_req_struct));
  1713.     memset(
  1714.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1715.         0,
  1716.         sizeof(poc_presence_publish_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1717.     myMsgPtr->remove = MMI_TRUE;
  1718.     memcpy(
  1719.         myMsgPtr->pinfo.entity,
  1720.         g_poc_cntx_p->profile_list[g_poc_cntx_p->profile_active].uri,
  1721.         POC_MAX_URI_LEN * sizeof(U8));
  1722.     Message.oslSrcId = MOD_MMI;
  1723.     Message.oslDestId = MOD_POC;
  1724.     Message.oslMsgId = MSG_ID_POC_PRESENCE_PUBLISH_REQ;
  1725.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1726.     Message.oslPeerBuffPtr = NULL;
  1727.     OslMsgSendExtQueue(&Message);
  1728.     SetProtocolEventHandler(mmi_poc_dereg_pres_unpublish_rsp, MSG_ID_POC_PRESENCE_PUBLISH_RSP);
  1729. }
  1730. /*****************************************************************************
  1731.  * FUNCTION
  1732.  *  mmi_poc_dereg_pres_unpublish_rsp
  1733.  * DESCRIPTION
  1734.  *  presence unpublish response when deregistering
  1735.  * PARAMETERS
  1736.  *  info        [IN]        Local parameters from protocol
  1737.  * RETURNS
  1738.  *  void
  1739.  *****************************************************************************/
  1740. void mmi_poc_dereg_pres_unpublish_rsp(void *info)
  1741. {
  1742.     /*----------------------------------------------------------------*/
  1743.     /* Local Variables                                                */
  1744.     /*----------------------------------------------------------------*/
  1745.     poc_presence_publish_rsp_struct *msgRsp;
  1746.     /*----------------------------------------------------------------*/
  1747.     /* Code Body                                                      */
  1748.     /*----------------------------------------------------------------*/
  1749.     msgRsp = (poc_presence_publish_rsp_struct*) info;
  1750.     ClearProtocolEventHandler(MSG_ID_POC_PRESENCE_PUBLISH_RSP);
  1751.     mmi_poc_deregister_req();
  1752. }
  1753. /*****************************************************************************
  1754.  * FUNCTION
  1755.  *  mmi_poc_deregister_req
  1756.  * DESCRIPTION
  1757.  *  poc deregister request
  1758.  * PARAMETERS
  1759.  *  void
  1760.  * RETURNS
  1761.  *  void
  1762.  *****************************************************************************/
  1763. void mmi_poc_deregister_req(void)
  1764. {
  1765. #ifdef __POC_MMI_TEST_XDM_ONLY__
  1766.     /*----------------------------------------------------------------*/
  1767.     /* Local Variables                                                */
  1768.     /*----------------------------------------------------------------*/
  1769.     /*----------------------------------------------------------------*/
  1770.     /* Code Body                                                      */
  1771.     /*----------------------------------------------------------------*/
  1772.     g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  1773.     HideStatusIcon(STATUS_ICON_POC);
  1774.     UpdateStatusIcons();
  1775.     if (g_poc_cntx_p->curr_use_xdm_mode == MMI_TRUE)
  1776.     {
  1777.         mmi_poc_group_deinit_req();
  1778.     }
  1779.     else
  1780.     {
  1781.         if (GetActiveScreenId() == SCR_ID_POC_REG)
  1782.         {
  1783.             DisplayPopup(
  1784.                 (U8*) GetString(STR_GLOBAL_DONE),
  1785.                 IMG_GLOBAL_ACTIVATED,
  1786.                 1,
  1787.                 UI_POPUP_NOTIFYDURATION_TIME,
  1788.                 (U8) SUCCESS_TONE);
  1789.         }
  1790.         else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  1791.         {
  1792.             DisplayPopup(
  1793.                 (U8*) GetString(STR_ID_POC_DEREGISTERED),
  1794.                 IMG_GLOBAL_ACTIVATED,
  1795.                 1,
  1796.                 UI_POPUP_NOTIFYDURATION_TIME,
  1797.                 (U8) SUCCESS_TONE);
  1798.         }
  1799.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  1800.     }
  1801. #else /* __POC_MMI_TEST_XDM_ONLY__ */ 
  1802.     MYQUEUE Message;
  1803.     poc_register_req_struct *myMsgPtr;
  1804.     myMsgPtr = (poc_register_req_struct*) OslConstructDataPtr(sizeof(poc_register_req_struct));
  1805.     memset(
  1806.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  1807.         0,
  1808.         sizeof(poc_register_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  1809.     myMsgPtr->action = POC_DEREGISTER_ACTION;
  1810.     memset(&myMsgPtr->contact, 0, sizeof(poc_addr_struct));
  1811.     myMsgPtr->data_account = 0;
  1812.     memset(myMsgPtr->proxy_addr, 0, POC_PROXY_ADDR_LEN * sizeof(U8));
  1813.     myMsgPtr->proxy_port = 0;
  1814.     memset(myMsgPtr->password, 0, POC_MAX_PASSWORD_LEN * sizeof(U8));
  1815.     Message.oslSrcId = MOD_MMI;
  1816.     Message.oslDestId = MOD_POC;
  1817.     Message.oslMsgId = PRT_POC_REGISTER_REQ;
  1818.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  1819.     Message.oslPeerBuffPtr = NULL;
  1820.     OslMsgSendExtQueue(&Message);
  1821.     SetProtocolEventHandler(mmi_poc_deregister_rsp, PRT_POC_REGISTER_RSP);
  1822. #endif /* __POC_MMI_TEST_XDM_ONLY__ */ 
  1823. }
  1824. /*****************************************************************************
  1825.  * FUNCTION
  1826.  *  mmi_poc_deregister_rsp
  1827.  * DESCRIPTION
  1828.  *  poc deregister response
  1829.  * PARAMETERS
  1830.  *  info        [IN]        Local parameters from protocol
  1831.  * RETURNS
  1832.  *  void
  1833.  *****************************************************************************/
  1834. void mmi_poc_deregister_rsp(void *info)
  1835. {
  1836.     /*----------------------------------------------------------------*/
  1837.     /* Local Variables                                                */
  1838.     /*----------------------------------------------------------------*/
  1839.     poc_register_rsp_struct *msgRsp;
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Code Body                                                      */
  1842.     /*----------------------------------------------------------------*/
  1843.     msgRsp = (poc_register_rsp_struct*) info;
  1844.     ClearProtocolEventHandler(PRT_POC_REGISTER_RSP);
  1845.     if (msgRsp->result != POC_OK)
  1846.     {
  1847.         g_poc_cntx_p->reg_error = MMI_TRUE;
  1848.     }
  1849.     g_poc_cntx_p->curr_reg_state = POC_REG_NONE;
  1850.     HideStatusIcon(STATUS_ICON_POC);
  1851.     UpdateStatusIcons();
  1852.     if (g_poc_cntx_p->curr_use_xdm_mode == MMI_TRUE)
  1853.     {
  1854.         mmi_poc_group_deinit_req();
  1855.     }
  1856.     else
  1857.     {
  1858.         if (GetActiveScreenId() == SCR_ID_POC_REG)
  1859.         {
  1860.             DisplayPopup(
  1861.                 (U8*) GetString(STR_GLOBAL_DONE),
  1862.                 IMG_GLOBAL_ACTIVATED,
  1863.                 1,
  1864.                 UI_POPUP_NOTIFYDURATION_TIME,
  1865.                 (U8) SUCCESS_TONE);
  1866.         }
  1867.         else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  1868.         {
  1869.             DisplayPopup(
  1870.                 (U8*) GetString(STR_ID_POC_DEREGISTERED),
  1871.                 IMG_GLOBAL_ACTIVATED,
  1872.                 1,
  1873.                 UI_POPUP_NOTIFYDURATION_TIME,
  1874.                 (U8) SUCCESS_TONE);
  1875.         }
  1876.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  1877.     }
  1878. }
  1879. /*****************************************************************************
  1880.  * FUNCTION
  1881.  *  mmi_poc_group_deinit_req
  1882.  * DESCRIPTION
  1883.  *  poc group de-init request
  1884.  * PARAMETERS
  1885.  *  void
  1886.  * RETURNS
  1887.  *  void
  1888.  *****************************************************************************/
  1889. void mmi_poc_group_deinit_req(void)
  1890. {
  1891.     /*----------------------------------------------------------------*/
  1892.     /* Local Variables                                                */
  1893.     /*----------------------------------------------------------------*/
  1894.     MYQUEUE Message;
  1895.     /*----------------------------------------------------------------*/
  1896.     /* Code Body                                                      */
  1897.     /*----------------------------------------------------------------*/
  1898.     SetProtocolEventHandler(mmi_poc_group_deinit_rsp, MSG_ID_POC_GROUP_DEINIT_RSP);
  1899.     Message.oslSrcId = MOD_MMI;
  1900.     Message.oslDestId = MOD_POC;
  1901.     Message.oslMsgId = MSG_ID_POC_GROUP_DEINIT_REQ;
  1902.     Message.oslDataPtr = NULL;
  1903.     Message.oslPeerBuffPtr = NULL;
  1904.     OslMsgSendExtQueue(&Message);
  1905. }
  1906. /*****************************************************************************
  1907.  * FUNCTION
  1908.  *  mmi_poc_group_deinit_rsp
  1909.  * DESCRIPTION
  1910.  *  poc group deinit response
  1911.  * PARAMETERS
  1912.  *  info        [IN]        Local parameters from protocol
  1913.  * RETURNS
  1914.  *  void
  1915.  *****************************************************************************/
  1916. void mmi_poc_group_deinit_rsp(void *info)
  1917. {
  1918.     /*----------------------------------------------------------------*/
  1919.     /* Local Variables                                                */
  1920.     /*----------------------------------------------------------------*/
  1921.     poc_group_deinit_rsp_struct *msgRsp;
  1922.     /*----------------------------------------------------------------*/
  1923.     /* Code Body                                                      */
  1924.     /*----------------------------------------------------------------*/
  1925.     msgRsp = (poc_group_deinit_rsp_struct*) info;
  1926.     ClearProtocolEventHandler(MSG_ID_POC_GROUP_DEINIT_RSP);
  1927.     memset(&g_poc_cntx_p->progressing, 0, sizeof(g_poc_cntx_p->progressing));
  1928.     if (msgRsp->result != POC_OK)
  1929.     {
  1930.         g_poc_cntx_p->reg_error = MMI_TRUE;
  1931.     }
  1932.     if (g_poc_cntx_p->reg_error != MMI_TRUE)
  1933.     {
  1934.         if (GetActiveScreenId() == SCR_ID_POC_REG)
  1935.         {
  1936.             DisplayPopup(
  1937.                 (U8*) GetString(STR_GLOBAL_DONE),
  1938.                 IMG_GLOBAL_ACTIVATED,
  1939.                 1,
  1940.                 UI_POPUP_NOTIFYDURATION_TIME,
  1941.                 (U8) SUCCESS_TONE);
  1942.         }
  1943.         else if (GetActiveScreenId() == SCR_ID_POC_MAIN)
  1944.         {
  1945.             DisplayPopup(
  1946.                 (U8*) GetString(STR_ID_POC_DEREGISTERED),
  1947.                 IMG_GLOBAL_ACTIVATED,
  1948.                 1,
  1949.                 UI_POPUP_NOTIFYDURATION_TIME,
  1950.                 (U8) SUCCESS_TONE);
  1951.         }
  1952.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  1953.     }
  1954.     else
  1955.     {
  1956.         if (((GetActiveScreenId() == SCR_ID_POC_REG) || (GetActiveScreenId() == SCR_ID_POC_MAIN)))
  1957.         {
  1958.             DisplayPopup(
  1959.                 (U8*) GetString(STR_GLOBAL_NOT_DONE),
  1960.                 IMG_GLOBAL_UNFINISHED,
  1961.                 1,
  1962.                 UI_POPUP_NOTIFYDURATION_TIME,
  1963.                 (U8) ERROR_TONE);
  1964.         }
  1965.         DeleteScreenIfPresent(SCR_ID_POC_REG);
  1966.     }
  1967. }
  1968. /*****************************************************************************
  1969.  * FUNCTION
  1970.  *  mmi_poc_contact_1_to_1_invite
  1971.  * DESCRIPTION
  1972.  *  1 to 1 invitation through contact
  1973.  * PARAMETERS
  1974.  *  void
  1975.  * RETURNS
  1976.  *  void
  1977.  *****************************************************************************/
  1978. void mmi_poc_contact_1_to_1_invite(void)
  1979. {
  1980.     /*----------------------------------------------------------------*/
  1981.     /* Local Variables                                                */
  1982.     /*----------------------------------------------------------------*/
  1983.     poc_addr_struct callee[POC_MAX_ADDR_NUM];
  1984.     mmi_poc_contact_list_disp *cont;
  1985.     /*----------------------------------------------------------------*/
  1986.     /* Code Body                                                      */
  1987.     /*----------------------------------------------------------------*/
  1988.     if (g_poc_cntx_p->call_status != POC_CALL_NONE)
  1989.     {
  1990.         MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  1991.         DisplayPopup(
  1992.             (U8*) GetString(STR_ID_POC_ERR_TERMINATE_CALL_FIRST),
  1993.             IMG_GLOBAL_WARNING,
  1994.             1,
  1995.             UI_POPUP_NOTIFYDURATION_TIME,
  1996.             (U8) WARNING_TONE);
  1997.         return;
  1998.     }
  1999.     g_poc_cntx_p->ptt_button_status = POC_PTT_DOWN;
  2000.     cont = &g_poc_cntx_p->contact_list_disp[g_poc_cntx_p->contact_selected];
  2001.     memset(g_poc_cntx_p->cm_talk_list, 0, sizeof(g_poc_cntx_p->cm_talk_list));
  2002.     g_poc_cntx_p->cm_talk_list_num = 0;
  2003.     strncpy(
  2004.         (S8*) g_poc_cntx_p->calling_disp.name,
  2005.         (S8*) g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id].display_name,
  2006.         POC_MAX_DISP_LEN - 1);
  2007.     strncpy(
  2008.         (S8*) g_poc_cntx_p->calling_disp.uri,
  2009.         (S8*) g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id].uri,
  2010.         POC_MAX_URI_LEN - 1);
  2011.     memset(callee, 0, sizeof(callee));
  2012.     memcpy(
  2013.         callee[0].disp_name,
  2014.         g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id].display_name,
  2015.         sizeof(callee[0].disp_name));
  2016.     memcpy(
  2017.         callee[0].uri,
  2018.         g_poc_cntx_p->contact_list[cont->group_id].entries[cont->entry_id].uri,
  2019.         sizeof(callee[0].uri));
  2020.     memset(g_poc_cntx_p->cm_talk_group_name, 0, sizeof(g_poc_cntx_p->cm_talk_group_name));
  2021.     mmi_poc_entry_inviting();
  2022.     mmi_poc_talk_invite_req(POC_1_TO_1_TALK, 1, callee, 0, 0, 0);
  2023. }
  2024. /*****************************************************************************
  2025.  * FUNCTION
  2026.  *  mmi_poc_talk_group_invite
  2027.  * DESCRIPTION
  2028.  *  poc talk group invite
  2029.  * PARAMETERS
  2030.  *  void
  2031.  * RETURNS
  2032.  *  void
  2033.  *****************************************************************************/
  2034. void mmi_poc_talk_group_invite(void)
  2035. {
  2036.     /*----------------------------------------------------------------*/
  2037.     /* Local Variables                                                */
  2038.     /*----------------------------------------------------------------*/
  2039.     poc_addr_struct callee[POC_MAX_ADDR_NUM];
  2040.     /*----------------------------------------------------------------*/
  2041.     /* Code Body                                                      */
  2042.     /*----------------------------------------------------------------*/
  2043.     if (g_poc_cntx_p->call_status != POC_CALL_NONE)
  2044.     {
  2045.         MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  2046.         DisplayPopup(
  2047.             (U8*) GetString(STR_ID_POC_ERR_TERMINATE_CALL_FIRST),
  2048.             IMG_GLOBAL_WARNING,
  2049.             1,
  2050.             UI_POPUP_NOTIFYDURATION_TIME,
  2051.             (U8) WARNING_TONE);
  2052.         return;
  2053.     }
  2054.     g_poc_cntx_p->ptt_button_status = POC_PTT_DOWN;
  2055.     memset(g_poc_cntx_p->cm_talk_list, 0, sizeof(g_poc_cntx_p->cm_talk_list));
  2056.     g_poc_cntx_p->cm_talk_list_num = 0;
  2057.     strncpy(
  2058.         (S8*) g_poc_cntx_p->calling_disp.name,
  2059.         (S8*) g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].display_name,
  2060.         POC_MAX_DISP_LEN - 1);
  2061.     strncpy(
  2062.         (S8*) g_poc_cntx_p->calling_disp.uri,
  2063.         (S8*) g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].list_uri,
  2064.         POC_MAX_URI_LEN - 1);
  2065.     memset(callee, 0, sizeof(callee));
  2066.     memcpy(
  2067.         callee[0].disp_name,
  2068.         g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].display_name,
  2069.         sizeof(callee[0].disp_name));
  2070.     memcpy(
  2071.         callee[0].uri,
  2072.         g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].list_uri,
  2073.         sizeof(callee[0].uri));
  2074.     memset(g_poc_cntx_p->cm_talk_group_name, 0, sizeof(g_poc_cntx_p->cm_talk_group_name));
  2075.     if (strlen((S8*) g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].display_name))
  2076.     {
  2077.         strncpy(
  2078.             (S8*) g_poc_cntx_p->cm_talk_group_name,
  2079.             (S8*) g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].display_name,
  2080.             POC_MAX_DISP_LEN - 1);
  2081.     }
  2082.     else
  2083.     {
  2084.         strncpy(
  2085.             (S8*) g_poc_cntx_p->cm_talk_group_name,
  2086.             (S8*) g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].list_uri,
  2087.             POC_MAX_DISP_LEN - 1);
  2088.     }
  2089.     mmi_poc_entry_inviting();
  2090.     if (g_poc_cntx_p->talk_group_list[g_poc_cntx_p->talk_group_selected].invite_member == MMI_TRUE)
  2091.     {
  2092.         mmi_poc_talk_invite_req(POC_PRE_ARRANGED_GROUP_TALK, 1, callee, 0, 0, 0);
  2093.     }
  2094.     else
  2095.     {
  2096.         mmi_poc_talk_invite_req(POC_CHAT_GROUP_TALK, 1, callee, 0, 0, 0);
  2097.     }
  2098. }
  2099. /*****************************************************************************
  2100.  * FUNCTION
  2101.  *  mmi_poc_talk_invite_req
  2102.  * DESCRIPTION
  2103.  *  poc talk group invite request
  2104.  * PARAMETERS
  2105.  *  talk_type       [IN]        Talk type
  2106.  *  no_callee       [IN]        Number of callees
  2107.  *  callee          [IN]        Callee address structure
  2108.  *  talk_id         [IN]        Talk id
  2109.  *  refer           [IN]        Refer flag
  2110.  *  rejoin          [IN]        Rejoin flag
  2111.  * RETURNS
  2112.  *  void
  2113.  *****************************************************************************/
  2114. void mmi_poc_talk_invite_req(U8 talk_type, U8 no_callee, poc_addr_struct *callee, U32 talk_id, U8 refer, U8 rejoin)
  2115. {
  2116.     /*----------------------------------------------------------------*/
  2117.     /* Local Variables                                                */
  2118.     /*----------------------------------------------------------------*/
  2119.     MYQUEUE Message;
  2120.     poc_talk_invite_req_struct *myMsgPtr;
  2121.     /*----------------------------------------------------------------*/
  2122.     /* Code Body                                                      */
  2123.     /*----------------------------------------------------------------*/
  2124.     myMsgPtr = (poc_talk_invite_req_struct*) OslConstructDataPtr(sizeof(poc_talk_invite_req_struct));
  2125.     memset(
  2126.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  2127.         0,
  2128.         sizeof(poc_talk_invite_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  2129.     myMsgPtr->request_id = POC_REQUEST_ID;
  2130.     myMsgPtr->talk_type = talk_type;
  2131.     myMsgPtr->num_addr = no_callee;
  2132.     memcpy(myMsgPtr->callee, callee, sizeof(myMsgPtr->callee));
  2133.     myMsgPtr->talk_id = talk_id;
  2134.     myMsgPtr->refer = refer;
  2135.     myMsgPtr->mao = g_poc_cntx_p->curr_mao_mode;
  2136.     myMsgPtr->rejoin = rejoin;
  2137.     if (refer == 0)
  2138.     {
  2139.         g_poc_cntx_p->talk_pres_ind_recved = POC_TALK_STATUS_NOT_READY;
  2140.     }
  2141.     Message.oslSrcId = MOD_MMI;
  2142.     Message.oslDestId = MOD_POC;
  2143.     Message.oslMsgId = PRT_POC_TALK_INVITE_REQ;
  2144.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  2145.     Message.oslPeerBuffPtr = NULL;
  2146.     OslMsgSendExtQueue(&Message);
  2147.     g_poc_cntx_p->floor_idle_recved = MMI_FALSE;
  2148.     g_poc_cntx_p->call_status = POC_CALL_ACTIVE;
  2149.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  2150.     SetProtocolEventHandler(mmi_poc_invite_rsp, PRT_POC_TALK_INVITE_RSP);
  2151. }
  2152. /*****************************************************************************
  2153.  * FUNCTION
  2154.  *  mmi_poc_invite_rsp
  2155.  * DESCRIPTION
  2156.  *  poc invite response
  2157.  * PARAMETERS
  2158.  *  info        [IN]        Local parameters from protocol
  2159.  * RETURNS
  2160.  *  void
  2161.  *****************************************************************************/
  2162. void mmi_poc_invite_rsp(void *info)
  2163. {
  2164.     /*----------------------------------------------------------------*/
  2165.     /* Local Variables                                                */
  2166.     /*----------------------------------------------------------------*/
  2167.     poc_talk_invite_rsp_struct *msgRsp;
  2168.     U8 list_name[POC_MAX_DISP_LEN];
  2169.     U8 uri[POC_MAX_URI_LEN];
  2170.     /*----------------------------------------------------------------*/
  2171.     /* Code Body                                                      */
  2172.     /*----------------------------------------------------------------*/
  2173.     msgRsp = (poc_talk_invite_rsp_struct*) info;
  2174.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_INVITE_RSP, (S32) g_poc_cntx_p->ptt_button_status));
  2175.     ClearProtocolEventHandler(PRT_POC_TALK_INVITE_RSP);
  2176.     if (msgRsp->result == POC_OK)
  2177.     {
  2178.         g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  2179.         g_poc_cntx_p->call_status = POC_CALL_ACTIVE;
  2180.         if (IsScreenPresent(SCR_ID_POC_CM))
  2181.         {
  2182.             HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_connected_idle);
  2183.         }
  2184.         else if (GetActiveScreenId() == SCR_ID_POC_CM)
  2185.         {
  2186.             mmi_poc_entry_connected_idle();
  2187.         }
  2188.     }
  2189.     else
  2190.     {
  2191.         g_poc_cntx_p->call_status = POC_CALL_NONE;
  2192.         if (g_poc_cntx_p->mo_inviting == MMI_TRUE)
  2193.         {
  2194.             mmi_poc_show_error_cause(msgRsp->result, msgRsp->cause);
  2195.             DeleteScreenIfPresent(SCR_ID_POC_CM);
  2196.             mmi_poc_remove_cm_screens();
  2197.         }
  2198.     }
  2199.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  2200.     if (strlen((S8*) g_poc_cntx_p->cm_talk_group_name))
  2201.     {
  2202.         strncpy((S8*) list_name, (S8*) g_poc_cntx_p->cm_talk_group_name, POC_MAX_DISP_LEN - 1);
  2203.     }
  2204.     else if (strlen((S8*) g_poc_cntx_p->calling_disp.name))
  2205.     {
  2206.         strncpy((S8*) list_name, (S8*) g_poc_cntx_p->calling_disp.name, POC_MAX_DISP_LEN - 1);
  2207.     }
  2208.     else
  2209.     {
  2210.         strncpy((S8*) list_name, (S8*) g_poc_cntx_p->calling_disp.uri, POC_MAX_DISP_LEN - 1);
  2211.     }
  2212.     strncpy((S8*) uri, (S8*) msgRsp->session_id, POC_MAX_URI_LEN - 1);
  2213.     if (strlen((S8*) uri))
  2214.     {
  2215.         mmi_poc_history_add(POC_OUTGOING_CALL, MMI_TRUE, list_name, uri, NULL);
  2216.     }
  2217.     else
  2218.     {
  2219.         mmi_poc_history_add(POC_OUTGOING_CALL, MMI_FALSE, list_name, g_poc_cntx_p->calling_disp.uri, NULL);
  2220.     }
  2221. }
  2222. /*****************************************************************************
  2223.  * FUNCTION
  2224.  *  mmi_poc_entry_inviting
  2225.  * DESCRIPTION
  2226.  *  poc inviting screen
  2227.  * PARAMETERS
  2228.  *  void
  2229.  * RETURNS
  2230.  *  void
  2231.  *****************************************************************************/
  2232. void mmi_poc_entry_inviting(void)
  2233. {
  2234.     /*----------------------------------------------------------------*/
  2235.     /* Local Variables                                                */
  2236.     /*----------------------------------------------------------------*/
  2237.     U8 *guiBuffer;
  2238.     U8 temp_disp[POC_MAX_DISP_LEN * 2];
  2239.     /*----------------------------------------------------------------*/
  2240.     /* Code Body                                                      */
  2241.     /*----------------------------------------------------------------*/
  2242.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_INVITING));
  2243.     EntryNewScreen(SCR_ID_POC_CM, mmi_poc_exit_release_ptt, mmi_poc_entry_inviting, NULL);
  2244.     DeleteUptoScrID(SCR_ID_POC_MAIN);
  2245.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  2246.     mmi_poc_remove_cm_screens();
  2247.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  2248.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_CM);
  2249.     g_poc_cntx_p->mo_inviting = MMI_TRUE;
  2250.     memset(g_poc_cntx_p->cm_disp, 0, sizeof(g_poc_cntx_p->cm_disp));
  2251.     UCS2Strcpy((S8*) g_poc_cntx_p->cm_disp, (S8*) GetString(STR_ID_POC_CM_INVITING));
  2252.     if (strlen((S8*) g_poc_cntx_p->calling_disp.name))
  2253.     {
  2254.         mmi_poc_util_copy_with_dot((S8*) g_poc_cntx_p->calling_disp.name, (S8*) temp_disp, POC_MAX_DISP_LEN - 1);
  2255.     }
  2256.     else
  2257.     {
  2258.         mmi_poc_util_copy_with_dot((S8*) g_poc_cntx_p->calling_disp.uri, (S8*) temp_disp, POC_MAX_DISP_LEN - 1);
  2259.     }
  2260.     UCS2Strcat((S8*) g_poc_cntx_p->cm_disp, (S8*) temp_disp);
  2261.     ShowCategory66Screen(
  2262.         STR_ID_POC_MAIN,
  2263.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  2264.         0,
  2265.         0,
  2266.         STR_GLOBAL_ABORT,
  2267.         IMG_GLOBAL_BACK,
  2268.         (U8*) g_poc_cntx_p->cm_disp,
  2269.         IMG_ID_POC_CM_INVITING,
  2270.         NULL);
  2271.     SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  2272.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  2273.     SetKeyHandler(mmi_poc_ptt_release, KEY_SEND, KEY_EVENT_UP);
  2274.     SetKeyHandler(mmi_poc_ptt_press, KEY_SEND, KEY_EVENT_DOWN);
  2275. }
  2276. /*****************************************************************************
  2277.  * FUNCTION
  2278.  *  mmi_poc_exit_release_ptt
  2279.  * DESCRIPTION
  2280.  *  release ptt key when exiting screen
  2281.  * PARAMETERS
  2282.  *  void
  2283.  * RETURNS
  2284.  *  void
  2285.  *****************************************************************************/
  2286. void mmi_poc_exit_release_ptt(void)
  2287. {
  2288.     /*----------------------------------------------------------------*/
  2289.     /* Local Variables                                                */
  2290.     /*----------------------------------------------------------------*/
  2291.     /*----------------------------------------------------------------*/
  2292.     /* Code Body                                                      */
  2293.     /*----------------------------------------------------------------*/
  2294.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_RELEASE_PTT));
  2295.     g_poc_cntx_p->mo_inviting = MMI_FALSE;
  2296.     if (GetActiveScreenId() != SCR_ID_POC_CM)
  2297.     {
  2298.         mmi_poc_ptt_release();
  2299.     }
  2300. }
  2301. /*****************************************************************************
  2302.  * FUNCTION
  2303.  *  mmi_poc_ptt_press
  2304.  * DESCRIPTION
  2305.  *  ptt key press handler
  2306.  * PARAMETERS
  2307.  *  void
  2308.  * RETURNS
  2309.  *  void
  2310.  *****************************************************************************/
  2311. void mmi_poc_ptt_press(void)
  2312. {
  2313.     /*----------------------------------------------------------------*/
  2314.     /* Local Variables                                                */
  2315.     /*----------------------------------------------------------------*/
  2316.     /*----------------------------------------------------------------*/
  2317.     /* Code Body                                                      */
  2318.     /*----------------------------------------------------------------*/
  2319.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_PTT_PRESS));
  2320.     g_poc_cntx_p->ptt_button_status = POC_PTT_DOWN;
  2321. }
  2322. /*****************************************************************************
  2323.  * FUNCTION
  2324.  *  mmi_poc_ptt_release
  2325.  * DESCRIPTION
  2326.  *  ptt key release handler
  2327.  * PARAMETERS
  2328.  *  void
  2329.  * RETURNS
  2330.  *  void
  2331.  *****************************************************************************/
  2332. void mmi_poc_ptt_release(void)
  2333. {
  2334.     /*----------------------------------------------------------------*/
  2335.     /* Local Variables                                                */
  2336.     /*----------------------------------------------------------------*/
  2337.     /*----------------------------------------------------------------*/
  2338.     /* Code Body                                                      */
  2339.     /*----------------------------------------------------------------*/
  2340.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_PTT_RELEASE));
  2341.     g_poc_cntx_p->ptt_button_status = POC_PTT_UP;
  2342. }
  2343. /*****************************************************************************
  2344.  * FUNCTION
  2345.  *  mmi_poc_progress_ind
  2346.  * DESCRIPTION
  2347.  *  process indication handler
  2348.  * PARAMETERS
  2349.  *  info        [IN]        Local parameters from protocol
  2350.  * RETURNS
  2351.  *  void
  2352.  *****************************************************************************/
  2353. void mmi_poc_progress_ind(void *info)
  2354. {
  2355.     /*----------------------------------------------------------------*/
  2356.     /* Local Variables                                                */
  2357.     /*----------------------------------------------------------------*/
  2358.     poc_talk_progress_ind_struct *msgRsp;
  2359.     /*----------------------------------------------------------------*/
  2360.     /* Code Body                                                      */
  2361.     /*----------------------------------------------------------------*/
  2362.     msgRsp = (poc_talk_progress_ind_struct*) info;
  2363.     if (msgRsp->status_code == 180)
  2364.     {   /* 180 = ringing */
  2365.         if (IsScreenPresent(SCR_ID_POC_CM))
  2366.         {
  2367.             HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_mo_ringing);
  2368.         }
  2369.         else
  2370.         {
  2371.             mmi_poc_entry_mo_ringing();
  2372.         }
  2373.     }
  2374. }
  2375. /*****************************************************************************
  2376.  * FUNCTION
  2377.  *  mmi_poc_entry_mo_ringing
  2378.  * DESCRIPTION
  2379.  *  mo ringing screen
  2380.  * PARAMETERS
  2381.  *  void
  2382.  * RETURNS
  2383.  *  void
  2384.  *****************************************************************************/
  2385. void mmi_poc_entry_mo_ringing(void)
  2386. {
  2387.     /*----------------------------------------------------------------*/
  2388.     /* Local Variables                                                */
  2389.     /*----------------------------------------------------------------*/
  2390.     U8 *guiBuffer;
  2391.     U8 temp_disp[POC_MAX_DISP_LEN * 2];
  2392.     /*----------------------------------------------------------------*/
  2393.     /* Code Body                                                      */
  2394.     /*----------------------------------------------------------------*/
  2395.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_ENTRY_MO_RINGING));
  2396.     AudioPlayReq(POC_MO_RING_TONE, DEVICE_AUDIO_PLAY_INFINITE);
  2397.     EntryNewScreen(SCR_ID_POC_CM, mmi_poc_exit_mo_ringing, mmi_poc_entry_mo_ringing, NULL);
  2398.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  2399.     mmi_poc_remove_cm_screens();
  2400.     SetDelScrnIDCallbackHandler(SCR_ID_POC_CM, (HistoryDelCBPtr) mmi_poc_cm_history_del_handler);
  2401.     g_poc_cntx_p->mo_inviting = MMI_TRUE;
  2402.     guiBuffer = GetCurrGuiBuffer(SCR_ID_POC_CM);
  2403.     memset(g_poc_cntx_p->cm_disp, 0, sizeof(g_poc_cntx_p->cm_disp));
  2404.     UCS2Strcpy((S8*) g_poc_cntx_p->cm_disp, (S8*) GetString(STR_ID_POC_CM_MO_RINGING));
  2405.     if (strlen((S8*) g_poc_cntx_p->calling_disp.name))
  2406.     {
  2407.         mmi_poc_util_copy_with_dot((S8*) g_poc_cntx_p->calling_disp.name, (S8*) temp_disp, POC_MAX_DISP_LEN - 1);
  2408.     }
  2409.     else
  2410.     {
  2411.         mmi_poc_util_copy_with_dot((S8*) g_poc_cntx_p->calling_disp.uri, (S8*) temp_disp, POC_MAX_DISP_LEN - 1);
  2412.     }
  2413.     UCS2Strcat((S8*) g_poc_cntx_p->cm_disp, (S8*) temp_disp);
  2414.     ShowCategory66Screen(
  2415.         STR_ID_POC_MAIN,
  2416.         GetRootTitleIcon(MENU_ID_POC_MAIN),
  2417.         0,
  2418.         0,
  2419.         STR_GLOBAL_ABORT,
  2420.         IMG_GLOBAL_BACK,
  2421.         (U8*) g_poc_cntx_p->cm_disp,
  2422.         IMG_ID_POC_CM_MO_RINGING,
  2423.         NULL);
  2424.     SetRightSoftkeyFunction(mmi_poc_disconnect_back, KEY_EVENT_UP);
  2425.     SetKeyHandler(mmi_poc_disconnect_end, KEY_END, KEY_EVENT_DOWN);
  2426.     SetKeyHandler(mmi_poc_ptt_release, KEY_SEND, KEY_EVENT_UP);
  2427. }
  2428. /*****************************************************************************
  2429.  * FUNCTION
  2430.  *  mmi_poc_exit_mo_ringing
  2431.  * DESCRIPTION
  2432.  *  exit function for mo ringing
  2433.  * PARAMETERS
  2434.  *  void
  2435.  * RETURNS
  2436.  *  void
  2437.  *****************************************************************************/
  2438. void mmi_poc_exit_mo_ringing(void)
  2439. {
  2440.     /*----------------------------------------------------------------*/
  2441.     /* Local Variables                                                */
  2442.     /*----------------------------------------------------------------*/
  2443.     /*----------------------------------------------------------------*/
  2444.     /* Code Body                                                      */
  2445.     /*----------------------------------------------------------------*/
  2446.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_EXIT_MO_RINGING));
  2447.     g_poc_cntx_p->mo_inviting = MMI_FALSE;
  2448.     AudioStopReq(POC_MO_RING_TONE);
  2449.     mmi_poc_exit_release_ptt();
  2450. }
  2451. /*****************************************************************************
  2452.  * FUNCTION
  2453.  *  mmi_poc_disconnect_back
  2454.  * DESCRIPTION
  2455.  *  disconnect go back
  2456.  * PARAMETERS
  2457.  *  void
  2458.  * RETURNS
  2459.  *  void
  2460.  *****************************************************************************/
  2461. void mmi_poc_disconnect_back(void)
  2462. {
  2463.     /*----------------------------------------------------------------*/
  2464.     /* Local Variables                                                */
  2465.     /*----------------------------------------------------------------*/
  2466.     /*----------------------------------------------------------------*/
  2467.     /* Code Body                                                      */
  2468.     /*----------------------------------------------------------------*/
  2469.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_DISCONNECT_BACK));
  2470.     g_poc_cntx_p->abort_type = POC_ABORT_BACK;
  2471.     mmi_poc_entry_media_processing();
  2472.     switch (g_poc_cntx_p->audio_status)
  2473.     {
  2474.         case POC_AUDIO_NONE:
  2475.             mmi_poc_talk_disconnect_req();
  2476.             break;
  2477.         case POC_AUDIO_ENCODING:
  2478.             mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  2479.             break;
  2480.         case POC_AUDIO_DECODING:
  2481.             mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  2482.             break;
  2483.         default:
  2484.             break;
  2485.     }
  2486. }
  2487. /*****************************************************************************
  2488.  * FUNCTION
  2489.  *  mmi_poc_disconnect_end
  2490.  * DESCRIPTION
  2491.  *  disconnect and go back to idle screen
  2492.  * PARAMETERS
  2493.  *  void
  2494.  * RETURNS
  2495.  *  void
  2496.  *****************************************************************************/
  2497. void mmi_poc_disconnect_end(void)
  2498. {
  2499.     /*----------------------------------------------------------------*/
  2500.     /* Local Variables                                                */
  2501.     /*----------------------------------------------------------------*/
  2502.     /*----------------------------------------------------------------*/
  2503.     /* Code Body                                                      */
  2504.     /*----------------------------------------------------------------*/
  2505.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_DISCONNECT_END));
  2506.     g_poc_cntx_p->abort_type = POC_ABORT_END;
  2507.     mmi_poc_entry_media_processing();
  2508.     switch (g_poc_cntx_p->audio_status)
  2509.     {
  2510.         case POC_AUDIO_NONE:
  2511.             mmi_poc_talk_disconnect_req();
  2512.             break;
  2513.         case POC_AUDIO_ENCODING:
  2514.             mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  2515.             break;
  2516.         case POC_AUDIO_DECODING:
  2517.             mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  2518.             break;
  2519.         default:
  2520.             break;
  2521.     }
  2522. }
  2523. /*****************************************************************************
  2524.  * FUNCTION
  2525.  *  mmi_poc_talk_disconnect_req
  2526.  * DESCRIPTION
  2527.  *  talk disconnect request
  2528.  * PARAMETERS
  2529.  *  void
  2530.  * RETURNS
  2531.  *  void
  2532.  *****************************************************************************/
  2533. void mmi_poc_talk_disconnect_req(void)
  2534. {
  2535.     /*----------------------------------------------------------------*/
  2536.     /* Local Variables                                                */
  2537.     /*----------------------------------------------------------------*/
  2538.     MYQUEUE Message;
  2539.     poc_talk_disconnect_req_struct *myMsgPtr;
  2540.     /*----------------------------------------------------------------*/
  2541.     /* Code Body                                                      */
  2542.     /*----------------------------------------------------------------*/
  2543.     g_poc_cntx_p->call_status = POC_CALL_PROGRESSING;
  2544.     myMsgPtr = (poc_talk_disconnect_req_struct*) OslConstructDataPtr(sizeof(poc_talk_disconnect_req_struct));
  2545.     memset(
  2546.         (U8*) myMsgPtr + sizeof(mmi_poc_dummy_req_struct),
  2547.         0,
  2548.         sizeof(poc_talk_disconnect_req_struct) - sizeof(mmi_poc_dummy_req_struct));
  2549.     myMsgPtr->request_id = POC_REQUEST_ID;
  2550.     myMsgPtr->talk_id = g_poc_cntx_p->active_talk_id;
  2551.     Message.oslSrcId = MOD_MMI;
  2552.     Message.oslDestId = MOD_POC;
  2553.     Message.oslMsgId = PRT_POC_TALK_DISCONNECT_REQ;
  2554.     Message.oslDataPtr = (oslParaType*) myMsgPtr;
  2555.     Message.oslPeerBuffPtr = NULL;
  2556.     OslMsgSendExtQueue(&Message);
  2557.     SetProtocolEventHandler(mmi_poc_talk_disconnect_rsp, PRT_POC_TALK_DISCONNECT_RSP);
  2558. }
  2559. /*****************************************************************************
  2560.  * FUNCTION
  2561.  *  mmi_poc_talk_disconnect_rsp
  2562.  * DESCRIPTION
  2563.  *  poc talk disconnect response
  2564.  * PARAMETERS
  2565.  *  info        [IN]        Local parameters from protocol
  2566.  * RETURNS
  2567.  *  void
  2568.  *****************************************************************************/
  2569. void mmi_poc_talk_disconnect_rsp(void *info)
  2570. {
  2571.     /*----------------------------------------------------------------*/
  2572.     /* Local Variables                                                */
  2573.     /*----------------------------------------------------------------*/
  2574.     poc_talk_disconnect_rsp_struct *msgRsp;
  2575.     /*----------------------------------------------------------------*/
  2576.     /* Code Body                                                      */
  2577.     /*----------------------------------------------------------------*/
  2578.     msgRsp = (poc_talk_disconnect_rsp_struct*) info;
  2579.     g_poc_cntx_p->call_status = POC_CALL_NONE;
  2580.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  2581.     ClearProtocolEventHandler(PRT_POC_TALK_DISCONNECT_RSP);
  2582.     DeleteScreenIfPresent(SCR_ID_POC_CM);
  2583.     mmi_poc_remove_cm_screens();
  2584.     if (GetActiveScreenId() == SCR_ID_POC_CM)
  2585.     {
  2586.         if (g_poc_cntx_p->abort_type == POC_ABORT_BACK)
  2587.         {
  2588.             mmi_poc_reset_all_audio();
  2589.         }
  2590.         else if (g_poc_cntx_p->abort_type == POC_ABORT_END)
  2591.         {
  2592.             DisplayIdleScreen();
  2593.         }
  2594.     }
  2595. }
  2596. /*****************************************************************************
  2597.  * FUNCTION
  2598.  *  mmi_poc_connect_ind
  2599.  * DESCRIPTION
  2600.  *  connect indication handler
  2601.  * PARAMETERS
  2602.  *  info        [IN]        Local parameters from protocol
  2603.  * RETURNS
  2604.  *  void
  2605.  *****************************************************************************/
  2606. void mmi_poc_connect_ind(void *info)
  2607. {
  2608.     /*----------------------------------------------------------------*/
  2609.     /* Local Variables                                                */
  2610.     /*----------------------------------------------------------------*/
  2611.     U8 list_name[POC_MAX_DISP_LEN];
  2612.     U8 uri[POC_MAX_URI_LEN];
  2613.     poc_talk_connect_ind_struct *msgRsp;
  2614.     /*----------------------------------------------------------------*/
  2615.     /* Code Body                                                      */
  2616.     /*----------------------------------------------------------------*/
  2617.     if (isInCall() && (g_poc_cntx_p->call_status != POC_CALL_PROGRESSING))
  2618.     {
  2619.         switch (g_poc_cntx_p->audio_status)
  2620.         {
  2621.             case POC_AUDIO_NONE:
  2622.                 mmi_poc_talk_disconnect_req();
  2623.                 break;
  2624.             case POC_AUDIO_ENCODING:
  2625.                 mmi_poc_audio_encode_stop(mmi_poc_talk_disconnect_req);
  2626.                 break;
  2627.             case POC_AUDIO_DECODING:
  2628.                 mmi_poc_audio_decode_stop(mmi_poc_talk_disconnect_req);
  2629.                 break;
  2630.             default:
  2631.                 break;
  2632.         }
  2633.         return;
  2634.     }
  2635.     msgRsp = (poc_talk_connect_ind_struct*) info;
  2636.     g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  2637.     memset(g_poc_cntx_p->cm_talk_group_name, 0, sizeof(g_poc_cntx_p->cm_talk_group_name));
  2638.     memset(g_poc_cntx_p->cm_talk_list, 0, sizeof(g_poc_cntx_p->cm_talk_list));
  2639.     g_poc_cntx_p->cm_talk_list_num = 0;
  2640.     switch (msgRsp->talk_type)
  2641.     {
  2642.         case POC_1_TO_1_TALK:
  2643.         case POC_UNKNOWN_TALK_TYPE:
  2644.         case POC_AD_HOC_GROUP_TALK:
  2645.             break;
  2646.         case POC_CHAT_GROUP_TALK:
  2647.         case POC_PRE_ARRANGED_GROUP_TALK:
  2648.             if (strlen((S8*) msgRsp->group_addr.disp_name))
  2649.             {
  2650.                 strncpy(
  2651.                     (S8*) g_poc_cntx_p->cm_talk_group_name,
  2652.                     (S8*) msgRsp->group_addr.disp_name,
  2653.                     POC_MAX_DISP_LEN - 1);
  2654.             }
  2655.             else
  2656.             {
  2657.                 strncpy((S8*) g_poc_cntx_p->cm_talk_group_name, (S8*) msgRsp->group_addr.uri, POC_MAX_DISP_LEN - 1);
  2658.             }
  2659.             break;
  2660.         default:
  2661.             ASSERT(0);
  2662.             break;
  2663.     }
  2664.     if (msgRsp->caller_privacy == MMI_TRUE)
  2665.     {
  2666.         g_poc_cntx_p->calling_disp.name[0] = 0xFF;
  2667.         g_poc_cntx_p->calling_disp.name[1] = 0;
  2668.     }
  2669.     else
  2670.     {
  2671.         strncpy((S8*) g_poc_cntx_p->calling_disp.name, (S8*) msgRsp->caller.disp_name, POC_MAX_DISP_LEN - 1);
  2672.         strncpy((S8*) g_poc_cntx_p->calling_disp.uri, (S8*) msgRsp->caller.uri, POC_MAX_URI_LEN - 1);
  2673.     }
  2674.     g_poc_cntx_p->call_status = POC_CALL_ACTIVE;
  2675.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  2676.     if (strlen((S8*) g_poc_cntx_p->cm_talk_group_name))
  2677.     {
  2678.         strncpy((S8*) list_name, (S8*) g_poc_cntx_p->cm_talk_group_name, POC_MAX_DISP_LEN - 1);
  2679.     }
  2680.     else if (strlen((S8*) msgRsp->caller.disp_name))
  2681.     {
  2682.         strncpy((S8*) list_name, (S8*) msgRsp->caller.disp_name, POC_MAX_DISP_LEN - 1);
  2683.     }
  2684.     else
  2685.     {
  2686.         strncpy((S8*) list_name, (S8*) msgRsp->caller.uri, POC_MAX_DISP_LEN - 1);
  2687.     }
  2688.     strncpy((S8*) uri, (S8*) msgRsp->session_id, POC_MAX_URI_LEN - 1);
  2689.     mmi_poc_history_add(POC_INCOMING_CALL, MMI_TRUE, list_name, uri, NULL);
  2690.     g_poc_cntx_p->floor_idle_recved = MMI_TRUE;
  2691.     if (IsScreenPresent(SCR_ID_POC_CM))
  2692.     {
  2693.         HistoryReplace(SCR_ID_POC_CM, SCR_ID_POC_CM, mmi_poc_entry_connected_idle);
  2694.     }
  2695.     else
  2696.     {
  2697.         mmi_poc_entry_connected_idle();
  2698.     }
  2699. }
  2700. /*****************************************************************************
  2701.  * FUNCTION
  2702.  *  mmi_poc_ring_ind
  2703.  * DESCRIPTION
  2704.  *  ringing indication handler
  2705.  * PARAMETERS
  2706.  *  info        [IN]        Local parameters from protocol
  2707.  * RETURNS
  2708.  *  void
  2709.  *****************************************************************************/
  2710. void mmi_poc_ring_ind(void *info)
  2711. {
  2712.     /*----------------------------------------------------------------*/
  2713.     /* Local Variables                                                */
  2714.     /*----------------------------------------------------------------*/
  2715.     poc_talk_ring_ind_struct *msgRsp;
  2716.     U8 list_name[POC_MAX_DISP_LEN];
  2717.     U8 uri[POC_MAX_URI_LEN];
  2718.     /*----------------------------------------------------------------*/
  2719.     /* Code Body                                                      */
  2720.     /*----------------------------------------------------------------*/
  2721.     if (isInCall() && (g_poc_cntx_p->call_status != POC_CALL_PROGRESSING))
  2722.     {
  2723.         mmi_poc_talk_answer_req(MMI_FALSE);
  2724.         ClearProtocolEventHandler(PRT_POC_TALK_ANSWER_RSP);
  2725.         return;
  2726.     }
  2727.     msgRsp = (poc_talk_ring_ind_struct*) info;
  2728.     if (g_poc_cntx_p->curr_reg_state == POC_REG_DEREGING)
  2729.     {
  2730.         mmi_poc_talk_answer_req(MMI_FALSE);
  2731.         ClearProtocolEventHandler(PRT_POC_TALK_ANSWER_RSP);
  2732.         return;
  2733.     }
  2734.     g_poc_cntx_p->active_talk_id = msgRsp->talk_id;
  2735.     memset(g_poc_cntx_p->cm_talk_group_name, 0, sizeof(g_poc_cntx_p->cm_talk_group_name));
  2736.     memset(g_poc_cntx_p->cm_talk_list, 0, sizeof(g_poc_cntx_p->cm_talk_list));
  2737.     g_poc_cntx_p->cm_talk_list_num = 0;
  2738.     switch (msgRsp->talk_type)
  2739.     {
  2740.         case POC_1_TO_1_TALK:
  2741.         case POC_UNKNOWN_TALK_TYPE:
  2742.         case POC_AD_HOC_GROUP_TALK:
  2743.             break;
  2744.         case POC_CHAT_GROUP_TALK:
  2745.         case POC_PRE_ARRANGED_GROUP_TALK:
  2746.             if (strlen((S8*) msgRsp->group_addr.disp_name))
  2747.             {
  2748.                 strncpy(
  2749.                     (S8*) g_poc_cntx_p->cm_talk_group_name,
  2750.                     (S8*) msgRsp->group_addr.disp_name,
  2751.                     POC_MAX_DISP_LEN - 1);
  2752.             }
  2753.             else
  2754.             {
  2755.                 strncpy((S8*) g_poc_cntx_p->cm_talk_group_name, (S8*) msgRsp->group_addr.uri, POC_MAX_DISP_LEN - 1);
  2756.             }
  2757.             break;
  2758.         default:
  2759.             ASSERT(0);
  2760.             break;
  2761.     }
  2762.     g_poc_cntx_p->call_status = POC_CALL_ACTIVE;
  2763.     MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POC_CALL_STATE, (S32) g_poc_cntx_p->call_status));
  2764.     if (msgRsp->caller_privacy == MMI_TRUE)
  2765.     {
  2766.         g_poc_cntx_p->calling_disp.name[0] = 0xFF;
  2767.         g_poc_cntx_p->calling_disp.name[1] = 0;
  2768.     }
  2769.     else
  2770.     {
  2771.         strncpy((S8*) g_poc_cntx_p->calling_disp.name, (S8*) msgRsp->caller.disp_name, POC_MAX_DISP_LEN - 1);
  2772.         strncpy((S8*) g_poc_cntx_p->calling_disp.uri, (S8*) msgRsp->caller.uri, POC_MAX_URI_LEN - 1);
  2773.     }
  2774.     if (strlen((S8*) g_poc_cntx_p->cm_talk_group_name))
  2775.     {
  2776.         strncpy((S8*) list_name, (S8*) g_poc_cntx_p->cm_talk_group_name, POC_MAX_DISP_LEN - 1);