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
b6d1208b
Commit
b6d1208b
authored
Aug 14, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】调整OTA的publish topic的处理,调整到APP层处理
【提交人】陈伟灿
parent
329075f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
21 deletions
+21
-21
application/kcloud/kk_topic_mng.c
application/kcloud/kk_topic_mng.c
+5
-1
common/api/com_api.h
common/api/com_api.h
+1
-0
midware/midware/dm/kk_dm_mng.c
midware/midware/dm/kk_dm_mng.c
+1
-0
midware/midware/dm/kk_dm_msg.c
midware/midware/dm/kk_dm_msg.c
+0
-8
midware/midware/dm/kk_dm_msg.h
midware/midware/dm/kk_dm_msg.h
+1
-6
midware/midware/ota/iotx_ota.c
midware/midware/ota/iotx_ota.c
+13
-6
No files found.
application/kcloud/kk_topic_mng.c
View file @
b6d1208b
...
@@ -21,6 +21,7 @@ const char DM_URI_THING_EVENT_POST[] = "thing/event/%.*s/post";
...
@@ -21,6 +21,7 @@ const char DM_URI_THING_EVENT_POST[] = "thing/event/%.*s/post";
const
char
DM_URI_THING_SERVICE_RESPONSE
[]
=
"thing/service/%.*s_reply"
;
const
char
DM_URI_THING_SERVICE_RESPONSE
[]
=
"thing/service/%.*s_reply"
;
const
char
DM_URI_THING_SERVICE_PROPERTY_SET_REPLY
[]
=
"thing/service/property/set_reply"
;
const
char
DM_URI_THING_SERVICE_PROPERTY_SET_REPLY
[]
=
"thing/service/property/set_reply"
;
const
char
KK_URI_OTA_PREFIX
[]
=
"/ota/device/upgrade/%s/%s/#"
;
const
char
KK_URI_OTA_PREFIX
[]
=
"/ota/device/upgrade/%s/%s/#"
;
const
char
KK_URI_OTA_PROCESS
[]
=
"/ota/device/progress/%s/%s"
;
int
KK_Subdev_Subscribe
(
const
cJSON
*
root
)
int
KK_Subdev_Subscribe
(
const
cJSON
*
root
)
...
@@ -218,7 +219,10 @@ char* KK_Make_Topic(cJSON *info)
...
@@ -218,7 +219,10 @@ char* KK_Make_Topic(cJSON *info)
break
;
break
;
case
MSG_SETREPLY
:
case
MSG_SETREPLY
:
_kk_utils_topic
(
DM_URI_THING_SERVICE_PROPERTY_SET_REPLY
,
product_type
->
valuestring
,
device_name
->
valuestring
,
&
topic
);
_kk_utils_topic
(
DM_URI_THING_SERVICE_PROPERTY_SET_REPLY
,
product_type
->
valuestring
,
device_name
->
valuestring
,
&
topic
);
break
;
break
;
case
MSG_OTA
:
_kk_utils_topic
(
KK_URI_OTA_PROCESS
,
product_type
->
valuestring
,
device_name
->
valuestring
,
&
topic
);
break
;
}
}
printf
(
"[%s][%d] TOPIC:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
topic
);
printf
(
"[%s][%d] TOPIC:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
topic
);
...
...
common/api/com_api.h
View file @
b6d1208b
...
@@ -40,6 +40,7 @@ typedef enum{
...
@@ -40,6 +40,7 @@ typedef enum{
MSG_EVENTPOST
,
MSG_EVENTPOST
,
MSG_SERVICERESPONSE
,
MSG_SERVICERESPONSE
,
MSG_SETREPLY
,
MSG_SETREPLY
,
MSG_OTA
,
}
kk_msg_type_t
;
}
kk_msg_type_t
;
typedef
void
ipc_cb
(
void
*
data
,
int
len
);
typedef
void
ipc_cb
(
void
*
data
,
int
len
);
...
...
midware/midware/dm/kk_dm_mng.c
View file @
b6d1208b
...
@@ -15,6 +15,7 @@ const char DM_URI_EXT_NTP_PREFIX[] DM_READ_ONLY = "/ext/ntp/%
...
@@ -15,6 +15,7 @@ const char DM_URI_EXT_NTP_PREFIX[] DM_READ_ONLY = "/ext/ntp/%
const
char
DM_URI_EXT_ERROR_PREFIX
[]
DM_READ_ONLY
=
"/ext/error/%s/%s"
;
const
char
DM_URI_EXT_ERROR_PREFIX
[]
DM_READ_ONLY
=
"/ext/error/%s/%s"
;
const
char
DM_URI_REPLY_SUFFIX
[]
DM_READ_ONLY
=
"_reply"
;
const
char
DM_URI_REPLY_SUFFIX
[]
DM_READ_ONLY
=
"_reply"
;
const
char
DM_URI_OTA_DEVICE_INFORM
[]
DM_READ_ONLY
=
"/ota/device/inform/%s/%s"
;
const
char
DM_URI_OTA_DEVICE_INFORM
[]
DM_READ_ONLY
=
"/ota/device/inform/%s/%s"
;
const
char
DM_URI_THING_EVENT_PROPERTY_POST_METHOD
[]
DM_READ_ONLY
=
"thing.event.property.post"
;
static
dm_mgr_ctx
g_dm_mgr
=
{
0
};
static
dm_mgr_ctx
g_dm_mgr
=
{
0
};
...
...
midware/midware/dm/kk_dm_msg.c
View file @
b6d1208b
...
@@ -7,14 +7,6 @@
...
@@ -7,14 +7,6 @@
#include "com_api.h"
#include "com_api.h"
const
char
DM_URI_SYS_PREFIX
[]
DM_READ_ONLY
=
"/sys/%s/%s/"
;
const
char
DM_URI_THING_EVENT_PROPERTY_POST
[]
DM_READ_ONLY
=
"thing/event/property/post"
;
const
char
DM_URI_THING_SERVICE_PROPERTY_SET_REPLY
[]
DM_READ_ONLY
=
"thing/service/property/set_reply"
;
const
char
DM_URI_THING_EVENT_POST
[]
DM_READ_ONLY
=
"thing/event/%.*s/post"
;
const
char
DM_URI_THING_SERVICE_RESPONSE
[]
DM_READ_ONLY
=
"thing/service/%.*s_reply"
;
const
char
DM_URI_THING_EVENT_PROPERTY_POST_METHOD
[]
DM_READ_ONLY
=
"thing.event.property.post"
;
const
char
DM_MSG_REQUEST
[]
DM_READ_ONLY
=
"{
\"
msgId
\"
:
\"
%d
\"
,
\"
version
\"
:
\"
%s
\"
,
\"
params
\"
:%.*s,
\"
method
\"
:
\"
%s
\"
}"
;
const
char
DM_MSG_REQUEST
[]
DM_READ_ONLY
=
"{
\"
msgId
\"
:
\"
%d
\"
,
\"
version
\"
:
\"
%s
\"
,
\"
params
\"
:%.*s,
\"
method
\"
:
\"
%s
\"
}"
;
const
char
DM_MSG_INFO
[]
DM_READ_ONLY
=
"{
\"
msgtype
\"
:
\"
%d
\"
,
\"
product_type
\"
:
\"
%s
\"
,
\"
device_name
\"
:
\"
%s
\"
,
\"
identifier
\"
:
\"
%s
\"
}"
;
const
char
DM_MSG_INFO
[]
DM_READ_ONLY
=
"{
\"
msgtype
\"
:
\"
%d
\"
,
\"
product_type
\"
:
\"
%s
\"
,
\"
device_name
\"
:
\"
%s
\"
,
\"
identifier
\"
:
\"
%s
\"
}"
;
...
...
midware/midware/dm/kk_dm_msg.h
View file @
b6d1208b
...
@@ -39,13 +39,8 @@ typedef struct {
...
@@ -39,13 +39,8 @@ typedef struct {
#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
;
extern
const
char
DM_URI_SYS_PREFIX
[]
DM_READ_ONLY
;
extern
const
char
DM_URI_THING_EVENT_PROPERTY_POST
[]
DM_READ_ONLY
;
const
char
DM_URI_THING_SERVICE_PROPERTY_SET_REPLY
[]
DM_READ_ONLY
;
const
char
DM_URI_THING_EVENT_POST
[]
DM_READ_ONLY
;
const
char
DM_URI_THING_SERVICE_RESPONSE
[]
DM_READ_ONLY
;
const
char
DM_URI_THING_EVENT_PROPERTY_POST_METHOD
[]
DM_READ_ONLY
;
//const char DM_URI_SYS_PREFIX[] DM_READ_ONLY = "/sys/%s/%s/";
//const char DM_URI_SYS_PREFIX[] DM_READ_ONLY = "/sys/%s/%s/";
...
...
midware/midware/ota/iotx_ota.c
View file @
b6d1208b
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include "iotx_ota_internal.h"
#include "iotx_ota_internal.h"
#include "com_api.h"
#include "com_api.h"
#include "cJSON.h"
#include "cJSON.h"
#include "kk_dm_msg.h"
/*#if (OTA_SIGNAL_CHANNEL) == 1
/*#if (OTA_SIGNAL_CHANNEL) == 1
...
@@ -514,23 +515,29 @@ do_exit:
...
@@ -514,23 +515,29 @@ do_exit:
int
OTA_publishProgress
(
void
*
handle
,
char
*
payload
){
int
OTA_publishProgress
(
void
*
handle
,
char
*
payload
){
OTA_Struct_pt
h_ota
=
(
OTA_Struct_pt
)
handle
;
OTA_Struct_pt
h_ota
=
(
OTA_Struct_pt
)
handle
;
if
(
NULL
==
handle
)
{
if
(
NULL
==
handle
)
{
OTA_LOG_ERROR
(
"handle is NULL"
);
OTA_LOG_ERROR
(
"handle is NULL
\n
"
);
return
IOT_OTAE_INVALID_PARAM
;
return
IOT_OTAE_INVALID_PARAM
;
}
}
if
(
NULL
==
payload
)
{
if
(
NULL
==
payload
)
{
OTA_LOG_ERROR
(
"payload is NULL"
);
OTA_LOG_ERROR
(
"payload is NULL
\n
"
);
return
IOT_OTAE_INVALID_PARAM
;
return
IOT_OTAE_INVALID_PARAM
;
}
}
/* inform OTA to topic: "/ota/device/progress/$(product_key)/$(device_name)" */
/* inform OTA to topic: "/ota/device/progress/$(product_key)/$(device_name)" */
char
topictmf
[]
=
"/ota/device/progress/%s/%s"
;
// int topicLen = strlen(DM_MSG_INFO) + strlen(h_ota->product_key) + strlen(h_ota->device_name) + 1;
int
topicLen
=
strlen
(
topictmf
)
+
strlen
(
h_ota
->
product_key
)
+
strlen
(
h_ota
->
device_name
)
+
1
;
int
topicLen
=
strlen
(
DM_MSG_INFO
)
+
10
+
strlen
(
h_ota
->
product_key
)
+
strlen
(
h_ota
->
device_name
)
+
1
;
char
*
topicBuf
=
malloc
(
topicLen
);
char
*
topicBuf
=
malloc
(
topicLen
);
HAL_Snprintf
(
topicBuf
,
topicLen
,
topictmf
,
h_ota
->
product_key
,
h_ota
->
device_name
);
if
(
topicBuf
==
NULL
){
OTA_LOG_ERROR
(
"MALLOC is NULL
\n
"
);
return
IOT_OTAE_INVALID_PARAM
;
}
HAL_Snprintf
(
topicBuf
,
topicLen
,
DM_MSG_INFO
,
MSG_OTA
,
h_ota
->
product_key
,
h_ota
->
device_name
,
""
);
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
root
,
"
topic
"
,
topicBuf
);
cJSON_AddStringToObject
(
root
,
"
info
"
,
topicBuf
);
cJSON_AddStringToObject
(
root
,
"payload"
,
payload
);
cJSON_AddStringToObject
(
root
,
"payload"
,
payload
);
void
*
buf
=
cJSON_Print
(
root
);
void
*
buf
=
cJSON_Print
(
root
);
kk_ipc_send
(
IPC_MID2APP
,
buf
,
strlen
(
buf
)
+
1
);
kk_ipc_send
(
IPC_MID2APP
,
buf
,
strlen
(
buf
)
+
1
);
...
...
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