static void gsm_thread_entry(void* parameter) { rt_size_t res=RT_ERROR; u8 linkNum=0; // finsh_init(&shell->parser); rt_kprintf("\r\n ---> gsm thread start !\r\n"); // while (1) { // 1. after power on get imsi code IMSIcode_Get(); // 2. after get imsi Comm AT initial start GSM_Module_TotalInitial(); // 3. Receivce & Process Communication Module data ---- GSM_Buffer_Read_Process(); if(!SMS_send_stateQuery()) { DataLink_Process(); //------------------------------------------------ if (Send_DataFlag== 1) { // rt_kprintf("\r\n gsm rx app msgQue: rxlen=%d rx_content=%s\r\n",msgq_gsm.len,msgq_gsm.info); // Data_Send(GPRS_info,GPRS_infoWr_Tx); res=rt_device_control(&Device_GSM, query_online, NULL); if(res==RT_EOK) { linkNum=gsm_rx_app_infoStruct.link_num; // IC link ==1 rt_device_write(&Device_GSM, linkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); } Send_DataFlag=0; } //--------- Step timer Dial_step_Single_10ms_timer(); // TTS TTS_Data_Play(); // Get CSQ value // GSM_CSQ_Query(); // SMS Send } else SMS_send_process(); // 相关短信处理 // Get CSQ value GSM_CSQ_Query(); // Voice Record VOC_REC_process(); rt_thread_delay(20); } }
static void gsm_thread_entry(void* parameter) { u8 atd_str[25]; rt_size_t res=RT_ERROR; // finsh_init(&shell->parser); // // step 1: Init Dataflash DF_init(); APP_IOpinInit(); rt_kprintf("\r\n ---> gsm thread start !\r\n"); HardWareVerion=HardWareGet(); // step 2: process config data SysConfiguration(); // system config total_ergotic(); Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate #ifdef HMI HMI_app_init(); #endif gps_init(); //-------------------------------------- while (1) { if(GSM_Working_State()) { // 1. after power on get imsi code IMSIcode_Get(); // 2. after get imsi Comm AT initial start GSM_Module_TotalInitial(); // 3. Receivce & Process Communication Module data ---- GSM_Buffer_Read_Process(); } rt_thread_delay(20); if(GSM_Working_State()==2) { DataLink_Process(); //------------------------------------------------ if (Send_DataFlag== 1) { res=rt_device_control(&Device_GSM, query_online, NULL); if(res==RT_EOK) rt_device_write(&Device_GSM, LinkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); Send_DataFlag=0; } //监听 if(CallState==CallState_rdytoDialLis) { CallState=CallState_Dialing; memset(atd_str,0,sizeof(atd_str)); memcpy(atd_str,"ATD",3); memcpy(atd_str+3,JT808Conf_struct.LISTEN_Num,strlen((const char*)JT808Conf_struct.LISTEN_Num)); memcpy(atd_str+3+strlen((const char*)JT808Conf_struct.LISTEN_Num),";\r\n",3); rt_hw_gsm_output(atd_str); rt_kprintf("\r\n拨打%s\r\n",atd_str); } //--------- Step timer // Dial_step_Single_10ms_timer(); // TTS TTS_Data_Play(); // Get CSQ value if(GSM_CSQ_Query()==false) { if(Calling_ATA_flag==1) { rt_thread_delay(3); rt_hw_gsm_output("ATA\r\n"); //检查信号强度 if(DispContent) rt_kprintf(" 接听 ATA\r\n"); Calling_ATA_flag=0; } } // SMS Service SMS_Process(); rt_thread_delay(10); } } }
static void gsm_thread_entry(void* parameter) { u8 atd_str[25]; rt_size_t res=RT_ERROR; // finsh_init(&shell->parser); // // step 1: Init Dataflash DF_init(); APP_IOpinInit(); rt_kprintf("\r\n ---> gsm thread start !\r\n"); HardWareVerion=HardWareGet(); // step 2: process config data SysConfiguration(); // system config total_ergotic(); Gsm_RegisterInit(); // init register states ,then it will power on the module SIMID_Convert_SIMCODE(); // translate #ifdef HMI HMI_app_init(); #endif gps_init(); Lcd_init(); //-------------------------------------- while (1) { if((GSM_PWR.result==result_success)&&(dwlcd_contr<=5)) { if(Login_Menu_Flag!=1) { Lcd_write(Big_lcd.status,LCD_PAGE,0x15); dwlcd_contr++; } else { Lcd_write(Big_lcd.status,LCD_PAGE,0x01); dwlcd_contr++; } ; } // 1. after power on get imsi code IMSIcode_Get(); // 2. after get imsi Comm AT initial start GSM_Module_TotalInitial(); // 3. Receivce & Process Communication Module data ---- GSM_Buffer_Read_Process(); rt_thread_delay(20); DataLink_Process(); //++++++++++++++++++++++++DWLCD+++++++++++++++++++++ //_485_RxHandler_01(); if(Big_lcd.RX_enable==LCD_BUSY) { Lcd_Data_Process(); Big_lcd.RX_enable=LCD_IDLE; } /* Lcd_write(Big_lcd.status,LCD_SETSPD,0); Lcd_write(Big_lcd.status,LCD_GPSNUM,Satelite_num); Lcd_write(Big_lcd.status,LCD_GSMNUM,ModuleSQ); */ if(ModuleStatus&Status_GPS ) { if(Big_lcd.RX_enable==LCD_IDLE) { if(lcd_contrl==0) { Lcd_write(Big_lcd.status,LCD_SETTIME,0); delay_ms(5); lcd_contrl++; } } } //++++++++++++++++++++++++DWLCD+++++++++++++++++++++ if(BD1_struct.Rx_enable==RT_EOK) { BD1_RxProcess(); } //------------------------------------------------ if (Send_DataFlag== 1) { res=rt_device_control(&Device_GSM, query_online, NULL); if(res==RT_EOK) rt_device_write(&Device_GSM, LinkNum,( const void *)GPRS_info,(rt_size_t) GPRS_infoWr_Tx); Send_DataFlag=0; } //监听 if(CallState==CallState_rdytoDialLis) { CallState=CallState_Dialing; memset(atd_str,0,sizeof(atd_str)); memcpy(atd_str,"ATD",3); memcpy(atd_str+3,JT808Conf_struct.LISTEN_Num,strlen((const char*)JT808Conf_struct.LISTEN_Num)); memcpy(atd_str+3+strlen((const char*)JT808Conf_struct.LISTEN_Num),";\r\n",3); rt_hw_gsm_output(atd_str); rt_kprintf("\r\n拨打%s\r\n",atd_str); } //--------- Step timer // Dial_step_Single_10ms_timer(); // TTS TTS_Data_Play(); // Get CSQ value if(GSM_CSQ_Query()==false) { if(Calling_ATA_flag==1) { delay_ms(10); rt_hw_gsm_output("ATA\r\n"); //检查信号强度 if(DispContent) rt_kprintf(" 接听 ATA\r\n"); Calling_ATA_flag=0; } } // SMS Service SMS_Process(); } }