/***************************************************************************** PhoneNum.c *****************************************************************************/ #include "includes.h" //SUT_FILE_LIST g_sutFilesList; int g_iPhoneNumFileIndex; int g_PhoneNumToUse=0; unsigned char g_ucCallPhonePro = 0; SUT_NUM_EDIT sutNumEdit; //在MainTask里面设置一次 不改变 int SetPhoneNumFile(const char *filename) { int FileLen; g_iPhoneNumFileIndex=GetFileIndex(filename); FileLen=GetFileLen(g_iPhoneNumFileIndex); if(FileLen==0) { g_iPhoneNumFileIndex=-1; } return g_iPhoneNumFileIndex; } /******************************************************** 统计电话本内电话的个数 ********************************************************/ int GetPhoneNumCount(void) { int i; char number[12]; g_PhoneNumToUse = 0; for(i=0;i1){//g_PhoneNumToUse ListBoxInit(&sutListBox,pPhonesName,0,accIconFileName,PhonesFeatures); }else{ ListBoxInit(&sutListBox,ascMsg,0,accIconFileName,PhonesFeatures); } //---------------------------- GuiDrawHLine(0,159,104,1); GuiShowStr(0,110," [M]呼叫 [S]选项 ",0x01); return; } // //按键提示 // if(susCt==0){ // GuiShowStr(0,110," [OK]呼叫 [S]选项 ",0x01); // }else if(susCt==200){ // GuiShowStr(0,110," [P2]修改 [P3]删除",0x01); // } // if(++susCt>=400)susCt=0; } //DeltePhoneNum(sutNumEdit.buffer); //AddPhoneNum(sutNumEdit.buffer); //ChangePhoneNum(sutNumEdit.buffer,"12345678902"); void CallPhoneResponse(void) { unsigned long key; key=ListBoxResponse(&sutListBox); switch(key) { case KEY_PANEL_EXIT: UISetNextStatus(UIS_MENU_MAIN); break; // case KEY_PANEL_MENU: // UISetNextStatus(UIS_MENU_MAIN); // break; case KEY_PANEL_MENU: //打电话 //获取电话号码 sutListBox.item[sutListBox.handle]; UISetNextStatus(UIS_CALL_TO_PHONE); break; case KEY_OPTION://选项 UISetNextStatus(UIS_CALL_PHONE_OPTION); break; default: break; } } void CallPhoneOptionShow(int update) { static const char *apcMenuSysSetup[]= { "新增","编辑","删除","" }; if(update) { GuiClearAll(); ShowCaption("电话选项",1); //0 GuiDrawHLine(0,159,20,1); GuiDrawHLine(0,159,104,1); MenuInit(&sutMenuSysSetup,apcMenuSysSetup); GuiDrawHLine(0,159,104,1); GuiShowStr(0,110,"[M]确定 [EXIT]退出",0x01); } } void CallPhoneOptionResponse(void) { char buf[30]; unsigned long key; key=MenuResponse(&sutMenuSysSetup); if(KEY_PANEL_MENU==key) { switch(sutMenuSysSetup.handle) { case 0:UISetNextStatus(UIS_CALL_PHONE_INPUT);break; case 1:UISetNextStatus(UIS_CALL_PHONE_MODIFY);break; case 2:UISetNextStatus(UIS_CALL_PHONE_DELETE);break; } } else if(KEY_PANEL_EXIT==g_ulKeyValue) UISetNextStatus(sutUIstatus.LastStatus); //else if(KEY_PANEL_MENU==g_ulKeyValue) UISetNextStatus(UIS_MENU_MAIN); } //LCD_WIDTH 160 //LCD_HEIGHT 128 void CallPhoneInputNumShow(int update) { static unsigned short susCt=0; if(update){ GuiClearAll();//clear ShowCaption("新增号码",1); //0 GuiDrawHLine(0,159,20,1); NumEditInit(&sutNumEdit,38,48,"11111111111"); NumEditShow(&sutNumEdit); GuiDrawHLine(0,159,104,1); susCt=0; GuiShowStr(0,110," [上]改值 [下]右移 ",0x01); } // //按键提示 // if(susCt==0){ // GuiShowStr(0,110," [上]加 [下]减 ",0x01);//[OK]确定 // }else if(susCt==200){ // GuiShowStr(0,110," [P2]左移 [P3]右移 ",0x01); // // } // if(++susCt>=400)susCt=0; } //sutListBox.item[sutListBox.handle] 显示光标选中的电话号码 void CallPhoneInputNewNumShow(int update) { //static unsigned short susCt=0; if(update){ GuiClearAll();//clear ShowCaption("修改号码",1);//0 GuiDrawHLine(0,159,20,1); NumEditInit(&sutNumEdit,38,48,sutListBox.item[sutListBox.handle]); NumEditShow(&sutNumEdit); GuiDrawHLine(0,159,104,1); // susCt=0; GuiShowStr(0,110," [上]改值 [下]右移 ",0x01); } // //按键提示 // if(susCt==0){ // GuiShowStr(0,110," [上]加 [下]减 ",0x01);//[OK]确定 // }else if(susCt==200){ // GuiShowStr(0,110," [P2]左移 [P3]右移 ",0x01); // } // if(++susCt>=400)susCt=0; } void CallPhoneDeleteNumShow(int update) { if(update){ GuiClearAll();//clear ShowCaption("删除号码",1);//0 GuiDrawHLine(0,159,20,1); NumEditInit(&sutNumEdit,38,48,sutListBox.item[sutListBox.handle]); //NumEditShow(&sutNumEdit); NumEditShowNORect(&sutNumEdit); GuiDrawHLine(0,159,104,1); GuiShowStr(0,110,"[M]确定 [EXIT]退出",0x01); } } void CallPhoneInputNumResponse(void) { unsigned long key; NumEditResponse(&sutNumEdit); if(KEY_PANEL_MENU==g_ulKeyValue){ //g_sutNumEdit.buffer // sutListBox.item[sutListBox.handle]=sutNumEdit.buffer; UISetNextStatus(UIS_CALL_PHONE); AddPhoneNum(sutNumEdit.buffer); } if(KEY_PANEL_EXIT==g_ulKeyValue)UISetNextStatus(UIS_CALL_PHONE); //else if(KEY_PANEL_MENU==g_ulKeyValue)UISetNextStatus(UIS_MENU_MAIN); } void CallPhoneInputNewNumResponse(void) { unsigned long key; NumEditResponse(&sutNumEdit); if(KEY_PANEL_MENU==g_ulKeyValue){ // sutListBox.item[sutListBox.handle]=sutNumEdit.buffer; ChangePhoneNum(sutListBox.item[sutListBox.handle],sutNumEdit.buffer);//sutListBox.item[sutListBox.handle],sutNumEdit.buffer UISetNextStatus(UIS_CALL_PHONE); } if(KEY_PANEL_EXIT==g_ulKeyValue)UISetNextStatus(UIS_CALL_PHONE); //else if(KEY_PANEL_MENU==g_ulKeyValue)UISetNextStatus(UIS_MENU_MAIN); } void CallPhoneInputDeleNumResponse(void) { unsigned long key; // NumEditResponse(&sutNumEdit); if(KEY_PANEL_MENU==g_ulKeyValue){ // sutListBox.item[sutListBox.handle]="00000000000"; ShowMessageBox("请稍候..."); DeltePhoneNum(sutNumEdit.buffer); UISetNextStatus(UIS_CALL_PHONE); } if(KEY_PANEL_EXIT==g_ulKeyValue)UISetNextStatus(UIS_CALL_PHONE); //else if(KEY_PANEL_MENU==g_ulKeyValue)UISetNextStatus(UIS_MENU_MAIN); } void CallToPhoneNum(int update) { if(update){ GuiClearAll();//clear ShowCaption("拨打电话",1); //0 GuiDrawHLine(0,159,20,1); NumEditInit(&sutNumEdit,38,48,sutListBox.item[sutListBox.handle]); //NumEditShow(&sutNumEdit); NumEditShowNORect(&sutNumEdit); GuiDrawHLine(0,159,104,1); GuiShowStr(0,110,"[M]拨打 [EXIT]挂断",0x01); } if(g_ucCallPhonePro == 2) { ModemSendAT("ATH\r"); //挂断电话 UISetNextStatus(UIS_CALL_PHONE); g_ucCallPhonePro = 0; ////////////////// MicDisable(); sutPocStatus.Mic=0; sutPocStatus.TTS=0; SpeakerDisable(); ////////////////// } } void CallToPhoneNumResponse(void) { char buf[30]; static int siCt; // NumEditResponse(&sutNumEdit); #if 0//暂时不支持或未做 if(KEY_PANEL_MENU==g_ulKeyValue){ g_ucCallPhonePro = 1; ModemSendAT("AT+VGT=1\r"); //输入增益控制 CallPhoneNum(sutListBox.item[sutListBox.handle]);//sutNumEdit.buffer sutListBox.item[sutListBox.handle] os_dly_wait(30); GuiClearRect(0,38,159,38+59); GuiShowBmp(40+12,40,"Pickup.bmp"); } #else ShowMessageBox("暂不支持"); IWDG_ReloadCounter(); os_dly_wait(100); UISetNextStatus(UIS_CALL_PHONE); #endif if(KEY_PANEL_EXIT==g_ulKeyValue){ // UISetNextStatus(UIS_STANDBY); ModemSendAT("ATH\r"); //挂断电话 UISetNextStatus(UIS_CALL_PHONE); g_ucCallPhonePro = 0; ////////////////// MicDisable(); sutPocStatus.Mic=0; sutPocStatus.TTS=0; SpeakerDisable(); ////////////////// } //else if(KEY_PANEL_MENU==g_ulKeyValue)UISetNextStatus(UIS_MENU_MAIN); }