void Gsm_State() { GsmConfig(Con_InitState,Con_InitState,Con_InitState,MsgSend, MsgOk,Sec(2),Sec(10),TimerStart); Gsm.TickCnt = 0; Gsm.BuffCnt = 0; Gsm.MsgLenght = 0; Gsm.L_Tick = 0; Gsm.Display = Done; //No change Gsm.Tcp_State = TCP_STATE_INIT; Gsm.ConnectionStatus = InitGsm; Gsm.Event = EvtInit; Gsm.Sms_Index = 0; // strcpy(Gsm.Ip_ADD,"103.241.144.173"); // strcpy(Gsm.PortNo,"31000"); /* strcpy(Gsm.Ip_ADD,"www.google.com"); strcpy(Gsm.PortNo,"8080"); */ strcpy(Gsm.Ip_ADD,"54.251.99.26"); strcpy(Gsm.PortNo,"9501"); strcpy(Gsm.D_Id ,"60"); TCP_Delay.Function =FnEnter; TCP_Delay.Delay =0; CIPSTATUS_Delay.Function =FnEnter; CIPSTATUS_Delay.Delay =0; }
void Init_Sim900(void) { #ifdef DebugOn GsmDisplayUpdate("Start ",1) ; #endif GsmDisableComm(); ReStart(); GsmConfig(Con_InitState,Con_ATE0,Con_ATE0,MsgSend, NORMAL_PDOWN,Sec(3),Sec(10),TimerStart); Gsm.BuffCnt = 0; //rxbuff start location is 0 Gsm_Tick(); GsmEnableComm(); GsmStartReceive(); drv_sim900_send_cmd(4,"AT\r\n");//test }
void VideoFieldContainerEditor::updateTimeInterface(void) { if(_AttachedVideo != NULL) { Real32 Time(_AttachedVideo->getPosition()); UInt32 Min(osgFloor(Time/60.0f)), Sec(osgFloor(Time - Min*60.0f)); boost::format TimeFormatter("%d:%02d"); _PlaybackTimeLabel->setText(boost::str(TimeFormatter % Min % Sec )); Time = _AttachedVideo->getDuration(); Min = osgFloor(Time/60.0f); Sec = osgFloor(Time - Min*60.0f); _TotalTimeLabel->setText(boost::str(TimeFormatter % Min % Sec )); _LocationSlider->getRangeModel()->setRangeProperties(_AttachedVideo->getPosition()/_AttachedVideo->getDuration() * 1000.0f, 0, 0, 1000, true); } else { _TotalTimeLabel->setText(""); _PlaybackTimeLabel->setText(""); _LocationSlider->getRangeModel()->setValue(0); } }
String Apollo::TimeValue::toString() { time_t tSec = Sec(); struct tm tms = *(::localtime(&tSec)); String s; s.appendf("%04d.%02d.%02d-%02d:%02d:%02d.%06d", tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday, tms.tm_hour, tms.tm_min, tms.tm_sec, MicroSec()); return s; }
void Standard_model_low_scale_constraint<Two_scale>::apply() { assert(model && "Error: Standard_model_low_scale_constraint::apply():" " model pointer must not be zero"); qedqcd.runto(scale, 1.0e-5); model->calculate_DRbar_masses(); const double alpha_em = qedqcd.displayAlpha(softsusy::ALPHA); const double alpha_s = qedqcd.displayAlpha(softsusy::ALPHAS); const double mz_pole = qedqcd.displayPoleMZ(); double delta_alpha_em = 0.; double delta_alpha_s = 0.; if (model->get_thresholds()) { delta_alpha_em = model->calculate_delta_alpha_em(alpha_em); delta_alpha_s = model->calculate_delta_alpha_s(alpha_s); } const double alpha_em_drbar = alpha_em / (1.0 - delta_alpha_em); const double alpha_s_drbar = alpha_s / (1.0 - delta_alpha_s); const double e_drbar = Sqrt(4.0 * Pi * alpha_em_drbar); const double g1 = model->get_g1(); const double g2 = model->get_g2(); const double mZ = model->get_thresholds() ? model->calculate_MVZ_DRbar(mz_pole) : mz_pole; double theta_w = model->calculate_theta_w(qedqcd, alpha_em_drbar); if (IsFinite(theta_w)) { model->get_problems().unflag_non_perturbative_parameter( "sin(theta_W)"); } else { model->get_problems().flag_non_perturbative_parameter( "sin(theta_W)", theta_w, get_scale(), 0); theta_w = ArcSin(Electroweak_constants::sinThetaW); } model->set_v(Re((2*mZ)/Sqrt(0.6*Sqr(g1) + Sqr(g2)))); model->calculate_Yu_DRbar(qedqcd); model->calculate_Yd_DRbar(qedqcd); model->calculate_Ye_DRbar(qedqcd); model->set_g1(1.2909944487358056*e_drbar*Sec(theta_w)); model->set_g2(e_drbar*Csc(theta_w)); model->set_g3(3.5449077018110318*Sqrt(alpha_s_drbar)); if (model->get_thresholds()) qedqcd.setPoleMW(model->recalculate_mw_pole(qedqcd.displayPoleMW())); }
int main() { TimePoint<Sec> time_point_sec(Sec(4)); // implicit cast, no precision loss TimePoint<Ms> time_point_ms(time_point_sec); print_ms(time_point_ms); // 4000 ms time_point_ms = TimePoint<Ms>(Ms(5756)); // explicit cast, need when precision loss may happens // 5756 truncated to 5000 time_point_sec = std::chrono::time_point_cast<Sec>(time_point_ms); print_ms(time_point_sec); // 5000 ms }
String Apollo::TimeValue::toRFC2822() { // "Thu, 19 Nov 1981 08:52:00 GMT" // "Thu, 19 Nov 1981 08:52:00 +0100 time_t tSec = Sec(); struct tm tms = *(::localtime(&tSec)); int nMaxSize = 1000; Flexbuf<TCHAR> buf(nMaxSize); _tcsftime((TCHAR*) buf, nMaxSize-1, _T("%a, %d %b %Y %H:%M:%S"), &tms); String s = (TCHAR*) buf; long gmtoff = 0; if (_get_timezone(&gmtoff) == 0) { gmtoff -= tms.tm_isdst ? 3600 : 0; s.appendf(" %+03d%02d", -(gmtoff / (60 * 60)), (gmtoff % (60 * 60))); } return s; }
void GsmInit() { switch (Gsm.Event) { case MsgOk: GsmClearBufffer(); Gsm.State=Gsm.NextState; Gsm.Event = EvtInit; break;//MsgOk case MsgError: GsmClearBufffer(); Gsm.State=Gsm.OldState; Gsm.Event = EvtInit; break ;//Msgok case NORMAL_PDOWN: GsmClearBufffer(); Gsm.Event = EvtInit; Gsm.TimeStatus = TimerStop; break;//NORMAL_PDOWN case TCP_SHUT_OK: GsmClearBufffer(); Gsm.State =Gsm.NextState; Gsm.Event = EvtInit; break;//TCP_SHUT_OK case EvtInit: nop(); break;//EvtInit } switch (Gsm.State) { case Con_ATE0: #ifdef DebugOn GsmDisplayUpdate("ATE0 ",1) ; #endif drv_sim900_send_cmd(6,"ATE0\r\n"); GsmConfig(Con_Running,Con_CNMI,Con_ATE0,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); break; case Con_CNMI: GsmDisplayUpdate("CNMI ",1) ; drv_sim900_send_cmd(13,"AT+CNMI=2,1\r\n"); __delay_cycles(9999999); drv_sim900_send_cmd(22,"AT+CSMP=17,167,0,241\r\n"); __delay_cycles(9999999); drv_sim900_send_cmd(11,"AT+CMGF=1\r\n"); __delay_cycles(9999999); drv_sim900_send_cmd(20,"AT+CMGDA=\"DEL ALL\"\r\n"); __delay_cycles(9999999); drv_sim900_send_cmd(12,"AT+CIPSHUT\r\n"); GsmConfig(Con_Running,Con_Exit,Con_CIPSHUT,MsgSend, TCP_SHUT_OK,Sec(1),Gsm.MaxDelay,TimerStart); // GsmConfig(Con_Running,Con_CSMP,Con_CNMI,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); break; case Con_CSMP: #ifdef DebugOn GsmDisplayUpdate("CSMP ",1) ; #endif drv_sim900_send_cmd(22,"AT+CSMP=17,167,0,241\r\n"); GsmConfig(Con_Running,Con_CMGF,Con_CSMP,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); break; case Con_CMGF: #ifdef DebugOn GsmDisplayUpdate(" CMGF ",1) ; #endif drv_sim900_send_cmd(11,"AT+CMGF=1\r\n"); GsmConfig(Con_Running,Con_CMGD,Con_CMGF,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); break; case Con_CMGD: drv_sim900_send_cmd(20,"AT+CMGDA=\"DEL ALL\"\r\n"); GsmConfig(Con_Running,Con_CIPSHUT,Con_CMGD,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); break; case Con_CIPSHUT: drv_sim900_send_cmd(12,"AT+CIPSHUT\r\n"); GsmConfig(Con_Running,Con_Exit,Con_CIPSHUT,MsgSend, TCP_SHUT_OK,Sec(1),Gsm.MaxDelay,TimerStart); break; case Con_Exit: Gsm.ConnectionStatus = GsmConnected; #ifdef DebugOn GsmDisplayUpdate("Connected",1) ; #endif GsmConfig(CheckCSQ,CheckCSQ,Con_Exit,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerInit); break; default: Gsm.State=Gsm.State; break; case Con_Started: break;// case Con_Running: nop(); break;//Con_Running case Con_InitState: //GsmConfig(Con_ATE0,Con_ATE0,Con_ATE0,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); //GsmConfig(Con_InitState,Con_ATE0,Con_ATE0,MsgSend, MsgOk,Sec(5),Sec(10),TimerStart); break;//Con_InitState }/***Gsm State end***/ }
void GsmRun(void) { switch (Gsm.ConnectionStatus) { case InitGsm: GsmInit(); break;//InitGsm case GsmConnected: // Tcp(); break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } switch (Gsm.TimeStatus) { case TimerInit: switch (Gsm.ConnectionStatus) { case InitGsm: GsmConfig(Con_InitState,Con_ATE0,Con_ATE0,MsgSend, MsgOk,Sec(5),Sec(10),TimerStart); break;//InitGsm case GsmConnected: GsmConfig(CheckCSQ,CheckCSQ,CheckCSQ,MsgSend, T_CsqReceived,Sec(1),Sec(10),TimerStart); break;//GsmConnected case GsmDisconnected: nop(); break;//GsmDisconnected case Gsm_CSQ_Low: nop(); break;//Gsm_CSQ_Low } break;//TimerInit case TimerRunning: switch (Gsm.ConnectionStatus) { case InitGsm: if(GsmPtr->NextState==Con_CNMI) { if((GsmPtr->TickCnt)%20==0){ drv_sim900_send_cmd(4,"AT\r\n");//test } else if((GsmPtr->TickCnt)%40==0){ drv_sim900_send_cmd(6,"ATE0\r\n");//test } } break;//InitGsm case GsmConnected: nop(); break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } nop(); break; case TimerOver: switch (Gsm.ConnectionStatus) { case InitGsm: GsmCheckMsg(); if((GsmPtr->NextState==Con_ATE0)&&(GsmPtr->Event == EvtInit)) { GsmPtr->EvtExpected=MsgOk; GsmCheckMsg(); if((GsmPtr->TickCnt)%30==0) //2 sec interval { drv_sim900_send_cmd(4,"AT\r\n");//test } } break;//InitGsm case GsmConnected: Tcp(); if((GsmPtr->TickCnt)%20==0) { switch(Gsm.OldState) { case T_CCIFSR: Gsm.State=T_CCIPSTART; break;//T_CCIFSR case T_CCREG: Gsm.State=Gsm.OldState; Gsm.Retry++; break;//Con_ATE0 }//Gsm.OldState } break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } nop(); break ;//Timerover case TimerStop: switch (Gsm.ConnectionStatus) { case InitGsm: Init_Sim900(); break;//InitGsm case GsmConnected: GsmConfig(CheckCSQ,CheckCSQ,CheckCSQ,MsgSend, T_CsqReceived,Sec(2),Sec(5),TimerStart); break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } nop(); break;//TimerStop case TimerStart: nop(); break;//TimerStart } nop(); }
void Tcp() { unsigned static retry=0; if(GsmCheckMsg()){ GsmClearBufffer(); switch (Gsm.Event) { case T_CsqReceived: if(Gsm.Rssi<=2) { Gsm.State=CsqLow; } else if(Gsm.Rssi<99) { Gsm.State=CsqHigh; } else if(Gsm.Rssi==99) { Gsm.State=CsqNoSignal; } break; //CsqReceived case IP_INITIAL: Gsm.State=T_CCSTT; Gsm.Event = EvtInit; break;//IP_INITIAL case IP_GPRSACT: Gsm.State=T_CCIFSR; Gsm.Event = EvtInit; break;//IP_GPRSACT case IP_START: Gsm.State=T_CCIICR; Gsm.Event = EvtInit; break; case ALREADY_CONNECTED: nop(); Gsm.Event = EvtInit; Gsm.State=TcpConnected; break;//ALREADY_CONNECTED case TCP_SEND_OK: Gsm.Event = EvtInit; Gsm.State=Con_SENDOK; break;//TCP_SEND_OK case PDP_DEACT: Gsm.Event = EvtInit; Gsm.State = T_CCIPSHUT ; break;//PDP_DEACT case TCP_CLOSED: Gsm.State=T_CCIPSHUT; Gsm.Event = EvtInit; break;//TCP_CLOSED case TCP_CONNECTING: Gsm.State=T_CCIPSTATUS; break;//TCP_CONNECTING case CONNECT_OK: Gsm.Event = EvtInit; Gsm.State=TcpConnected; break;//CONNECT_OK case TCP_SHUT_OK: Gsm.Event = EvtInit; Gsm.State=T_CCIPSHUT; break;//TCP_SHUT_OK case EvtGsmRing: break;//EvtGsmRing: case EvtGsmMsg: break;//EvtGsmMsg: case Tcp_CREG_oK: Gsm.State = T_CCIPSTATUS; Gsm.Event = EvtInit; break;//Tcp_CREG_oK case MsgOk: Gsm.State = Gsm.NextState; Gsm.Event = EvtInit; GsmClearBufffer(); break;//MsgOk case MsgError: break;//MsgError, }} switch (Gsm.State) { /*case Con_ATE0: #ifdef DebugOn GsmDisplayUpdate("ATE0 ",1) ; #endif drv_sim900_send_cmd(6,"ATE0\r\n"); GsmConfig(Con_Running,T_CCREG,Con_ATE0,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); if(Gsm.Retry>1) { Gsm.State = Gsm.NextState; retry=0; } break; */ case CsqLow: case CsqHigh: sprintf(Gsm.Gsm_Sms,"CSQ = %d",Gsm.Rssi);// same with csq precedded GsmDisplayUpdate(Gsm._Csq,2); Gsm.State = Gsm.NextState; Gsm.Event = EvtInit; break;//csqdetected case CheckCSQ: #ifdef DebugOn GsmDisplayUpdate("CSQ ",1) ; #endif drv_sim900_send_cmd(6,"AT+CSQ\r\n"); GsmConfig(Con_Running,T_CCREG,CheckCSQ,MsgSend, T_CsqReceived,Sec(2),Sec(10),TimerStart); if(Gsm.Retry>5) { Gsm.State = T_CCIPSHUT; drv_sim900_send_cmd(4,"AT\r\n");//test Gsm.Retry=0; } break; case T_CCREG: #ifdef DebugOn GsmDisplayUpdate("CCREG ",1) ; #endif drv_sim900_send_cmd(get_size(CREG),CREG); GsmConfig(Con_Running,T_CCIPSTATUS, T_CCREG,MsgSend, Tcp_CREG_oK,Sec(1),Gsm.MaxDelay,TimerStart); if(Gsm.Retry>5) { Gsm.State = T_CCIPSHUT; Gsm.Retry=0; } break;//T_CCREG case T_CCIPSTATUS://CREG OK #ifdef DebugOn // GsmDisplayUpdate("CCIPSTATUS ",1) ; #endif GsmClearBufffer(); drv_sim900_send_cmd(14,CIPSTATUS); //ok state Ip intial GsmConfig(Con_Running,T_CCIPSTATUS, T_CCIPSTATUS,MsgSend, TCP_MSG,Sec(1),Gsm.MaxDelay,TimerStart); break;//T_CCIPSTATUS case T_CCSTT: #ifdef DebugOn GsmDisplayUpdate("CSTT ",1) ; #endif GsmClearBufffer(); GsmConfig(Con_Running,T_CCIPSTATUS, T_CCSTT,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); drv_sim900_send_cmd(get_size(CSTT),CSTT); drv_sim900_send_cmd(1,"\""); drv_sim900_send_cmd(get_size("INTERNET"),"INTERNET"); drv_sim900_send_cmd(1,"\""); drv_sim900_send_cmd(6,",\"\",\"\""); // ,"","" drv_sim900_send_cmd(2,"\r\n"); break;//T_CCIPSTATUS, case T_CIPCLOSE: #ifdef DebugOn GsmDisplayUpdate("cipclose ",1) ; #endif GsmClearBufffer(); drv_sim900_send_cmd(get_size(CIPCLOSE),CIPCLOSE); break;// CIPCLOSE, case T_CCIPCSGP: break;//T_CCIPCSGP case T_CCIICR: #ifdef DebugOn GsmDisplayUpdate("CIICR ",1) ; #endif GsmClearBufffer(); GsmConfig(Con_Running,T_CLPORT, T_CCIICR,MsgSend, MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); drv_sim900_send_cmd(get_size(CIICR),CIICR); break;//T_CCSTT case T_CLPORT : #ifdef DebugOn GsmDisplayUpdate("CLPORT ",1) ; #endif GsmClearBufffer(); GsmConfig(Con_Running,T_CCIFSR, T_CLPORT,MsgSend,MsgOk,Sec(1),Gsm.MaxDelay,TimerStart); drv_sim900_send_cmd(get_size(CLPORT),CLPORT); drv_sim900_send_cmd(1,"\""); drv_sim900_send_cmd(get_size("60"),"60"); drv_sim900_send_cmd(3,"\"\r\n"); break;//T_CLPORT case T_CCIPSTART: #ifdef DebugOn GsmDisplayUpdate("CCIPSTART ",1) ; #endif GsmClearBufffer(); GsmConfig(Con_Running,T_CCIPSTATUS, T_CCIPSTART,MsgSend, TCP_MSG,Sec(1),Gsm.MaxDelay,TimerStart); drv_sim900_send_cmd(get_size(CIPSTART),CIPSTART); drv_sim900_send_cmd(1,"\""); drv_sim900_send_cmd(get_size(Gsm.Ip_ADD),Gsm.Ip_ADD); //"64.27.25.155\",\"10020\"\r\n" drv_sim900_send_cmd(3,"\",\""); drv_sim900_send_cmd(get_size(Gsm.PortNo),Gsm.PortNo); drv_sim900_send_cmd(3,"\"\r\n"); break;//T_CCIFSR case T_CCIFSR: #ifdef DebugOn GsmDisplayUpdate("CCIFSR ",1) ; #endif GsmClearBufffer(); drv_sim900_send_cmd(get_size(CIFSR),CIFSR); GsmConfig(Con_Running,T_CCIPSTART, T_CCIFSR,MsgSend, TCP_MSG,Sec(1),Gsm.MaxDelay,TimerStart); break;//T_CCIPSTART, case T_CCIPSHUT: #ifdef DebugOn GsmDisplayUpdate("CIPSHUT ",1) ; #endif GsmClearBufffer(); drv_sim900_send_cmd(12,"AT+CIPSHUT\r\n"); GsmConfig(Con_Running,CheckCSQ, CheckCSQ,MsgSend,TCP_SHUT_OK,Sec(1),Gsm.MaxDelay,TimerStart); break;//T_CCIPSHUT case TcpConnected: #ifdef DebugOn GsmDisplayUpdate("TCP Connected",2) ; #endif if(TCP_Delay.Function==FnEnter) { TCP_Delay.Delay=Gsm.L_Tick+ TCP_DELAY_Interval;//10sec TCP_Delay.Function=FnExit; ToSend(RegularUpdate); GsmConfig(T_CCIPSTATUS,T_CCIPSTATUS, T_CCIPSTATUS,MsgSend, TCP_SEND_OK,Sec(1),Sec(10),TimerStart); } else { Gsm.State=T_CCIPSTATUS; if(Gsm.L_Tick>TCP_Delay.Delay) { TCP_Delay.Function=FnEnter; GsmConfig(T_CCIPSHUT,T_CCIPSTATUS, T_CCIPSTATUS,MsgSend, SERVER_LISTENING,Sec(1),Gsm.MaxDelay,TimerStart); } } break;//TcpConnected case Con_SENDOK: #ifdef DebugOn GsmDisplayUpdate("Send ok",1) ; GsmConfig(T_CCIPSTATUS,T_CCIPSTATUS, T_CCIPSTATUS,MsgSend, SERVER_LISTENING,Sec(1),Gsm.MaxDelay,TimerStart); #endif break;//Con_SENDOK; case Con_Running: nop(); break;//Con_Running } }
void GsmRun(void) { switch (Gsm.ConnectionStatus) { case InitGsm: GsmInit(); break;//InitGsm case GsmConnected: if(Gsm.Event==EvtGsmMsg) { Tcp(); } if(Gsm.Tcp_State == TCP_STATE_CONNECTED){ if(CIPSTATUS_Delay.Function==FnEnter) { CIPSTATUS_Delay.Delay=GsmPtr->L_Tick+ CIPSTATUS_INTERVAL;//10sec CIPSTATUS_Delay.Function=FnExit; Tcp(); } else { GsmPtr->State=T_CCIPSTATUS; if(GsmPtr->L_Tick>CIPSTATUS_Delay.Delay) { CIPSTATUS_Delay.Function=FnEnter; } } } break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } switch (Gsm.TimeStatus) { case TimerInit: switch (Gsm.ConnectionStatus) { case InitGsm: GsmConfig(Con_InitState,Con_ATE0,Con_ATE0,MsgSend, MsgOk,Sec(5),Sec(10),TimerStart); break;//InitGsm case GsmConnected: GsmConfig(CheckCSQ,CheckCSQ,CheckCSQ,MsgSend, T_CsqReceived,Sec(1),Sec(10),TimerStart); break;//GsmConnected case GsmDisconnected: nop(); break;//GsmDisconnected case Gsm_CSQ_Low: nop(); break;//Gsm_CSQ_Low } break;//TimerInit case TimerRunning: switch (Gsm.ConnectionStatus) { case InitGsm: if(GsmPtr->NextState==Con_CNMI) { if((GsmPtr->TickCnt)%20==0){ drv_sim900_send_cmd(4,"AT\r\n");//test } else if((GsmPtr->TickCnt)%40==0){ drv_sim900_send_cmd(6,"ATE0\r\n");//test } } break;//InitGsm case GsmConnected: if(Gsm.Event==EvtGsmMsg) { Tcp(); } nop(); break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } nop(); break; case TimerOver: switch (Gsm.ConnectionStatus) { case InitGsm: GsmCheckMsg(); if((GsmPtr->NextState==Con_ATE0)&&(GsmPtr->Event == EvtInit)) { GsmPtr->EvtExpected=MsgOk; GsmCheckMsg(); if((GsmPtr->TickCnt)%30==0) //2 sec interval { drv_sim900_send_cmd(4,"AT\r\n");//test } } break;//InitGsm case GsmConnected: Tcp(); if((GsmPtr->TickCnt)%20==0) { switch(Gsm.OldState) { case T_CCIFSR: Gsm.State=T_CCIPSTART; break;//T_CCIFSR case T_CCREG: Gsm.State=Gsm.OldState; Gsm.Retry++; break;//Con_ATE0 }//Gsm.OldState } break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } nop(); break ;//Timerover case TimerStop: switch (Gsm.ConnectionStatus) { case InitGsm: Init_Sim900(); break;//InitGsm case GsmConnected: GsmConfig(T_CCIPSHUT,CheckCSQ,CheckCSQ,MsgSend, T_CsqReceived,Sec(1),Sec(10),TimerStart); break;//GsmConnected case GsmDisconnected: break;//GsmDisconnected case Gsm_CSQ_Low: break;//Gsm_CSQ_Low } nop(); break;//TimerStop case TimerStart: nop(); break;//TimerStart } nop(); }
void Sec::normalize() { *this = Sec( sec() ); }