/** * Busca en todos los comandos posibles para autocomplar el texto. */ char* Console::Generator(const char* text, int state) { //Obtengo todos los comandos posibles. tVecStr cmd = GetAllCommands(); static int len; static size_t index; string empty = EMPTY; string name = EMPTY; if (!state) { index = 0; len = strlen (text); } while(index < cmd.size()) { name = cmd[index]; if(name.compare(0,len,text)==0) { index++; return StrToChar(name); } index++; } //Si ya verifico todos los comandos y no encontro nada //retorno null. return ((char *)NULL); }
unsigned char is_gateway_busy(void) { unsigned char i; //unsigned char current; for(i=0;i<DEEP;i++) { if(scs_frame[i].finished) { scs_frame[i].finished = 0; switch(StrToChar(&scs_frame[i].byte[1])) { case 0x00: //scs_frame[current].finished = 0; return 0x02; case 0x01: return 0x01; case 0x07: return 0x07; case 0x08: if(StrToChar(&scs_frame[i].byte[3]) == 2 || StrToChar(&scs_frame[i].byte[3]) == 3) return 1; break; case 0x13: return 0x13; case 0x22: return 1; default: break; } } } return 0; }
unsigned char decode_id(void) { unsigned char i; unsigned char buffer[3]; //static unsigned char ID_buffer[8]; volatile unsigned char current = 0xFF; for(i=0;i<DEEP;i++) { if(scs_frame[i].finished) { current = i; break; } } if(scs_frame[current].finished && current != 0xFF) { switch(StrToChar(&scs_frame[current].byte[1])) { case 0x18: for(i=0;i<16;i++) { g_reception_buffer[i] = scs_frame[current].byte[i+3]; } for(i=0;i<8;i++) { buffer[0] = g_reception_buffer[i * 2]; buffer[1] = g_reception_buffer[i * 2 + 1]; buffer[2] = 0; g_asc_reception_buffer[i] = StrToChar(buffer); } switch(g_asc_reception_buffer[0]) { case 0xD0: if(g_reception_buffer[6] == '0' || g_reception_buffer[6] == 'F') id_frame(); break; default:break; } break; default: scs_frame[current].finished = 0; if(state.id_setting == 1) { if( Time_delay.timer_flex.time_out == 1 ) { state.id_setting = 0; send_frame_pp_ext_broad("D000010E00000000",TRANS_DELAY); asm("nop"); } } return 1; } } scs_frame[current].finished = 0; return 0; }
unsigned char decode_SCS(void) { volatile unsigned char current = 0xFF; unsigned char i; unsigned char buffer[3]; //unsigned char current; for(i=0;i<DEEP;i++) { if(scs_frame[i].finished) { current = i; break; } } if(scs_frame[current].finished && current != 0xFF) { switch(StrToChar(&scs_frame[current].byte[1])) { case 0x00: break; case 0x01: break; case 0x07: break; case 0x17: for(i=0;i<8;i++) { g_short_buffer[i] = scs_frame[current].byte[i+3]; } for(i=0;i<4;i++) { buffer[0] = g_short_buffer[i * 2]; buffer[1] = g_short_buffer[i * 2 + 1]; buffer[2] = 0; g_asc_short_buffer[i] = StrToChar(buffer); } break; case 0x18: for(i=0;i<16;i++) { g_reception_buffer[i] = scs_frame[current].byte[i+3]; } for(i=0;i<8;i++) { buffer[0] = g_reception_buffer[i * 2]; buffer[1] = g_reception_buffer[i * 2 + 1]; buffer[2] = 0; g_asc_reception_buffer[i] = StrToChar(buffer); } break; default: scs_frame[current].finished = 0; return 1; } } scs_frame[current].finished = 0; return 0; }