static trap_retval DoRemotePut( byte *snd, trap_elen len ) { WORD rc; putstring( "RemotePut\r\n" ); putconnstatus( Connection ); if( len == 0 ) { _INITSPXECB( Send, 1, NULL, 0 ); } else { _INITSPXECB( Send, 2, (char *)snd, len ); } SendECB.hsem = (HSEM) &SendSem; SendHead.connectionCtl |= 0x10; SendHead.packetLen = _SWAPINT( sizeof( SendHead ) + len ); DosSemSet( &SendSem ); rc = SpxSendSequencedPacket( Connection, &SendECB ); putrc( "SPXSendSequencedPacket", rc ); for( ;; ) { /* I don't know what the 0x1001 status is - I can't find it in any documentation, but if we don't wait for it to clear, things mess up badly. */ if( SendECB.status != SPX_SUCCESSFUL && !InUse( SendECB ) && SendECB.status != 0x1001 ) break; rc = DosSemWait( &SendSem, 1000 ); if( rc != ERROR_SEM_TIMEOUT ) { break; } } SendECB.hsem = 0; putstring( "Done RemotePut\r\n" ); return( len ); }
bool set_dest_ip( ) { u8 retry; u8 respond_str[AT_CMD_LENGTH]; for ( retry = 0 ;retry < 3 ; retry++) { putstring(COM2,"AT^SISS=0,address,\"socktcp:\/\/"); putstring(COM2,my_icar.mg323.server_ip_port); putstring(COM2,"\"\r\n"); memset(respond_str, 0x0, AT_CMD_LENGTH); if ( my_icar.stm32_u2_rx.empty ) {//no data... OSTimeDlyHMSM(0, 0, 0, 100); } while ( !my_icar.stm32_u2_rx.empty ) {//have data ... if ( get_respond(respond_str) ) { //debug_gsm("Res_str:%s\r\n",respond_str); if (strstr((char *)respond_str,"ERROR")) { return false; } if (strstr((char *)respond_str,"OK\r\n")) { return true; } } else { debug_gsm("CMD:AT^SICS no respond, timeout\r\n"); } } OSTimeDlyHMSM(0, 0, 1, 0); } return false ; }
/*---------------------------------------------------------------------------*/ void uip_debug_ipaddr_print(const uip_ipaddr_t *addr) { #if UIP_CONF_IPV6 uint16_t a; unsigned int i; int f; for(i = 0, f = 0; i < sizeof(uip_ipaddr_t); i += 2) { a = (addr->u8[i] << 8) + addr->u8[i + 1]; if(a == 0 && f >= 0) { if(f++ == 0) { putstring("::"); } } else { if(f > 0) { f = -1; } else if(i > 0) { putstring(":"); } puthex(a >> 8); puthex(a & 0xFF); } } #else /* UIP_CONF_IPV6 */ PRINTA("%u.%u.%u.%u", addr->u8[0], addr->u8[1], addr->u8[2], addr->u8[3]); #endif /* UIP_CONF_IPV6 */ }
bool gsm_dial( unsigned char * phone_number ) { u8 retry; u8 respond_str[AT_CMD_LENGTH]; for ( retry = 0 ;retry < 10 ; retry++) { putstring(COM2,"ATD"); putstring(COM2,phone_number); putstring(COM2,";\r\n"); memset(respond_str, 0x0, AT_CMD_LENGTH); if ( my_icar.stm32_u2_rx.empty ) {//no data... OSTimeDlyHMSM(0, 0, 0, 100); } while ( !my_icar.stm32_u2_rx.empty ) {//have data ... if ( get_respond(respond_str) ) { //debug_gsm("Res_str:%s\r\n",respond_str); if (strstr((char *)respond_str,"ERROR")) { return false; } if (strstr((char *)respond_str,"CONF: 1")) { //^CONF: 1 return true; } } else { debug_gsm("CMD:ATD no respond, timeout\r\n"); } } OSTimeDlyHMSM(0, 0, 1, 0); } return false ; }
int main(void) { char y[10]; x[0] = 'H'; x[1] = 'e'; x[2] = 'l'; x[3] = 'l'; x[4] = 'o'; x[5] = '\n'; x[6] = 0; y[0] = 'G'; y[1] = 'o'; y[2] = 'o'; y[3] = 'd'; y[4] = ' '; y[5] = 'b'; y[6] = 'y'; y[7] = 'e'; y[8] = '\n'; y[9] = 0; putstring(x); putstring(y); }
static void flushrow( ) { unsigned char *outp, *p, *q; int count; int col = outmax; if (linerepeat > 1) { /* Put out line repeat count */ fwrite ("\0\0\377", 3, 1, stdout); putchar (linerepeat); } for (outp = p = lastrow; col > 0;) { for (q = p, count=0; (count < col) && (*q == *p); q++,count++); if (count > MINRUN) { if (p > outp) { putstring (outp, p-outp); outp = p; } col -= count; switch (*p) { case SOLID_0: #ifdef DEBUG /* if (outcol > 0) */ fprintf (stderr, "Solid run 0, length: %d\n", count); #endif putsolid (SOLID_0, count); break; case SOLID_1: #ifdef DEBUG fprintf (stderr, "Solid run 1, length: %d, pos %d\n", count, outcol); #endif putsolid (SOLID_1, count); break; default: #ifdef DEBUG fprintf (stderr, "Pattern run, length: %d\n", count); #endif putpattern (*p, count); break; } outp = p = q; } else { p++; col--; } } if (p > outp) putstring (outp, p-outp); if (ferror (stdout)) pm_error ("write error"); }
void startup_message(void) { putcrlf(); #ifdef __GNUC__ putstring("GCC " __VERSION__ "\r\n"); #endif putstring(name_string); putspace(); putstring(version_string); /* Silicon Revision */ putstring(" Mask("); puthex(ECHV); /* ADC reading codes Board ID */ putstring(") ID("); putstring(board_id_to_string()); /* Stack pointer */ putstring(") SP("); puthex(SP); putstring(") "); putstring(date_string); putspace(); putstring(time_string); /* now for some manufacturing data */ putcrlf(); if( manufacturing_find_tag("T#") ) manufacturing_print_tag(); putspace(); if( manufacturing_find_tag("SN") || manufacturing_find_tag("S#") ) manufacturing_print_tag(); }
int bytnodtyp(void) { int going=TRUE,nr,x; struct NodeType *nt=NULL; puttekn("\n\n\rVilken nodtyp vill du ha som förinställd?\n\n\r",-1); puttekn(" 0: Ingen, jag vill bli tillfrågad vid inloggning.\n\r",-1); for(x=0; x<MAXNODETYPES; x++) { if(Servermem->nodetypes[x].nummer==0) break; sprintf(outbuffer,"%2d: %s\n\r",Servermem->nodetypes[x].nummer,Servermem->nodetypes[x].desc); putstring(outbuffer,-1,0); } while(going) { putstring("\n\rVal: ",-1,0); if(getstring(EKO,2,NULL)) return(1); nr = atoi(inmat); if(nr<0) putstring("\n\rDu måste ange ett positivt heltal.\n\r",-1,0); else if(nr==0) going=FALSE; else if(!(nt=GetNodeType(atoi(inmat)))) putstring("\n\rFinns ingen sådan nodtyp.\n\r",-1,0); else going=FALSE; } if(!nt) { Servermem->inne[nodnr].shell=0; puttekn("\n\n\rDu har nu ingen förinställd nodtyp.\n\r",-1); } else { Servermem->inne[nodnr].shell = nt->nummer; puttekn("\n\n\rDin förinställda nodtyp är nu:\n\r",-1); puttekn(nt->desc,-1); puttekn("\n\n\r",-1); } return(0); }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(udp_server_process, ev, data) { PROCESS_BEGIN(); putstring("Starting UDP server\n"); #if BUTTON_SENSOR_ON putstring("Button 1: Print RIME stats\n"); #endif #if SERVER_RPL_ROOT create_dag(); #endif server_conn = udp_new(NULL, UIP_HTONS(0), NULL); udp_bind(server_conn, UIP_HTONS(3000)); PRINTF("Listen port: 3000, TTL=%u\n", server_conn->ttl); while(1) { PROCESS_YIELD(); if(ev == tcpip_event) { tcpip_handler(); #if (BUTTON_SENSOR_ON && (DEBUG==DEBUG_PRINT)) } else if(ev == sensors_event && data == &button_sensor) { print_stats(); #endif /* BUTTON_SENSOR_ON */ } } PROCESS_END(); }
bool set_gprs_passwd( ) { u8 retry; u8 respond_str[AT_CMD_LENGTH]; for ( retry = 0 ;retry < 3 ; retry++) { putstring(COM2, (unsigned char *)at_set_channel0_para); putstring(COM2, "passwd,"); putstring(COM2, (unsigned char *)apn_list[my_icar.mg323.apn_index][3]); putstring(COM2, "\r\n"); memset(respond_str, 0x0, AT_CMD_LENGTH); if ( my_icar.stm32_u2_rx.empty ) {//no data... OSTimeDlyHMSM(0, 0, 0, 100); } while ( !my_icar.stm32_u2_rx.empty ) {//have data ... if ( get_respond(respond_str) ) { //debug_gsm("Res_str:%s\r\n",respond_str); if (strstr((char *)respond_str,"ERROR")) { return false; } if (strstr((char *)respond_str,"OK\r\n")) { return true; } } else { debug_gsm("CMD:AT^SICS no respond, timeout\r\n"); } } OSTimeDlyHMSM(0, 0, 0, 500); } return false ; }
static void prompt(char *filename) { if (clreol) cleareol(); else if (promptlen > 0) kill_line(); if (!hard) { promptlen = 0; if (Senter && Sexit) { putstring(Senter); promptlen += (2 * soglitch); } if (clreol) cleareol(); promptlen += printf(_("--More--")); if (filename != NULL) { promptlen += printf(_("(Next file: %s)"), filename); } else if (!no_intty) { promptlen += printf("(%d%%)", (int)((file_pos * 100) / file_size)); } if (dum_opt) { promptlen += printf(_("[Press space to continue, 'q' to quit.]")); } if (Senter && Sexit) putstring(Sexit); if (clreol) clreos(); fflush(stdout); } else ringbell(); inwait++; }
void putrc( char *func, WORD rc ) { if( rc == 0 ) return; putstring( func ); putstring( " returned " ); puthex( rc ); putstring( "\r\n" ); }
void InitMessage(){ putstring("DDS generator driver v_"); putnum(10); USART_Transmit( '\n' ); USART_Transmit( '\r' ); putstring("Type help for command list"); USART_Transmit( '\n' ); USART_Transmit( '\r' ); }
int sendtocon(char *pekare, int size) { struct IntuiMessage *mymess; struct NiKMess *nikmess; int aborted = FALSE, paused=FALSE; ULONG signals,conwritesig = 1L << conwriteport->mp_SigBit, conreadsig = 1L << conreadport->mp_SigBit,windsig = 1L << NiKwind->UserPort->mp_SigBit, nikomnodesig = 1L << nikomnodeport->mp_SigBit; char console = 1, tecken; conwritereq->io_Command=CMD_WRITE; conwritereq->io_Data=(APTR)pekare; conwritereq->io_Length=size; SendIO((struct IORequest *)conwritereq); while(console) { signals = Wait(conwritesig | conreadsig | windsig | nikomnodesig); if(signals & conwritesig) { console=0; if(WaitIO((struct IORequest *)conwritereq)) printf("Error console\n"); } if(signals & conreadsig) { if((tecken=congettkn()) == 3) { if(console) { AbortIO((struct IORequest *)conwritereq); WaitIO((struct IORequest *)conwritereq); } aborted=TRUE; console=0; putstring("^C\n\r",-1,0); } else if((tecken==' ' && (Servermem->inne[nodnr].flaggor & MELLANSLAG)) || tecken==19) paused=TRUE; else if(tecken && typeaheadbuftkn<50) { typeaheadbuf[typeaheadbuftkn++]=tecken; typeaheadbuf[typeaheadbuftkn]=0; } } if(signals & windsig) { mymess=(struct IntuiMessage *)GetMsg(NiKwind->UserPort); ReplyMsg((struct Message *)mymess); cleanup(OK,""); } if(signals & nikomnodesig) { while(nikmess = (struct NiKMess *) GetMsg(nikomnodeport)) { handleservermess(nikmess); ReplyMsg((struct Message *)nikmess); } if(carrierdropped()) aborted = TRUE; } } if(paused && gettekn()==3) { putstring("^C\n\r",-1,0); return(TRUE); } return(aborted); }
//added by dongbo huang, this is to set the short address of this node static void set_rime_addr(void) { signed char i; #if CC2530_CONF_MAC_FROM_PRIMARY unsigned char __xdata *macp = &X_IEEE_ADDR; #else unsigned char __code *macp = (__code unsigned char *)0xFFE8; #endif //#if CC2530_CONF_MAC_FROM_PRIMARY // putstring("Reading MAC from Info Page\r\n"); //#else // putstring("Reading MAC from flash\r\n"); /* * The MAC is always stored in 0xFFE8 of the highest BANK of our flash. This * maps to address 0xFFF8 of our CODE segment, when this BANK is selected. * Load the bank, read 8 bytes starting at 0xFFE8 and restore last BANK. * Since we are called from main(), this MUST be BANK1 or something is very * wrong. This code can be used even without a bankable firmware. */ /* Don't interrupt us to make sure no BANK switching happens while working */ // DISABLE_INTERRUPTS(); /* Switch to the BANKn, * map CODE: 0x8000 - 0xFFFF to FLASH: 0xn8000 - 0xnFFFF */ // FMAP = CC2530_LAST_FLASH_BANK; //#endif for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) { rimeaddr_node_addr.u8[i] = *macp; macp++; } #if !CC2530_CONF_MAC_FROM_PRIMARY /* Remap 0x8000 - 0xFFFF to BANK1 */ FMAP = 1; ENABLE_INTERRUPTS(); #endif /* Now the address is stored MSB first */ #if STARTUP_CONF_VERBOSE putstring("Rime configured with address "); for(i = 0; i < RIMEADDR_SIZE - 1; i++) { puthex(rimeaddr_node_addr.u8[i]); putchar(':'); } puthex(rimeaddr_node_addr.u8[i]); putstring("\r\n"); #endif cc2530_rf_set_addr(IEEE802154_PANID); return; }
static int HandleOP(GetTargetName) { if (targetname) putstring(c, targetname); else putstring(c, ""); return 0; }
//------------------------------------------------------------------------------ //原型: //功能:设置回显模式 //参数: //返回: //备注:1-回显 0-不回显 //------------------------------------------------------------------------------ void set_at_echo(u8 f_mod) { if (f_mod) // 1 回显 不需要 { putstring(COM2, "ATE1\r\n"); //enable echo } else // 0 禁止回显 { putstring(COM2, "ATE0\r\n"); //disable echo } }
void macrodump(struct macrotable *node, FILE * f) { if (!node) return; macrodump(node->left, f); putstring(f, node->name); putstring(f, node->definition); putref(f, node->implementor); macrodump(node->right, f); }
/* Print a buffer of n characters */ static void prbuf(register char *s, register int n) { register char c; /* next output character */ register int state; /* next output char's UL state */ #define wouldul(s,n) ((n) >= 2 && (((s)[0] == '_' && (s)[1] == '\b') || ((s)[1] == '\b' && (s)[2] == '_'))) while (--n >= 0) if (!ul_opt) putchar(*s++); else { if (*s == ' ' && pstate == 0 && ulglitch && wouldul(s + 1, n - 1)) { s++; continue; } if ((state = wouldul(s, n)) != 0) { c = (*s == '_') ? s[2] : *s; n -= 2; s += 3; } else c = *s++; if (state != pstate) { if (c == ' ' && state == 0 && ulglitch && wouldul(s, n - 1)) state = 1; else putstring(state ? ULenter : ULexit); } if (c != ' ' || pstate == 0 || state != 0 || ulglitch == 0) #ifdef HAVE_WIDECHAR { wchar_t wc; size_t mblength; mbstate_t mbstate; memset(&mbstate, '\0', sizeof(mbstate_t)); s--; n++; mblength = xmbrtowc(&wc, s, n, &mbstate); while (mblength--) putchar(*s++); n += mblength; } #else putchar(c); #endif /* HAVE_WIDECHAR */ if (state && *chUL) { putsout(chBS); putstring(chUL); } pstate = state; } }
/* * play recursively - possible stack overflow if subdirectories too nested */ void play(FatReader &dir) { FatReader file; while (dir.readDir(dirBuf) > 0) { // Read every file in the directory one at a time // Skip it if not a subdirectory and not a .WAV file if (!DIR_IS_SUBDIR(dirBuf) && strncmp_P((char *)&dirBuf.name[8], PSTR("WAV"), 3)) { continue; } Serial.println(); // clear out a new line for (uint8_t i = 0; i < dirLevel; i++) { Serial.write(' '); // this is for prettyprinting, put spaces in front } if (!file.open(vol, dirBuf)) { // open the file in the directory error("file.open failed"); // something went wrong } if (file.isDir()) { // check if we opened a new directory putstring("Subdir: "); printEntryName(dirBuf); Serial.println(); dirLevel += 2; // add more spaces // play files in subdirectory play(file); // recursive! dirLevel -= 2; } else { // Aha! we found a file that isnt a directory putstring("Playing "); printEntryName(dirBuf); // print it out if (!wave.create(file)) { // Figure out, is it a WAV proper? putstring(" Not a valid WAV"); // ok skip it } else { Serial.println(); // Hooray it IS a WAV proper! wave.play(); // make some noise! uint8_t n = 0; while (wave.isplaying) {// playing occurs in interrupts, so we print dots in realtime putstring("."); if (!(++n % 32))Serial.println(); delay(100); } sdErrorCheck(); // everything OK? // if (wave.errors)Serial.println(wave.errors); // wave decoding errors } } } }
void set_alarm(void) { uint8_t mode = init_set_menu(1); while (!check_timeout()) { if (just_pressed & 0x2) { just_pressed = 0; screenmutex++; if (mode == SET_ALARM) { DEBUG(putstring("Set alarm hour")); // ok now its selected mode = SET_HOUR; // display instructions below print_menu_opts("change hr.","set hour"); } else if (mode == SET_HOUR) { DEBUG(putstring("Set alarm min")); mode = SET_MIN; // print the hour normal // display instructions below print_menu_opts("change min","set mins"); } else { mode = SET_ALARM; // print the hour normal // display instructions below print_menu_advance(); } print_alarmline(mode); screenmutex--; } if ((just_pressed & 0x4) || (pressed & 0x4)) { just_pressed = 0; screenmutex++; if (mode == SET_HOUR) { alarm_h = (alarm_h+1) % 24; // print the hour inverted eeprom_write_byte(&EE_ALARM_HOUR, alarm_h); } if (mode == SET_MIN) { alarm_m = (alarm_m+1) % 60; eeprom_write_byte(&EE_ALARM_MIN, alarm_m); } print_alarmline(mode); screenmutex--; if (pressed & 0x4) delay_ms(200); } } }
/*---------------------------------------------------------------------------*/ static void tcpip_handler(void) { leds_on(LEDS_GREEN); if(uip_newdata()) { putstring("0x"); puthex(uip_datalen()); putstring(" bytes response=0x"); puthex((*(uint16_t *) uip_appdata) >> 8); puthex((*(uint16_t *) uip_appdata) & 0xFF); putchar('\n'); } leds_off(LEDS_GREEN); return; }
int main(void) { char t[2]; int b; b = 10; t[1] = 0; while (b) { f(48+b-1, t); putstring(t); b = b - 1; } f('\n', t); putstring(t); }
int main (void) { int i; char space[2]; char cr[2]; space[0] = ' '; space[1] = 0; cr[0] = '\n'; cr[1] = 0; i = 0; while (i<=12) { putint(i); putstring(space); putint(fib(i)); putstring(cr); i = i + 1; } }
static int print_doc_msg_func(int pnum, int num_pages) { char temp[10]; int key; if ( pnum == -1 ) /* successful completion */ { static FCODE msg[] = {"Done -- Press any key"}; buzzer(0); putstringcenter(7, 0, 80, C_HELP_LINK, msg); getakey(); return (0); } if ( pnum == -2 ) /* aborted */ { static FCODE msg[] = {"Aborted -- Press any key"}; buzzer(1); putstringcenter(7, 0, 80, C_HELP_LINK, msg); getakey(); return (0); } if (pnum == 0) /* initialization */ { static FCODE msg[] = {"Generating FRACTINT.DOC"}; helptitle(); printinstr(); setattr(2, 0, C_HELP_BODY, 80*22); putstringcenter(1, 0, 80, C_HELP_HDG, msg); putstring(7, 30, C_HELP_BODY, "Completed:"); movecursor(25,80); /* hide cursor */ } sprintf(temp, "%d%%", (int)( (100.0 / num_pages) * pnum ) ); putstring(7, 41, C_HELP_LINK, temp); while ( keypressed() ) { key = getakey(); if ( key == ESC ) return (0); /* user abort */ } return (1); /* AOK -- continue */ }
static int authuser(Conn *c) { int i; Msg *m; m = allocmsg(c, SSH_CMSG_USER, 4+strlen(c->user)); putstring(m, c->user); sendmsg(m); m = recvmsg(c, -1); switch(m->type){ case SSH_SMSG_SUCCESS: free(m); return 0; case SSH_SMSG_FAILURE: free(m); break; default: badmsg(m, 0); } for(i=0; i<c->nokauth; i++){ debug(DBG_AUTH, "authmask %#lux, consider %s (%#x)\n", c->authmask, c->okauth[i]->name, 1<<c->okauth[i]->id); if(c->authmask & (1<<c->okauth[i]->id)) if((*c->okauth[i]->fn)(c) == 0) return 0; } debug(DBG_AUTH, "no auth methods worked; (authmask=%#lux)\n", c->authmask); return -1; }
uint16_t sd_raw_read_start(uint32_t offset, uint8_t* buffer, uint16_t length) { uint32_t block_address; if (currentblockoffset != 0xFFFF) { putstring("YEEEK"); while (1); } if (length > 512) length = 512; /* determine byte count to read at once */ block_address = offset & 0xfffffe00; // putstring("\n\raddr "); uart_putdw_hex(block_address); /* address card */ select_card(); /* send single block request */ if(sd_raw_send_command_r1(CMD_READ_SINGLE_BLOCK, block_address)) { unselect_card(); return 0; } /* wait for data block (start byte 0xfe) */ while(sd_raw_rec_byte() != 0xfe); /* read byte block */ for(currentblockoffset = 0; currentblockoffset < length; ++currentblockoffset) { *buffer++ = sd_raw_rec_byte(); //uart_putc(b); } return length; }
bool shutdown_mg323( ) { u8 retry; u8 respond_str[AT_CMD_LENGTH]; for ( retry = 0 ;retry < 3 ; retry++) { putstring(COM2,"AT^SMSO\r\n"); memset(respond_str, 0x0, AT_CMD_LENGTH); if ( my_icar.stm32_u2_rx.empty ) {//no data... OSTimeDlyHMSM(0, 0, 0, 100); } while ( !my_icar.stm32_u2_rx.empty ) {//have data ... if ( get_respond(respond_str) ) { //debug_gsm("Res_str:%s\r\n",respond_str); if (strstr((char *)respond_str,"ERROR")) { return false; } if (strstr((char *)respond_str,"SHUTDOWN")) { return true; } } else { debug_gsm("CMD:AT^SMSO no respond, timeout\r\n"); } } OSTimeDlyHMSM(0, 0, 1, 0); } return false ; }
bool close_tcp_conn( ) { u8 retry; u8 respond_str[AT_CMD_LENGTH]; prompt("Max. stack @ %08X\r\n",&respond_str[AT_CMD_LENGTH-1]); for ( retry = 0 ;retry < 3 ; retry++) { putstring(COM2,"AT^SISC=0\r\n"); memset(respond_str, 0x0, AT_CMD_LENGTH); if ( my_icar.stm32_u2_rx.empty ) {//no data... OSTimeDlyHMSM(0, 0, 0, 100); } while ( !my_icar.stm32_u2_rx.empty ) {//have data ... if ( get_respond(respond_str) ) { //debug_gsm("Res_str:%s\r\n",respond_str); if (strstr((char *)respond_str,"ERROR")) { return false; } if (strstr((char *)respond_str,"OK\r\n")) { return true; } } else { debug_gsm("CMD:AT^SISC no respond, timeout\r\n"); } } OSTimeDlyHMSM(0, 0, 1, 0); } return false ; }
u8 check_tcp_status( ) { u8 retry; u8 respond_str[AT_CMD_LENGTH]; for ( retry = 0 ;retry < 3 ; retry++) { putstring(COM2,"AT^SISI?\r\n"); memset(respond_str, 0x0, AT_CMD_LENGTH); if ( my_icar.stm32_u2_rx.empty ) {//no data... OSTimeDlyHMSM(0, 0, 0, 100); } while ( !my_icar.stm32_u2_rx.empty ) {//have data ... if ( get_respond(respond_str) ) { //debug_gsm("Res_str:%s\r\n",respond_str); if (strstr((char *)respond_str,"ERROR")) { return false; } if (strstr((char *)respond_str,"SISI: 0,")) { //^SISI: 0,2,0,0,0,0 return respond_str[9]-0x30; } } else { debug_gsm("CMD:AT^SISI no respond, timeout\r\n"); } } OSTimeDlyHMSM(0, 0, 1, 0); } return false ; }