diff --git a/applications/core.c b/applications/core.c index eab307b..ed7aae8 100644 --- a/applications/core.c +++ b/applications/core.c @@ -179,7 +179,7 @@ static void upSendFile_thread_entry(void *parameter) FILE_INFO *f = RT_NULL; f = (FILE_INFO *) parameter; - static rt_uint8_t d[BUFFER_ROW][200] = { }; + static rt_uint8_t d[BUFFER_ROW][200] = { };//need static? static rt_uint8_t s[BUFFER_ROW] = { }; if (getFileSize(f->fname) > scfg.maxSizePerFile+200) { LOG_W("file '%s' is too large to send.",f->fname); @@ -189,9 +189,9 @@ static void upSendFile_thread_entry(void *parameter) } LOG_D("ready to send '%s---%d'",f->fname,f->index); rt_uint8_t len = pack_File(f->fname, 0, d, s); -// for (size_t i = 0; i < len; i++) { -// LOG_HEX("rst",16,d[i],s[i]); -// } + for (size_t i = 0; i < len; i++) { + LOG_HEX("rst",16,d[i],s[i]); + } // list_thread(); if (len)//部分demo数据体积>>1k { diff --git a/applications/cryp.c b/applications/cryp.c index b8d4e99..9792f67 100644 --- a/applications/cryp.c +++ b/applications/cryp.c @@ -23,7 +23,7 @@ int aes_128_cbc_pkcs7(rt_uint8_t *data, rt_uint16_t len, rt_uint8_t *dout) { - +// AES-256 // 工作模式 CBC ,填充模式 PKCS7,不同语言要保持一致。 // PKCS7规则是长度不够时缺几位补几个几,长度够时也要补 // key长度由KEY_LEN定义,默认32位 diff --git a/applications/func/func.c b/applications/func/func.c index 935e394..f99e41f 100644 --- a/applications/func/func.c +++ b/applications/func/func.c @@ -190,7 +190,7 @@ void upSend_thread_entry(void* parameter) } if (sendMsg(dout, rst) == RT_EOK) { - tcpClose(); +// tcpClose(); LOG_I("send to TT Done."); } else//发送失败,实例不存在此种情况 @@ -260,6 +260,13 @@ void selfTest() rst[p++] = (uint8_t)(cap >> 8); rst[p++] = (uint8_t)(cap & 0xff); + //添加配置文件信息 + uint8_t size = sizeof(scfg); + memcpy(rst + p,&scfg, size); + p+=size; + + rst[7] = p-8;//更新数据长度 + rst[p++] = bccCRC(rst+2, p-1); ////校验位为1个字节,采用异或运算,从指令的第3个字节开始,到奇偶校验位的前一个字节结束 rst[p++] = 0xED; //结束位 @@ -469,8 +476,6 @@ void updateAllSysCfg(uint8_t *cfg, size_t len) set_cfg("maxTTRetryCnt",scfg.maxTTRetryCnt); set_cfg("minTTPeriCnt",scfg.minTTPeriCnt); set_cfg("minTTsinal",scfg.minTTsinal); - set_cfg("minActiveTime",scfg.minActiveTime); - set_cfg("maxActiveTime",scfg.maxActiveTime); set_cfg("timeout",scfg.timeout); char tmpstr[20]; @@ -507,11 +512,12 @@ void reportSysCfg() rst[++p] = 0xED; size = p+1; + LOG_HEX("cfg",16,rst,size); upSend(rst, size); // LOG_HEX("scfg",16,&scfg,size); // LOG_HEX("cfg",16,rst,p+1); - updateAllSysCfg(rst+8, rst[7]); +// updateAllSysCfg(rst+8, rst[7]); } //3.2.8定时自报位置信息 diff --git a/applications/getinfo.c b/applications/getinfo.c index 4002d93..d90408b 100644 --- a/applications/getinfo.c +++ b/applications/getinfo.c @@ -300,7 +300,7 @@ static int webclient_get_data(const char *url) static unsigned char *buffer = RT_NULL; size_t length = 0; - if (webclient_request(url, RT_NULL, RT_NULL, 0, (void **) &buffer, &length) < 0) + if (!isTCPok() || webclient_request(url, RT_NULL, RT_NULL, 0, (void **) &buffer, &length) < 0) { LOG_E("TT server is not ready."); if (buffer) @@ -412,9 +412,9 @@ uint8_t getXh(void) void repGetTT_thread_entry(void* parameter) { - while(!isTTon())//第一次运行时未上电则等待 + while(!isTCPok())//第一次运行时未上电则等待 {} - while(isTTon())//中间未上电则退出 + while(isTCPok())//中间未上电则退出 { for (size_t var = 0; var < (sizeof(infoH) / sizeof(infoH[0])); var++) //轮询每个参数 { diff --git a/applications/usrcfg.h b/applications/usrcfg.h index ac76b89..1241406 100644 --- a/applications/usrcfg.h +++ b/applications/usrcfg.h @@ -35,8 +35,6 @@ typedef struct uint8_t maxTTRetryCnt; uint8_t minTTPeriCnt; uint8_t minTTsinal; - uint8_t minActiveTime; - uint8_t maxActiveTime; uint8_t timeout; uint8_t openWindowTime[8]; uint16_t maxSizePerFile; diff --git a/rtconfig.h b/rtconfig.h index 70be998..759b248 100644 --- a/rtconfig.h +++ b/rtconfig.h @@ -346,7 +346,7 @@ /* end of miscellaneous packages */ /* Arduino libraries */ - +//#define BSP_USING_SDRAM /* Projects */