| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #include "gateway_collect.h"
- #include "../../User/includes.h"
- #include "../network_mgr/net_ctrl.h"
- #include "../dev_mgr/taxctrl/tax_ctrl.h"
- #include "../network/uplink.h"
- #include "../storage/AT24C128Opt.h"
- #include "../network/downlink.h"
- void * lora_queue_mem_calloc_must(void);
- int lora_queue_mem_free(void * p_msg);
- void lora_queue_insert(char *p_msg, uint32_t msg_len);
- static uint16_t _crc_get_gw(uint8_t *data, uint8_t size)
- {
- uint8_t i, crc = 0;
-
- for(i = 0;i < size;i++){
- crc ^=data[i];
- }
-
- return crc;
- }
- static uint16_t _crc_get1(uint8_t *data, uint8_t size)
- {
- uint8_t i, crc = 0;
-
- for(i = 0;i < size;i++){
- crc ^=data[i];
- }
-
- return crc;
- }
- /*-----------------------------------
- * 向服务器发送网关的信息
- * ----------------------------------*/
- void gateway_net_send_gatewayMsg(void)
- {
- uint8_t sendBuff[160];
- uint8_t sendLen = 0;
- static uint8_t bfirstPowerup = 0;
- static uint8_t timer = 0;
- if(bfirstPowerup==0){
- g_runData.bsendGatewaySttus = 1;
- g_runData.bsendGatewayVersion = 3;
- bfirstPowerup = 1;
- timer = 3;
- }
- if(g_runData.bsendGatewaySttus>=1){
- uplink_tax_statusmcmd_0x2002(sendBuff,&sendLen,DEVICE_OILL,0);
- tax_net_send(sendBuff,sendLen,FIRST_TYPE_STATUS,COLL_UP_STATUS_CMD2002);
- g_runData.bsendGatewaySttus = 0;
- }
- else if(g_runData.bsendGatewayVersion >= timer) {
- uplink_tax_statusmcmd_0x2001(sendBuff,&sendLen,DEVICE_OILL,0);
- tax_net_send(sendBuff,sendLen,FIRST_TYPE_STATUS,COLL_UP_STATUS_CMD2001);
- if(timer ==3) timer = 10;
- else if(timer == 10) timer = 60;
- else timer = 60;
- g_runData.bsendGatewayVersion = 0;
- printf("send gateway msg to server\r\n");
- }
-
- return;
- }
|