修改交易订单编号数据类型和通讯条件时间间隔判断
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
{
diff --git a/supwisdom/sp_communicate.h b/supwisdom/sp_communicate.h
index b8daf77..da422f3 100644
--- a/supwisdom/sp_communicate.h
+++ b/supwisdom/sp_communicate.h
@@ -64,7 +64,7 @@
#define PK_INT_WATERSTATUS "1"
#define PK_INT_WATERMUCH "2"
-#define PK_BIN_BILLNO "3"
+#define PK_INT_COBILLNO "3"
#define PK_INT_TRANSWAY "4"
#define PK_INT_UNTRANSCONST "5"
#define PK_BIN_DEVICEKEY "6"
diff --git a/supwisdom/sp_config.h b/supwisdom/sp_config.h
index 81f4140..b57a05b 100644
--- a/supwisdom/sp_config.h
+++ b/supwisdom/sp_config.h
@@ -101,14 +101,14 @@
uint8 devphyid[4]; //É豸±àºÅ
uint8 transdate[3]; //YYDDMM¸ñʽÈÕÆÚ
uint8 transtime[3];
- uint8 billno[10]; //½»Ò×¶©µ¥±àºÅ
+ uint32 cobillno; //½»Ò×¶©µ¥±àºÅ
uint8 cardphyid[4]; //¿¨ÎïÀíid
uint8 transway; //½»Ò×·½Ê½£¬0-³õʼ£¬1-Ë¢¿¨£¬2-ɨÂë
uint8 amount; //ʵ¼ÊÖ§¸¶½ð¶î
uint8 paidAmount; //ÒÑÖ§¸¶½ð¶î£¬µ±ÊÇÏȿ۷ÑģʽÏ£¬¼Ç¼ÒÑÖ§¸¶µÄ½ð¶î
uint8 flowsensors; //ʵ¼ÊʹÓüÆÁ¿£¨µ¥Î»£º°ÙºÁÉý£©
uint8 transtatus; //Á÷ˮ״̬£¬0-³õʼ£¬1-³É¹¦£¬2-ʧ°Ü
- uint8 reverse[1]; //ռλ·û
+ uint8 reverse[7]; //ռλ·û
uint8 crc[2]; //len=32
} sp_transdtl_t;
@@ -201,7 +201,7 @@
uint8 link_stat; //0--Á´Â·¹¤×÷ÖУ¬1---Á´Â·¿ÉÓÃ
uint8 load_para_status; //0--Õý³££¬!0--´íÎó
uint8 deviceno;
- uint8 local_deviceno;
+ uint8 local_deviceno;
uint8 devphyid[4];
sp_cardstate_t cardState;
@@ -233,7 +233,7 @@
uint8 expiredate[4];
uint8 waterlimit; //µ¥´Î³öË®ÉÏÏÞ£¨100ml£©
- uint8 billno[10]; //½»Ò×¶©µ¥±àºÅ,BCDÂë
+ uint32 cobillno; //½»Ò×¶©µ¥±àºÅ,BCDÂë
sp_qrcode_t qrcode; //¶þάÂë
sp_feepara_t feepara;
} sp_card_t;
diff --git a/supwisdom/sp_consume.c b/supwisdom/sp_consume.c
index 703c00c..4052bfd 100644
--- a/supwisdom/sp_consume.c
+++ b/supwisdom/sp_consume.c
@@ -32,8 +32,8 @@
pos->purchase.used_num = 0;
return 0;
}
- //usedcount = sp_flowsensor_get_count()/pos->sysconf.flowsensor_uint;
- usedcount = count/pos->sysconf.flowsensor_unit;
+ usedcount = sp_flowsensor_get_count()/pos->sysconf.flowsensor_unit;
+ //usedcount = count/pos->sysconf.flowsensor_unit;
count++;
if(usedcount < pos->purchase.paid_num)
{
diff --git a/supwisdom/sp_data.c b/supwisdom/sp_data.c
index 020b476..a6bad45 100644
--- a/supwisdom/sp_data.c
+++ b/supwisdom/sp_data.c
@@ -4,8 +4,8 @@
#include "sp_constant.h"
#include "sp_display.h"
-#define record_behalf_len 25
-#define record_below_len 7
+#define record_behalf_len 19
+#define record_below_len 13
//Ñ»·¼Ç¼ÿһ±ÊÁ÷Ë®¼Ç¼µÄµØÖ·
static uint16 sp_write_last_record(sp_pos_t* pos)
@@ -83,7 +83,7 @@
memcpy(record->devphyid, pos->devphyid, sizeof(pos->devphyid));
memcpy(record->transdate, ctime, 3);
memcpy(record->transtime, ctime+3, 3);
- memcpy(record->billno, card->billno, sizeof(card->billno));
+ record->cobillno = card->cobillno;
memcpy(record->cardphyid, card->cardphyid, sizeof(card->cardphyid));
if(pos->paymode == PAYMODE_QRCODE)
{
diff --git a/supwisdom/sp_display.c b/supwisdom/sp_display.c
index fb0417c..676e27d 100644
--- a/supwisdom/sp_display.c
+++ b/supwisdom/sp_display.c
@@ -101,15 +101,6 @@
{
MEMCPY(last_ctime,ctime,6);
disp_hint_info_two(pos,"F°æ±¾",PRO_VERSION,0);
- /*
- if(pos->sysconf.register_flag)
- {
- if(pos->dynamic.ws_client_stat)
- {
- show_home_qrcode(pos->dynamic.qrcode_url);
- }
- }
- */
}
}