getinfo.c 获取loc前增加网络状态的判断

usrcfg.h 更新SYS_CFG的定义
selfTest 增加cfg的字段
This commit is contained in:
CSSC-WORK\murmur 2023-08-17 09:22:02 +08:00
parent afaf81a3fc
commit c165e15b80
6 changed files with 19 additions and 15 deletions

View File

@ -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
{

View File

@ -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位

View File

@ -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定时自报位置信息

View File

@ -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++) //轮询每个参数
{

View File

@ -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;

View File

@ -346,7 +346,7 @@
/* end of miscellaneous packages */
/* Arduino libraries */
//#define BSP_USING_SDRAM
/* Projects */