From d27ad959168c1b7c7d6688ce62864a2d8eee2f80 Mon Sep 17 00:00:00 2001 From: "CSSC-WORK\\murmur" Date: Fri, 5 Jan 2024 08:36:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=94=B9=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8IP=E7=9A=84=E6=8C=87=E4=BB=A4=20=E6=B8=85?= =?UTF-8?q?=E7=90=86=E6=8C=87=E4=BB=A4=E5=A2=9E=E5=8A=A0=E8=BE=A8=E8=AF=86?= =?UTF-8?q?=E5=BA=A6=EF=BC=8C=E5=B8=B8=E7=94=A8=E6=8C=87=E4=BB=A4=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E7=94=A8=E4=B8=AD=E6=96=87=EF=BC=8C=E5=85=B6=E5=AE=83?= =?UTF-8?q?=E7=94=A8=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/alarmer.c | 2 +- applications/cfg/cfg.c | 13 +++++---- applications/core.c | 4 +-- applications/cryp/cryp.c | 6 ++--- applications/getinfo.c | 58 ++++++++++++++++++++++++++++++++++++++++ applications/main.c | 6 ++--- applications/tools.c | 2 +- drivers/drv_eth.c | 2 +- 8 files changed, 77 insertions(+), 16 deletions(-) diff --git a/applications/alarmer.c b/applications/alarmer.c index bda0f6f..7308797 100644 --- a/applications/alarmer.c +++ b/applications/alarmer.c @@ -297,7 +297,7 @@ int isInWindowZone() -MSH_CMD_EXPORT(clearAlarm,清空闹钟); +MSH_CMD_EXPORT(clearAlarm,clear all alarms); MSH_CMD_EXPORT(stopAlarm,stop); MSH_CMD_EXPORT(startAlarm,start); MSH_CMD_EXPORT(isInWindowZone,isInWindow); diff --git a/applications/cfg/cfg.c b/applications/cfg/cfg.c index 76e24f5..e316d5a 100644 --- a/applications/cfg/cfg.c +++ b/applications/cfg/cfg.c @@ -304,7 +304,7 @@ static void clear_sta(void) } } } -MSH_CMD_EXPORT_ALIAS(clear_sta,clsSta, 重置系统统计数据) +MSH_CMD_EXPORT_ALIAS(clear_sta,clsSta, reset sta info) volatile size_t nislock=0; static void nsetLock() @@ -459,7 +459,10 @@ static void gf() static void add(int argc, char **argv) { - postFileInfo(argv[1],atoi(argv[2])); + if (argc == 3) { + postFileInfo(argv[1],atoi(argv[2])); + } + // gf(); // clearFileToSend(argv[1]); // gf(); @@ -508,8 +511,8 @@ char tmp[60]; MSH_CMD_EXPORT(gf, 查看待发送文件列表) -MSH_CMD_EXPORT_ALIAS(add, cf,查看待发送文件列表) -MSH_CMD_EXPORT(sta, 查询系统统计数据) -MSH_CMD_EXPORT(cfg, config params. 配置系统参数,支持参数) +MSH_CMD_EXPORT_ALIAS(add, cf,add file to list) +MSH_CMD_EXPORT(sta, check sta info) +MSH_CMD_EXPORT(cfg, 配置系统参数,支持参数) //set_if() #endif diff --git a/applications/core.c b/applications/core.c index 1b8a2b5..593e67b 100644 --- a/applications/core.c +++ b/applications/core.c @@ -835,8 +835,8 @@ MSH_CMD_EXPORT(fileIsReady,fileIsReady); //MSH_CMD_EXPORT(chkAndSendFile, chkAndSendFile); //MSH_CMD_EXPORT(getAndSendFile, getAndSendFile); MSH_CMD_EXPORT(initTT,初始化TT); -MSH_CMD_EXPORT(deInitTT,去初始化TT); -MSH_CMD_EXPORT(d_remain,剩余超时时间); +MSH_CMD_EXPORT(deInitTT,去初始化TT,勿在初始化过程中使用); +MSH_CMD_EXPORT(d_remain,time remain); MSH_CMD_EXPORT(resetTM,resetTM); MSH_CMD_EXPORT(d_upSendFile,d_upSendFile); #endif diff --git a/applications/cryp/cryp.c b/applications/cryp/cryp.c index cb3ce2e..9420d18 100644 --- a/applications/cryp/cryp.c +++ b/applications/cryp/cryp.c @@ -312,6 +312,6 @@ void decrypt_file_test(int argc, char **argv) #include /* 导出到自动初始化 */ -MSH_CMD_EXPORT(aes_string_test, 使用AES-256加密字符串。crypt string using AES-256.); -MSH_CMD_EXPORT(crypt_file_test, 使用AES-256加密文件。crypt file using AES-256.); -MSH_CMD_EXPORT(decrypt_file_test, 使用AES-256解密文件。decrypt file using AES-256.); +MSH_CMD_EXPORT(aes_string_test, crypt string using AES-256.); +MSH_CMD_EXPORT(crypt_file_test, crypt file using AES-256.); +MSH_CMD_EXPORT(decrypt_file_test, decrypt file using AES-256.); diff --git a/applications/getinfo.c b/applications/getinfo.c index 40e40a4..e0cfe68 100644 --- a/applications/getinfo.c +++ b/applications/getinfo.c @@ -23,6 +23,8 @@ #define TT_RW TT_IP "/action/webGetTdState"//入网 #define TT_JH TT_IP "/action/webGetPSState"//激活 #define TT_DW TT_IP "/action/webGetBDGPS"//定位 +#define TT_WEB_GET TT_IP "/action/webGetSocketAddr"//服务器地址 +#define TT_WEB_SET TT_IP "/action/webSetSocketAddr"//服务器地址 //http://192.168.0.232:4005/action/webGetSIMState webGetBDGPS #define MAX_LEN 15 @@ -517,3 +519,59 @@ size_t getSignals(uint8_t *dout, uint8_t len){ memcpy(dout,signalInfo,len); return len; } + +void dwebser(int argc, char **argv) +{ + static unsigned char *buffer = RT_NULL; + size_t length = 0; + char arg[100]=""; + + + if (argc == 1) {//查询 + strcpy(arg,TT_WEB_GET); + } + else if (argc == 3) {//设置 + if (strcmp(argv[2],"cssc") == 0) {//最后一个参数为密码,避免意外修改 +// ?tdsocketip=47.108.213.132&tdsocketport=7222 + strcpy(arg,TT_WEB_SET); + strcat(arg,"?tdsocketip="); + strcat(arg,argv[1]); + strcat(arg,"&tdsocketport=7222"); + } + else { + LOG_W("wrong password."); + return; + } + } + else if (argc == 2) {//须密码 + LOG_W("need password."); + return; + } + + static char *url = RT_NULL; + url = web_strdup(arg); +// LOG_I("%s",url); + if (url == RT_NULL) + { + LOG_E("no memory for create getTT url buffer.\n"); + return; + } + + if (!isTCPok() || webclient_request(url, RT_NULL, RT_NULL, 0, (void **) &buffer, &length) <= 0) + { + LOG_E("TT server or webclient is not ready."); + if (buffer) + { + web_free(buffer); + } + return; + } + +// if (buffer && length && buffer[length-1] == 0x7d) //0x7d='}',首次返回的数据不完整,此处直接丢掉避免报错 + { + LOG_I("%s", buffer); + web_free(buffer); + } + +} +MSH_CMD_EXPORT(dwebser,'pwebser [IP] [password]'。无参数表示查询服务器信息,带参表示设置。IP无校验。) diff --git a/applications/main.c b/applications/main.c index 6fdfa15..26ce336 100644 --- a/applications/main.c +++ b/applications/main.c @@ -79,14 +79,14 @@ int main(void) extern int rt_hw_stm32_eth_init(void); -MSH_CMD_EXPORT(rt_hw_stm32_eth_init, 初始化网络。); +//MSH_CMD_EXPORT(rt_hw_stm32_eth_init, 初始化网络。); void show_version(void) { char str[30]; uint8_t t[10]; size_t len=time2Byte(t); - rt_kprintf("SW Version: %s, build-%s\n","2.8d",bytes2str(t, 3, 10, "", str)); + rt_kprintf("SW Version: %s, build-%s\n","2.9d",bytes2str(t, 3, 10, "", str)); } MSH_CMD_EXPORT(show_version,显示版本号); @@ -100,4 +100,4 @@ static void clock_information(void) LOG_D("PCLK2_Frequency = %d", HAL_RCC_GetPCLK2Freq()); } -MSH_CMD_EXPORT(clock_information,始终信息); +MSH_CMD_EXPORT(clock_information,sys clock info); diff --git a/applications/tools.c b/applications/tools.c index 3c75b75..7858aef 100644 --- a/applications/tools.c +++ b/applications/tools.c @@ -166,7 +166,7 @@ void tm2str(int argc, char **argv) date2Str(s); LOG_I("result is %s",s); } -MSH_CMD_EXPORT(tm2str,时间转换为字符串) +MSH_CMD_EXPORT(tm2str,time2str) /** diff --git a/drivers/drv_eth.c b/drivers/drv_eth.c index 0eb001c..0b95218 100644 --- a/drivers/drv_eth.c +++ b/drivers/drv_eth.c @@ -701,7 +701,7 @@ void rt_hw_stm32_eth_deinit() HAL_ETH_DeInit(&EthHandle); __HAL_RCC_ETH_CLK_DISABLE() ; } -MSH_CMD_EXPORT(rt_hw_stm32_eth_deinit, 去初始化网络。); +//MSH_CMD_EXPORT(rt_hw_stm32_eth_deinit, 去初始化网络。); void setLinkUp() { /* send link up. */