Browse Source

v3.0 添加key->rfid map映射

pingche_yh3
zhangsan 4 years ago
parent
commit
cbacc08493
  1. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym
  2. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab
  3. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad
  4. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc
  5. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf
  6. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr
  7. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb
  8. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd
  9. BIN
      si4/soft_gsm_main.si4project/soft_gsm_main.siwork
  10. 59
      source/app/app_common.c
  11. 10
      source/app/app_common.h
  12. 17
      source/app/app_drv.c
  13. 17
      source/app/app_task_485.c
  14. 5
      source/app/app_task_485_control.c
  15. 2
      source/app/app_task_485_control.h
  16. 4
      source/app/app_task_rfid.c

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_sym

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xab

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xad

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xc

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xf

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xr

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsb

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.sip_xsd

Binary file not shown.

BIN
si4/soft_gsm_main.si4project/soft_gsm_main.siwork

Binary file not shown.

59
source/app/app_common.c

@ -9,6 +9,57 @@
struct printer_maintenance_global G; struct printer_maintenance_global G;
U8 ccmodbus_len = 0; 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() void L2_register_init()
{ {
U8 i = 0; U8 i = 0;
@ -23,7 +74,7 @@ void L2_register_init()
G.jing_weight = 0; G.jing_weight = 0;
G.thrombolytic_val = G.bolus_val = G.hold_val = 0; G.thrombolytic_val = G.bolus_val = G.hold_val = 0;
G.asga.xaxis = G.asga.yaxis = G.asga.zaxis = 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++) 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].reg = 0x07;
G.md_slaver_info[3].regnum = 0x01; 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].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[3].mask = 0;
G.md_slaver_info[4].slaver = SLAVER_SHOW01_ID; //显示�按键 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].slaver = SLAVER_TCP_SERVER_ID; //�务�
G.ccmd_slaver_info[3].oper = MODBUS_OPER_WRITE_M; G.ccmd_slaver_info[3].oper = MODBUS_OPER_WRITE_M;
G.ccmd_slaver_info[3].reg = 0x10; 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].bytes = G.ccmd_slaver_info[3].regnum * 2;
G.ccmd_slaver_info[3].buf = (U8*)&G.jing_weight; G.ccmd_slaver_info[3].buf = (U8*)&G.jing_weight;
G.ccmd_slaver_info[3].mask = 0; G.ccmd_slaver_info[3].mask = 0;
@ -121,7 +172,7 @@ void L2_register_init()
G.flowStarted = 0; G.flowStarted = 0;
G.flowStartVal = 1; G.flowStartVal = 1;
G._keyled = G._rfid = 0; G._keyled = G._key = 0;
G.reset = 0; G.reset = 0;
G.debug = 0; G.debug = 0;

10
source/app/app_common.h

@ -6,6 +6,8 @@
#include "../tpc/tpc_modbus.h" #include "../tpc/tpc_modbus.h"
#include "../tpc/tpc_ccmodbus.h" #include "../tpc/tpc_ccmodbus.h"
#define D_CAR_HOSPITAL_NO 0x0001
#define APP_VERSION_HEX 0x20 //高4位主版本,低4位次版本 #define APP_VERSION_HEX 0x20 //高4位主版本,低4位次版本
// #define BOARD_MAIN03_A9 // #define BOARD_MAIN03_A9
@ -132,7 +134,7 @@ typedef struct printer_maintenance_global
U16 bolus_val; U16 bolus_val;
U16 hold_val; U16 hold_val;
CCAsGaInfo asga; CCAsGaInfo asga;
U16 rfid; U8 rfid[6];
S32 weight[4]; S32 weight[4];
//U16 reserved2[16 - 9]; //U16 reserved2[16 - 9];
@ -148,13 +150,15 @@ typedef struct printer_maintenance_global
U8 ccid_passwd[22]; //保存ccid密码空间 21+'\0' U8 ccid_passwd[22]; //保存ccid密码空间 21+'\0'
TS_BoardStatus boardstatus; TS_BoardStatus boardstatus;
U8 _keyled; U8 _keyled;
U8 _rfid; U16 _key;
S32 pi_weight; S32 pi_weight;
S32 total_weight; S32 total_weight;
CCAsGaInfo asga_02; CCAsGaInfo asga_02;
U8 reset; U8 reset;
U8 debug; U8 debug;
U32 rfidval;
U16 rfidHospitalNo;
}PMGlobal; }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 L3_protocol_handler_uart0_fun(TS_PH3_ccmodbus *ccmodbus);
extern void L2_do_board_reset(void); extern void L2_do_board_reset(void);
extern void L2_do_gm35_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 #endif

17
source/app/app_drv.c

@ -90,6 +90,7 @@ void L3_UARTcom0_exp_protocol(TS_Handle_PH3 *p)
{ {
switch(p->ts_ccmodbus.slaver) switch(p->ts_ccmodbus.slaver)
{ {
#if 0
case SLAVER_RFID: case SLAVER_RFID:
L0_uart0_uc('r'); L0_uart0_uc('r');
L0_uart0_uchex(p->ts_ccmodbus.buf[0]); 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]; G.rfid = G._rfid = p->ts_ccmodbus.buf[0];
} }
break; break;
#endif
case SLAVER_COM0: case SLAVER_COM0:
L3_protocol_handler_uart0_fun(&p->ts_ccmodbus); L3_protocol_handler_uart0_fun(&p->ts_ccmodbus);
break; break;
@ -115,12 +117,17 @@ void L3_UARTcom3_exp_protocol(TS_Handle_PH3 *p)
if(L3_checkCrc16(&p->ts_ccmodbus)) if(L3_checkCrc16(&p->ts_ccmodbus))
{ {
L0_uart0_uc('r'); 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[0] = p->ts_ccmodbus.buf[0];
G.rfid = G._rfid = 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; p->ok = 0;
} }

17
source/app/app_task_485.c

@ -88,15 +88,22 @@ void L3_task_485_handle(TS_485 *s)
{ {
//TODO //TODO
} }
else if(G._keyled == 0x28) else if(G._keyled == 0x1e)
{ {
L0_uart0_uc('#'); L0_uart0_uc('#');
G.pi_weight = G.total_weight; G.pi_weight = G.total_weight;
} }
} else
else {
{ //G.rfid = G._keyled;
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; break;
case 5: case 5:

5
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; 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; 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 #endif
L2_task_go(D_task_485_control_01); L2_task_go(D_task_485_control_01);

2
source/app/app_task_485_control.h

@ -9,7 +9,7 @@ typedef struct
{ {
TS_task task; TS_task task;
S32 total_weight_pool; S32 total_weight_pool;
U16 rfid_pool; U32 rfid_pool;
}TS_485_control; }TS_485_control;
extern TS_485_control ts_485_control; extern TS_485_control ts_485_control;

4
source/app/app_task_rfid.c

@ -22,7 +22,7 @@ void L1_enable_rfid()
{ {
//L0_uart0_sendArray(rfid_start_pkg,10); //L0_uart0_sendArray(rfid_start_pkg,10);
//L0_uart3_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); L0_uart3_sendArray(newrfid_start_pkg,15);
} }
@ -30,7 +30,7 @@ void L1_disable_rfid()
{ {
//L0_uart0_sendArray(rfid_stop_pkg,7); //L0_uart0_sendArray(rfid_stop_pkg,7);
//L0_uart3_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); L0_uart3_sendArray(newrfid_stop_pkg,6);
} }

Loading…
Cancel
Save