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
89415e10
Commit
89415e10
authored
Sep 23, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】增加主机reboot service调用
【提交人】陈伟灿
parent
be4b4048
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
34 deletions
+24
-34
application/kcloud/kcloud_data_handle.c
application/kcloud/kcloud_data_handle.c
+11
-25
common/hal/HAL_OS_linux.c
common/hal/HAL_OS_linux.c
+2
-1
midware/midware/dm/kk_dm_msg.h
midware/midware/dm/kk_dm_msg.h
+1
-0
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+7
-5
midware/tsl/tsl_handle/kk_tsl_parse.c
midware/tsl/tsl_handle/kk_tsl_parse.c
+3
-3
No files found.
application/kcloud/kcloud_data_handle.c
View file @
89415e10
...
...
@@ -7,8 +7,8 @@
#include "kk_product.h"
//#include "kcloud_log.h"
#define KK_FILTER_
ADD_TOPIC "/thing/topo/add
"
#define KK_FILTER_
ADD_TOPIC_REPLY "/thing/topo/add
_reply"
#define KK_FILTER_
TOPO_TOPIC "/thing/topo/
"
#define KK_FILTER_
TOPO_REPLY "
_reply"
#define KK_FILTER_DELETE_TOPIC "/thing/topo/delete"
#define KK_FILTER_DELETE_TOPIC_REPLY "/thing/topo/delete_reply"
#define KK_FILTER_REGISTER_TOPIC "/thing/sub/register"
...
...
@@ -17,17 +17,14 @@
#define KK_FILTER_LOGIN_TOPIC_REPLY "/thing/combine/login_reply"
#define KK_FILTER_SET_TOPIC "/thing/service/property/set"
#define KK_FILTER_SET_TOPIC_REPLY "/thing/service/property/set_reply"
#define KK_FILTER_EVENT_POST_TOPIC "/thing/event/property/post"
#define KK_FILTER_EVENT_POST_REPLY "/thing/event/property/post_reply"
#define KK_FILTER_EVENT_POST_TOPIC1 "/thing/event/"
#define KK_FILTER_EVENT_POST_TOPIC2 "/post"
#define KK_FILTER_EVENT_POST_REPLY "/post_reply"
#define KK_FILTER_STATUS_ONLINE "/thing/status/online"
#define KK_FILTER_STATUS_ONLINE_REPLY "/thing/status/online_reply"
#define KK_FILTER_STATUS_OFFLINE "/thing/status/offline"
#define KK_FILTER_STATUS_OFFLINE_REPLY "/thing/status/offline_reply"
#define KK_FILTER_TOPO_BATCH_ADD "/thing/topo/batch_add"
#define KK_FILTER_TOPO_BATCH_ADD_REPLY "/thing/topo/batch_add_reply"
#define KK_FILTER_TOPO_BATCH_DELETE "/thing/topo/batch_delete"
#define KK_FILTER_TOPO_BATCH_DELETE_REPLY "/thing/topo/batch_delete_reply"
#define KK_FILTER_TOPO_CHANEG_REPLY "/thing/topo/change_reply"
#define KK_CLOUDSTATE_MSG "/thing/ccu/cloudstate"
...
...
@@ -212,12 +209,8 @@ void KK_Data_FromDev(void* str,int len)
}
static
int
_check_invalid_topic
(
const
char
*
topic
)
{
if
(
strstr
(
topic
,
KK_FILTER_ADD_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_ADD_TOPIC_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_DELETE_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_DELETE_TOPIC_REPLY
)
==
NULL
){
if
(
strstr
(
topic
,
KK_FILTER_TOPO_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_TOPO_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_REGISTER_TOPIC
)
!=
NULL
&&
\
...
...
@@ -234,8 +227,9 @@ static int _check_invalid_topic(const char* topic)
else
if
(
strstr
(
topic
,
KK_FILTER_TOPO_CHANEG_REPLY
)
!=
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_EVENT_POST_TOPIC
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_LOGIN_TOPIC_REPLY
)
==
NULL
){
else
if
(
strstr
(
topic
,
KK_FILTER_EVENT_POST_TOPIC1
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_EVENT_POST_TOPIC2
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_EVENT_POST_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_STATUS_ONLINE
)
!=
NULL
&&
\
...
...
@@ -245,15 +239,7 @@ static int _check_invalid_topic(const char* topic)
else
if
(
strstr
(
topic
,
KK_FILTER_STATUS_OFFLINE
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_STATUS_OFFLINE_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_TOPO_BATCH_ADD
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_TOPO_BATCH_ADD_REPLY
)
==
NULL
){
return
1
;
}
else
if
(
strstr
(
topic
,
KK_FILTER_TOPO_BATCH_DELETE
)
!=
NULL
&&
\
strstr
(
topic
,
KK_FILTER_TOPO_BATCH_DELETE_REPLY
)
==
NULL
){
return
1
;
}
}
return
0
;
}
...
...
common/hal/HAL_OS_linux.c
View file @
89415e10
...
...
@@ -248,7 +248,8 @@ int HAL_GetProduct_Code(_OU_ char *product_code)
{
int
len
=
strlen
(
g_product_code
);
memset
(
product_code
,
0x0
,
PRODUCT_CODE_LEN
);
strncpy
(
product_code
,
g_product_code
,
len
);
//strncpy(product_code, g_product_code, len);
strncpy
(
product_code
,
"15"
,
strlen
(
"15"
));
return
len
;
}
...
...
midware/midware/dm/kk_dm_msg.h
View file @
89415e10
...
...
@@ -55,6 +55,7 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
#define KK_THING_TOPO_DELETE_MSG "/thing/topo/delete"
#define KK_THING_TOPO_BATCH_DELETE_MSG "/thing/topo/batch_delete"
#define KK_THING_TOPO_CHANGE_MSG "/thing/topo/change"
#define KK_THING_SERVICE_REBOOT "/thing/service/reboot"
//const char DM_URI_SYS_PREFIX[] DM_READ_ONLY = "/sys/%s/%s/";
...
...
midware/midware/dm/kk_linkkit.c
View file @
89415e10
...
...
@@ -261,7 +261,7 @@ static int _iotx_linkkit_delete_handle(cJSON *payload)
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);
char
*
out
;
int
res
=
0
;
cJSON
*
json
;
...
...
@@ -279,8 +279,6 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
payload_Str
=
cJSON_Print
(
payload
);
if
(
strstr
(
typeJson
->
valuestring
,
KK_REGISTER_TOPIC_REPLY
)){
//====todo======
//get devicececret and save it
INFO_PRINT
(
" topic:register_reply
\n
"
);
dm_msg_response_payload_t
response
;
res
=
dm_msg_response_parse
((
char
*
)
payload_Str
,
strlen
(
payload
->
valuestring
)
+
1
,
&
response
);
...
...
@@ -307,8 +305,6 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
_iotx_linkkit_upstream_mutex_unlock
();
}
else
if
(
strstr
(
typeJson
->
valuestring
,
KK_LOGIN_TOPIC_REPLY
)){
//====todo======
//
INFO_PRINT
(
" topic:login_reply
\n
"
);
dm_msg_response_payload_t
response
;
res
=
dm_msg_response_parse
((
char
*
)
payload_Str
,
strlen
(
payload
->
valuestring
)
+
1
,
&
response
);
...
...
@@ -360,6 +356,12 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
INFO_PRINT
(
" topo change
\n
"
);
_iotx_linkkit_delete_handle
(
payload
);
}
else
if
(
strstr
(
typeJson
->
valuestring
,
KK_THING_SERVICE_REBOOT
)){
INFO_PRINT
(
" reboot called!!!
\n
"
);
cJSON
*
deviceCode
=
cJSON_GetObjectItem
(
info_root
,
MSG_DEVICE_CODE_STR
);
dm_msg_thing_event_post
(
deviceCode
->
valuestring
,
"rebootNotification"
);
sleep
(
3
);
HAL_Reboot
();
}
else
{
INFO_PRINT
(
"Error 222222222222222
\n
"
);
...
...
midware/tsl/tsl_handle/kk_tsl_parse.c
View file @
89415e10
...
...
@@ -461,7 +461,7 @@ static int _kk_tsl_properties_parse(_IN_ kk_tsl_t *shadow, _IN_ lite_cjson_t *ro
return
FAIL_RETURN
;
}
printf
(
"Index: %d"
,
index
);
printf
(
"Index: %d
\n
"
,
index
);
_kk_tsl_property_parse
(
shadow
->
properties
+
index
,
&
lite_property
);
}
...
...
@@ -828,7 +828,7 @@ static int _kk_tsl_services_parse(_IN_ kk_tsl_t *shadow, _IN_ lite_cjson_t *root
return
SUCCESS_RETURN
;
}
printf
(
"
Number: %d
"
,
lite_services
.
size
);
printf
(
"
_kk_tsl_services_parse Number: %d
\n
"
,
lite_services
.
size
);
if
(
lite_services
.
size
==
0
)
{
return
SUCCESS_RETURN
;
}
...
...
@@ -850,7 +850,7 @@ static int _kk_tsl_services_parse(_IN_ kk_tsl_t *shadow, _IN_ lite_cjson_t *root
return
FAIL_RETURN
;
}
printf
(
"
Index: %d
"
,
index
);
printf
(
"
Index: %d
\n
"
,
index
);
_kk_tsl_service_parse
(
shadow
,
service
,
&
lite_service
);
}
...
...
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