修改交易订单编号数据类型和通讯条件时间间隔判断
diff --git a/supwisdom/sp_communicate.c b/supwisdom/sp_communicate.c
index a86f503..eecd901 100644
--- a/supwisdom/sp_communicate.c
+++ b/supwisdom/sp_communicate.c
@@ -84,9 +84,9 @@
{
card->waterlimit = field.val.intval;
}
- else if(IS_KEY(PK_BIN_BILLNO,field.key))
+ else if(IS_KEY(PK_INT_COBILLNO,field.key))
{
- MEMCPY(card->billno, field.val.binval, field.strlen);
+ card->cobillno = field.val.intval;
}
else if(IS_KEY(PK_INT_FEEAMOUNT,field.key))
{
@@ -215,9 +215,9 @@
{
MEMCPY(card->qrcode.qrcode_url, field.val.strval, field.strlen);
}
- else if(IS_KEY(PK_BIN_BILLNO, field.key))
+ else if(IS_KEY(PK_INT_COBILLNO, field.key))
{
- MEMCPY(card->billno, field.val.binval, field.strlen);
+ card->cobillno = field.val.intval;
}
else if(IS_KEY(PK_INT_VAILDTIME, field.key))
{
@@ -270,9 +270,9 @@
while(size-- > 0)
{
sp_unpack_value(&unpack,&field);
- if(IS_KEY(PK_BIN_BILLNO, field.key))
+ if(IS_KEY(PK_INT_COBILLNO, field.key))
{
- MEMCPY(card->billno, field.val.binval, field.strlen);
+ card->cobillno = field.val.intval;
}
else if(IS_KEY(PK_INT_AUTHSTATUS, field.key))
{
@@ -310,7 +310,7 @@
cw_pack_map_size(&pack, 2);
sp_pack_put_bin(&pack, PK_BIN_DEVPHYID, pos->devphyid, 4);
- sp_pack_put_bin(&pack, PK_BIN_BILLNO, card->billno, sizeof(card->billno));
+ sp_pack_put_int(&pack, PK_INT_COBILLNO, card->cobillno);
req.datalen += sp_pack_length(&pack);
sp_usart_send(pos, &req);
@@ -318,14 +318,14 @@
}
//Á÷Ë®ÉÏ´«
-static uint8 transdtl_account_bilLno[10];
+static uint32 transdtl_account_cobilLno = 0;
static uint16 sp_async_upload_transdtl(sp_pos_t* pos, sp_transdtl_t* transdtl)
{
uint8 crc[2];
cw_pack_context pack;
sp_protocol_request_t req;
- MEMCPY(transdtl_account_bilLno, transdtl->billno, sizeof(transdtl->billno));
+ transdtl_account_cobilLno = transdtl->cobillno;
sp_protocol_req_init(&req, SP_CMD_TRANSDTL_ACCOUNT);
sp_pack_init(&pack,req.data,sizeof(req.data));
cw_pack_map_size(&pack,10);
@@ -333,7 +333,7 @@
sp_pack_put_bin(&pack, PK_BIN_DEVPHYID, transdtl->devphyid,4);
sp_pack_put_bin(&pack, PK_BIN_TRANSDATE, transdtl->transdate,3);
sp_pack_put_bin(&pack, PK_BIN_TRANSTIME, transdtl->transtime,3);
- sp_pack_put_bin(&pack, PK_BIN_BILLNO, transdtl->billno, sizeof(transdtl->billno));
+ sp_pack_put_int(&pack, PK_INT_COBILLNO, transdtl->cobillno);
sp_pack_put_bin(&pack, PK_BIN_CARDPHYID, transdtl->cardphyid,
sizeof(transdtl->cardphyid));
sp_pack_put_int(&pack, PK_INT_TRANSWAY, transdtl->transway);
@@ -362,10 +362,9 @@
while(size-- > 0)
{
sp_unpack_value(&unpack,&field);
- if(IS_KEY(PK_BIN_BILLNO,field.key))
+ if(IS_KEY(PK_INT_COBILLNO,field.key))
{
- if(MEMCMP(field.val.binval, transdtl_account_bilLno,
- sizeof(transdtl_account_bilLno)) == 0)
+ if(field.val.intval == transdtl_account_cobilLno)
{
pos->unconfirm_transdtl.transaddr+= sizeof(sp_transdtl_t);
if(ADDR_TRANSDTL_END <= pos->unconfirm_transdtl.transaddr)
@@ -559,17 +558,23 @@
if(ticker - pos->last_comm_status.sendtime > COMM_WAIT_TIME)
{
if(pos->devlogin.last_login_ticker == 0 || pos->devlogin.login_flag == 0
- || (ticker - pos->devlogin.last_login_ticker) > DELAY_TIME60s*60*24)
+ || ticker - pos->devlogin.last_login_ticker > DELAY_TIME15s*2)
{
- pos->devlogin.last_login_ticker = ticker;
- sp_async_equipment_login(pos);
+ if(ticker - pos->devlogin.last_login_ticker > DELAY_TIME15s*2)
+ {
+ pos->devlogin.last_login_ticker = ticker;
+ sp_async_equipment_login(pos);
+ }
}
else if(ticker < pos->heartbeat.last_heartbeat_ticker
|| pos->heartbeat.last_heartbeat_ticker == 0
- || (ticker - pos->heartbeat.last_heartbeat_ticker) > DELAY_TIME60s*2)
+ || ticker - pos->heartbeat.last_heartbeat_ticker > DELAY_TIME15s)
{
- pos->heartbeat.last_heartbeat_ticker = ticker;
- sp_async_heartbeat(pos);
+ if(ticker - pos->heartbeat.last_heartbeat_ticker > DELAY_TIME15s)
+ {
+ pos->heartbeat.last_heartbeat_ticker = ticker;
+ sp_async_heartbeat(pos);
+ }
}
else
{