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
577f192d
Commit
577f192d
authored
Aug 18, 2020
by
黄振令
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】代码优化,已经设备查找不到问题
【提交人】huangzhenling
parent
a63ba7bd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
9 deletions
+18
-9
midware/midware/midware.c
midware/midware/midware.c
+2
-2
platform/zigbee/app/builder/Z3GatewayHost/kk_sub_tsl.c
platform/zigbee/app/builder/Z3GatewayHost/kk_sub_tsl.c
+1
-2
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
+4
-4
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
+3
-0
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
...form/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
+1
-1
platform/zigbee/protocol/zigbee/app/framework/plugin/device-table/device-table.c
...l/zigbee/app/framework/plugin/device-table/device-table.c
+7
-0
No files found.
midware/midware/midware.c
View file @
577f192d
...
@@ -274,13 +274,13 @@ int main(const int argc, const char **argv)
...
@@ -274,13 +274,13 @@ int main(const int argc, const char **argv)
for
(;;)
{
for
(;;)
{
usleep
(
200000
);
usleep
(
200000
);
kk_platMsg_dispatch
();
kk_platMsg_dispatch
();
if
(
ct
==
0
){
/*
if (ct == 0){
ct =1;
ct =1;
void* buf = "{ \"msgId\": \"7\", \"version\": \"1.0\", \"mac\": \"588E81FFFED3834A\", \"method\": \"thing.topo.add\", \"params\": { \"AppVersion\": \"10\", \"deviceType\": \"1\", \"deviceCode\": \"2\", \"productType\": \"3\", \"productCode\": \"4\" }}";
void* buf = "{ \"msgId\": \"7\", \"version\": \"1.0\", \"mac\": \"588E81FFFED3834A\", \"method\": \"thing.topo.add\", \"params\": { \"AppVersion\": \"10\", \"deviceType\": \"1\", \"deviceCode\": \"2\", \"productType\": \"3\", \"productCode\": \"4\" }}";
kk_platMsg_handle(buf);
kk_platMsg_handle(buf);
//kk_set_tsl_by_productKey("a1OYuSallan","model.json");
//kk_set_tsl_by_productKey("a1OYuSallan","model.json");
//kk_mid_subdev_add("a1OYuSallan","allanWno8yDdsjCX15iq","","aabbccddeeff1122");
//kk_mid_subdev_add("a1OYuSallan","allanWno8yDdsjCX15iq","","aabbccddeeff1122");
}
}
*/
}
}
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_sub_tsl.c
View file @
577f192d
...
@@ -121,7 +121,7 @@ int kk_sub_tsl_add(const char *device_mac,const char *product_type)
...
@@ -121,7 +121,7 @@ int kk_sub_tsl_add(const char *device_mac,const char *product_type)
}
}
_sub_dev_mutex_lock
();
_sub_dev_mutex_lock
();
memset
(
node
->
product_type
,
0x0
,
sizeof
(
node
->
product_type
)
);
memset
(
node
,
0
,
sizeof
(
sub_dev_node_t
)
);
memcpy
(
node
->
device_mac
,
device_mac
,
strlen
(
device_mac
));
memcpy
(
node
->
device_mac
,
device_mac
,
strlen
(
device_mac
));
memcpy
(
node
->
product_type
,
product_type
,
strlen
(
product_type
));
memcpy
(
node
->
product_type
,
product_type
,
strlen
(
product_type
));
node
->
devid
=
_sub_tsl_next_devid
();
node
->
devid
=
_sub_tsl_next_devid
();
...
@@ -140,7 +140,6 @@ int kk_sub_tsl_get_device_by_mac(_IN_ char device_mac[DEVICE_MAC_MAXLEN], _OU_ s
...
@@ -140,7 +140,6 @@ int kk_sub_tsl_get_device_by_mac(_IN_ char device_mac[DEVICE_MAC_MAXLEN], _OU_ s
list_for_each_entry
(
search_node
,
&
ctx
->
dev_list
,
linked_list
,
sub_dev_node_t
)
{
list_for_each_entry
(
search_node
,
&
ctx
->
dev_list
,
linked_list
,
sub_dev_node_t
)
{
if
((
strlen
(
search_node
->
device_mac
)
==
strlen
(
device_mac
))
&&
if
((
strlen
(
search_node
->
device_mac
)
==
strlen
(
device_mac
))
&&
(
memcmp
(
search_node
->
device_mac
,
device_mac
,
strlen
(
device_mac
))
==
0
))
{
(
memcmp
(
search_node
->
device_mac
,
device_mac
,
strlen
(
device_mac
))
==
0
))
{
/* dm_log_debug("Device Found, Product Key: %s, Device Name: %s", product_key, device_name); */
if
(
node
)
{
if
(
node
)
{
*
node
=
search_node
;
*
node
=
search_node
;
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
View file @
577f192d
...
@@ -53,9 +53,9 @@ void kk_rpc_reportDevices(kk_report_device_s device)
...
@@ -53,9 +53,9 @@ void kk_rpc_reportDevices(kk_report_device_s device)
rpc_cJSON_AddAppVersionToObject
(
devicesJson
,
device
.
AppVersion
);
rpc_cJSON_AddAppVersionToObject
(
devicesJson
,
device
.
AppVersion
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceType"
,
"1"
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceType"
,
"1"
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceCode"
,
"2"
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceCode"
,
"2"
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productType"
,
"3"
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productType"
,
PRODUCT_TYPE
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productCode"
,
"4"
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productCode"
,
"4"
);
kk_sub_tsl_add
(
device
sJson
,
device
.
mac
,
"3"
);
kk_sub_tsl_add
(
device
.
mac
,
PRODUCT_TYPE
);
kk_rpc_report_devices
(
devicesJson
,
device
.
mac
);
kk_rpc_report_devices
(
devicesJson
,
device
.
mac
);
}
}
bool
kk_rpc_report_LightStatus
(
EmberEUI64
mac
,
bool
LightStatus
)
bool
kk_rpc_report_LightStatus
(
EmberEUI64
mac
,
bool
LightStatus
)
...
@@ -228,7 +228,7 @@ cJSON *rpc_Control(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac)
...
@@ -228,7 +228,7 @@ cJSON *rpc_Control(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac)
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
goto
error_return
;
}
else
{
}
else
{
res
=
kk_sub_tsl_get_device_by_mac
(
mac
->
string
,
&
node
);
res
=
kk_sub_tsl_get_device_by_mac
(
mac
->
value
string
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
if
(
res
!=
SUCCESS_RETURN
)
{
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
...
@@ -246,7 +246,7 @@ cJSON *rpc_Control(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac)
...
@@ -246,7 +246,7 @@ cJSON *rpc_Control(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac)
if
(
propertyItem
!=
NULL
)
if
(
propertyItem
!=
NULL
)
{
{
int
value
=
rpc_get_u8
(
propertyItem
->
valuestring
);
int
value
=
rpc_get_u8
(
propertyItem
->
valuestring
);
res
=
g_tsl_zigbee_map
[
pCtrlIdx
].
zigbee_ctrl
[
index
].
zigbee_cb
(
ctx
,
mac
,
&
value
);
res
=
g_tsl_zigbee_map
[
pCtrlIdx
].
zigbee_ctrl
[
index
].
zigbee_cb
(
ctx
,
mac
->
valuestring
,
&
value
);
if
(
res
<
0
)
{
if
(
res
<
0
)
{
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
set_json_error_type
(
ctx
,
JRPC_INVALID_PARAMS
,
MSG_INVALID_PARAMS
);
goto
error_return
;
goto
error_return
;
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
View file @
577f192d
...
@@ -11,6 +11,9 @@
...
@@ -11,6 +11,9 @@
#define KK_REPORT_ATTRIBUTE_METHOD "thing.service.property.report"
#define KK_REPORT_ATTRIBUTE_METHOD "thing.service.property.report"
#define KK_READ_ATTRIBUTE_METHOD "thing.service.property.get"
#define KK_READ_ATTRIBUTE_METHOD "thing.service.property.get"
#define PRODUCT_TYPE "3"
cJSON
*
rpc_Control
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
rpc_Control
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
rpc_read_attribue
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
rpc_read_attribue
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
int
lightStatusSet
(
jrpc_context
*
ctx
,
const
char
*
mac
,
void
*
data
);
int
lightStatusSet
(
jrpc_context
*
ctx
,
const
char
*
mac
,
void
*
data
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
View file @
577f192d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
kk_tsl_zigbee_map_t
g_tsl_zigbee_map
[]
=
{
kk_tsl_zigbee_map_t
g_tsl_zigbee_map
[]
=
{
{
{
"a1h88DsZIaY"
,
PRODUCT_TYPE
,
3
,
3
,
{
{
{
KK_TSL_DATA_TYPE_TEXT
,
"LightStatus"
,
lightStatusSet
},
{
KK_TSL_DATA_TYPE_TEXT
,
"LightStatus"
,
lightStatusSet
},
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/device-table/device-table.c
View file @
577f192d
...
@@ -484,6 +484,13 @@ void emAfDeviceTableLoad(void)
...
@@ -484,6 +484,13 @@ void emAfDeviceTableLoad(void)
deviceTable
[
i
].
clusterOutStartPosition
=
(
uint16_t
)
data
;
deviceTable
[
i
].
clusterOutStartPosition
=
(
uint16_t
)
data
;
deviceTable
[
i
].
state
=
EMBER_AF_PLUGIN_DEVICE_TABLE_STATE_JOINED
;
deviceTable
[
i
].
state
=
EMBER_AF_PLUGIN_DEVICE_TABLE_STATE_JOINED
;
char
mac
[
17
]
=
{
0
};
sprintf
(
mac
,
"%02X%02X%02X%02X%02X%02X%02X%02X"
,
deviceTable
[
i
].
eui64
[
7
],
deviceTable
[
i
].
eui64
[
6
],
deviceTable
[
i
].
eui64
[
5
],
deviceTable
[
i
].
eui64
[
4
],
deviceTable
[
i
].
eui64
[
3
],
deviceTable
[
i
].
eui64
[
2
],
deviceTable
[
i
].
eui64
[
1
],
deviceTable
[
i
].
eui64
[
0
]);
kk_sub_tsl_add
(
mac
,
"3"
);
}
}
deviceTable
[
i
].
lastMsgTimestamp
=
halCommonGetInt32uMillisecondTick
();
deviceTable
[
i
].
lastMsgTimestamp
=
halCommonGetInt32uMillisecondTick
();
...
...
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