/*—————————————————————————— * 文 件 名:Cmd.c * 日 期:2013-12-30 * 文件说明:控制台主文件 *——————————————————————————*/ #include "Cmd.h" #include #include "include.h" #include "debug_printf.h" #include "Rtc.h" #include "addr.h" #include "uart.h" #include "storage.h" #include "apl.h" #include "PHY.h" #include "rtc_ext.h" #include "update.h" u8 buf[10]; extern u8 tedtbuf[150]; extern u16 resettime;//系统复位次数 extern u8 g_DebugRxBuffer[]; extern struct st_uart_port COM_MBUS_MASTER_port; //extern struct st_uart_port COM_MBUS_SLAVE_port; extern struct st_uart_port COM_PLC_port; extern struct st_uart_port COM_485_port; void e5e50000_tx(void); void e5e50001_tx(void); void irda_tx(void); void auto_sync_list_meters(void); void read_ext_rtc(void); void set_ext_rtc(void); void read_mtype(void); void ctrl_12v_pow(void); void PrintfMonitorWaterMeterDataFrame( void ); void ClearXYDataFrameStore(void); void ClearMeterInfo( void ); void startsjreadmeter( void ); void ReadSystemMeterAddrList( void ); sCmd CmdList[] = { {"writeaddr",set_local_addr,""}, {"readaddr",read_local_addr,""}, {"simulplc",simul_plc_rx,""}, {"addlist",add_list_node,""}, {"addflash",add_in_flash,""}, {"scanlist",scan_list,""}, {"setmpow",set_mbus_power,""}, {"getmpow", read_mbus_power,""}, {"simultx",simul_read_meter,""}, {"ver", ReadVersion,""}, {"reboot",SysReset,""}, {"mdirect",mbus_direct_tx,""}, {"port",scan_ports,""}, {"setmport",set_mbus_port,""}, {"setmaintain", write_maintain,""}, {"readmaintain", read_maintain,""}, {"readmconfig",read_curent_protocl,""}, {"closepr",close_printf,""}, {"openpr",open_printf,""}, {"setmconfig",set_gMeterConfig,""}, {"readxywaf",PrintfMonitorWaterMeterDataFrame,""}, {"clearxywaf",ClearXYDataFrameStore,""}, {"transparent", transparent_Proc,""}, {"ReadWMAddr",ReadSystemMeterAddrList,"Read Water Meter ADDR And Data List"}, {"clearminfo",ClearMeterInfo,"Clear Water Meter ADDR And Data List"}, {"settime",set_ext_rtc,""}, {"readtime",read_ext_rtc,""}, {"irda",irda_tx,""}, {"auto",auto_sync_list_meters,""}, {"setrtc",set_ext_rtc,""}, {"readrtc",read_ext_rtc,""}, {"mtype", read_mtype,""}, {"ctr12v",ctrl_12v_pow,""}, {"ls", ListCmd,""} }; u8 CmdListLen = sizeof(CmdList) / sizeof(sCmd); /*—————————————————————————— * 函 数 名:Cmd_Proc * 输入参数:None * 输出参数:None * 返 回 值:None * 功能说明:控制台任务调度 *——————————————————————————*/ void Cmd_Proc(void) { if (get_debugBuf_len() > 0) { Cmd_Exe(); printf("C>"); } else { printf("\r\ncommand length error!\r\n"); } } u8 find_cmd_length(u8 * buf) { for (u8 i = 0; i < 255; i++) { if ((buf[i] == ' ') || (buf[i] == '\r') || (buf[i] == '\n')) { return i; } } return 0; } /*—————————————————————————— * 函 数 名:Cmd_Exe * 输入参数:None * 输出参数:None * 返 回 值:None * 功能说明:控制台执行 *——————————————————————————*/ void Cmd_Exe(void) { //u32 time_t = 0; u8 commandLength = 0; u8 commandByte = 0; const u8 *command; bool match = TRUE; u8 input_cmd_len; // go through each command for (u8 i = 0; i < CmdListLen; i++) { // get the command command = CmdList[i].cmd; // get the length of the cmd commandLength = 0; commandByte = CmdList[i].cmd[0]; while (commandByte != 0) { commandLength++; commandByte = CmdList[i].cmd[commandLength]; } match = TRUE; // check for differences in the command and what was entered input_cmd_len = find_cmd_length(g_DebugRxBuffer); if (input_cmd_len != commandLength) { match = FALSE; continue; } for (u8 j = 0; j < commandLength; j++) { if (command[j] != g_DebugRxBuffer[j]) { match = FALSE; break; } } // commands with 0 length are invalid if (commandLength < 1) { match = FALSE; } // if command matches command entered call the callback if (match) { //time_t = GetSysTime(); //LIST(printf("\r\n");); (CmdList[i].action)(); //LIST(printf("it has taken %d ms\r\n", GetSysTime() - time_t);); //DISP(printf("CMD: 耗时%dms\r\n",GetSysTime() - time_t);); break; } } if (!match) { if((g_DebugRxBuffer[0] != '\r') && (g_DebugRxBuffer[0] != '\n')) { //LIST(printf("\r\ncommand not recognized\r\n");); LIST(printf("CMD: 不支持命令\r\n");); } else { LIST(printf("\r\n");); } } } /*—————————————————————————— * 函 数 名:CharToU8 * 输入参数:None * 输出参数:None * 返 回 值:None * 功能说明:ASII码字符数据转换成u8型 *——————————————————————————*/ u8 CharToU8(u8 data) { if ('0' <= data && data <= '9') { return data - '0'; } else if ('a' <= data && data <= 'f') { return data - 'a' + 10; } else if ('A' <= data && data <= 'F') { return data - 'A' + 10; } else { return 0; } } /*—————————————————————————— * 函 数 名:GetU8Para * 输入参数:None * 输出参数:None * 返 回 值:None * 功能说明:控制台获取数据 *——————————————————————————*/ void GetU8Para(u8 *para,u8 index) { u8 i = 0; for(u16 j=0;j 5) { break; } } length = finger-header; if((*header) == '-') { startPos = 1; } for(i=length;i>startPos;i--) { finger--; placeVal = (*finger) - 48; value = value + (digitMod * placeVal); digitMod = digitMod * 10; } if(startPos == 1) { value = 65536 - value; } length=0; break; } } } *para = value; return; } /*—————————————————————————— * 函 数 名:GetStrPara * 输入参数:None * 输出参数:None * 返 回 值:None * 功能说明:控制台获取数据 *——————————————————————————*/ u8 GetStrPara(u8* buffer, u8 index) { u8 i = 0; u8 len = 0; u8* buf = buffer; u16 j = 0; u16 length = get_debugBuf_len(); for(j=0; j 99) { year = 10; } if (month == 0 || month > 12) { month = 1; } if (day == 0 || day > 31) { day = 1; } if (hour >= 24) { hour = 0; } if (minute >= 60) { minute = 0; } if (second >= 60) { second = 0; } Time_Set(year, month, day, hour, minute, second); } /*—————————————————————————— * 函 数 名:GetTime * 输入参数:None * 输出参数:None * 返 回 值:None * 功能说明:获取系统时钟 *——————————————————————————*/ void GetTime(void) { Time_Get(); } /*—————————————————————————— * 函 数 名:ListCmd * 输入参数:None * 输出参数:None * 返 回 值:None * 功能说明:打印控制台命令 *——————————————————————————*/ void ListCmd(void) { u8 i; for (i=0; i 48) { printf("can not exceed 48 hour\r\n"); } else { set_maintain_time((u16)tir); getval = read_maintain_time(); printf("maintian time = %d\r\n", getval); } } void read_maintain(void) { u16 getval; getval = read_maintain_time(); printf("maintian time = %d\r\n", getval); } void lora_cmd_tx(void ) { u8 length; GetU8Para(&length,1); mac_data_req(tedtbuf, length); } void release_debug(void) { } /***************************************************************************** * Function : set_gMeterConfig * Description : none * Input : void * Output : None * Return : * Others : * Record * 1.Date : 20170424 * Author : barry * Modification: Created function *****************************************************************************/ void set_gMeterConfig(void) { u8 protl; GetU8Para(&protl,1); set_curent_protocl(protl); read_curent_protocl(); } /***************************************************************************** * Function : e5e50000_tx * Description : none * e5e50000 0 0x0b ...//auto even * e5e50000 0 0x03 ...//auto none * e5e50000 0 0x4b ...//2400 even * e5e50000 0 0x43 ...//2400 none * e5e50000 0 0x2b ...//1200 even * e5e50000 0 0x23 ...//1200 none * e5e50000 0 0x4b 49030325220000 6810490303252200000103901f00c116 * Input : void * Output : None * Return : * Others : * Record * 1.Date : 20170524 * Author : barry * Modification: Created function *****************************************************************************/ void e5e50000_tx(void) { u8 port; u8 config; u8 id[20]; u8 str[100]; u8 buf[100]; u8 length; ST_E5E50000_packet *e5e50000_ptr = (ST_E5E50000_packet *)buf; GetU8Para(&port,1); GetU8Para(&config,2); GetStrPara((u8*)id,3); GetStrPara((u8*)str,4); change_string_to_arry16((char*)id); length = change_string_to_arry16((char*)str); e5e50000_ptr->start68 = 0x68; read_addr(e5e50000_ptr->id); e5e50000_ptr->end68 = 0x68; e5e50000_ptr->ctrl = 0x11; e5e50000_ptr->len = 14 + length; e5e50000_ptr->DI[0] = 0x33; e5e50000_ptr->DI[1] = 0x33; e5e50000_ptr->DI[2] = 0x18; e5e50000_ptr->DI[3] = 0x18; e5e50000_ptr->port = port; e5e50000_ptr->meter_config = config; MemCpy(&e5e50000_ptr->meter_type, id, 8); MemCpy(buf + sizeof(ST_E5E50000_packet), str, length); buf[sizeof(ST_E5E50000_packet) + length] = GetSum(buf, buf[9] +10); buf[sizeof(ST_E5E50000_packet) + length + 1] = 0x16; simulate_mbus_plc_rx(buf, buf[9] +12); } void e5e50001_tx(void) { ST_E5E50001_packet e5e50001_packet; u8 str[30] = {0}; u8 addr[6]; GetStrPara((u8*)str,1); change_string_to_arry16((char*)str); read_addr(addr); e5e50001_packet.start68 = 0x68; memcpy(e5e50001_packet.id, addr, 6); e5e50001_packet.end68 = 0x68; e5e50001_packet.ctrl = 0x11; e5e50001_packet.len = 14 + sizeof(ST_J188_read); e5e50001_packet.DI[0] = 0x34; e5e50001_packet.DI[1] = 0x33; e5e50001_packet.DI[2] = 0x18; e5e50001_packet.DI[3] = 0x18; e5e50001_packet.port = 0x00; e5e50001_packet.port_config = 0x0b; memcpy(&e5e50001_packet.meter_type, str , 8); e5e50001_packet.packet188.head.start68 = 0x68; memcpy(&e5e50001_packet.packet188.head.type, str, 8); e5e50001_packet.packet188.head.ctrl = 0x01; e5e50001_packet.packet188.head.len = 0x03; e5e50001_packet.packet188.head.DI[0] = 0x90; e5e50001_packet.packet188.head.DI[1] = 0x1f; e5e50001_packet.packet188.SER = 0x05; e5e50001_packet.packet188.cs = GetSum(&e5e50001_packet.packet188.head.start68, sizeof(ST_J188_read) -2); e5e50001_packet.packet188.end = 0x16; e5e50001_packet.cs = GetSum(&e5e50001_packet.start68, sizeof(ST_E5E50001_packet)-2 ); e5e50001_packet.end16 = 0x16; simulate_mbus_plc_rx((u8*)&e5e50001_packet, sizeof(ST_E5E50001_packet)); } void irda_tx(void) { u8 irda_buf[] = {0x68, 0x09, 0x13, 0x88, 0x06, 0x00, 0x00, 0x68, 0x11, 0x04, 0x33, 0x33, 0x34, 0x33, 0x5C, 0x16}; IRDA_TX(irda_buf, sizeof(irda_buf)); } //输入是BCD码,星期天是0,星期1-星期6 对应1<<1——1<<6 void set_ext_rtc(void) { st_rtc_ext rtc_dat; GetU8Para(&rtc_dat.year, 1); GetU8Para(&rtc_dat.month, 2); GetU8Para(&rtc_dat.day, 3); GetU8Para(&rtc_dat.hour, 4); GetU8Para(&rtc_dat.min, 5); GetU8Para(&rtc_dat.sec, 6); GetU8Para(&rtc_dat.week, 7); rtc_dat.year = (rtc_dat.year / 10) * 16 + rtc_dat.year % 10; rtc_dat.month = (rtc_dat.month / 10) * 16 + rtc_dat.month % 10; rtc_dat.day = (rtc_dat.day / 10) * 16 + rtc_dat.day % 10; rtc_dat.hour = (rtc_dat.hour / 10) * 16 + rtc_dat.hour % 10; rtc_dat.min = (rtc_dat.min / 10) * 16 + rtc_dat.min % 10; rtc_dat.sec = (rtc_dat.sec / 10) * 16 + rtc_dat.sec % 10; rtc_dat.week = 1<< rtc_dat.week; set_rtc_time( rtc_dat ); read_ext_rtc(); } //输出也是BCD码 void read_ext_rtc(void) { u8 week; st_rtc_ext rtc_dat = {0x00}; read_rtc_time(&rtc_dat); week = (u8)(log(rtc_dat.week) / log(2)); printf("%.2x-%.2x-%.2x %.2x:%.2x:%.2x week-%.2x\r\n", rtc_dat.year, rtc_dat.month, rtc_dat.day, \ rtc_dat.hour, rtc_dat.min, rtc_dat.sec, week); } typedef struct { u8 mtype; u8 *string; }st_mtype; st_mtype mtypelist[] = { {MBUS_901F_2400_E, "标准188 901F"}, {MBUS_1F90_2400_E, "标准188 1F90"}, {MBUS_HHCQ_2400_N, "重庆智能"}, {MBUS_YZSJ_1200_E, "湖南双佳"}, {MBUS_HZJD_1200_E, "杭州竞达"}, {RS485_NJSM_1200_N, "南京水门485"}, {RS485_CS485_2400_E, "长沙485"}, }; void read_mtype(void) { printf("\r\n"); for(u8 i = 0; i < sizeof(mtypelist)/sizeof(st_mtype); i++) { printf("%d %s\r\n", mtypelist[i].mtype, mtypelist[i].string); } } void ctrl_12v_pow(void) { u8 open; GetU8Para(&open,1); if (open) { open_RS485_switch(); printf("open 12V\r\n"); } else { close_RS485_switch(); printf("close 12V\r\n"); } } ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// #if 0 //void sbus_ack(void) //{ // static u8 mbusCmd[] = { 0x68, 0x10, 0x14, 0x64, 0x02, 0x38, 0x00, 0x00, 0x00, 0x81, 0x03, 0x90, 0x1f,0x00, 0x5d, 0x16}; // // open_mbus_switch(); // // hal_UartDMATx(com_MBUS_slave_DMA_cfg, mbusCmd, sizeof(mbusCmd)); // // printf("%d MBUS slave TX:",clock_time()); // printf_buf(mbusCmd, sizeof(mbusCmd)); //} // // // // //void read_update_datas(void) //{ // /* // st_update_params st_update; // // if ( read_update_flash(&st_update) ) // { // printf("totalBytes: %d\r\n",st_update.totalBytes); // printf("total_packets: %d\r\n",st_update.total_packets); // printf("version: %d\r\n",st_update.version); // printf("current_packets: %d\r\n",st_update.current_packets); // printf("received_packets: %d\r\n",st_update.received_packets); // printf("status: %d\r\n",st_update.status); // } // else // { // printf("update crc err\r\n"); // } // */ //} // // // // //void read_local_addr(void) //{ // u8 flashtemp[8]; // // read_addr(flashtemp); // // printf("local addr 0x"); // for (u8 i = 0; i < 6; i++) // { // printf("%.2X", flashtemp[5 -i]); // } // printf("\r\n"); //} // //void read_id(void) //{ // u8 id[12] = {0}; // // read_unique_id( id); // // printf("unique id: "); // // for (u8 i = 0; i < 12; i++) // { // printf("%.2X", id[i]); // } // printf("\r\n"); //} // // //void write_RTC_reg(void) //{ // //} // // // ///* //void add_slave_node_info(void) //{ // u8 meter_id[22]; // // ST_slave_doc node; // // GetStrPara(meter_id, 1); // // change_string_to_arry16((char*)meter_id); // // MemCpy(node.meter_addr, meter_id + 1, 7); // node.meter_type = meter_id[0]; // // add_slave_node(node); //} // // //void read_slave_node_info(void) //{ // u8 meter_id[20]; // ST_slave_doc node; // GetStrPara(meter_id, 1); // // change_string_to_arry16((char*)meter_id); // // if (find_slave_node_from_id(meter_id, &node)) // { // printf("valid = %.2x \r\n", node.valid_node); // printf("meter type = 0x%.2x\r\n",node.meter_type); // // printf("meter_addr :"); // for (u8 i = 0; i< 7; i++) // { // printf(" %.2x", node.meter_addr[i]); // } // } // else // { // printf("slave node not exist\r\n"); // } //} // // //void delete_slave_node_info(void) //{ // u8 meter_id[20]; // // GetStrPara(meter_id, 1); // change_string_to_arry16((char*)meter_id); // // delete_salve_node_from_id(meter_id); //} //*/ // // //void IRDA_debug_tx(void) //{ // u8 irda_buf[] = {0x68, 0x09, 0x13, 0x88, 0x06, 0x00, 0x00, 0x68, 0x11, 0x04, 0x33, 0x33, 0x34, 0x33, 0x5C, 0x16}; // IRDA_TX(irda_buf, sizeof(irda_buf)); //} // // // // // // // // // // // // //void start_self_test(void) //{ // process_start(&TEST_self_process, NULL); //} // // ////输入是BCD码,星期天是0,星期1-星期6 对应1<<1——1<<6 //void set_ext_rtc(void) //{ // st_rtc_ext rtc_dat; // // GetU8Para(&rtc_dat.year, 1); // GetU8Para(&rtc_dat.month, 2); // GetU8Para(&rtc_dat.day, 3); // GetU8Para(&rtc_dat.hour, 4); // GetU8Para(&rtc_dat.min, 5); // GetU8Para(&rtc_dat.sec, 6); // GetU8Para(&rtc_dat.week, 7); // // rtc_dat.year = (rtc_dat.year / 10) * 16 + rtc_dat.year % 10; // rtc_dat.month = (rtc_dat.month / 10) * 16 + rtc_dat.month % 10; // rtc_dat.day = (rtc_dat.day / 10) * 16 + rtc_dat.day % 10; // rtc_dat.hour = (rtc_dat.hour / 10) * 16 + rtc_dat.hour % 10; // rtc_dat.min = (rtc_dat.min / 10) * 16 + rtc_dat.min % 10; // rtc_dat.sec = (rtc_dat.sec / 10) * 16 + rtc_dat.sec % 10; // // rtc_dat.week = 1<< rtc_dat.week; // // set_rtc_time( rtc_dat ); // // printf("OK\r\n"); //} // ////输出也是BCD码 //void read_ext_rtc(void) //{ // u8 week; // // st_rtc_ext rtc_dat; // // read_rtc_time(&rtc_dat); // // week = (u8)(log(rtc_dat.week) / log(2)); // // printf("%.2x-%.2x-%.2x %.2x:%.2x:%.2x week-%.2x\r\n", rtc_dat.year, rtc_dat.month, rtc_dat.day, \ // rtc_dat.hour, rtc_dat.min, rtc_dat.sec, week); //} // // //void read_reg_all(void) //{ // u8 startReg = 0; // u8 endReg = 0; // u8 tempValue; // // GetU8Para(&startReg, 1); // GetU8Para(&endReg, 2); // // for (u8 i = startReg; i<= endReg; i++) // { // if ((i % 10 == 0) && (i > 0)) // { // printf("\r\n"); // } // SX1276Read(i, &tempValue); // printf("%x ", tempValue); // } // printf("\r\n"); //} // //void send_packet(void) //{ // u8 length; // GetU8Para(&length, 1); // #ifndef USE_LORA_MODE // SX1276Fsk_Send_Packet(tedtbuf, length); //#else // SX1276LoRa_Send_Packet(tedtbuf, length); // #endif //} // // // // //void simul_plc_rx(void) //{ // u8 str[30] = {0}; // u8 buf[30]; // u8 addr[6]; // GetStrPara((u8*)str,1); // change_string_to_arry16((char*)str); // // read_addr(addr); // // if (!read_current_HUSF()) // { // buf[0] = 0x68; // memcpy(buf + 1, addr, 6); // buf[7] = 0x68; // // buf[8] = 0x11; // buf[9] = 0x0c; // // buf[10] = 0x00; // buf[11] = 0xFF; // buf[12] = 0x01; // buf[13] = 0x00; // // memcpy(buf + 14, str, 8); // // for (u8 i = 0; i < buf[9]; i++) // { // buf[i+ 10] += 0x33; // } // // buf[buf[9]+ 10] = GetSum(buf, buf[9]+ 10); // buf[buf[9]+11] = 0x16; // simulate_mbus_plc_rx(buf, buf[9]+12); // } // else // { // buf[0] = 0x68; // memcpy(buf + 1, str + 1, 6); // buf[7] = 0x68; // // buf[8] = 0x11; // buf[9] = 0x06; // // buf[10] = 0x1F; // buf[11] = 0x90; // buf[12] = str[7]; // buf[13] = 0x10; // buf[14] = 0x00; // buf[15] = 0x03; // // for (u8 i = 0; i < buf[9]; i++) // { // buf[i+ 10] += 0x33; // } // // buf[buf[9]+ 10] = GetSum(buf, buf[9]+ 10); // buf[buf[9]+11] = 0x16; // simulate_mbus_plc_rx(buf, buf[9]+12); // } //} // // //void simul_plc_frozen(void) //{ // u8 str[30] = {0}; // u8 buf[30]; // u8 addr[6]; // GetStrPara((u8*)str,1); // change_string_to_arry16((char*)str); // // read_addr(addr); // // buf[0] = 0x68; // memcpy(buf + 1, addr, 6); // buf[7] = 0x68; // // buf[8] = 0x11; // buf[9] = 0x0c; // // buf[10] = 0x01; // buf[11] = 0x01; // buf[12] = 0x06; // buf[13] = 0x05; // // memcpy(buf + 14, str, 8); // // for (u8 i = 0; i < buf[9]; i++) // { // buf[i+ 10] += 0x33; // } // // buf[buf[9]+ 10] = GetSum(buf, buf[9]+ 10); // buf[buf[9]+11] = 0x16; // simulate_mbus_plc_rx(buf, buf[9]+12); //} // // //void simul_slave_rx(void) //{ // // u8 str[30] = {0}; // u8 addr[7]; // GetStrPara((u8*)str,1); // change_string_to_arry16((char*)str); // // memcpy(addr, str + 1, 7); // // simulate_mbus_slave_rx(addr, 7); //} // //void read_meter(void) //{ // u8 buf[] = {0x68, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x68, 0x11, 0x04, 0x33, 0x33, 0x34, 0x33, 0xAE, 0x16 }; // // simulate_mbus_plc_rx(buf, buf[9]+12); //} // // // //void set_gMeterConfig(void) //{ // u8 temp_confirmed; // u8 temp_config; // // bool saved_confirmed_val; // // GetU8Para(&temp_confirmed, 1); // GetU8Para(&temp_config, 2); // // saved_confirmed_val = (bool)temp_confirmed; // // if (set_meter_config_info((bool)temp_confirmed, temp_config)) // { // if (read_meter_config(&temp_confirmed, &temp_config)) // { // printf("confirmed = %d, g_meterConfig = %d\r\n", (u8)temp_confirmed, temp_config); // // if (saved_confirmed_val) // { // process_post(&PLC_find_type_process, PROCESS_EVENT_EXIT, NULL); // } // else // { // process_post(&PLC_Moudel_process, PROCESS_EVENT_EXIT, NULL); // } // // } // else // { // printf("read from flash err\r\n"); // } // } // else // { // printf("set meter config err\r\n"); // } //} // // // // //void read_gMeterConfig(void) //{ // u8 temp_confirmed; // u8 temp_config; // // if (read_meter_config(&temp_confirmed, &temp_config)) // { // printf("confirmed = %d, g_meterConfig = %d\r\n", (u8)temp_confirmed, temp_config); // } // else // { // printf("read from flash err\r\n"); // } //} // //void del_meter_data(void) //{ // u8 str[30] = {0}; // GetStrPara((u8*)str,1); // change_string_to_arry16((char*)str); // delete_meter_data(str); // printf("delete finish\r\n"); //} // //void manual_add_meter_data(void) //{ // u8 str[20] = {0}; //addr // u8 p_data[12] = {0}; //addr // u8 success = 0; // // struct st_meter_temp_value tempNode; // // GetStrPara((u8*)str,1); // GetU8Para(&success,2); // GetStrPara((u8*)p_data,3); // change_string_to_arry16((char*)str); // change_string_to_arry16((char*)p_data); // // MemCpy(tempNode.id, str, 7); // MemCpy(tempNode.data + 1, p_data, 4); // tempNode.data[0] = 0x2C; // // tempNode.valid = 1; // tempNode.status = (success == 0)? READ_METER_FAILED : READ_METER_OK; // tempNode.failed_count = 0; // // tempNode.exp_time = clock_time() + 3600000*2; // // if (add_meter_in_list(tempNode)) // { // printf("add node ok\r\n"); // } // else // { // printf("add node failed\r\n"); // } //} // //void write_maintain(void) //{ // u8 tir; // u16 getval; // GetU8Para(&tir,1); // // if (tir > 48) // { // printf("can not exceed 48 hour\r\n"); // } // else // { // set_maintain_time((u16)tir); // // if (read_maintain_time(&getval)) // { // printf("maintian time = %d\r\n", getval); // } // else // { // printf("write maintain time err\r\n"); // } // } //} // // //void read_maintain(void) //{ // u16 val; // // if (read_maintain_time(&val)) // { // printf("maintian time = %d\r\n", val); // } // else // { // printf("read eeprom err\r\n"); // } // //} // //void set_version_of_HBSF(void) //{ // bool ver_HBSF; // // GetU8Para((u8*)&ver_HBSF,1); // // set_HBSF_version(ver_HBSF); // // if (get_HBSF_version()) // { // printf("set HBSF true\r\n"); // } // else // { // printf("set HBSF false\r\n"); // } //} // // //void read_version_of_HBSF(void) //{ // if (get_HBSF_version()) // { // printf(" HBSF true\r\n"); // } // else // { // printf(" HBSF false\r\n"); // } //} #endif