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
490a67cf
Commit
490a67cf
authored
Sep 11, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】添加APP端主动删除子设备的消息处理
【提交人】陈伟灿
parent
4edd1128
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
861 additions
and
760 deletions
+861
-760
application/kcloud/kcloud_data_handle.c
application/kcloud/kcloud_data_handle.c
+34
-2
application/kcloud/kcloud_main.c
application/kcloud/kcloud_main.c
+74
-76
application/kcloud/kk_topic_mng.c
application/kcloud/kk_topic_mng.c
+217
-209
common/api/com_api.h
common/api/com_api.h
+52
-50
midware/midware/dm/kk_dm_msg.h
midware/midware/dm/kk_dm_msg.h
+60
-59
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+31
-1
midware/midware/midware.c
midware/midware/midware.c
+0
-9
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
+277
-244
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
+36
-34
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
+80
-76
platform/zigbee/app/builder/Z3GatewayHost/libapi_com.so
platform/zigbee/app/builder/Z3GatewayHost/libapi_com.so
+0
-0
No files found.
application/kcloud/kcloud_data_handle.c
View file @
490a67cf
...
@@ -22,9 +22,11 @@
...
@@ -22,9 +22,11 @@
#define KK_FILTER_STATUS_ONLINE_REPLY "/thing/status/online_reply"
#define KK_FILTER_STATUS_ONLINE_REPLY "/thing/status/online_reply"
#define KK_FILTER_STATUS_OFFLINE "/thing/status/offline"
#define KK_FILTER_STATUS_OFFLINE "/thing/status/offline"
#define KK_FILTER_STATUS_OFFLINE_REPLY "/thing/status/offline_reply"
#define KK_FILTER_STATUS_OFFLINE_REPLY "/thing/status/offline_reply"
#define KK_FILTER_TOPO_CHANEG_REPLY "/thing/topo/change_reply"
#define KK_CLOUDSTATE_MSG "/thing/ccu/cloudstate"
#define KK_CLOUDSTATE_MSG "/thing/ccu/cloudstate"
#define KK_CLOUDSTATE_MSG_REPLY "/thing/ccu/cloudstate_reply"
#define KK_CLOUDSTATE_MSG_REPLY "/thing/ccu/cloudstate_reply"
#define KK_TOPO_CHANGE_MSG_STR "/thing/topo/change"
const
char
DM_MSG_TO_MIDDWARE
[]
=
"{
\"
msgtype
\"
:
\"
%s
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
deviceCode
\"
:
\"
%s
\"
}"
;
const
char
DM_MSG_TO_MIDDWARE
[]
=
"{
\"
msgtype
\"
:
\"
%s
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
deviceCode
\"
:
\"
%s
\"
}"
;
#define KK_TOPIC_SERVICE_DELIMITER '/'
#define KK_TOPIC_SERVICE_DELIMITER '/'
...
@@ -202,6 +204,9 @@ static int _check_invalid_topic(const char* topic)
...
@@ -202,6 +204,9 @@ static int _check_invalid_topic(const char* topic)
else
if
(
strstr
(
topic
,
KK_FILTER_SET_TOPIC_REPLY
)
!=
NULL
){
else
if
(
strstr
(
topic
,
KK_FILTER_SET_TOPIC_REPLY
)
!=
NULL
){
return
1
;
return
1
;
}
}
else
if
(
strstr
(
topic
,
KK_FILTER_TOPO_CHANEG_REPLY
)
!=
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_EVENT_POST_TOPIC
)
!=
NULL
&&
\
else
if
(
strstr
(
topic
,
KK_FILTER_EVENT_POST_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_LOGIN_TOPIC_REPLY
)
==
NULL
){
strstr
(
topic
,
KK_FILTER_LOGIN_TOPIC_REPLY
)
==
NULL
){
return
1
;
return
1
;
...
@@ -273,7 +278,31 @@ static int _kk_topic_parse_pkdn(_IN_ char *topic, _IN_ int start_deli,
...
@@ -273,7 +278,31 @@ static int _kk_topic_parse_pkdn(_IN_ char *topic, _IN_ int start_deli,
return
RETURN_SUCCESS
;
return
RETURN_SUCCESS
;
}
}
static
int
_kk_topo_change_handle
(
cJSON
*
payload
)
{
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
if
(
paramStr
==
NULL
){
ERROR_PRINT
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
return
RETURN_FAIL
;
}
cJSON
*
state
=
cJSON_GetObjectItem
(
paramStr
,
MSG_TOPO_CHANGE_TYPE_STR
);
if
(
state
!=
NULL
&&
state
->
valueint
==
1
){
cJSON
*
deviceArray
=
cJSON_GetObjectItem
(
paramStr
,
MSG_TOPO_CHANGE_DEVICES_STR
);
if
(
deviceArray
==
NULL
){
ERROR_PRINT
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
return
RETURN_FAIL
;
}
cJSON
*
item
=
deviceArray
->
child
;
while
(
item
!=
NULL
){
char
*
deviceCode
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
char
*
productCode
=
cJSON_GetObjectItem
(
item
,
MSG_PRODUCT_CODE_STR
)
->
valuestring
;
KK_Subdev_UnSubscribe_By_DeviceCode
(
deviceCode
,
productCode
);
item
=
item
->
next
;
}
}
return
RETURN_SUCCESS
;
}
static
char
*
_kk_data_create
(
const
char
*
topic
,
const
char
*
data
)
static
char
*
_kk_data_create
(
const
char
*
topic
,
const
char
*
data
)
{
{
cJSON
*
root
;
cJSON
*
root
;
...
@@ -301,17 +330,20 @@ static char * _kk_data_create(const char *topic,const char *data)
...
@@ -301,17 +330,20 @@ static char * _kk_data_create(const char *topic,const char *data)
cJSON
*
infoObj
=
cJSON_Parse
(
infoStr
);
cJSON
*
infoObj
=
cJSON_Parse
(
infoStr
);
cJSON
*
payloadObj
=
cJSON_Parse
(
data
);
cJSON
*
payloadObj
=
cJSON_Parse
(
data
);
cJSON_AddItemToObject
(
root
,
MSG_INFO_STR
,
infoObj
);
cJSON_AddItemToObject
(
root
,
MSG_INFO_STR
,
infoObj
);
cJSON_AddItemToObject
(
root
,
MSG_PAYLOAD_STR
,
payloadObj
);
cJSON_AddItemToObject
(
root
,
MSG_PAYLOAD_STR
,
payloadObj
);
if
(
strstr
(
topic
,
KK_TOPO_CHANGE_MSG_STR
)){
_kk_topo_change_handle
(
payloadObj
);
}
out
=
cJSON_Print
(
root
);
out
=
cJSON_Print
(
root
);
cJSON_Delete
(
root
);
cJSON_Delete
(
root
);
free
(
msgStr
);
free
(
msgStr
);
free
(
infoStr
);
free
(
infoStr
);
INFO_PRINT
(
"[%s][%d]%s
\n
"
,
__FUNCTION__
,
__LINE__
,
out
);
INFO_PRINT
(
"[%s][%d]%s
\n
"
,
__FUNCTION__
,
__LINE__
,
out
);
return
out
;
return
out
;
//free(out); /* Print to text, Delete the cJSON, print it, release the string. */
//free(out); /* Print to text, Delete the cJSON, print it, release the string. */
}
}
const
char
DM_MSG_CLOUDSTATE
[]
=
"{
\"
msgId
\"
:
\"
1
\"
,
\"
version
\"
:
\"
1.0
\"
,
\"
params
\"
:{
\"
IOTCloudState
\"
:
\"
%d
\"
},
\"
method
\"
:
\"
thing.ccu.cloudstate_reply
\"
}"
;
const
char
DM_MSG_CLOUDSTATE
[]
=
"{
\"
msgId
\"
:
\"
1
\"
,
\"
version
\"
:
\"
1.0
\"
,
\"
params
\"
:{
\"
IOTCloudState
\"
:
\"
%d
\"
},
\"
method
\"
:
\"
thing.ccu.cloudstate_reply
\"
}"
;
int
KK_Send_CloudState
(
int
state
)
int
KK_Send_CloudState
(
int
state
)
{
{
char
*
infoStr
=
NULL
;
char
*
infoStr
=
NULL
;
...
...
application/kcloud/kcloud_main.c
View file @
490a67cf
/*******************************************************************************
/*******************************************************************************
* Copyright (c) 2012, 2020 IBM Corp.
* Copyright (c) 2012, 2020 IBM Corp.
*
*
* All rights reserved. This program and the accompanying materials
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* are made available under the terms of the Eclipse Public License v2.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
*
* The Eclipse Public License is available at
* The Eclipse Public License is available at
* https://www.eclipse.org/legal/epl-2.0/
* https://www.eclipse.org/legal/epl-2.0/
* and the Eclipse Distribution License is available at
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*
* Contributors:
* Contributors:
* Ian Craggs - initial contribution
* Ian Craggs - initial contribution
*******************************************************************************/
*******************************************************************************/
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <pthread.h>
#include <pthread.h>
#include "MQTTAsync.h"
#include "MQTTAsync.h"
#include "mqtt_api.h"
#include "mqtt_api.h"
#include "com_api.h"
#include "com_api.h"
#include "kk_product.h"
#include "kk_product.h"
static
int
mqtt_start
(
void
)
static
int
mqtt_start
(
void
)
{
{
int
count
=
0
;
int
count
=
0
;
MQTTAsync
mqttClient
;
MQTTAsync
mqttClient
;
int
rc
=
0
;
int
rc
=
0
;
mqttClient
=
KK_MQTT_Connect
();
mqttClient
=
KK_MQTT_Connect
();
if
(
mqttClient
==
NULL
)
if
(
mqttClient
==
NULL
)
{
{
WARNING_PRINT
(
"KK_MQTT_Connect FAIL!!!
\n
"
);
WARNING_PRINT
(
"KK_MQTT_Connect FAIL!!!
\n
"
);
}
}
else
else
{
{
INFO_PRINT
(
"Waiting for publication of %s
\n
"
INFO_PRINT
(
"Waiting for publication of %s
\n
"
"on topic %s for client with ClientID: %s
\n
"
,
"on topic %s for client with ClientID: %s
\n
"
,
PAYLOAD
,
TOPIC
,
CLIENTID
);
PAYLOAD
,
TOPIC
,
CLIENTID
);
}
}
while
(
1
)
while
(
1
)
{
{
usleep
(
100000L
);
usleep
(
100000L
);
count
++
;
count
++
;
if
(
count
>
50
)
if
(
count
>
50
)
{
{
count
=
0
;
count
=
0
;
//INFO_PRINT("i am send now\n");
//INFO_PRINT("i am send now\n");
//KK_MQTT_SendMsg(TOPIC,"hello my world",2);
//KK_MQTT_SendMsg(TOPIC,"hello my world",2);
}
}
}
}
INFO_PRINT
(
"MQTTAsync_destroy
\n
"
);
INFO_PRINT
(
"MQTTAsync_destroy
\n
"
);
MQTTAsync_destroy
(
&
mqttClient
);
MQTTAsync_destroy
(
&
mqttClient
);
return
rc
;
return
rc
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
int
rc
=
0
;
int
rc
=
0
;
//KK_Data_Hdl_Init();
//KK_Data_Hdl_Init();
kk_zlog_init
(
"kcloud"
);
kk_zlog_init
(
"kcloud"
);
/*set the callback to get the device date to cloud*/
/*set the callback to get the device date to cloud*/
HAL_SetProduct_Type
(
PRODUCT_TPYE
);
kk_ipc_init
(
IPC_APP2MID
,
KK_Data_FromDev
,
NULL
,
NULL
);
HAL_SetProduct_Code
(
PRODUCT_CODE
);
rc
=
mqtt_start
();
kk_ipc_init
(
IPC_APP2MID
,
KK_Data_FromDev
,
NULL
,
NULL
);
rc
=
mqtt_start
();
return
rc
;
}
return
rc
;
}
application/kcloud/kk_topic_mng.c
View file @
490a67cf
This diff is collapsed.
Click to expand it.
common/api/com_api.h
View file @
490a67cf
/*
/*
* Copyright (C) 2020-2020 ikonke
* Copyright (C) 2020-2020 ikonke
*/
*/
#ifndef _KK_COM_API_H_
#ifndef _KK_COM_API_H_
#define _KK_COM_API_H_
#define _KK_COM_API_H_
#if defined(__cplusplus)
#if defined(__cplusplus)
extern
"C"
{
extern
"C"
{
#endif
#endif
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <unistd.h>
#include <unistd.h>
#include "ev.h"
#include "ev.h"
#include "nn.h"
#include "nn.h"
#include "pair.h"
#include "pair.h"
#include "pubsub.h"
#include "pubsub.h"
#include "pipeline.h"
#include "pipeline.h"
//=====kk======================
//=====kk======================
typedef
enum
{
typedef
enum
{
IPC_APP2MID
=
0
,
IPC_APP2MID
=
0
,
IPC_MID2APP
,
IPC_MID2APP
,
IPC_MID2PLAT
,
IPC_MID2PLAT
,
IPC_PLAT2MID
,
IPC_PLAT2MID
,
IPC_UNDEF
IPC_UNDEF
}
ipc_type
;
}
ipc_type
;
#define MSG_TYPE_STR "msgtype"
#define MSG_TYPE_STR "msgtype"
#define MSG_PRODUCT_TYPE_STR "productType"
#define MSG_PRODUCT_TYPE_STR "productType"
#define MSG_PRODUCT_CODE_STR "productCode"
#define MSG_PRODUCT_CODE_STR "productCode"
#define MSG_DEVICE_CODE_STR "deviceCode"
#define MSG_DEVICE_CODE_STR "deviceCode"
#define MSG_PAYLOAD_STR "payload"
#define MSG_PAYLOAD_STR "payload"
#define MSG_INFO_STR "info"
#define MSG_INFO_STR "info"
#define MSG_INDENTIFIER_STR "identifier"
#define MSG_INDENTIFIER_STR "identifier"
#define MSG_PARAMS_STR "params"
#define MSG_PARAMS_STR "params"
#define MSG_IOTClOUDSTATE_STR "IOTCloudState"
#define MSG_IOTClOUDSTATE_STR "IOTCloudState"
#define MSG_TOPO_CHANGE_TYPE_STR "changeType"
typedef
void
ipc_cb
(
void
*
data
,
int
len
,
char
*
chalMark
);
#define MSG_TOPO_CHANGE_DEVICES_STR "devices"
int
kk_ipc_init
(
ipc_type
type
,
ipc_cb
cb
,
char
*
chalMark
,
char
*
ip
);
int
kk_ipc_deinit
(
ipc_type
type
);
typedef
void
ipc_cb
(
void
*
data
,
int
len
,
char
*
chalMark
);
int
kk_ipc_send
(
ipc_type
type
,
void
*
data
,
int
len
);
int
kk_ipc_init
(
ipc_type
type
,
ipc_cb
cb
,
char
*
chalMark
,
char
*
ip
);
int
kk_ipc_send_ex
(
ipc_type
type
,
void
*
data
,
int
len
,
char
*
chalMark
);
int
kk_ipc_deinit
(
ipc_type
type
);
int
kk_ipc_send
(
ipc_type
type
,
void
*
data
,
int
len
);
#if defined(__cplusplus)
int
kk_ipc_send_ex
(
ipc_type
type
,
void
*
data
,
int
len
,
char
*
chalMark
);
}
#endif
#if defined(__cplusplus)
#endif
}
#endif
#endif
midware/midware/dm/kk_dm_msg.h
View file @
490a67cf
#ifndef __KK_DM_MSG__
#ifndef __KK_DM_MSG__
#define __KK_DM_MSG__
#define __KK_DM_MSG__
#include "kk_tsl_common.h"
#include "kk_tsl_common.h"
#include "../tsl_handle/lite-cjson.h"
#include "../tsl_handle/lite-cjson.h"
#define DM_MSG_KEY_ID "id"
#define DM_MSG_KEY_ID "id"
#define DM_MSG_KEY_VERSION "version"
#define DM_MSG_KEY_VERSION "version"
#define DM_MSG_KEY_METHOD "method"
#define DM_MSG_KEY_METHOD "method"
#define DM_MSG_KEY_PARAMS "params"
#define DM_MSG_KEY_PARAMS "params"
#define DM_MSG_KEY_CODE "code"
#define DM_MSG_KEY_CODE "code"
#define DM_MSG_KEY_DATA "data"
#define DM_MSG_KEY_DATA "data"
#define DM_MSG_KEY_MESSAGE "message"
#define DM_MSG_KEY_MESSAGE "message"
#define DM_MSG_VERSION "1.0"
#define DM_MSG_VERSION "1.0"
#define DM_MSG_KEY_PRODUCT_KEY "productKey"
#define DM_MSG_KEY_PRODUCT_KEY "productKey"
#define DM_MSG_KEY_DEVICE_NAME "deviceName"
#define DM_MSG_KEY_DEVICE_NAME "deviceName"
#define DM_MSG_KEY_DEVICE_SECRET "deviceSecret"
#define DM_MSG_KEY_DEVICE_SECRET "deviceSecret"
#define DM_MSG_KEY_TIME "time"
#define DM_MSG_KEY_TIME "time"
#define DM_MSG_SIGN_METHOD_SHA256 "Sha256"
#define DM_MSG_SIGN_METHOD_SHA256 "Sha256"
#define DM_MSG_SIGN_METHOD_HMACMD5 "hmacMd5"
#define DM_MSG_SIGN_METHOD_HMACMD5 "hmacMd5"
#define DM_MSG_SIGN_METHOD_HMACSHA1 "hmacSha1"
#define DM_MSG_SIGN_METHOD_HMACSHA1 "hmacSha1"
#define DM_MSG_SIGN_METHOD_HMACSHA256 "hmacSha256"
#define DM_MSG_SIGN_METHOD_HMACSHA256 "hmacSha256"
typedef
struct
{
typedef
struct
{
lite_cjson_t
id
;
lite_cjson_t
id
;
lite_cjson_t
code
;
lite_cjson_t
code
;
lite_cjson_t
data
;
lite_cjson_t
data
;
lite_cjson_t
message
;
lite_cjson_t
message
;
}
dm_msg_response_payload_t
;
}
dm_msg_response_payload_t
;
#ifndef DM_READ_ONLY
#ifndef DM_READ_ONLY
#define DM_READ_ONLY
#define DM_READ_ONLY
#endif
#endif
#define DM_MSG_VERSION "1.0"
#define DM_MSG_VERSION "1.0"
const
char
DM_MSG_INFO
[]
DM_READ_ONLY
;
const
char
DM_MSG_INFO
[]
DM_READ_ONLY
;
#define KK_REGISTER_TOPIC_REPLY "/thing/sub/register_reply"
#define KK_REGISTER_TOPIC_REPLY "/thing/sub/register_reply"
#define KK_ADD_TOPIC_REPLY "/thing/topo/add_reply"
#define KK_ADD_TOPIC_REPLY "/thing/topo/add_reply"
#define KK_LOGIN_TOPIC_REPLY "/thing/combine/login_reply"
#define KK_LOGIN_TOPIC_REPLY "/thing/combine/login_reply"
#define KK_ONLINE_TOPIC_REPLY "/thing/status/online_reply"
#define KK_ONLINE_TOPIC_REPLY "/thing/status/online_reply"
#define KK_THING_SERVICE_PROPERTY_SET "/thing/service/property/set"
#define KK_THING_SERVICE_PROPERTY_SET "/thing/service/property/set"
#define KK_THING_OTA_DEVICE_UPGRADE "/ota/device/upgrade"
#define KK_THING_OTA_DEVICE_UPGRADE "/ota/device/upgrade"
#define KK_THING_CLOUDSTATE_MSG "/thing/ccu/cloudstate_reply"
#define KK_THING_CLOUDSTATE_MSG "/thing/ccu/cloudstate_reply"
#define KK_THING_TOPO_ADD_MSG "/thing/topo/add"
#define KK_THING_TOPO_ADD_MSG "/thing/topo/add"
#define KK_THING_PROPERTY_POST "property/post"
#define KK_THING_PROPERTY_POST "property/post"
#define KK_THING_TOPO_DELETE_MSG "/thing/topo/delete"
#define KK_THING_TOPO_DELETE_MSG "/thing/topo/delete"
#define KK_THING_TOPO_CHANGE_MSG "/thing/topo/change"
//const char DM_URI_SYS_PREFIX[] DM_READ_ONLY = "/sys/%s/%s/";
//const char DM_URI_SYS_PREFIX[] DM_READ_ONLY = "/sys/%s/%s/";
#endif
#endif
midware/midware/dm/kk_linkkit.c
View file @
490a67cf
...
@@ -234,6 +234,31 @@ int kk_get_cloud_recv_status(void){
...
@@ -234,6 +234,31 @@ int kk_get_cloud_recv_status(void){
return
s_CloudStatusRecv
;
return
s_CloudStatusRecv
;
}
}
static
int
_iotx_linkkit_delete_handle
(
cJSON
*
payload
)
{
if
(
payload
==
NULL
){
return
FAIL_RETURN
;
}
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
cJSON
*
state
=
cJSON_GetObjectItem
(
paramStr
,
MSG_TOPO_CHANGE_TYPE_STR
);
if
(
state
!=
NULL
&&
state
->
valueint
==
1
){
cJSON
*
deviceArray
=
cJSON_GetObjectItem
(
paramStr
,
MSG_TOPO_CHANGE_DEVICES_STR
);
if
(
deviceArray
==
NULL
){
return
FAIL_RETURN
;
}
cJSON
*
item
=
deviceArray
->
child
;
while
(
item
!=
NULL
){
char
*
deviceCode
=
cJSON_GetObjectItem
(
item
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
dm_mgr_subdev_delete
(
deviceCode
);
item
=
item
->
next
;
}
}
return
SUCCESS_RETURN
;
}
static
void
_iotx_linkkit_event_callback
(
iotx_dm_event_types_t
type
,
char
*
data
)
static
void
_iotx_linkkit_event_callback
(
iotx_dm_event_types_t
type
,
char
*
data
)
{
{
INFO_PRINT
(
"_iotx_linkkit_event_callback ================== [%s]
\n
"
,
data
);
INFO_PRINT
(
"_iotx_linkkit_event_callback ================== [%s]
\n
"
,
data
);
...
@@ -331,7 +356,12 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -331,7 +356,12 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
INFO_PRINT
(
"ota upgrade...
\n
"
);
INFO_PRINT
(
"ota upgrade...
\n
"
);
kk_dm_ota_send
(
data
,
strlen
(
data
)
+
1
);
kk_dm_ota_send
(
data
,
strlen
(
data
)
+
1
);
}
else
{
}
else
if
(
strstr
(
typeJson
->
valuestring
,
KK_THING_TOPO_CHANGE_MSG
)){
INFO_PRINT
(
" topo change
\n
"
);
_iotx_linkkit_delete_handle
(
payload
);
}
else
{
INFO_PRINT
(
"Error 222222222222222
\n
"
);
INFO_PRINT
(
"Error 222222222222222
\n
"
);
}
}
...
...
midware/midware/midware.c
View file @
490a67cf
...
@@ -618,14 +618,6 @@ void *ccu_property_monitor(void *args)
...
@@ -618,14 +618,6 @@ void *ccu_property_monitor(void *args)
}
}
static
int
kk_set_product_info
(
void
)
{
HAL_SetProduct_Type
(
PRODUCT_TPYE
);
HAL_SetProduct_Code
(
PRODUCT_CODE
);
return
0
;
}
int
main
(
const
int
argc
,
const
char
**
argv
)
int
main
(
const
int
argc
,
const
char
**
argv
)
{
{
...
@@ -638,7 +630,6 @@ int main(const int argc, const char **argv)
...
@@ -638,7 +630,6 @@ int main(const int argc, const char **argv)
kk_zlog_init
(
"midware"
);
kk_zlog_init
(
"midware"
);
memset
(
mid_ctx
,
0
,
sizeof
(
mid_ctx_t
));
memset
(
mid_ctx
,
0
,
sizeof
(
mid_ctx_t
));
kk_set_product_info
();
kk_tsl_api_init
();
kk_tsl_api_init
();
kk_ipc_init
(
IPC_MID2APP
,
mid_cb
,
NULL
,
NULL
);
kk_ipc_init
(
IPC_MID2APP
,
mid_cb
,
NULL
,
NULL
);
kk_ipc_init
(
IPC_MID2PLAT
,
mid2p_cb
,
NULL
,
"*"
);
kk_ipc_init
(
IPC_MID2PLAT
,
mid2p_cb
,
NULL
,
"*"
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
View file @
490a67cf
This diff is collapsed.
Click to expand it.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
View file @
490a67cf
#ifndef __KK_TSL_PROPERTY_SET_H
#ifndef __KK_TSL_PROPERTY_SET_H
#define __KK_TSL_PROPERTY_SET_H
#define __KK_TSL_PROPERTY_SET_H
#include "kk_test.h"
#include "kk_test.h"
cJSON
*
kk_tsl_property_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
kk_topo_change_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
kk_tsl_property_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
int
kk_tsl_set_gloabl_OnOff
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_OperationMode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_gloabl_OnOff
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_mode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_position
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_OperationMode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_mode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_position
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
#endif
#endif
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
View file @
490a67cf
#ifndef _KK_TEST_H
#ifndef _KK_TEST_H
#define _KK_TEST_H
#define _KK_TEST_H
#include "rpc_network_operate.h"
#include "rpc_network_operate.h"
#include "network-creator.h"
#include "network-creator.h"
#include "network-creator-security.h"
#include "network-creator-security.h"
#include "RPC_API.h"
#include "RPC_API.h"
#include "com_api.h"
#include "com_api.h"
#include "zb_device_id.h"
#include "zb_device_id.h"
#include "kk_device_manager.h"
#include "kk_device_manager.h"
#include "kk_zigbee_api.h"
#include "kk_zigbee_api.h"
#include "kk_tsl_property_report.h"
#include "kk_tsl_property_report.h"
#include "kk_tsl_property_set.h"
#include "kk_tsl_property_set.h"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
#define KK_DEVICE_TOPO_CHANGE_TYPE "/thing/topo/change"
#define KK_IPC_VERSION "1.0"
#define KK_REPORT_DEVICE_JOINED_METHOD "thing.topo.add"
#define KK_IPC_VERSION "1.0"
#define KK_REPORT_DEVICE_LEAVE_METHOD "thing.topo.delete"
#define KK_REPORT_DEVICE_JOINED_METHOD "thing.topo.add"
#define KK_REPORT_ATTRIBUTE_METHOD "thing.event.property.post"
#define KK_REPORT_DEVICE_LEAVE_METHOD "thing.topo.delete"
#define KK_READ_ATTRIBUTE_METHOD "thing.service.property.get"
#define KK_REPORT_ATTRIBUTE_METHOD "thing.event.property.post"
#define KK_READ_ATTRIBUTE_METHOD "thing.service.property.get"
#define ZIGBEE_COO_PRODUCT_CODE "2"
#define ZIGBEE_COO_PRODUCT_CODE "2"
#define TEST_PRODUCT_CODE "24"
#define GW2CCU_PROTOCOL "tcp"
#define TEST_PRODUCT_CODE "24"
#define GW2CCU_PROTOCOL "tcp"
#define MSG_TOPO_CHANGE_TYPE_STR "changeType"
#define MSG_TOPO_CHANGE_DEVICES_STR "devices"
int
kk_zcl_onoff_set
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
kk_zcl_onoff_set
(
jrpc_context
*
ctx
,
const
char
*
mac
,
unsigned
char
ep
,
void
*
data
);
int
kk_sendData2CCU
(
char
*
data
,
int
len
);
int
kk_sendData2CCU
(
char
*
data
,
int
len
);
#define RPC_KK_TEST_FUNCTION_TABLE \
{(rpc_function*)kk_tsl_property_operation,"/thing/service/property/set"},\
{(rpc_function*)kk_tsl_property_operation,KK_READ_ATTRIBUTE_METHOD}
#define RPC_KK_TEST_FUNCTION_TABLE \
{(
rpc_function
*
)
kk_tsl_property_operation
,
"/thing/service/property/set"
},
\
{(
rpc_function
*
)
kk_tsl_property_operation
,
KK_READ_ATTRIBUTE_METHOD
},
\
{(
rpc_function
*
)
kk_topo_change_operation
,
KK_DEVICE_TOPO_CHANGE_TYPE
}
enum
{
WC_normal_dir
=
0
,
//"正转"
WC_reversed_dir
=
1
,
//"反转"
WC_calibration_mode
=
2
,
//"校验"
}
windowCoveringMode
;
enum
{
WC_normal_dir
=
0
,
//"正转"
WC_reversed_dir
=
1
,
//"反转"
WC_calibration_mode
=
2
,
//"校验"
}
windowCoveringMode
;
#endif
#endif
platform/zigbee/app/builder/Z3GatewayHost/libapi_com.so
View file @
490a67cf
No preview for this file type
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