串口1,485功能。
数据接收解析及数据库处理
This commit is contained in:
1 parent
e36baf375d
commit
0735772f8a
19 files changed
+2066
-228
No files matched your search
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
/* DATA_comm.c */
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include "cjson.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -24,11 +25,10 @@
|
||||
#include <rtdbg.h>
|
||||
|
||||
rt_mq_t proc_mq;
|
||||
//static struct proc_request *req;
|
||||
|
||||
char cjson_falg=0;//是否解析cjson
|
||||
char *json_buffer=NULL;
|
||||
|
||||
//
|
||||
char *json_buffer=NULL;//
|
||||
|
||||
/**
|
||||
* 截取两个指定子串之间的内容
|
||||
@@ -432,17 +432,18 @@ void proc_thread_entry(void *parameter)
|
||||
while (1)
|
||||
{
|
||||
// 接收请求指针
|
||||
if (rt_mq_recv(proc_mq, &req, sizeof(req), RT_WAITING_FOREVER) == RT_EOK)
|
||||
if (rt_mq_recv(proc_mq, &req, sizeof(req), RT_WAITING_FOREVER) >= RT_EOK)
|
||||
{
|
||||
if (!req) continue;
|
||||
memcpy(DATA_api,req->input,5);
|
||||
extract_between(req->input, "[", "]", DATA_machins, sizeof(DATA_machins));
|
||||
|
||||
if(strcmp(DATA_machins,machine_ID)==0)
|
||||
{
|
||||
char *p=strstr(req->input,"]");
|
||||
if(!p){cjson_falg=0;}
|
||||
else {
|
||||
if(!p)
|
||||
{
|
||||
cjson_falg=0;
|
||||
}else {
|
||||
p += strlen("]");
|
||||
}
|
||||
|
||||
@@ -481,8 +482,7 @@ int data_comm_init(void)
|
||||
}
|
||||
|
||||
dat_comm_stack = rt_memheap_alloc(&sram_DTCMRAM, 1024*6);
|
||||
dat_err = rt_thread_init(&dat_comm_thread, "dat_comm", proc_thread_entry, RT_NULL,
|
||||
dat_comm_stack, 1024*6, 15, 10);
|
||||
dat_err = rt_thread_init(&dat_comm_thread, "dat_comm", proc_thread_entry, RT_NULL,dat_comm_stack, 1024*6, 15, 10);
|
||||
|
||||
if(dat_err != RT_EOK)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user