123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- /********************************************************************************
- * File Name: MC8332GpsTask.h
- * Function Describe: Header file for MC8332GpsTask.c
- * Explain:
- * Writer:
- * Date: 2016-3-11
- *******************************************************************************/
- #include "includes.h"
- unsigned int Mododrex_Net;
- unsigned int netshowvalue;
- FOTA_UPDATE fota_update;
- void AtHandle(char *pMsg)
- {
- int csq;
- short targetIndex;
- unsigned char tempSocket,i,temp;
- unsigned short tempLen;
- char buf[80]="\r\n";
- char bufTemp[3];
- char buf3[40];//////////////////////////
- STATUE ipStatus;
-
- if(0==ModemStrCmp(pMsg,"^SYSINFO:"))
- {
- if(pMsg[15]!=','){
- netshowvalue=atoi(&pMsg[15]);
- }else{
- netshowvalue=atoi(&pMsg[16]);
- }
- }
- if(0==ModemStrCmp(pMsg,"+CSQ:"))
- {
-
- //UpdateCsqValue(GetCSQ(pMsg));
- g_iCSQ=GetCSQ(pMsg);
- }else if(0==ModemStrCmp(pMsg, "+CCLK:"))
- {//+CCLK: "17/09/28,04:48:35"
- //+CCLK: "80/01/06,00:10:44"
- //+CCLK: "17/10/19,07:22:35"
- g_usModeYTime=atoi(&pMsg[8]);
- g_usModemTime=atoi(&pMsg[11]);
- g_usModeDTime=atoi(&pMsg[14]);
- g_usModeHTime=atoi(&pMsg[17])+8;
- if(g_usModeHTime >= 24) g_usModeHTime -= 24;
- g_usModeMTime=atoi(&pMsg[20]);
- g_usModeSTime=atoi(&pMsg[23]);
- SetTime(g_usModeHTime, g_usModeMTime, g_usModeSTime);//保存下来,以便下次启动,没登陆前可以使用本地时间显示
- SlwTrace(INF, "UpdateTime",1);
- }else if(0==ModemStrCmp(pMsg, "+POC:START"))
- {
- sutPocStatus.modemRstFlag=1;
- sutPocStatus.ModemInactiveCt=0;//当模块重启后重新计数串口通讯异常计数器
- }
-
- }
- /************************************************
- 每10ms处理一次
- **************************************************/
- void GpsTaskTick(unsigned char reset)
- {
- static unsigned int sucSecCt=0;
- if(reset){
- sucSecCt=0;
- return;
- }
- if(sutGpsInfo.Updata==1){
- if(g_uiGpsStat==0){
- sutGpsInfo.isGpsWork=0;
- sutGpsInfo.isGpsValid=0;
- sutGpsInfo.GpsInactiveCt=0;
- SlwTrace(INF,"GPS Close------",1);
- g_usUart3RecvLen=0;
- GPS_PWREN_LOW;
- }else{
- sutGpsInfo.isGpsWork=0;
- sutGpsInfo.isGpsValid=0;
- sutGpsInfo.GpsInactiveCt=0;
- GPS_PWREN_HIGH;
- SlwTrace(INF,"GPS open------",1);
- }
- sutGpsInfo.Updata=0;
- }
-
- //GPS Uart消息处理
- if(g_usUart3RecvLen)
- {
- process_nema((char *)RxBuffer3);
- g_usUart3RecvLen=0;
- }
-
- //===========以下控制每秒执行一次============
- if(os_time_get() < sucSecCt) return;
- sucSecCt=os_time_get()+100;
-
- //////////////////20170112////////////////////
- GpsCtrlSendPos();//里面涉及到鉴权,所以得跑起来 //以及GPS上传时间
- }
-
- void AtQuery()
- {
- static unsigned char send_sucCt=0;
-
- switch(send_sucCt){
-
- case 0:
- //ModemSendAT("AT+POC=509\r\n");
- break;
- case 1:
- ModemSendAT("AT+CSQ\r\n");
- break;
- case 2:
- ModemSendAT("AT^SYSINFO\r\n");
- break;
- }
- if(++send_sucCt>2) send_sucCt=0;
- }
|