Commit 8fcfbe3a authored by 陈伟灿's avatar 陈伟灿

Merge branch 'yjq' into 'master'

20210713:问题

See merge request chenweican/k-sdk!88
parents 3533b5b2 8fd421e1
......@@ -8,8 +8,11 @@ CFLAGS += -I$(TOP_DIR)/common/api
CFLAGS += -I$(TOP_DIR)/common/json
CFLAGS += -I$(TOP_DIR)/common/nanomsg/include
CFLAGS += -I$(TOP_DIR)/common/ev/include
CFLAGS += -I$(TOP_DIR)/common/sqlite
LDFLAGS += -lkk_tsl
LDFLAGS += -lapi_com
LDFLAGS += -lsqlite -ldl
ifeq ($(CONFIG_MODEL),x86)
LDFLAGS += -L$(TOP_DIR)/common/nanomsg -lnanomsg_ubuntu
LDFLAGS += -L$(TOP_DIR)/common/ev -lev_ubuntu
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,13 +8,18 @@
#include "com_api.h"
#include "kk_opcode.h"
typedef struct {
cJSON *json;
cJSON *newccu;
cJSON *oldccu;
unsigned char online_status;
int channelNum;
int syn_type;
char *syn_opcode;
char gwDeviceCode[DEVICE_CODE_LEN];
char productCode[PRODUCT_CODE_LEN];
char deviceCode[DEVICE_CODE_LEN];
char opearteType[8];
struct list_head linked_list;
} kk_map_dev_node_t;
......@@ -23,7 +28,12 @@ typedef struct {
struct list_head dev_list;
} kk_map_dev_ctx;
kk_map_dev_node_t *kk_map_dev_add(char *deviceCode,char *productCode,char *gwdeviceCode);
kk_map_dev_node_t *kk_map_dev_add(char *deviceCode,char *productCode,char *gwdeviceCode,char *onlineStatus);
int kk_create_devicestatus_to_sdk(cJSON *root);
int kk_create_devices_to_sdk(cJSON *root);
int _deviceCode_switchto_mac(char * deviceCode,char *mac);
int mac_switchto_deviceCode(char *mac,char * deviceCode);
kk_map_dev_ctx *_kk_map_dev_ctx(void);
#endif
\ No newline at end of file
......@@ -24,18 +24,40 @@
#include "kk_findccu_handle.h"
#include "kk_login_handle.h"
#include "kk_data_handle.h"
//#include "kcloud_log.h"
//#include "kk_lan_queue.h"
#include "kk_lan_node_db.h"
static void sig_handler(int sig)
{
printf("Received signal: %d\n", sig);
abort();
}
int main(int argc, char* argv[])
{
int rc = 0;
char *ppp;
open("kk_lan",LOG_PID,LOG_USER);
/*set the callback to get the device date to cloud*/
kk_ipc_init(IPC_APP2MID,(ipc_cb*)KK_Data_FromMid,NULL,NULL);
kk_findccu_handle_init();
kk_map_dev_init();
kk_login_init();
struct sigaction sig = {0};
sig.sa_handler = sig_handler;
sig.sa_flags = 0;
for(int i=0;i<31;i++){
//sigaction(i, &sig, NULL);
}
//lan_queue_init();
kk_lan_db_node_init();
kk_handle_sync_info();
while(1){
//count++;
//if(count == 10){
......
......@@ -42,7 +42,7 @@ int kk_send_data_to_sdk(char *buf)
send(s_ConnInfo[i].socketfd, tmpBuf, strlen(tmpBuf), 0);
}
}
free(buf);
free(tmpBuf);
return 0;
}
......@@ -66,7 +66,10 @@ static int _kk_handle_data(char *buf,int sockfd){
}else{
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
kk_data_handle(json,sockfd);
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
cJSON_Delete(json);
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
}
}
......@@ -109,12 +112,14 @@ void *TCP_Analyzer(void *pPara)
s_ConnInfo[index].socketfd = -1;
memset(s_ConnInfo[index].ip,0x0,sizeof(s_ConnInfo[index].ip));
pthread_mutex_unlock(&data_mutex);
return NULL;
}
else
{
printf("TCP_Analyzer:%s,%d\n",Buf,(int)Size);
_kk_handle_data(Buf,s_ConnInfo[index].socketfd);
printf("[%s][%d] TCP_Analyzer end.\n",__FUNCTION__,__LINE__);
}
}
return NULL;
......@@ -214,7 +219,7 @@ void *TCPServer()
}
for(i = 0; i < LISTEN_MAX; i ++){
if(s_ConnInfo[i].socketfd != -1){
if(i == 4){
if(i == LISTEN_MAX-1){
DEBUG_PRINT("more then max client!!!\n");
}
continue;
......
......@@ -16,10 +16,21 @@
#define OPEARTETYPE_STRING "operateType"
#define NEWCCU_STRING "newccu"
#define OLDCCU_STRING "oldccu"
#define FINDCCU_OPCODE "FIND_CCU"
#define LOGIN_OPCODE "LOGIN"
#define HEARTBEAT_OPCODE "CCU_HB"
#define SYNC_OPCODE "SYNC_INFO"
#define GET_ZB_DEVS_HW_INFO_OPCODE "GET_ZIGBEE_DEVS_HW_INFO"
#define SWITCH_OPCODE "SWITCH"
#define VALUERANGE_STRING "valueRange"
#define DEVICE_FIELD_STRING "device_field"
#define DEVICE_FIELD_IDNDEX_STRING "device_field_index"
......
......@@ -6,8 +6,11 @@
#define APP2MID "ipc:///tmp/app2mid.ipc"
#define APP2MID_PUBSUB "ipc:///tmp/app2mid_pubsub.ipc"
#define PLAT2MID "ipc:///tmp/plat2mid.ipc"
//#define GW2CCU_PIPE "tcp://%s:5555"
//#define GW2CCU_PUBSUB "tcp://%s:5557"
#define GW2CCU_PIPE "tcp://%s:35567"
#define GW2CCU_PUBSUB "tcp://%s:35568"
#define MAGIC "magic12"
#define MAGIC_ACK "magic12ack"
#define FILTERSTR "|"
......
......@@ -38,6 +38,11 @@ typedef enum {
#define MSG_PAYLOAD_STR "payload"
#define MSG_INFO_STR "info"
#define MSG_INDENTIFIER_STR "identifier"
#define MSG_DATA_TYPE_STR "dataType"
#define MSG_PARAMS_STR "params"
#define MSG_IOTClOUDSTATE_STR "IOTCloudState"
#define MSG_TOPO_CHANGE_TYPE_STR "changeType"
......@@ -64,6 +69,8 @@ typedef enum {
#define MSG_TIMER_SETCOUNTDOWN_GETCOUNTDOWN "getCountDown"
#define MSG_PROPERTY_STR "property"
#define MSG_PROPERTIES_STR "properties"
#define MSG_ONLINE_STATUS_STR "onlineStatus"
/************************LOCK KEY*************************/
#define MSG_KEYDELETE_NOTIFICATION_KEYID "KeyDeletedNotification.KeyID"
#define MSG_KEYDELETE_NOTIFICATION_KEYTYPE "KeyDeletedNotification.KeyType"
......
......@@ -31,7 +31,7 @@
#define PRODUCT_TPYE "kk"
#define CCU_LAN "eth1"
#define KK_CCU_ID "CCU_77777"
#define KK_CCU_ID "CCU_77771"
#define KK_CCU_PRODUCTID "ccu_n12"
#define KK_GW_PRODUCTID "gateway_2"
#define KK_CCU_RANDOM "0000000000"
......
......@@ -13,7 +13,7 @@ COMP_LIB_COMPONENTS := \
#SUBDIRS += application/kcloud
$(call Append_Conditional, SUBDIRS, application/kcloud, KCLOUD_PLATFORM_SUPPORT)
$(call Append_Conditional, SUBDIRS, application/kk_luoma, LUOMA_PLATFORM_SUPPORT)
SUBDIRS += application/oled
#SUBDIRS += application/oled
SUBDIRS += application/klansdk
SUBDIRS += midware/midware
SUBDIRS += common/mqtt
......
......@@ -154,6 +154,8 @@ static int kk_get_properties_info(char *deviceCode,cJSON *obj)
valueType == KK_TSL_DATA_TYPE_ENUM||
valueType == KK_TSL_DATA_TYPE_BOOL){
cJSON_AddNumberToObject(propertyItem, propertyStr, atoi(valueStr));
}else if(valueType == KK_TSL_DATA_TYPE_DOUBLE){
cJSON_AddNumberToObject(propertyItem, propertyStr, atof(valueStr));
}
}
cJSON_AddItemToObject(obj, KK_SYNC_PROPERTY_STR, propertyItem);
......
......@@ -24,14 +24,14 @@
{
"opcode":"SWITCH",
"identifiermap":"PowerSwitch_1",
"dataType":"string",
"dataType":"map",
"channel":"1",
"valueRange":["OFF","ON"]
},
{
"opcode":"SWITCH",
"identifiermap":"PowerSwitch_2",
"dataType":"string",
"dataType":"map",
"channel":"2",
"valueRange":["OFF","ON"]
}
......
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