Commit 5fe6622a authored by 陈伟灿's avatar 陈伟灿

Merge branch 'yjq' into 'master'

新增队列接收数据

See merge request chenweican/k-sdk!49
parents e8d57f6a 785e96ed
......@@ -292,6 +292,7 @@ APPLICATION_FILES= \
./ZB/kk_rgb_hsl_convert.c\
./ZB/kk_color_space.c\
./ZB/sub_device_manage.c\
./ZB/kk_ncp_queue.c\
./ZB/kk_topo_batch_handle.c\
./ZB/kk_wlist_mng.c\
./kk_test.c\
......
#include "kk_device_table_db.h"
#include "sqlite3.h"
#include "kk_ncp_queue.h"
void kk_mac_conver(EmberEUI64 mac,char* macString)
{
......@@ -535,6 +536,8 @@ void emberAfPluginDeviceTableInitialized(void)
kk_load_dev_map_table();
kk_device_map_print();
kk_device_config_load_from_db();
#define NCP_QUEUE_MAX_SIZE 50
ncp_queue_init(NCP_QUEUE_MAX_SIZE);
}
void test_123(int val)
......
#include "kk_test.h"
#include "kk_ncp_queue.h"
static void kk_rpc_send_message(cJSON *data,char *msgtype,char *method,EmberEUI64 mac)
{
......@@ -190,6 +191,8 @@ error_return:
extern void ncp_queue_tick(void);
......@@ -202,6 +205,8 @@ void emberAfMainTickCallback(void)
unsigned int time = halCommonGetInt32uMillisecondTick();
kk_sub_dev_manage();
ncp_queue_tick();
if((time-last_time)>=3000){
last_time = time;
kk_productCode_tick();
......
......@@ -225,7 +225,19 @@ static int eval_request(struct jrpc_server *server, cJSON *root) {
#define KK_THING_OTA_DEVICE_UPGRADE "/ota/device/upgrade"
void ncp_queue_tick(void)
{
cJSON *root = NULL;
char *str;
if(ncp_queue_dequeue(&root)==0){
str = rpc_cJSON_Print(root);
printf("dequeue cJson = %s\n",str);
free(str);
eval_request(&my_server, root);
rpc_cJSON_Delete(root);
}
}
void _cb(void* data, int len, char* chlmark){
if (data != NULL){
printf("plat_cb: %s [%d]RECEIVED \r\n", data,len);
......@@ -241,12 +253,13 @@ void _cb(void* data, int len, char* chlmark){
kk_ota_process(root);
}else{
eval_request(&my_server, root);
ncp_queue_enqueue((void *)root);
//eval_request(&my_server, root);
}
}
//shift processed request, discarding it
rpc_cJSON_Delete(root);
//rpc_cJSON_Delete(root);
} else {
if (1) {
printf("INVALID JSON Received:\n---\n%s\n---\n",
......
#include "yjq_ezsp.h"
#include "./jsonrpc/rpccJSON.h"
......@@ -91,6 +94,7 @@ extern void kk_print_network_info(void);
extern void test_123(int val);
extern void kk_ota_test111();
extern void kk_ota_test123123123();
extern int ncp_queue_enqueue(void *data);
void kk_message_process(char *messageString)
{
......@@ -116,7 +120,7 @@ void kk_message_process(char *messageString)
kk_ota_test123123123();
}
if(MEMCOMPARE(messageString,"AT+TEST\r\n",len)==0){
kk_ota_test111();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment