diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym index 630ec58..e775c54 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab index b920929..a470386 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad index 15f9615..6b3c0f3 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc index 3fd7e2d..f232641 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf index ff93a37..f397539 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr index 3d029cc..c2bdb18 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb index 0b3a23c..af87b0c 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd index 031ed26..55c8804 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd and b/si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd differ diff --git a/si4/soft_gsm_main.si4project/soft_gsm_main.siwork b/si4/soft_gsm_main.si4project/soft_gsm_main.siwork index 230c2cf..1139a9a 100644 Binary files a/si4/soft_gsm_main.si4project/soft_gsm_main.siwork and b/si4/soft_gsm_main.si4project/soft_gsm_main.siwork differ diff --git a/source/app/app_common.c b/source/app/app_common.c index 87e8751..6fe471d 100644 --- a/source/app/app_common.c +++ b/source/app/app_common.c @@ -9,6 +9,57 @@ struct printer_maintenance_global G; U8 ccmodbus_len = 0; +#define KEY_RFID_MAP_SIZE 26 +U32 code key_rfid_map[KEY_RFID_MAP_SIZE] = +{ + /// key, rfid + //0x01,1, ///S1 ///key_map[0] key_map[1] + //0x02,11, ///S2 ///key_map[n] key_map[n+1] + 0x03,0x01000001, ///呼叫 + 0x04,0x02000001, ///分诊 + 0x08,0x01000003, ///一线 + 0x09,0x01000004, ///采血 + 0x0a,0x01000005, ///心电 + 0x0B,0x02000003, ///CT + 0x0f,0x01000007, ///二线 + 0x10,0x01000008, ///谈话 + 0x11,0x01000009, ///签字 + 0x12,0x0100000A, ///团注 + 0x16,0x02000005, ///介入 + 0x17,0x0100000C, ///置鞘(穿刺) + 0x18,0x0100000D, ///病房 + //0x1d,9, ///S16 + //0x1f,10, ///S17 + //0x1e,0 /// 清零按键,无需亮灯 +}; + +U32 key_rfid_map_out(U32 key) +{ + U8 n; + for(n = 0; n < KEY_RFID_MAP_SIZE; n+=2) + { + if(key == key_rfid_map[n]) + { + return key_rfid_map[n+1]; + } + } + return 0; +} + +U32 rfid_key_map_out(U32 rfid) +{ + U8 n; + for(n = 0; n < KEY_RFID_MAP_SIZE; n+=2) + { + if(rfid == key_rfid_map[n+1]) + { + return key_rfid_map[n]; + } + } + return 0; +} + + void L2_register_init() { U8 i = 0; @@ -23,7 +74,7 @@ void L2_register_init() G.jing_weight = 0; G.thrombolytic_val = G.bolus_val = G.hold_val = 0; G.asga.xaxis = G.asga.yaxis = G.asga.zaxis = 0; - G.rfid = 0; + G.rfidval = G.rfidHospitalNo = 0; for(i=0;i<4;i++) { @@ -59,7 +110,7 @@ void L2_register_init() G.md_slaver_info[3].reg = 0x07; G.md_slaver_info[3].regnum = 0x01; G.md_slaver_info[3].bytes = G.md_slaver_info[3].regnum * 2; - G.md_slaver_info[3].buf = (U8*)&G.rfid; + G.md_slaver_info[3].buf = (U8*)&G._key; G.md_slaver_info[3].mask = 0; G.md_slaver_info[4].slaver = SLAVER_SHOW01_ID; //显示板按键 @@ -111,7 +162,7 @@ void L2_register_init() G.ccmd_slaver_info[3].slaver = SLAVER_TCP_SERVER_ID; //服务? G.ccmd_slaver_info[3].oper = MODBUS_OPER_WRITE_M; G.ccmd_slaver_info[3].reg = 0x10; - G.ccmd_slaver_info[3].regnum = 0x11; + G.ccmd_slaver_info[3].regnum = 0x13; G.ccmd_slaver_info[3].bytes = G.ccmd_slaver_info[3].regnum * 2; G.ccmd_slaver_info[3].buf = (U8*)&G.jing_weight; G.ccmd_slaver_info[3].mask = 0; @@ -121,7 +172,7 @@ void L2_register_init() G.flowStarted = 0; G.flowStartVal = 1; - G._keyled = G._rfid = 0; + G._keyled = G._key = 0; G.reset = 0; G.debug = 0; diff --git a/source/app/app_common.h b/source/app/app_common.h index 9455aca..24ef1d0 100644 --- a/source/app/app_common.h +++ b/source/app/app_common.h @@ -6,6 +6,8 @@ #include "../tpc/tpc_modbus.h" #include "../tpc/tpc_ccmodbus.h" +#define D_CAR_HOSPITAL_NO 0x0001 + #define APP_VERSION_HEX 0x20 //高4位主版本,低4位次版本 // #define BOARD_MAIN03_A9 @@ -132,7 +134,7 @@ typedef struct printer_maintenance_global U16 bolus_val; U16 hold_val; CCAsGaInfo asga; - U16 rfid; + U8 rfid[6]; S32 weight[4]; //U16 reserved2[16 - 9]; @@ -148,13 +150,15 @@ typedef struct printer_maintenance_global U8 ccid_passwd[22]; //保存ccid密码空间 21+'\0' TS_BoardStatus boardstatus; U8 _keyled; - U8 _rfid; + U16 _key; S32 pi_weight; S32 total_weight; CCAsGaInfo asga_02; U8 reset; U8 debug; + U32 rfidval; + U16 rfidHospitalNo; }PMGlobal; //寄存器内存基地址 @@ -171,6 +175,8 @@ extern void L3_protocol_handler_uart4_fun(U8 *pPara); extern void L3_protocol_handler_uart0_fun(TS_PH3_ccmodbus *ccmodbus); extern void L2_do_board_reset(void); extern void L2_do_gm35_reset(void); +extern U32 rfid_key_map_out(U32 rfid); +extern U32 key_rfid_map_out(U32 key); #endif diff --git a/source/app/app_drv.c b/source/app/app_drv.c index 0a5d002..c68fb44 100644 --- a/source/app/app_drv.c +++ b/source/app/app_drv.c @@ -90,6 +90,7 @@ void L3_UARTcom0_exp_protocol(TS_Handle_PH3 *p) { switch(p->ts_ccmodbus.slaver) { + #if 0 case SLAVER_RFID: L0_uart0_uc('r'); L0_uart0_uchex(p->ts_ccmodbus.buf[0]); @@ -98,6 +99,7 @@ void L3_UARTcom0_exp_protocol(TS_Handle_PH3 *p) G.rfid = G._rfid = p->ts_ccmodbus.buf[0]; } break; + #endif case SLAVER_COM0: L3_protocol_handler_uart0_fun(&p->ts_ccmodbus); break; @@ -115,12 +117,17 @@ void L3_UARTcom3_exp_protocol(TS_Handle_PH3 *p) if(L3_checkCrc16(&p->ts_ccmodbus)) { L0_uart0_uc('r'); - L0_uart0_uchex(p->ts_ccmodbus.buf[0]); + L0_uart0_uchex(p->ts_ccmodbus.buf[5]); - if(p->ts_ccmodbus.buf[0] != G._rfid) //rfid发生改变 - { - G.rfid = G._rfid = p->ts_ccmodbus.buf[0]; - } + //G.rfid = G._rfid = p->ts_ccmodbus.buf[0]; + G.rfid[0] = p->ts_ccmodbus.buf[0]; + G.rfid[1] = p->ts_ccmodbus.buf[1]; + G.rfid[2] = p->ts_ccmodbus.buf[2]; + G.rfid[3] = p->ts_ccmodbus.buf[3]; + G.rfid[4] = p->ts_ccmodbus.buf[4]; + G.rfid[5] = p->ts_ccmodbus.buf[5]; + G.rfidval = (U32)G.rfid[2] << 24 | (U32)G.rfid[3]<<16 | (U32)G.rfid[4]<<8 | (U32)G.rfid[5]; + G.rfidHospitalNo = (U32)G.rfid[0] << 8 | (U32)G.rfid[1]<<0; } p->ok = 0; } diff --git a/source/app/app_task_485.c b/source/app/app_task_485.c index d0e06cb..3a08d7e 100644 --- a/source/app/app_task_485.c +++ b/source/app/app_task_485.c @@ -88,15 +88,22 @@ void L3_task_485_handle(TS_485 *s) { //TODO } - else if(G._keyled == 0x28) + else if(G._keyled == 0x1e) { L0_uart0_uc('#'); G.pi_weight = G.total_weight; } - } - else - { - G.rfid = G._keyled; + else + { + //G.rfid = G._keyled; + U32 rfid = key_rfid_map_out(G._keyled); + G.rfid[0] = D_CAR_HOSPITAL_NO >> 8 & 0xFF; + G.rfid[0] = D_CAR_HOSPITAL_NO >> 0 & 0xFF;; + G.rfid[2] = rfid >> 24 & 0xFF; + G.rfid[3] = rfid >> 16 & 0xFF; + G.rfid[4] = rfid >> 8 & 0xFF; + G.rfid[5] = rfid >> 0 & 0xFF; + } } break; case 5: diff --git a/source/app/app_task_485_control.c b/source/app/app_task_485_control.c index 6381bb1..87ead66 100644 --- a/source/app/app_task_485_control.c +++ b/source/app/app_task_485_control.c @@ -46,10 +46,11 @@ void L3_task_485_control_handle(TS_485_control *s) s->total_weight_pool = G.jing_weight; } - if(s->rfid_pool != G.rfid) + if(G.rfidHospitalNo == D_CAR_HOSPITAL_NO && s->rfid_pool != G.rfidval) { G.md_slaver_info[3].mask = 1; - s->rfid_pool = G.rfid; + G._key = (U16)rfid_key_map_out(G.rfidval); + s->rfid_pool = G.rfidval; } #endif L2_task_go(D_task_485_control_01); diff --git a/source/app/app_task_485_control.h b/source/app/app_task_485_control.h index 5b6d638..8706603 100644 --- a/source/app/app_task_485_control.h +++ b/source/app/app_task_485_control.h @@ -9,7 +9,7 @@ typedef struct { TS_task task; S32 total_weight_pool; - U16 rfid_pool; + U32 rfid_pool; }TS_485_control; extern TS_485_control ts_485_control; diff --git a/source/app/app_task_rfid.c b/source/app/app_task_rfid.c index 628b937..cb1408f 100644 --- a/source/app/app_task_rfid.c +++ b/source/app/app_task_rfid.c @@ -22,7 +22,7 @@ void L1_enable_rfid() { //L0_uart0_sendArray(rfid_start_pkg,10); //L0_uart3_sendArray(rfid_start_pkg,10); - L0_uart0_sendArray(newrfid_start_pkg,15); + //L0_uart0_sendArray(newrfid_start_pkg,15); L0_uart3_sendArray(newrfid_start_pkg,15); } @@ -30,7 +30,7 @@ void L1_disable_rfid() { //L0_uart0_sendArray(rfid_stop_pkg,7); //L0_uart3_sendArray(rfid_stop_pkg,7); - L0_uart0_sendArray(newrfid_stop_pkg,6); + //L0_uart0_sendArray(newrfid_stop_pkg,6); L0_uart3_sendArray(newrfid_stop_pkg,6); }