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

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.  *  Modification Notice:
  37.  *  --------------------------
  38.  *  This software is modified by MediaTek Inc. and the information contained
  39.  *  herein is confidential. The software may not be copied and the information
  40.  *  contained herein may not be used or disclosed except with the written
  41.  *  permission of MediaTek Inc. (C) 2001
  42.  *
  43.  *******************************************************************************/
  44.  /*******************************************************************************
  45.  * Filename:
  46.  * ---------
  47.  *   ATHandler.c
  48.  *
  49.  * Project:
  50.  * --------
  51.  *   Maui_Software
  52.  *
  53.  * Description:
  54.  * ------------
  55.  *  .......
  56.  *
  57.  * Author:
  58.  * -------
  59.  * -------
  60.  *
  61.  *------------------------------------------------------------------------------
  62.  * $Log$
  63.  *
  64.  * removed!
  65.  * removed!
  66.  * Add check for MMI_PS_AT_LANG_EN.
  67.  *
  68.  * removed!
  69.  * removed!
  70.  * 
  71.  *
  72.  * removed!
  73.  * removed!
  74.  * Fix compile warning.
  75.  *
  76.  * removed!
  77.  * removed!
  78.  * Add LCM Test support.
  79.  *
  80.  * removed!
  81.  * removed!
  82.  * Set Greeting text modification.
  83.  *
  84.  * removed!
  85.  * removed!
  86.  * Modify Index parameter of AtSetProfileTone.
  87.  *
  88.  * removed!
  89.  * removed!
  90.  * Add check length: 0xFF = only modify mode for setting greeting text.
  91.  *
  92.  * removed!
  93.  * removed!
  94.  * Add AT general response for set_silent mode.
  95.  *
  96.  * removed!
  97.  * removed!
  98.  * 
  99.  *
  100.  * removed!
  101.  * removed!
  102.  * 
  103.  *
  104.  * removed!
  105.  * removed!
  106.  * 
  107.  *
  108.  * removed!
  109.  * removed!
  110.  * 
  111.  *
  112.  * removed!
  113.  * removed!
  114.  * 
  115.  *
  116.  * removed!
  117.  * removed!
  118.  * 
  119.  *
  120.  * removed!
  121.  * removed!
  122.  * 
  123.  *
  124.  * removed!
  125.  * removed!
  126.  * 
  127.  *
  128.  * removed!
  129.  * removed!
  130.  * 
  131.  *
  132.  * removed!
  133.  * removed!
  134.  * 
  135.  *
  136.  * removed!
  137.  * removed!
  138.  * 
  139.  *
  140.  *******************************************************************************/
  141. /**
  142.  * Copyright Notice
  143.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  144.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  145.  *  (It is illegal to remove this copyright notice from this software or any
  146.  *  portion of it)
  147.  */
  148. /**********************************************************************************
  149.    Filename:      ATHandler.c
  150.    Author:        Gautam
  151.    Date Created:  
  152.    Contains:   AT comamnd handler
  153. **********************************************************************************/
  154. #include  "Stdc.h"
  155. #include "L4Dr1.h"
  156. #include "GlobalMenuItems.h"
  157. #include "PixtelDataTypes.h"
  158. #include "KeyBrd.h"
  159. #include "ProtocolEvents.h"
  160. #include "ATHandlerProt.h"
  161. // #include "ATHandlerDcl.h"
  162. #include "DateTimeType.h"
  163. #include "AlarmGProt.h"
  164. #include "AlarmFrameWorkProt.h"
  165. #include "CallManagementGProt.h"
  166. #include "CallManagementStruct.h"
  167. #include "gpioInc.h"
  168. #include "GlobalDefs.h"
  169. #include "IdleAppDef.h"
  170. #include "IdleAppProt.h"        /* IsTrChineseSet(), IsSmChinsesSet() */
  171. #include "mdi_datatype.h"
  172. #include "mdi_audio.h"
  173. #include "MMIThemes.h"
  174. #include "NVRAMEnum.h"
  175. #include "NVRAMProt.h"
  176. #include "NVRAMType.h"
  177. #include "PhoneSetupGprots.h"   /* PhnsetGetTimeFormat(), PhnsetGetDateFormat() */
  178. #include "ProfilesDefs.h"
  179. #include "ProfileGprots.h"
  180. #include "Profiles_prot.h"
  181. #include "SettingDefs.h"        /* MAX_SETTING_WELCOME_TEXT */
  182. #include "SettingGprots.h"
  183. #include "SettingProt.h"
  184. #include "SimDetectionGexdcl.h"
  185. #include "SettingsGdcl.h"
  186. #include "WPSSProtos.h"
  187. #include "ShortcutsProts.h"
  188. #include "SSCStringHandle.h"    /* SSC_ENGLISH, ... defination */
  189. #include "wgui_status_icons.h"
  190. #include "wgui_categories_inputs.h"
  191. #include "DownloadDefs.h"
  192. #include "WallpaperDefs.h"
  193. #include "PhoneSetup.h"
  194. #include "FontRes.h"
  195. #ifdef MMI_ON_HARDWARE_P
  196. #include "L4Dr.h"
  197. #endif 
  198. #ifndef YEARFORMATE
  199. #define YEARFORMATE 2000
  200. #endif 
  201. BOOL SetFromAT = FALSE;
  202. extern U8 gprofileId;
  203. extern U8 gactivatedprofile;
  204. extern U16 gCurrLangIndex;
  205. extern U16 gMaxDeployedLangs;
  206. extern sLanguageDetails *gLanguageArray;
  207. extern rtc_format_struct gclockData;
  208. extern S8 gHour[];
  209. extern S8 gMinute[];
  210. extern S8 gDate[];
  211. extern S8 gMonth[];
  212. extern S8 gYear[];
  213. extern U8 gPLMN[];
  214. extern sLanguageDetails *gLanguageArray;
  215. extern U16 gCurrLangIndex;
  216. extern BOOL AtSetProfileTone(U8 profileID, PROFILE_TONE_TYPE_ENUM tone_type, U8 tone_idx);
  217. extern void RefreshNwProviderName(U8 *UpdatePlmn);
  218. extern void MutethePhone(void);
  219. extern void UnMutethePhone(void);
  220. void ATRstFactoryDefault(void *ind);
  221. void ATRstConfirm(void);
  222. void ATVerifyPINRsp(void *info);
  223. void ATLCMRGBTestHandler(void *ind);
  224. /*****************************************************************************
  225.  * FUNCTION
  226.  *  ATHandlerInit
  227.  * DESCRIPTION
  228.  *  Set Volume : in the existing profile???
  229.  *  Set Mute Mode
  230.  *  Set Silent Mode
  231.  *  Set Vibartion Mode
  232.  *  Simulate Key Input
  233.  *  Display Text On Main LCD : in what ever screen or the scren that ermits the same
  234.  *  Display Status Icon : Irrespective of the condition?
  235.  *  Set Alarm                        :Organise
  236.  *  Delete Alarm ... would he give the ID ???:Organizer
  237.  *  Set Date and Time                :Settings phonesetup
  238.  *  Set Date and Time Format            .Settings
  239.  *  Set language                     : Settings
  240.  *  Set Greeting Text                :Settings
  241.  *  Make Outgoing Call
  242.  *  Answer Incoming Call
  243.  *  Hang up outgoig call during dialling
  244.  *  Sync Call Table
  245.  * PARAMETERS
  246.  *  void
  247.  * RETURNS
  248.  *  void
  249.  *****************************************************************************/
  250. void ATHandlerInit(void)
  251. {
  252.     /*----------------------------------------------------------------*/
  253.     /* Local Variables                                                */
  254.     /*----------------------------------------------------------------*/
  255.     /*----------------------------------------------------------------*/
  256.     /* Code Body                                                      */
  257.     /*----------------------------------------------------------------*/
  258.     SetProtocolEventHandler(ATSetVolume, PRT_MSG_ID_MMI_EQ_VOLUME_CHANGE_IND);
  259.     SetProtocolEventHandler(ATSimulateKeyBoard, PRT_MSG_ID_MMI_EQ_SIMULATE_KEY_PRESS_REQ_IND);
  260.     SetProtocolEventHandler(ATTextOnLCD, PRT_MSG_ID_MMI_EQ_DISPLAY_TEXT_REQ_IND);
  261.     SetProtocolEventHandler(AtShowStatusIcon, PRT_MSG_ID_MMI_EQ_SET_INDICATOR_REQ_IND);
  262.     SetProtocolEventHandler(ATSetRTC, PRT_MSG_ID_MMI_EQ_SET_RTC_TIME_REQ_IND);
  263.     SetProtocolEventHandler(ATSetAlarm, MSG_ID_MMI_AT_ALARM_SET_REQ_IND);
  264.     SetProtocolEventHandler(ATQueryAlarm, MSG_ID_MMI_AT_ALARM_QUERY_REQ_IND);
  265.     SetProtocolEventHandler(ATCancelAlarm, MSG_ID_MMI_AT_ALARM_DELETE_REQ_IND);
  266.     SetProtocolEventHandler(ATMakeOutgoingCall, PRT_MSG_ID_MMI_CC_DIAL_REQ_IND);
  267.     SetProtocolEventHandler(ATAnswerIncomingCall, PRT_MSG_ID_MMI_CC_CALL_ACCEPT_REQ_IND);
  268.     SetProtocolEventHandler(ATHangupCall, PRT_MSG_ID_MMI_CC_CALL_ABORT_REQ_IND);
  269.     SetProtocolEventHandler(ATSetProfileHandler, PRT_MMI_SET_MMI_DEFAULT_PROF_IND);
  270.     SetProtocolEventHandler(ATSyncCallTable, PRT_MSG_ID_MMI_CC_SYNC_TABLE_REQ_IND);
  271.     SetProtocolEventHandler(AtSetGreetingTextHdlr, PRT_MMI_EQ_SET_GREETING_TEXT_REQ_IND);
  272.     SetProtocolEventHandler(ATSetLanguage, PRT_MMI_EQ_SET_LANGUAGE_REQ_IND);
  273.     SetProtocolEventHandler(ATSetSilentMode, PRT_MMI_EQ_SET_SILENT_MODE_REQ_IND);
  274.     SetProtocolEventHandler(ATSetVibrationMode, PRT_MMI_EQ_SET_VIBRATOR_MODE_REQ_IND);
  275.     SetProtocolEventHandler(ATSetDateandTimeFormat, PRT_MMI_EQ_SET_DATE_TIME_FORMAT_REQ_IND);
  276.     SetProtocolEventHandler(ATSetMute, PRT_MMI_EQ_MUTE_CHANGE_IND);
  277.     SetProtocolEventHandler(AtQueryGreetingTextIndHdlr, PRT_MMI_EQ_QUERY_GREETING_TEXT_REQ_IND);
  278.     SetProtocolEventHandler(AtQueryLangIndHdlr, PRT_MMI_EQ_QUERY_LANGUAGE_REQ_IND);
  279.     SetProtocolEventHandler(AtQuerySilentModeIndHdlr, PRT_MMI_EQ_QUERY_SILENT_MODE_REQ_IND);
  280.     SetProtocolEventHandler(AtQueryVibratorModeIndHdlr, PRT_MMI_EQ_QUERY_VIBRATOR_MODE_REQ_IND);
  281.     SetProtocolEventHandler(AtQueryDTFmtIndHdlr, PRT_MMI_EQ_QUERY_DATE_TIME_FORMAT_REQ_IND);
  282.     SetProtocolEventHandler(AtQueryMuteModeIndHdlr, PRT_MMI_EQ_QUERY_MUTE_MODE_REQ_IND);
  283.     SetProtocolEventHandler(ATPowerReset, MSG_ID_MMI_POWER_RESET_IND);
  284.     SetProtocolEventHandler(ATRstFactoryDefault, PRT_MMI_FACTORY_RESTORE_REQ_IND);
  285.     SetProtocolEventHandler(ATLCMRGBTestHandler, MSG_ID_MMI_EM_RGB_TEST_REQ_IND);
  286. }
  287. /*********************/
  288. /* Send Message Func */
  289. /*********************/
  290. /*****************************************************************************
  291.  * FUNCTION
  292.  *  SendMsg2AT
  293.  * DESCRIPTION
  294.  *  Send message to AT
  295.  * PARAMETERS
  296.  *  msg_id              [IN]        Message id
  297.  *  local_param_ptr     [?]         Local parameter pointer
  298.  *  peer_buf_ptr        [?]         Peer buffer pointer
  299.  * RETURNS
  300.  *  void
  301.  *****************************************************************************/
  302. void SendMsg2AT(U16 msg_id, void *local_param_ptr, void *peer_buf_ptr)
  303. {
  304. #ifdef MMI_ON_HARDWARE_P
  305.     /*----------------------------------------------------------------*/
  306.     /* Local Variables                                                */
  307.     /*----------------------------------------------------------------*/
  308.     MYQUEUE Message;
  309.     /*----------------------------------------------------------------*/
  310.     /* Code Body                                                      */
  311.     /*----------------------------------------------------------------*/
  312.     Message.oslMsgId = msg_id;
  313.     Message.oslDataPtr = (oslParaType*) local_param_ptr;
  314.     Message.oslPeerBuffPtr = peer_buf_ptr;
  315.     Message.oslSrcId = MOD_MMI;
  316.     Message.oslDestId = MOD_L4C;
  317.     OslMsgSendExtQueue(&Message);
  318. #endif /* MMI_ON_HARDWARE_P */ 
  319. }
  320. /******************/
  321. /* Greeting Text  */
  322. /******************/
  323. /*****************************************************************************
  324.  * FUNCTION
  325.  *  AtSetGreetingTextHdlr
  326.  * DESCRIPTION
  327.  *  Set greeting text from AT command
  328.  * PARAMETERS
  329.  *  msg     [?]     Greeting text to be set
  330.  * RETURNS
  331.  *  void
  332.  *****************************************************************************/
  333. void AtSetGreetingTextHdlr(void *msg)
  334. {
  335.     /*----------------------------------------------------------------*/
  336.     /* Local Variables                                                */
  337.     /*----------------------------------------------------------------*/
  338.     mmi_at_general_res_req_struct *rsp_msg;
  339.     mmi_eq_set_greeting_text_req_ind_struct *msgReq;
  340.     /*----------------------------------------------------------------*/
  341.     /* Code Body                                                      */
  342.     /*----------------------------------------------------------------*/
  343.     msgReq = (mmi_eq_set_greeting_text_req_ind_struct*) msg;
  344.     rsp_msg = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
  345.     if ( (msgReq->length < (MAX_SETTING_WELCOME_TEXT * ENCODING_LENGTH)) || (msgReq->length == 0xFF))
  346.     {
  347.         rsp_msg->result = PhnsetSetWelcomeText((MMI_BOOL) msgReq->mode, (U8) msgReq->dcs, (U8*) msgReq->text, (U8)msgReq->length);
  348.     }
  349.     SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void*)rsp_msg, NULL);
  350. }
  351. /***************/
  352. /* Language    */
  353. /***************/
  354. /*****************************************************************************
  355.  * FUNCTION
  356.  *  AtQueryGreetingTextIndHdlr
  357.  * DESCRIPTION
  358.  *  Query Greeting Text from AT command
  359.  * PARAMETERS
  360.  *  msg     [?]     No action
  361.  * RETURNS
  362.  *  void
  363.  *****************************************************************************/
  364. void AtQueryGreetingTextIndHdlr(void *msg)
  365. {
  366.     /*----------------------------------------------------------------*/
  367.     /* Local Variables                                                */
  368.     /*----------------------------------------------------------------*/
  369.     mmi_eq_query_greeting_text_res_req_struct *rsp_msg;
  370.     /*----------------------------------------------------------------*/
  371.     /* Code Body                                                      */
  372.     /*----------------------------------------------------------------*/
  373.     rsp_msg = (mmi_eq_query_greeting_text_res_req_struct*)
  374.         OslConstructDataPtr(sizeof(mmi_eq_query_greeting_text_res_req_struct));
  375.     rsp_msg->mode = IsShowWelcomeScr1();
  376.     rsp_msg->dcs = L4_UCS2;
  377.     PhnsetGetWelcomeText((S8*) rsp_msg->text, sizeof(rsp_msg->text));
  378.     rsp_msg->length = (U8) pfnUnicodeStrlen((S8*) rsp_msg->text);
  379.     SendMsg2AT(PRT_MMI_EQ_QUERY_GREETING_TEXT_RES_REQ, (void*)rsp_msg, NULL);
  380. }
  381. /*****************************************************************************
  382.  * FUNCTION
  383.  *  ATSetLanguage
  384.  * DESCRIPTION
  385.  *  Set Language from AT command
  386.  * PARAMETERS
  387.  *  msg     [?]     Set language request
  388.  * RETURNS
  389.  *  void
  390.  *****************************************************************************/
  391. void ATSetLanguage(void *msg)
  392. {
  393.     /*----------------------------------------------------------------*/
  394.     /* Local Variables                                                */
  395.     /*----------------------------------------------------------------*/
  396.     /* to see the value of language code */
  397.     U8 data = 0;
  398.     S16 error;
  399.     S8 *ssc_sp;
  400.     mmi_eq_set_language_req_ind_struct *msgInd;
  401.     /*----------------------------------------------------------------*/
  402.     /* Code Body                                                      */
  403.     /*----------------------------------------------------------------*/
  404.     msgInd = (mmi_eq_set_language_req_ind_struct*) msg;
  405.     switch (msgInd->lang_code)
  406.     {
  407.         case MMI_PS_AT_LANG_TW:
  408.             ssc_sp = SSC_TCHINESE;  /* data = 1; */
  409.             break;
  410.         case MMI_PS_AT_LANG_ZH:
  411.             ssc_sp = SSC_SCHINESE;  /* data = 2; */
  412.             break;
  413.         case MMI_PS_AT_LANG_DEFAULT:
  414.         case MMI_PS_AT_LANG_EN:
  415.         default:
  416.             ssc_sp = SSC_ENGLISH;   /* data = 0; */
  417.             break;
  418.     }
  419.     for (data = 0; data < gMaxDeployedLangs; data++)
  420.     {
  421.         if (strcmp((PS8) gLanguageArray[data].aLangSSC, ssc_sp) == 0)
  422.         {
  423.             break;
  424.         }
  425.     }
  426.     /* Language not support (out of boundary) */
  427.     if (data >= gMaxDeployedLangs)
  428.     {
  429.         SendLangChange2AT(0xFF);
  430.         return;
  431.     }
  432.     if (data != gCurrLangIndex)
  433.     {
  434.         SetCurrentLanguage(data);
  435.         WriteValue(NVRAM_SETTING_LANG, &data, DS_BYTE, &error);
  436.         RefreshNwProviderName(gPLMN);
  437.         if (g_idle_context.IsOnIdleScreen)
  438.         {
  439.             EntryIdleScreen();
  440.         }
  441.     }
  442.     SendLangChange2AT(data);
  443. }
  444. /*****************************************************************************
  445.  * FUNCTION
  446.  *  AtQueryLangIndHdlr
  447.  * DESCRIPTION
  448.  *  Query language setting from AT command
  449.  * PARAMETERS
  450.  *  msg     [?]     No action
  451.  * RETURNS
  452.  *  void
  453.  *****************************************************************************/
  454. void AtQueryLangIndHdlr(void *msg)
  455. {
  456.     /*----------------------------------------------------------------*/
  457.     /* Local Variables                                                */
  458.     /*----------------------------------------------------------------*/
  459.     U8 lang_type = MMI_PS_AT_LANG_DEFAULT;
  460.     mmi_eq_query_language_res_req_struct *res_msg;
  461.     /*----------------------------------------------------------------*/
  462.     /* Code Body                                                      */
  463.     /*----------------------------------------------------------------*/
  464.     res_msg =
  465.         (mmi_eq_query_language_res_req_struct*) OslConstructDataPtr(sizeof(mmi_eq_query_language_res_req_struct));
  466.     if (IsTrChineseSet())
  467.     {
  468.         lang_type = MMI_PS_AT_LANG_TW;
  469.     }
  470.     else if (IsSmChineseSet())
  471.     {
  472.         lang_type = MMI_PS_AT_LANG_ZH;
  473.     }
  474.     else if (strcmp((PS8) gLanguageArray[gCurrLangIndex].aLangSSC, SSC_ENGLISH) == 0)
  475.     {
  476.      lang_type = MMI_PS_AT_LANG_EN;
  477.     }
  478.     else
  479.     {
  480.         lang_type = MMI_PS_AT_LANG_UNKWN;
  481.     }
  482.     res_msg->lang_code = lang_type;
  483.     SendMsg2AT(PRT_MMI_EQ_QUERY_LANGUAGE_RES_REQ, (void*)res_msg, NULL);
  484. }
  485. /*****************************************************************************
  486.  * FUNCTION
  487.  *  SendLangChange2AT
  488.  * DESCRIPTION
  489.  *  Send to AT command when language change, for AT+CLAE
  490.  * PARAMETERS
  491.  *  code        [IN]        Language to be set
  492.  * RETURNS
  493.  *  void
  494.  *****************************************************************************/
  495. void SendLangChange2AT(U8 code)
  496. {
  497.     /*----------------------------------------------------------------*/
  498.     /* Local Variables                                                */
  499.     /*----------------------------------------------------------------*/
  500.     mmi_eq_set_language_req_struct *msgReq;
  501.     /*----------------------------------------------------------------*/
  502.     /* Code Body                                                      */
  503.     /*----------------------------------------------------------------*/
  504.     msgReq = (mmi_eq_set_language_req_struct*) OslConstructDataPtr(sizeof(mmi_eq_set_language_req_struct));
  505.     /*
  506.      * switch (code)
  507.      * {
  508.      * case 0: msgReq->lang_code = MMI_PS_AT_LANG_EN; break;
  509.      * case 1: msgReq->lang_code = MMI_PS_AT_LANG_TW; break;
  510.      * case 2: msgReq->lang_code = MMI_PS_AT_LANG_ZH; break;
  511.      * default: msgReq->lang_code = MMI_PS_AT_LANG_EN; break;
  512.      * }
  513.      */
  514.     if (code > gMaxDeployedLangs)
  515.     {
  516.         msgReq->lang_code = MMI_PS_AT_LANG_UNKWN;
  517.     }
  518.     else
  519.     {
  520.         if (strcmp((PS8) gLanguageArray[code].aLangSSC, SSC_ENGLISH) == 0)
  521.         {
  522.             msgReq->lang_code = MMI_PS_AT_LANG_EN;
  523.         }
  524.         else if (strcmp((PS8) gLanguageArray[code].aLangSSC, SSC_TCHINESE) == 0)
  525.         {
  526.             msgReq->lang_code = MMI_PS_AT_LANG_TW;
  527.         }
  528.         else if (strcmp((PS8) gLanguageArray[code].aLangSSC, SSC_SCHINESE) == 0)
  529.         {
  530.             msgReq->lang_code = MMI_PS_AT_LANG_ZH;
  531.         }
  532.         else
  533.         {
  534.             msgReq->lang_code = MMI_PS_AT_LANG_UNKWN;
  535.         }
  536.     }
  537.     SendMsg2AT(PRT_MMI_EQ_SET_LANGUAGE_REQ, (void*)msgReq, NULL);
  538. }
  539. /***************/
  540. /* Silent mode */
  541. /***************/
  542. /*****************************************************************************
  543.  * FUNCTION
  544.  *  ATSetSilentMode
  545.  * DESCRIPTION
  546.  *  Set Silent Mode from AT command
  547.  * PARAMETERS
  548.  *  msg     [?]     Set silent mode on/off request message
  549.  * RETURNS
  550.  *  void
  551.  *****************************************************************************/
  552. void ATSetSilentMode(void *msg)
  553. {
  554.     /*----------------------------------------------------------------*/
  555.     /* Local Variables                                                */
  556.     /*----------------------------------------------------------------*/
  557.     mmi_eq_set_silent_mode_req_struct *msgReq;
  558.     mmi_at_general_res_req_struct *rsp_msg;
  559.     /*----------------------------------------------------------------*/
  560.     /* Code Body                                                      */
  561.     /*----------------------------------------------------------------*/
  562.     msgReq = (mmi_eq_set_silent_mode_req_struct*) msg;
  563.     rsp_msg = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
  564.     
  565.     SetFromAT = TRUE;
  566.     if (msgReq->mode)
  567.     {
  568.         ClearKeyEvents();
  569.         ActivateSilentProfile();
  570.         if (IsSilentModeActivated())
  571.         {
  572.             /* set silent mode successfully */
  573.             rsp_msg->result = TRUE;
  574.         }
  575.         else
  576.         {
  577.             /* set silent mode failed */
  578.             rsp_msg->result = FALSE;
  579.         }
  580.     }
  581.     else
  582.     {
  583.         ClearKeyEvents();
  584.         DeactivateSilentProfile();
  585.         if (IsSilentModeActivated())
  586.         {
  587.             /* deactivate silent mode failed */
  588.             rsp_msg->result = FALSE;
  589.         }
  590.         else
  591.         {
  592.             /* deactivate silent mode successfully */
  593.             rsp_msg->result = TRUE;
  594.         }
  595.     }
  596.     SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void*)rsp_msg, NULL);
  597.     
  598.     SetFromAT = FALSE;
  599. }
  600. /*****************************************************************************
  601.  * FUNCTION
  602.  *  AtQuerySilentModeIndHdlr
  603.  * DESCRIPTION
  604.  *  Query silent mode setting from AT command
  605.  * PARAMETERS
  606.  *  msg     [?]     No action
  607.  * RETURNS
  608.  *  void
  609.  *****************************************************************************/
  610. void AtQuerySilentModeIndHdlr(void *msg)
  611. {
  612.     /*----------------------------------------------------------------*/
  613.     /* Local Variables                                                */
  614.     /*----------------------------------------------------------------*/
  615.     mmi_eq_query_silent_mode_res_req_struct *res_msg;
  616.     /*----------------------------------------------------------------*/
  617.     /* Code Body                                                      */
  618.     /*----------------------------------------------------------------*/
  619.     res_msg =
  620.         (mmi_eq_query_silent_mode_res_req_struct*)
  621.         OslConstructDataPtr(sizeof(mmi_eq_query_silent_mode_res_req_struct));
  622.     if (gactivatedprofile == 5) /* 5: Silent Profile */
  623.     {
  624.         res_msg->mode = MMI_TRUE;
  625.     }
  626.     else
  627.     {
  628.         res_msg->mode = MMI_FALSE;
  629.     }
  630.     SendMsg2AT(PRT_MMI_EQ_QUERY_SILENT_MODE_RES_REQ, (void*)res_msg, NULL);
  631. }
  632. /******************/
  633. /* Vibration Mode */
  634. /******************/
  635. /*****************************************************************************
  636.  * FUNCTION
  637.  *  ATSetVibrationMode
  638.  * DESCRIPTION
  639.  *  AT Command set Vibrator Mode
  640.  * PARAMETERS
  641.  *  msg     [?]     Set vibration mode on/off request
  642.  * RETURNS
  643.  *  void
  644.  *****************************************************************************/
  645. void ATSetVibrationMode(void *msg)
  646. {
  647.     /*----------------------------------------------------------------*/
  648.     /* Local Variables                                                */
  649.     /*----------------------------------------------------------------*/
  650.     U8 tmpValue = gprofileId;
  651.     mmi_eq_set_vibrator_mode_req_ind_struct *msgInd;
  652.     MMI_ALERT_TYPE alertType;
  653.     /*----------------------------------------------------------------*/
  654.     /* Code Body                                                      */
  655.     /*----------------------------------------------------------------*/
  656.     msgInd = (mmi_eq_set_vibrator_mode_req_ind_struct*) msg;
  657.     SetFromAT = TRUE;
  658.     gprofileId = gactivatedprofile;
  659.     alertType = GetMtCallAlertTypeEnum();
  660.     if (msgInd->mode == 1)
  661.     {
  662.         if ((alertType == MMI_ALERT_NONE) || (alertType == MMI_SILENT))
  663.         {
  664.             SetMtCallAlertTypeEnum(MMI_VIBRATION_ONLY);
  665.         }
  666.         else if (alertType == MMI_RING)
  667.         {
  668.             SetMtCallAlertTypeEnum(MMI_VIBRATION_AND_RING);
  669.         }
  670.     }
  671.     else if (msgInd->mode == 0)
  672.     {
  673.         if ((alertType == MMI_VIBRATION_AND_RING) || (alertType == MMI_VIBRATION_THEN_RING))
  674.         {
  675.             SetMtCallAlertTypeEnum(MMI_RING);
  676.         }
  677.         else if (alertType == MMI_VIBRATION_ONLY)
  678.         {
  679.             SetMtCallAlertTypeEnum(MMI_SILENT);
  680.         }
  681.     }
  682.     gprofileId = tmpValue;
  683.     SetFromAT = FALSE;
  684.     if (GetActiveScreenId() == SCR_PROFILES_CUSTOMIZE)
  685.     {
  686.         ExitScrProfilesCustomize();
  687.         GoBackHistory();
  688.     }
  689. }
  690. /*****************************************************************************
  691.  * FUNCTION
  692.  *  AtQueryVibratorModeIndHdlr
  693.  * DESCRIPTION
  694.  *  Query vibrator mode setting from AT command
  695.  * PARAMETERS
  696.  *  msg     [?]     No action
  697.  * RETURNS
  698.  *  void
  699.  *****************************************************************************/
  700. void AtQueryVibratorModeIndHdlr(void *msg)
  701. {
  702.     /*----------------------------------------------------------------*/
  703.     /* Local Variables                                                */
  704.     /*----------------------------------------------------------------*/
  705.     MMI_ALERT_TYPE alert_type;
  706.     mmi_eq_query_vibrator_mode_res_req_struct *res_msg;
  707.     /*----------------------------------------------------------------*/
  708.     /* Code Body                                                      */
  709.     /*----------------------------------------------------------------*/
  710.     res_msg = (mmi_eq_query_vibrator_mode_res_req_struct*)
  711.         OslConstructDataPtr(sizeof(mmi_eq_query_vibrator_mode_res_req_struct));
  712.     alert_type = GetMtCallAlertTypeEnum();
  713.     if (alert_type == MMI_VIBRATION_ONLY ||
  714.         alert_type == MMI_VIBRATION_AND_RING || alert_type == MMI_VIBRATION_THEN_RING)
  715.     {
  716.         res_msg->mode = MMI_TRUE;
  717.     }
  718.     else
  719.     {
  720.         res_msg->mode = MMI_FALSE;
  721.     }
  722.     SendMsg2AT(PRT_MMI_EQ_QUERY_VIBRATOR_MODE_RES_REQ, (void*)res_msg, NULL);
  723. }
  724. /********************/
  725. /* Date/Time Format */
  726. /********************/
  727. /*****************************************************************************
  728.  * FUNCTION
  729.  *  ATSetDateandTimeFormat
  730.  * DESCRIPTION
  731.  *  AT Command set Date Time Format
  732.  * PARAMETERS
  733.  *  msg     [?]     Set date time format request message, specifying time/date
  734.  * RETURNS
  735.  *  void
  736.  *****************************************************************************/
  737. void ATSetDateandTimeFormat(void *msg)
  738. {
  739.     /*----------------------------------------------------------------*/
  740.     /* Local Variables                                                */
  741.     /*----------------------------------------------------------------*/
  742.     U8 date_time_fmt = 0;
  743.     mmi_eq_set_date_time_format_req_ind_struct *msgReq;
  744.     /*----------------------------------------------------------------*/
  745.     /* Code Body                                                      */
  746.     /*----------------------------------------------------------------*/
  747.     msgReq = (mmi_eq_set_date_time_format_req_ind_struct*) msg;
  748.     SetFromAT = TRUE;
  749.     if (msgReq->is_date_set)
  750.     {
  751.         switch (msgReq->mode)
  752.         {
  753.             case DATE_DD_MMM_YYYY:
  754.                 date_time_fmt = 0;
  755.                 break;
  756.             case DATE_DD_MM_YYYY_S:
  757.                 date_time_fmt = 1;
  758.                 break;
  759.             case DATE_MM_DD_YYYY_S:
  760.                 date_time_fmt = 2;
  761.                 break;
  762.             case DATE_YYYY_MM_DD_S:
  763.                 date_time_fmt = 3;
  764.                 break;
  765.             case DATE_YYYY_MM_DD_H:
  766.                 date_time_fmt = 4;
  767.                 break;
  768.             case DATE_MMM_DD_YYYY:
  769.                 date_time_fmt = 5;
  770.                 break;
  771.             default:
  772.                 break;  /* we do not have suport for this format */
  773.         }
  774.         PhnsetSetDateFormat(date_time_fmt);
  775.     }
  776.     else
  777.     {
  778.         switch (msgReq->mode)
  779.         {
  780.             case TIME_HH_MM_24:
  781.                 date_time_fmt = 1;
  782.                 break;
  783.             case TIME_HH_MM_12:
  784.                 date_time_fmt = 0;
  785.                 break;
  786.             default:
  787.                 break;  /* formt not support */
  788.         }
  789.         PhnsetSetTimeFormat(date_time_fmt);
  790.     }
  791.     SetFromAT = FALSE;
  792.     if (g_idle_context.IsOnIdleScreen)
  793.     {
  794.         EntryIdleScreen();
  795.     }
  796. }
  797. /*****************************************************************************
  798.  * FUNCTION
  799.  *  AtQueryDTFmtIndHdlr
  800.  * DESCRIPTION
  801.  *  Query date time format setting from AT command
  802.  * PARAMETERS
  803.  *  msg     [?]     Query type (time/date)
  804.  * RETURNS
  805.  *  void
  806.  *****************************************************************************/
  807. void AtQueryDTFmtIndHdlr(void *msg)
  808. {
  809.     /*----------------------------------------------------------------*/
  810.     /* Local Variables                                                */
  811.     /*----------------------------------------------------------------*/
  812.     U8 date_time_fmt;
  813.     mmi_eq_query_date_time_format_req_ind_struct *in_msg = (mmi_eq_query_date_time_format_req_ind_struct*) msg;
  814.     mmi_eq_query_date_time_format_res_req_struct *res_msg;
  815.     /*----------------------------------------------------------------*/
  816.     /* Code Body                                                      */
  817.     /*----------------------------------------------------------------*/
  818.     res_msg = (mmi_eq_query_date_time_format_res_req_struct*)
  819.         OslConstructDataPtr(sizeof(mmi_eq_query_date_time_format_res_req_struct));
  820.     if (in_msg->is_date == MMI_TRUE)
  821.     {   /* Query date format */
  822.         res_msg->is_date = MMI_TRUE;
  823.         date_time_fmt = PhnsetGetDateFormat();
  824.         switch (date_time_fmt)
  825.         {
  826.             case 0:
  827.                 res_msg->mode = DATE_DD_MMM_YYYY;
  828.                 break;
  829.             case 1:
  830.                 res_msg->mode = DATE_DD_MM_YYYY_S;
  831.                 break;
  832.             case 2:
  833.                 res_msg->mode = DATE_MM_DD_YYYY_S;
  834.                 break;
  835.             case 3:
  836.                 res_msg->mode = DATE_YYYY_MM_DD_S;
  837.                 break;
  838.             case 4:
  839.                 res_msg->mode = DATE_YYYY_MM_DD_H;
  840.                 break;
  841.             case 5:
  842.                 res_msg->mode = DATE_MMM_DD_YYYY;
  843.                 break;
  844.             default:
  845.                 res_msg->mode = 0;
  846.                 break;
  847.         }
  848.     }
  849.     else
  850.     {   /* Query time format */
  851.         res_msg->is_date = MMI_FALSE;
  852.         date_time_fmt = PhnsetGetTimeFormat();
  853.         switch (date_time_fmt)
  854.         {
  855.             case 0:
  856.                 res_msg->mode = TIME_HH_MM_12;
  857.                 break;
  858.             case 1:
  859.                 res_msg->mode = TIME_HH_MM_24;
  860.                 break;
  861.             default:
  862.                 res_msg->mode = TIME_HH_MM_12;
  863.                 break;
  864.         }
  865.     }
  866.     SendMsg2AT(PRT_MMI_EQ_QUERY_DATE_TIME_FORMAT_RES_REQ, (void*)res_msg, NULL);
  867. }
  868. /*******************/
  869. /* Mute mode       */
  870. /*******************/
  871. /*****************************************************************************
  872.  * FUNCTION
  873.  *  ATSetMute
  874.  * DESCRIPTION
  875.  *  AT Command set Mute
  876.  * PARAMETERS
  877.  *  msg     [?]     Set mute on/off request
  878.  * RETURNS
  879.  *  void
  880.  *****************************************************************************/
  881. void ATSetMute(void *msg)
  882. {
  883.     /*----------------------------------------------------------------*/
  884.     /* Local Variables                                                */
  885.     /*----------------------------------------------------------------*/
  886.     mmi_eq_set_mute_req_struct *msgReq;
  887.     /*----------------------------------------------------------------*/
  888.     /* Code Body                                                      */
  889.     /*----------------------------------------------------------------*/
  890.     msgReq = (mmi_eq_set_mute_req_struct*) msg;
  891.     if (!isInCall())
  892.     {
  893.         return;
  894.     }
  895.     SetFromAT = TRUE;
  896.     switch (msgReq->audio_device)
  897.     {
  898.         case MDI_DEVICE_MICROPHONE:
  899.             if ((msgReq->mute_onoff == MMI_TRUE) && !IsPhoneInMute())
  900.             {
  901.                 MutethePhone();
  902.             }
  903.             else if ((msgReq->mute_onoff == MMI_FALSE) && IsPhoneInMute())
  904.             {
  905.                 UnMutethePhone();
  906.             }
  907.             break;
  908.         case MDI_DEVICE_SPEAKER:
  909.             if (msgReq->mute_onoff == MMI_TRUE)
  910.             {
  911.                 MuteOnSpeaker();
  912.             }
  913.             else
  914.             {
  915.                 MuteOnSpeaker();
  916.             }
  917.             break;
  918.         default:
  919.             break;
  920.     }
  921.     SetFromAT = FALSE;
  922. }
  923. /*****************************************************************************
  924.  * FUNCTION
  925.  *  AtQueryMuteModeIndHdlr
  926.  * DESCRIPTION
  927.  *  Query mute mode setting from AT command
  928.  * PARAMETERS
  929.  *  msg     [?]     No action
  930.  * RETURNS
  931.  *  void
  932.  *****************************************************************************/
  933. void AtQueryMuteModeIndHdlr(void *msg)
  934. {
  935.     /*----------------------------------------------------------------*/
  936.     /* Local Variables                                                */
  937.     /*----------------------------------------------------------------*/
  938.     mmi_eq_query_mute_mode_res_req_struct *res_msg;
  939.     /*----------------------------------------------------------------*/
  940.     /* Code Body                                                      */
  941.     /*----------------------------------------------------------------*/
  942.     res_msg = (mmi_eq_query_mute_mode_res_req_struct*)
  943.         OslConstructDataPtr(sizeof(mmi_eq_query_mute_mode_res_req_struct));
  944.     if (IsPhoneInMute())
  945.     {
  946.         res_msg->mode = MMI_TRUE;
  947.     }
  948.     else
  949.     {
  950.         res_msg->mode = MMI_FALSE;
  951.     }
  952.     SendMsg2AT(PRT_MMI_EQ_QUERY_MUTE_MODE_RES_REQ, (void*)res_msg, NULL);
  953. }
  954. /*********/
  955. /* Volume */
  956. /*********/
  957. /*****************************************************************************
  958.  * FUNCTION
  959.  *  ATSetVolume
  960.  * DESCRIPTION
  961.  *  AT command set volume
  962.  * PARAMETERS
  963.  *  msg     [?]     Volume type/level setting request
  964.  * RETURNS
  965.  *  void
  966.  *****************************************************************************/
  967. void ATSetVolume(void *msg)
  968. {
  969.     /*----------------------------------------------------------------*/
  970.     /* Local Variables                                                */
  971.     /*----------------------------------------------------------------*/
  972.     U32 tmpValue;
  973.     mmi_eq_set_volume_req_struct *msgReq;
  974.     /*----------------------------------------------------------------*/
  975.     /* Code Body                                                      */
  976.     /*----------------------------------------------------------------*/
  977.     msgReq = (mmi_eq_set_volume_req_struct*) msg;
  978.     SetFromAT = TRUE;
  979.     tmpValue = gprofileId;
  980.     gprofileId = gactivatedprofile;
  981.     switch (msgReq->volume_type)
  982.     {
  983.         case MDI_VOLUME_MEDIA:
  984.             if (msgReq->volume_level < MDI_MAX_VOLUME_LEVEL)
  985.                 /* MTK Brian added for setting activated ring tone volume, 2003/12/02 */
  986.             {
  987.                 SetActivatedRingVolumeLevel(msgReq->volume_level);
  988.             }
  989.             break;
  990.         case MDI_VOLUME_KEY:
  991.             if (msgReq->volume_level < MDI_MAX_VOLUME_LEVEL)
  992.                 /* MTK Brian added for setting activated keypad volume, 2003/12/02 */
  993.             {
  994.                 SetActivatedKeypadVolumeLevel(msgReq->volume_level);
  995.             }
  996.             break;
  997.         case MDI_VOLUME_SPH:
  998.             if (msgReq->volume_level < MDI_MAX_VOLUME_LEVEL)
  999.             {
  1000.                 SaveSpeechVolume(msgReq->volume_level);
  1001.             }
  1002.             break;
  1003.         default:
  1004.             break;
  1005.     }
  1006.     gprofileId = (U8) tmpValue;
  1007.     SetFromAT = FALSE;
  1008. }
  1009. /**********/
  1010. /* Keybord */
  1011. /**********/
  1012. /*****************************************************************************
  1013.  * FUNCTION
  1014.  *  ATSimulateKeyBoard
  1015.  * DESCRIPTION
  1016.  *  AT command simulate key board event
  1017.  * PARAMETERS
  1018.  *  msg     [?]     Keypad status/key code message
  1019.  * RETURNS
  1020.  *  void
  1021.  *****************************************************************************/
  1022. void ATSimulateKeyBoard(void *msg)
  1023. {
  1024.     /*----------------------------------------------------------------*/
  1025.     /* Local Variables                                                */
  1026.     /*----------------------------------------------------------------*/
  1027.     mmi_eq_simulate_key_press_req_ind_struct *msgReq;
  1028.     /*----------------------------------------------------------------*/
  1029.     /* Code Body                                                      */
  1030.     /*----------------------------------------------------------------*/
  1031.     msgReq = (mmi_eq_simulate_key_press_req_ind_struct*) msg;
  1032.     SetFromAT = TRUE;
  1033.     ProcessKeyEvent(msgReq->keypad_status, msgReq->keycode);
  1034.     /* can not be tested on windiows as status value reuired is 513 ,.. 8 bits ?? */
  1035.     SetFromAT = FALSE;
  1036. }
  1037. /*************/
  1038. /* Status Icon */
  1039. /*************/
  1040. /*****************************************************************************
  1041.  * FUNCTION
  1042.  *  AtShowStatusIcon
  1043.  * DESCRIPTION
  1044.  *  AT command set to show status icon
  1045.  * PARAMETERS
  1046.  *  msg     [?]     Status icon id to be shown
  1047.  * RETURNS
  1048.  *  void
  1049.  *****************************************************************************/
  1050. void AtShowStatusIcon(void *msg)
  1051. {
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Local Variables                                                */
  1054.     /*----------------------------------------------------------------*/
  1055.     mmi_eq_set_indicator_req_ind_struct *msgReq;
  1056.     /*----------------------------------------------------------------*/
  1057.     /* Code Body                                                      */
  1058.     /*----------------------------------------------------------------*/
  1059.     msgReq = (mmi_eq_set_indicator_req_ind_struct*) msg;
  1060.     SetFromAT = TRUE;
  1061.     if (msgReq->icon_id < MAX_STATUS_ICONS)
  1062.     {
  1063.         ShowStatusIcon(msgReq->icon_id);
  1064.         UpdateStatusIcons();
  1065.     }
  1066.     SetFromAT = FALSE;
  1067. }
  1068. /*******/
  1069. /* RTC */
  1070. /*******/
  1071. /*****************************************************************************
  1072.  * FUNCTION
  1073.  *  ATSetRTC
  1074.  * DESCRIPTION
  1075.  *  AT command set RTC
  1076.  * PARAMETERS
  1077.  *  msg     [?]     RTC
  1078.  * RETURNS
  1079.  *  void
  1080.  *****************************************************************************/
  1081. void ATSetRTC(void *msg)
  1082. {
  1083.     /*----------------------------------------------------------------*/
  1084.     /* Local Variables                                                */
  1085.     /*----------------------------------------------------------------*/
  1086.     MYTIME alarmDateTime;
  1087.     mmi_eq_set_rtc_time_req_ind_struct *msgReq;
  1088.     /*----------------------------------------------------------------*/
  1089.     /* Code Body                                                      */
  1090.     /*----------------------------------------------------------------*/
  1091.     msgReq = (mmi_eq_set_rtc_time_req_ind_struct*) msg;
  1092.     SetFromAT = TRUE;
  1093.     if (msgReq->rtc_type == RTC_TIME_CLOCK_IND)
  1094.     {
  1095.         mmi_at_general_res_req_struct *rsp_msg;
  1096.         rsp_msg = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
  1097.         alarmDateTime.nSec = msgReq->alarm.data_time.rtc_sec;
  1098.         alarmDateTime.nMin = msgReq->alarm.data_time.rtc_min;
  1099.         alarmDateTime.nHour = msgReq->alarm.data_time.rtc_hour;
  1100.         alarmDateTime.nDay = msgReq->alarm.data_time.rtc_day;
  1101.         alarmDateTime.nMonth = msgReq->alarm.data_time.rtc_mon;
  1102.         alarmDateTime.nYear = msgReq->alarm.data_time.rtc_year + YEARFORMATE;
  1103.         if (PhnsetSetDTFromAT(alarmDateTime))
  1104.         {
  1105.             rsp_msg->result = TRUE;
  1106.         }
  1107.         else
  1108.         {
  1109.             rsp_msg->result = FALSE;
  1110.         }
  1111.         SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void*)rsp_msg, NULL);
  1112.     }
  1113.     SetFromAT = FALSE;
  1114.     if (g_idle_context.IsOnIdleScreen)
  1115.     {
  1116.         EntryIdleScreen();
  1117.     }
  1118. }
  1119. /********/
  1120. /* Alarm */
  1121. /********/
  1122. /*****************************************************************************
  1123.  * FUNCTION
  1124.  *  ATQueryAlarm
  1125.  * DESCRIPTION
  1126.  *  Query alarm setting from AT command
  1127.  * PARAMETERS
  1128.  *  msg     [?]     No action
  1129.  * RETURNS
  1130.  *  void
  1131.  *****************************************************************************/
  1132. void ATQueryAlarm(void *msg)
  1133. {
  1134.     /*----------------------------------------------------------------*/
  1135.     /* Local Variables                                                */
  1136.     /*----------------------------------------------------------------*/
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Code Body                                                      */
  1139.     /*----------------------------------------------------------------*/
  1140.     SetFromAT = TRUE;
  1141.     AlmQueryAlarmFromAT();
  1142.     SetFromAT = FALSE;
  1143. }
  1144. /*****************************************************************************
  1145.  * FUNCTION
  1146.  *  ATSetAlarm
  1147.  * DESCRIPTION
  1148.  *  AT command set alarm
  1149.  * PARAMETERS
  1150.  *  msg     [?]     Alarm time/index to be set
  1151.  * RETURNS
  1152.  *  void
  1153.  *****************************************************************************/
  1154. void ATSetAlarm(void *msg)
  1155. {
  1156. #ifdef MMI_ON_HARDWARE_P
  1157.     /*----------------------------------------------------------------*/
  1158.     /* Local Variables                                                */
  1159.     /*----------------------------------------------------------------*/
  1160.     mmi_at_alarm_set_req_ind_struct *req = (mmi_at_alarm_set_req_ind_struct*) msg;
  1161.     mmi_at_alarm_set_res_req_struct *rsp;
  1162.     MYTIME alarmDateTime;
  1163.     MYQUEUE Message;
  1164.     /*----------------------------------------------------------------*/
  1165.     /* Code Body                                                      */
  1166.     /*----------------------------------------------------------------*/
  1167.     SetFromAT = TRUE;
  1168.     Message.oslSrcId = MOD_MMI;
  1169.     Message.oslDestId = MOD_L4C;
  1170.     Message.oslMsgId = MSG_ID_MMI_AT_ALARM_SET_RES_REQ;
  1171.     rsp = (mmi_at_alarm_set_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_alarm_set_res_req_struct));
  1172.     if (req->alarm.alarm_index < NUM_OF_ALM)
  1173.     {
  1174.         alarmDateTime.nSec = req->alarm.date_time.rtc_sec;
  1175.         alarmDateTime.nMin = req->alarm.date_time.rtc_min;
  1176.         alarmDateTime.nHour = req->alarm.date_time.rtc_hour;
  1177.         alarmDateTime.nDay = req->alarm.date_time.rtc_day;
  1178.         alarmDateTime.nMonth = req->alarm.date_time.rtc_mon;
  1179.         alarmDateTime.nYear = req->alarm.date_time.rtc_year + YEARFORMATE;
  1180.         ClearKeyEvents();
  1181.         AlmSetAlarmFromAT(req->alarm.alarm_index, alarmDateTime, req->alarm.recurr);
  1182.         rsp->result = KAL_TRUE;
  1183.     }
  1184.     else
  1185.     {
  1186.         rsp->result = KAL_FALSE;
  1187.     }
  1188.     Message.oslDataPtr = (oslParaType*) rsp;
  1189.     Message.oslPeerBuffPtr = NULL;
  1190.     OslMsgSendExtQueue(&Message);
  1191.     SetFromAT = FALSE;
  1192. #endif /* MMI_ON_HARDWARE_P */ 
  1193. }
  1194. /*****************************************************************************
  1195.  * FUNCTION
  1196.  *  ATCancelAlarm
  1197.  * DESCRIPTION
  1198.  *  AT command cancel alarm
  1199.  * PARAMETERS
  1200.  *  msg     [?]     Alarm index to be set
  1201.  * RETURNS
  1202.  *  void
  1203.  *****************************************************************************/
  1204. void ATCancelAlarm(void *msg)
  1205. {
  1206. #ifdef MMI_ON_HARDWARE_P
  1207.     /*----------------------------------------------------------------*/
  1208.     /* Local Variables                                                */
  1209.     /*----------------------------------------------------------------*/
  1210.     mmi_at_alarm_delete_req_ind_struct *req = (mmi_at_alarm_delete_req_ind_struct*) msg;
  1211.     mmi_at_alarm_delete_res_req_struct *rsp;
  1212.     MYQUEUE Message;
  1213.     /*----------------------------------------------------------------*/
  1214.     /* Code Body                                                      */
  1215.     /*----------------------------------------------------------------*/
  1216.     SetFromAT = TRUE;
  1217.     Message.oslSrcId = MOD_MMI;
  1218.     Message.oslDestId = MOD_L4C;
  1219.     Message.oslMsgId = MSG_ID_MMI_AT_ALARM_DELETE_RES_REQ;
  1220.     rsp = (mmi_at_alarm_delete_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_alarm_delete_res_req_struct));
  1221.     if (req->alarm_index < NUM_OF_ALM)
  1222.     {
  1223.         ClearKeyEvents();
  1224.         AlmCancelAlarmFromAT(req->alarm_index);
  1225.         rsp->result = KAL_TRUE;
  1226.     }
  1227.     else
  1228.     {
  1229.         rsp->result = KAL_FALSE;
  1230.     }
  1231.     Message.oslDataPtr = (oslParaType*) rsp;
  1232.     Message.oslPeerBuffPtr = NULL;
  1233.     OslMsgSendExtQueue(&Message);
  1234.     SetFromAT = FALSE;
  1235. #endif /* MMI_ON_HARDWARE_P */ 
  1236. }
  1237. /*******/
  1238. /* Call */
  1239. /*******/
  1240. /*****************************************************************************
  1241.  * FUNCTION
  1242.  *  ATAnswerIncomingCall
  1243.  * DESCRIPTION
  1244.  *  AT command answer incoming call
  1245.  * PARAMETERS
  1246.  *  msg     [?]     Call id to be answered
  1247.  * RETURNS
  1248.  *  void
  1249.  *****************************************************************************/
  1250. void ATAnswerIncomingCall(void *msg)
  1251. {
  1252.     /*----------------------------------------------------------------*/
  1253.     /* Local Variables                                                */
  1254.     /*----------------------------------------------------------------*/
  1255.     mmi_cc_call_accept_req_ind_struct *msgReq;
  1256.     /*----------------------------------------------------------------*/
  1257.     /* Code Body                                                      */
  1258.     /*----------------------------------------------------------------*/
  1259.     msgReq = (mmi_cc_call_accept_req_ind_struct*) msg;
  1260.     AcceptCallForAT(msgReq->call_id);
  1261. }
  1262. /*****************************************************************************
  1263.  * FUNCTION
  1264.  *  ATMakeOutgoingCall
  1265.  * DESCRIPTION
  1266.  *  AT command make outgoing call
  1267.  * PARAMETERS
  1268.  *  msg     [?]     Destination number/call type to be made
  1269.  * RETURNS
  1270.  *  void
  1271.  *****************************************************************************/
  1272. void ATMakeOutgoingCall(void *msg)
  1273. {
  1274.     /*----------------------------------------------------------------*/
  1275.     /* Local Variables                                                */
  1276.     /*----------------------------------------------------------------*/
  1277.     mmi_cc_dial_req_ind_struct *msgReq;
  1278.     PU8 start;
  1279.     U8 number[MAX_DIGIT];
  1280.     /*----------------------------------------------------------------*/
  1281.     /* Code Body                                                      */
  1282.     /*----------------------------------------------------------------*/
  1283.     msgReq = (mmi_cc_dial_req_ind_struct*) msg;
  1284.     memset((PS8) number, 0, MAX_DIGIT);
  1285.     start = number;
  1286.     if (msgReq->dest.type & 0x10)
  1287.     {
  1288.         number[0] = '+';
  1289.         start++;
  1290.     }
  1291.     if (msgReq->dest.length < MAX_DIGIT)
  1292.     {
  1293.         strncpy((PS8) start, (PS8) msgReq->dest.number, msgReq->dest.length);
  1294.     }
  1295.     else
  1296.     {
  1297.         strcpy((PS8) start, (PS8) msgReq->dest.number);
  1298.     }
  1299.     MakeMOForAT((PS8) number, msgReq->dest.length, msgReq->call_type);
  1300. }
  1301. /*****************************************************************************
  1302.  * FUNCTION
  1303.  *  ATHangupCall
  1304.  * DESCRIPTION
  1305.  *  AT command hang up call
  1306.  * PARAMETERS
  1307.  *  msg     [?]     No action
  1308.  * RETURNS
  1309.  *  void
  1310.  *****************************************************************************/
  1311. void ATHangupCall(void *msg)
  1312. {
  1313.     /*----------------------------------------------------------------*/
  1314.     /* Local Variables                                                */
  1315.     /*----------------------------------------------------------------*/
  1316.     /* use of id feild.. t */
  1317.     mmi_cc_call_release_ind_struct *msgReq;
  1318.     /*----------------------------------------------------------------*/
  1319.     /* Code Body                                                      */
  1320.     /*----------------------------------------------------------------*/
  1321.     msgReq = (mmi_cc_call_release_ind_struct*) msg;
  1322.     RemoveOutgoingIndicationScreen();
  1323. }
  1324. /*****************************************************************************
  1325.  * FUNCTION
  1326.  *  ATSyncCallTable
  1327.  * DESCRIPTION
  1328.  *  AT command sync call table
  1329.  * PARAMETERS
  1330.  *  msg     [?]     No action
  1331.  * RETURNS
  1332.  *  void
  1333.  *****************************************************************************/
  1334. void ATSyncCallTable(void *msg)
  1335. {
  1336.     /*----------------------------------------------------------------*/
  1337.     /* Local Variables                                                */
  1338.     /*----------------------------------------------------------------*/
  1339.     /*----------------------------------------------------------------*/
  1340.     /* Code Body                                                      */
  1341.     /*----------------------------------------------------------------*/
  1342.     SetSyncCallFromATFlag(TRUE);
  1343.     SyncCallList();
  1344. }
  1345. /*************/
  1346. /* Text on LCD */
  1347. /*************/
  1348. static U8 buffer[100];
  1349. /*****************************************************************************
  1350.  * FUNCTION
  1351.  *  ATTextOnLCD
  1352.  * DESCRIPTION
  1353.  *  AT command show text on LCD (function not working)
  1354.  * PARAMETERS
  1355.  *  msg     [?]     Message to be shown(?)
  1356.  * RETURNS
  1357.  *  void
  1358.  *****************************************************************************/
  1359. void ATTextOnLCD(void *msg)
  1360. {
  1361.     /*----------------------------------------------------------------*/
  1362.     /* Local Variables                                                */
  1363.     /*----------------------------------------------------------------*/
  1364.     int buffersize = 100;
  1365.     /*----------------------------------------------------------------*/
  1366.     /* Code Body                                                      */
  1367.     /*----------------------------------------------------------------*/
  1368.     if (g_idle_context.IsOnIdleScreen)
  1369.     {
  1370.         ClearKeyEvents();
  1371.         ShowCategory5Screen(
  1372.             0,
  1373.             0,
  1374.             STR_GLOBAL_OK,
  1375.             IMG_GLOBAL_OK,
  1376.             0,
  1377.             0,
  1378.             INPUT_TYPE_ALPHANUMERIC_UPPERCASE,
  1379.             buffer,
  1380.             buffersize,
  1381.             0);
  1382.         SetLeftSoftkeyFunction(ATTextOnLCDExit, KEY_EVENT_UP);
  1383.     }
  1384. }
  1385. /*****************************************************************************
  1386.  * FUNCTION
  1387.  *  ATTextOnLCDExit
  1388.  * DESCRIPTION
  1389.  *  Exit text on LCD screen
  1390.  * PARAMETERS
  1391.  *  void
  1392.  * RETURNS
  1393.  *  void
  1394.  *****************************************************************************/
  1395. void ATTextOnLCDExit(void)
  1396. {
  1397.     /*----------------------------------------------------------------*/
  1398.     /* Local Variables                                                */
  1399.     /*----------------------------------------------------------------*/
  1400.     /*----------------------------------------------------------------*/
  1401.     /* Code Body                                                      */
  1402.     /*----------------------------------------------------------------*/
  1403.     EntryIdleScreen();
  1404. }
  1405. /********/
  1406. /* Profile */
  1407. /********/
  1408. /*****************************************************************************
  1409.  * FUNCTION
  1410.  *  ATSetProfileHandler
  1411.  * DESCRIPTION
  1412.  *  AT command set profile
  1413.  * PARAMETERS
  1414.  *  msg     [?]     Wall paper/tone/home city/theme/short cut setting request
  1415.  * RETURNS
  1416.  *  void
  1417.  *****************************************************************************/
  1418. void ATSetProfileHandler(void *msg)
  1419. {
  1420. #ifdef MMI_ON_HARDWARE_P
  1421.     /*----------------------------------------------------------------*/
  1422.     /* Local Variables                                                */
  1423.     /*----------------------------------------------------------------*/
  1424.     mmi_set_mmi_default_prof_ind_struct *mmi_set_prof_struct = (mmi_set_mmi_default_prof_ind_struct*) msg;
  1425.     mmi_at_general_res_req_struct *msgReq;
  1426.     /*----------------------------------------------------------------*/
  1427.     /* Code Body                                                      */
  1428.     /*----------------------------------------------------------------*/
  1429.     msgReq = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
  1430.     msgReq->result = MMI_FALSE;
  1431.     if (mmi_set_prof_struct->op != 1)   /* Query command, not imlpemented, send response with error result to L4 */
  1432.     {
  1433.         goto MMILAB_ATSETPROF_END;
  1434.     }
  1435.     switch (mmi_set_prof_struct->category)
  1436.     {
  1437.         case 0: /* Wallpaper */
  1438.         {
  1439.             if (PhnsetSetDisplayFromAT((U8) (mmi_set_prof_struct->param3 - 1), (U8) MMI_PHNSET_TYPE_WP) == MMI_TRUE)
  1440.             {
  1441.                 msgReq->result = MMI_TRUE;
  1442.             }
  1443.             break;
  1444.         }
  1445.         case 1: /* Tone */
  1446.         {
  1447.             if (mmi_set_prof_struct->param2 == 0)
  1448.             {
  1449.                 if (AtSetProfileTone(mmi_set_prof_struct->param1, TONE_POWERONTONE, (mmi_set_prof_struct->param3 - 1)) ==
  1450.                     MMI_TRUE)
  1451.                 {
  1452.                     msgReq->result = MMI_TRUE;
  1453.                 }
  1454.             }
  1455.             break;
  1456.         }
  1457.         case 2: /* Home City */
  1458.         {
  1459.             if (ATSetHomeCity((U8) (mmi_set_prof_struct->param3)) == MMI_TRUE)
  1460.             {
  1461.                 msgReq->result = MMI_TRUE;
  1462.             }
  1463.             break;
  1464.         }
  1465.     #if defined(__MMI_THEMES_APPLICATION__)
  1466.         case 3: /* Theme */
  1467.         {
  1468.             if (ATSetTheme((U8) (mmi_set_prof_struct->param3 - 1)) == MMI_TRUE)
  1469.             {
  1470.                 msgReq->result = MMI_TRUE;
  1471.             }
  1472.             break;
  1473.         }
  1474.     #endif /* defined(__MMI_THEMES_APPLICATION__) */ 
  1475.     #ifndef __DISABLE_SHORTCUTS_IMPL__
  1476.         case 4: /* Shortcut */
  1477.         {
  1478.             if (ATSetShortcuts((PU8) mmi_set_prof_struct->param4) == MMI_TRUE)
  1479.             {
  1480.                 msgReq->result = MMI_TRUE;
  1481.             }
  1482.             break;
  1483.         }
  1484.     #endif /* __DISABLE_SHORTCUTS_IMPL__ */ 
  1485.         case 5: /* Screen Saver */
  1486.         {
  1487.             if (PhnsetSetDisplayFromAT((U8) (mmi_set_prof_struct->param3 - 1), (U8) MMI_PHNSET_TYPE_SS) == MMI_TRUE)
  1488.             {
  1489.                 msgReq->result = MMI_TRUE;
  1490.             }
  1491.             break;
  1492.         }
  1493.     #ifdef __MMI_POWER_ON_OFF_DISPLAY__
  1494.         case 6: /* Power On */
  1495.         {
  1496.             if (PhnsetSetDisplayFromAT((U8) (mmi_set_prof_struct->param3 - 1), (U8) MMI_PHNSET_TYPE_PWRON) == MMI_TRUE)
  1497.             {
  1498.                 msgReq->result = MMI_TRUE;
  1499.             }
  1500.             break;
  1501.         }
  1502.         case 7: /* Power Off */
  1503.         {
  1504.             if (PhnsetSetDisplayFromAT((U8) (mmi_set_prof_struct->param3 - 1), (U8) MMI_PHNSET_TYPE_PWROFF) == MMI_TRUE)
  1505.             {
  1506.                 msgReq->result = MMI_TRUE;
  1507.             }
  1508.             break;
  1509.         }
  1510.     #endif /* __MMI_POWER_ON_OFF_DISPLAY__ */ 
  1511.         default:
  1512.             msgReq->result = MMI_FALSE;
  1513.             break;
  1514.     }
  1515.   MMILAB_ATSETPROF_END:
  1516.     SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void*)msgReq, NULL);
  1517. #endif /* MMI_ON_HARDWARE_P */ 
  1518. }
  1519. /*****************************************************************************
  1520.  * FUNCTION
  1521.  *  ATPowerReset
  1522.  * DESCRIPTION
  1523.  *  AT command reset power
  1524.  * PARAMETERS
  1525.  *  ind     [?]     
  1526.  *  in    msg      no action(?)
  1527.  * RETURNS
  1528.  *  void
  1529.  *****************************************************************************/
  1530. void ATPowerReset(void *ind)
  1531. {
  1532.     /*----------------------------------------------------------------*/
  1533.     /* Local Variables                                                */
  1534.     /*----------------------------------------------------------------*/
  1535.     mmi_power_reset_ind_struct *msg = (mmi_power_reset_ind_struct*) ind;
  1536.     /*----------------------------------------------------------------*/
  1537.     /* Code Body                                                      */
  1538.     /*----------------------------------------------------------------*/
  1539.     AlmATPowerReset(msg->poweroff, msg->rtc_timer);
  1540. }
  1541. /*****************************************************************************
  1542.  * FUNCTION
  1543.  *  ATRstFactoryDefault
  1544.  * DESCRIPTION
  1545.  *  AT command restore factory default
  1546.  * PARAMETERS
  1547.  *  ind     [?]     
  1548.  *  in    msg      no action(?)
  1549.  * RETURNS
  1550.  *  void
  1551.  *****************************************************************************/
  1552. extern SecuritySetupContext gSecuritySetupContext;
  1553. void ATRstFactoryDefault(void *ind)
  1554. {
  1555.     /*----------------------------------------------------------------*/
  1556.     /* Local Variables                                                */
  1557.     /*----------------------------------------------------------------*/
  1558.     MYQUEUE Message;
  1559.     MMIPHONEVERIFYREQ *local_data;
  1560.     mmi_factory_restore_req_ind_struct *msg = (mmi_factory_restore_req_ind_struct*) ind;
  1561.     /*----------------------------------------------------------------*/
  1562.     /* Code Body                                                      */
  1563.     /*----------------------------------------------------------------*/
  1564.     Message.oslSrcId = MOD_MMI;
  1565.     Message.oslDestId = MOD_L4C;
  1566.     Message.oslMsgId = PRT_MMI_SMU_VERIFY_PIN_REQ;
  1567.     local_data = (MMIPHONEVERIFYREQ*) OslConstructDataPtr(sizeof(MMIPHONEVERIFYREQ));
  1568.     memset(local_data->pin, '', (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1569.     memset(local_data->new_pin, '', (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1570.     local_data->pin_type = MMI_SETTING_TYPE_PHONELOCK;
  1571.     /*  Change gInputPhoneLockBuffer to ASCII then copy local_data->pin */
  1572.     memcpy(local_data->pin, msg->pwd, (MAX_SIM_SETTING_PASSWD_LEN + 1));
  1573.     Message.oslDataPtr = (oslParaType*) local_data;
  1574.     Message.oslPeerBuffPtr = NULL;
  1575.     /* set the protocol handler to handle the response of this request */
  1576.     gSecuritySetupContext.VerifyPassSuccessCallBack = ATRstConfirm;
  1577.     SetProtocolEventHandler(ATVerifyPINRsp, PRT_MMI_SMU_VERIFY_PIN_RSP);
  1578.     OslMsgSendExtQueue(&Message);
  1579. }
  1580. /*****************************************************************************
  1581.  * FUNCTION
  1582.  *  ATVerifyPINRsp
  1583.  * DESCRIPTION
  1584.  *  
  1585.  * PARAMETERS
  1586.  *  info        [?]     
  1587.  * RETURNS
  1588.  *  void
  1589.  *****************************************************************************/
  1590. void ATVerifyPINRsp(void *info)
  1591. {
  1592.     /*----------------------------------------------------------------*/
  1593.     /* Local Variables                                                */
  1594.     /*----------------------------------------------------------------*/
  1595.     /*----------------------------------------------------------------*/
  1596.     /* Code Body                                                      */
  1597.     /*----------------------------------------------------------------*/
  1598.     extern void FillCountDownNumber(sim_chv_info_struct chv_info);
  1599.     mmi_smu_verify_pin_rsp_struct *local_data = (mmi_smu_verify_pin_rsp_struct*) info;
  1600.     FillCountDownNumber(local_data->chv_info);
  1601.     gSecuritySetupContext.PINBlocked = 0;
  1602.     g_pwr_context.PowerOnSIMStatus &= ~MMI_SIM_STATUS_INVALID;  /* 0x01: Invalid SIM reset */
  1603.     if (local_data->next_type != MMI_SETTING_TYPE_NO_REQUIRED)
  1604.     {
  1605.         mmi_at_general_res_req_struct *rsp_msg;
  1606.         rsp_msg = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
  1607.         rsp_msg->result = FALSE;
  1608.         SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void*)rsp_msg, NULL);
  1609.     }
  1610.     else
  1611.     {
  1612.         SECSETVerifyPINRsp(info);
  1613.     }
  1614. }
  1615. /*****************************************************************************
  1616.  * FUNCTION
  1617.  *  ATRstConfirm
  1618.  * DESCRIPTION
  1619.  *  This function is to handle AT command restore factory default
  1620.  *  Following functions: RstStartRestore
  1621.  * PARAMETERS
  1622.  *  void
  1623.  *  a(?)        [IN/OUT]        
  1624.  *  b(?)        [IN]            
  1625.  * RETURNS
  1626.  *  void
  1627.  *****************************************************************************/
  1628. extern pBOOL bStatus;
  1629. void ATRstConfirm(void)
  1630. {
  1631.     /*----------------------------------------------------------------*/
  1632.     /* Local Variables                                                */
  1633.     /*----------------------------------------------------------------*/
  1634.     mmi_at_general_res_req_struct *rsp_msg;
  1635.     /*----------------------------------------------------------------*/
  1636.     /* Code Body                                                      */
  1637.     /*----------------------------------------------------------------*/
  1638.     rsp_msg = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
  1639.     RstStartRestore();
  1640.     if (bStatus)
  1641.     {
  1642.         rsp_msg->result = TRUE;
  1643.     }
  1644.     else
  1645.     {
  1646.         rsp_msg->result = FALSE;
  1647.     }
  1648.     SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void*)rsp_msg, NULL);
  1649. }
  1650. /*****************************************************************************
  1651.  * FUNCTION
  1652.  *  ATLCMRGBTestHandler
  1653.  * DESCRIPTION
  1654.  *  This function is to handle AT command LCM RGB Test
  1655.   * PARAMETERS
  1656.  *  void
  1657.  *  a(?)        [IN/OUT]        
  1658.  *  b(?)        [IN]            
  1659.  * RETURNS
  1660.  *  void
  1661.  *****************************************************************************/
  1662. void ATLCMRGBTestHandler(void *ind)
  1663. {
  1664.     /*----------------------------------------------------------------*/
  1665.     /* Local Variables                                                */
  1666.     /*----------------------------------------------------------------*/
  1667.     mmi_at_general_res_req_struct *rsp_msg;
  1668.     mmi_em_rgb_test_req_ind_struct *msg = (mmi_em_rgb_test_req_ind_struct*) ind;
  1669.     /*----------------------------------------------------------------*/
  1670.     /* Code Body                                                      */
  1671.     /*----------------------------------------------------------------*/
  1672.     extern void EMLCDSetColor(U8 red, U8 green, U8 blue);
  1673.     
  1674.     rsp_msg = (mmi_at_general_res_req_struct*) OslConstructDataPtr(sizeof(mmi_at_general_res_req_struct));
  1675.     if (msg->type)
  1676.     {
  1677.         if ((msg->red > 255) || (msg->green > 255) || (msg->blue > 255))
  1678.         {
  1679.             rsp_msg->result = FALSE;
  1680.         }
  1681.         else
  1682.         {
  1683.             rsp_msg->result = TRUE;
  1684.             EMLCDSetColor((U8)msg->red, (U8)msg->green, (U8)msg->blue);       
  1685.         }
  1686.     }
  1687.     else
  1688.     {
  1689.         rsp_msg->result = TRUE;
  1690.         GoBackHistory();
  1691.     }    
  1692.     SendMsg2AT(MSG_ID_MMI_AT_GENERAL_RES_REQ, (void*)rsp_msg, NULL);
  1693. }