Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈伟灿
k-sdk
Commits
8fd421e1
Commit
8fd421e1
authored
Jul 13, 2021
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
20210713:问题
parent
3533b5b2
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1352 additions
and
901 deletions
+1352
-901
application/klansdk/iot.mk
application/klansdk/iot.mk
+3
-0
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+514
-325
application/klansdk/kk_data_mng.c
application/klansdk/kk_data_mng.c
+437
-238
application/klansdk/kk_data_mng.h
application/klansdk/kk_data_mng.h
+21
-11
application/klansdk/kk_findccu_handle.c
application/klansdk/kk_findccu_handle.c
+90
-90
application/klansdk/kk_lan_main.c
application/klansdk/kk_lan_main.c
+23
-1
application/klansdk/kk_login_handle.c
application/klansdk/kk_login_handle.c
+219
-214
application/klansdk/kk_opcode.h
application/klansdk/kk_opcode.h
+12
-1
common/api/com_api.c
common/api/com_api.c
+3
-0
common/api/com_api.h
common/api/com_api.h
+7
-0
common/hal/kk_product.h
common/hal/kk_product.h
+1
-1
makefile
makefile
+1
-1
midware/midware/dm/kk_sync_data.c
midware/midware/dm/kk_sync_data.c
+2
-0
midware/tsl/tsl_handle/kk_utils.c
midware/tsl/tsl_handle/kk_utils.c
+15
-15
midware/tsl/tsl_handle/klist.h
midware/tsl/tsl_handle/klist.h
+2
-2
opcodeMapCfg/device_3023.json
opcodeMapCfg/device_3023.json
+2
-2
No files found.
application/klansdk/iot.mk
View file @
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
...
...
application/klansdk/kk_data_handle.c
View file @
8fd421e1
This diff is collapsed.
Click to expand it.
application/klansdk/kk_data_mng.c
View file @
8fd421e1
This diff is collapsed.
Click to expand it.
application/klansdk/kk_data_mng.h
View file @
8fd421e1
...
...
@@ -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
application/klansdk/kk_findccu_handle.c
View file @
8fd421e1
application/klansdk/kk_lan_main.c
View file @
8fd421e1
...
...
@@ -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){
...
...
application/klansdk/kk_login_handle.c
View file @
8fd421e1
...
...
@@ -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
;
...
...
application/klansdk/kk_opcode.h
View file @
8fd421e1
...
...
@@ -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"
...
...
common/api/com_api.c
View file @
8fd421e1
...
...
@@ -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 "|"
...
...
common/api/com_api.h
View file @
8fd421e1
...
...
@@ -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"
...
...
common/hal/kk_product.h
View file @
8fd421e1
...
...
@@ -31,7 +31,7 @@
#define PRODUCT_TPYE "kk"
#define CCU_LAN "eth1"
#define KK_CCU_ID "CCU_7777
7
"
#define KK_CCU_ID "CCU_7777
1
"
#define KK_CCU_PRODUCTID "ccu_n12"
#define KK_GW_PRODUCTID "gateway_2"
#define KK_CCU_RANDOM "0000000000"
...
...
makefile
View file @
8fd421e1
...
...
@@ -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
...
...
midware/midware/dm/kk_sync_data.c
View file @
8fd421e1
...
...
@@ -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
);
...
...
midware/tsl/tsl_handle/kk_utils.c
View file @
8fd421e1
midware/tsl/tsl_handle/klist.h
View file @
8fd421e1
opcodeMapCfg/device_3023.json
View file @
8fd421e1
...
...
@@ -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"
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment