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
f7ac64c6
Commit
f7ac64c6
authored
Nov 08, 2021
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】1,增加离线语音OTA功能;2,修改编译级别为werror
【提交人】陈伟灿
parent
ac14fe24
Changes
23
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
387 additions
and
203 deletions
+387
-203
application/kcloud/kcloud_config.h
application/kcloud/kcloud_config.h
+0
-2
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+34
-16
application/klansdk/kk_lan_voice_panel.c
application/klansdk/kk_lan_voice_panel.c
+15
-3
application/klansdk/kk_lan_voice_panel.h
application/klansdk/kk_lan_voice_panel.h
+3
-27
application/klansdk/kk_opcode.h
application/klansdk/kk_opcode.h
+6
-0
application/klansdk/kk_voice_panel_handle.c
application/klansdk/kk_voice_panel_handle.c
+235
-64
application/klansdk/kk_voice_panel_handle.h
application/klansdk/kk_voice_panel_handle.h
+9
-9
common/api/com_api.c
common/api/com_api.c
+2
-2
common/api/tcp_channel.c
common/api/tcp_channel.c
+6
-4
common/hal/HAL_OS_linux.c
common/hal/HAL_OS_linux.c
+1
-1
common/hal/kk_product.h
common/hal/kk_product.h
+2
-0
midware/midware/area/kk_area_handle.c
midware/midware/area/kk_area_handle.c
+11
-9
midware/midware/area/kk_area_handle.h
midware/midware/area/kk_area_handle.h
+6
-0
midware/midware/dm/kk_dm_msg.h
midware/midware/dm/kk_dm_msg.h
+3
-1
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+38
-52
midware/midware/dm/kk_sub_db.c
midware/midware/dm/kk_sub_db.c
+2
-1
midware/midware/midware.c
midware/midware/midware.c
+2
-2
midware/midware/ota/iotx_ota.c
midware/midware/ota/iotx_ota.c
+3
-3
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+1
-0
midware/midware/scene/kk_scene_handle.h
midware/midware/scene/kk_scene_handle.h
+1
-0
midware/tsl/tsl_handle/kk_tsl_api.c
midware/tsl/tsl_handle/kk_tsl_api.c
+5
-5
midware/tsl/tsl_handle/kk_tsl_parse.c
midware/tsl/tsl_handle/kk_tsl_parse.c
+1
-1
tools/board/config.linux.nx5
tools/board/config.linux.nx5
+1
-1
No files found.
application/kcloud/kcloud_config.h
View file @
f7ac64c6
...
@@ -19,8 +19,6 @@ typedef enum {
...
@@ -19,8 +19,6 @@ typedef enum {
RETURN_FAIL
=
-
1
,
RETURN_FAIL
=
-
1
,
RETURN_SUCCESS
=
0
,
RETURN_SUCCESS
=
0
,
}
kk_kcloud_error_code_t
;
}
kk_kcloud_error_code_t
;
#define KK_DEVICESECRET_PATH "/data/kk/kk_deviceSecret.txt"
#define KK_TOKEN_PATH "/data/kk/kk_token.txt"
#define HOST_NAME "dev.nj-ikonke.site"
#define HOST_NAME "dev.nj-ikonke.site"
int
KK_Get_ccuid
(
char
*
device_code
);
int
KK_Get_ccuid
(
char
*
device_code
);
#endif
#endif
...
...
application/klansdk/kk_data_handle.c
View file @
f7ac64c6
...
@@ -379,8 +379,41 @@ int kk_data_handle(cJSON *json,int sockfd)
...
@@ -379,8 +379,41 @@ int kk_data_handle(cJSON *json,int sockfd)
if
(
key
!=
NULL
){
if
(
key
!=
NULL
){
kk_handle_del_history_info
(
key
->
valuestring
);
kk_handle_del_history_info
(
key
->
valuestring
);
}
}
}
else
if
(
strcmp
(
opcode
->
valuestring
,
VOICE_VOLUME_CTRL
)
==
0
){
cJSON
*
vol
=
cJSON_GetObjectItem
(
json
,
"arg"
);
if
(
vol
!=
NULL
){
kk_voice_control
(
atoi
(
vol
->
valuestring
));
}
}
else
if
(
strcmp
(
opcode
->
valuestring
,
VOICE_SWITCH_CTRL
)
==
0
){
cJSON
*
onff
=
cJSON_GetObjectItem
(
json
,
"arg"
);
int
value
=
0
;
if
(
onff
!=
NULL
){
if
(
strcmp
(
onff
->
valuestring
,
"on"
)
==
0
){
value
=
1
;
}
else
{
value
=
0
;
}
kk_voice_switch
(
value
);
}
}
else
if
(
strcmp
(
opcode
->
valuestring
,
VOICE_VERSION_QUERY
)
==
0
){
char
ver
[
16
]
=
{
0
};
kk_vp_voice_version_get
(
ver
,
sizeof
(
ver
));
cJSON
*
root
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
root
,
"nodeid"
,
"*"
);
cJSON_AddStringToObject
(
root
,
"opcode"
,
VOICE_VERSION_QUERY
);
cJSON_AddStringToObject
(
root
,
"status"
,
"success"
);
cJSON_AddStringToObject
(
root
,
"arg"
,
ver
);
send_msg_to_module
(
root
);
cJSON_Delete
(
root
);
}
else
if
(
strcmp
(
opcode
->
valuestring
,
VOICE_OTA
)
==
0
){
cJSON
*
otafile
=
cJSON_GetObjectItem
(
json
,
"arg"
);
if
(
otafile
!=
NULL
){
kk_voice_ota_mtu_set
(
KK_VOICE_OTA_MTU
);
kk_vp_ota_file_update_start
(
otafile
->
valuestring
);
}
}
else
if
(
strcmp
(
opcode
->
valuestring
,
EXIT_VOICE_FACTORY
)
==
0
){
kk_voice_exit_factory_mode
();
}
else
{
}
else
{
kk_ccu_opcode_handle
(
json
);
kk_ccu_opcode_handle
(
json
);
}
}
}
}
...
@@ -416,24 +449,13 @@ static int kk_parse_syncinfo(cJSON *payload)
...
@@ -416,24 +449,13 @@ static int kk_parse_syncinfo(cJSON *payload)
gwdevicecode
=
cJSON_GetObjectItem
(
gwitem
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
gwdevicecode
=
cJSON_GetObjectItem
(
gwitem
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
if
(
subdevices
!=
NULL
){
if
(
subdevices
!=
NULL
){
subitem
=
subdevices
->
child
;
subitem
=
subdevices
->
child
;
while
(
subitem
!=
NULL
){
while
(
subitem
!=
NULL
){
deviceCode
=
cJSON_GetObjectItem
(
subitem
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
deviceCode
=
cJSON_GetObjectItem
(
subitem
,
MSG_DEVICE_CODE_STR
)
->
valuestring
;
productCode
=
cJSON_GetObjectItem
(
subitem
,
MSG_PRODUCT_CODE_STR
)
->
valuestring
;
productCode
=
cJSON_GetObjectItem
(
subitem
,
MSG_PRODUCT_CODE_STR
)
->
valuestring
;
onlineStatus
=
cJSON_GetObjectItem
(
subitem
,
MSG_ONLINE_STATUS_STR
);
onlineStatus
=
cJSON_GetObjectItem
(
subitem
,
MSG_ONLINE_STATUS_STR
);
properties
=
cJSON_GetObjectItem
(
subitem
,
MSG_PROPERTIES_STR
);
properties
=
cJSON_GetObjectItem
(
subitem
,
MSG_PROPERTIES_STR
);
kk_map_dev_node_add
(
deviceCode
,
productCode
,
gwdevicecode
,(
onlineStatus
->
valueint
==
1
)
?
"1"
:
"0"
);
kk_map_dev_node_add
(
deviceCode
,
productCode
,
gwdevicecode
,(
onlineStatus
->
valueint
==
1
)
?
"1"
:
"0"
);
kk_lan_property_syn_deal
(
deviceCode
,
properties
);
kk_lan_property_syn_deal
(
deviceCode
,
properties
);
subitem
=
subitem
->
next
;
subitem
=
subitem
->
next
;
}
}
}
}
...
@@ -444,10 +466,6 @@ static int kk_parse_syncinfo(cJSON *payload)
...
@@ -444,10 +466,6 @@ static int kk_parse_syncinfo(cJSON *payload)
}
}
int
is_ccu_msg
(
cJSON
*
productCode
,
cJSON
*
deviceCode
)
int
is_ccu_msg
(
cJSON
*
productCode
,
cJSON
*
deviceCode
)
{
{
char
ccuid
[
33
]
=
{
0
};
char
ccuid
[
33
]
=
{
0
};
...
...
application/klansdk/kk_lan_voice_panel.c
View file @
f7ac64c6
...
@@ -282,15 +282,27 @@ int kk_vp_config_file_info_check(int f_ver,int f_size,int crc32)
...
@@ -282,15 +282,27 @@ int kk_vp_config_file_info_check(int f_ver,int f_size,int crc32)
}
}
return
0
;
return
0
;
}
}
int
kk_voice_exit_factory_mode
(
void
)
{
uint8_t
data
[
1
]
=
{
1
};
vp_send_data_build
(
OPCODE_COMPLETED_TEST_OP
,
sizeof
(
data
),
data
);
return
1
;
}
void
kk_voice_ota_mtu_set
(
uint16_t
mtu
)
{
uint8_t
res
[
3
]
=
{
0
};
res
[
0
]
=
0xff
;
res
[
1
]
=
(
mtu
>>
8
)
&
0xff
;
res
[
2
]
=
mtu
&
0xff
;
INFO_PRINT
(
"[set] MTU OTA SIZE = %d
\n
"
,
mtu
);
vp_send_data_build
(
OPCODE_VOICE_SWITCH
,
sizeof
(
res
),
res
);
}
void
kk_vp_manage_init
(
void
)
void
kk_vp_manage_init
(
void
)
{
{
vp_scene_id_map_load
();
vp_scene_id_map_load
();
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
_vp_config_file_version_load
();
_vp_config_file_version_load
();
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
vp_mag
.
cfg_info
.
f_size
=
_vp_get_cfg_file_size
();
vp_mag
.
cfg_info
.
f_size
=
_vp_get_cfg_file_size
();
vp_mag
.
cfg_info
.
crc32
=
_vp_get_cfg_file_crc32
();
vp_mag
.
cfg_info
.
crc32
=
_vp_get_cfg_file_crc32
();
}
}
...
...
application/klansdk/kk_lan_voice_panel.h
View file @
f7ac64c6
...
@@ -14,41 +14,17 @@ int kk_voice_panel_init(int argc, char* argv[]);
...
@@ -14,41 +14,17 @@ int kk_voice_panel_init(int argc, char* argv[]);
#define UPDATING_8009_CONFIG_FILE_INFO 3
#define UPDATING_8009_CONFIG_FILE_INFO 3
#define STOP_8009_CONFIG_FILE_UPDATE 4
#define STOP_8009_CONFIG_FILE_UPDATE 4
#define GET_8009_CONFIG_FILE_INFO 5
#define GET_8009_CONFIG_FILE_INFO 5
#define KK_VOICE_OTA_MTU 128
void
kk_vp_set_state_machine
(
int
state
);
void
kk_vp_set_state_machine
(
int
state
);
void
kk_vp_set_config_file_version
(
int
ver
);
void
kk_vp_set_config_file_version
(
int
ver
);
int
kk_vp_config_file_info_check
(
int
f_ver
,
int
f_size
,
int
crc32
);
int
kk_vp_config_file_info_check
(
int
f_ver
,
int
f_size
,
int
crc32
);
void
kk_vp_update_result_check
(
uint8_t
status
,
uint32_t
f_ver
);
void
kk_vp_update_result_check
(
uint8_t
status
,
uint32_t
f_ver
);
void
kk_vp_set_config_file_version
(
int
ver
);
void
kk_vp_set_config_file_version
(
int
ver
);
void
kk_vp_cfg_info_check
(
uint32_t
f_ver
,
uint32_t
f_size
,
uint32_t
crc32
);
void
kk_vp_cfg_info_check
(
uint32_t
f_ver
,
uint32_t
f_size
,
uint32_t
crc32
);
void
kk_vp_cfg_info_set
(
uint32_t
f_ver
,
uint32_t
f_size
,
uint32_t
crc32
);
void
kk_vp_cfg_info_set
(
uint32_t
f_ver
,
uint32_t
f_size
,
uint32_t
crc32
);
void
kk_vp_set_updateFlag
(
int
flag
);
void
kk_vp_set_updateFlag
(
int
flag
);
void
kk_voice_ota_mtu_set
(
uint16_t
mtu
);
int
kk_voice_exit_factory_mode
(
void
);
#endif
#endif
application/klansdk/kk_opcode.h
View file @
f7ac64c6
...
@@ -28,6 +28,12 @@
...
@@ -28,6 +28,12 @@
#define ZIGBEE_DEV_HW_INFO_PUSH "ZIGBEE_DEV_HW_INFO_PUSH"
#define ZIGBEE_DEV_HW_INFO_PUSH "ZIGBEE_DEV_HW_INFO_PUSH"
#define GET_HISTORY_ALARM_LOG "GET_HISTORY_ALARM_LOG"
#define GET_HISTORY_ALARM_LOG "GET_HISTORY_ALARM_LOG"
#define DEL_HISTORY_ALARM_LOG "DEL_HISTORY_ALARM_LOG"
#define DEL_HISTORY_ALARM_LOG "DEL_HISTORY_ALARM_LOG"
#define VOICE_VOLUME_CTRL "SOUND_VAL"
#define VOICE_SWITCH_CTRL "VOICE_SWITCH"
#define VOICE_VERSION_QUERY "VOICE_VERSION"
#define VOICE_OTA_FINISH "VOICE_OTA_FINISH"
#define VOICE_OTA "VOICE_OTA"
#define EXIT_VOICE_FACTORY "EXIT_VOICE_FACTORY"
#define SWITCH_OPCODE "SWITCH"
#define SWITCH_OPCODE "SWITCH"
#define GET_HISTORY_MSG_TYPE "/thing/service/historyAlarm"
#define GET_HISTORY_MSG_TYPE "/thing/service/historyAlarm"
#define DEL_HISTORY_MSG_TYPE "/thing/service/delAlarm"
#define DEL_HISTORY_MSG_TYPE "/thing/service/delAlarm"
...
...
application/klansdk/kk_voice_panel_handle.c
View file @
f7ac64c6
This diff is collapsed.
Click to expand it.
application/klansdk/kk_voice_panel_handle.h
View file @
f7ac64c6
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#define OPCODE_8009_SNAPSHOOT 0x1000
#define OPCODE_8009_SNAPSHOOT 0x1000
#define OPCODE_SNAPSHOOT 0x1001
#define OPCODE_SNAPSHOOT 0x1001
#define OPCODE_SCENE_ID_NOTIFY 0x1003
#define OPCODE_SCENE_ID_NOTIFY 0x1003
#define OPCODE_VOICE_CONTROL 0x1008
#define OPCODE_SYSTEM_TIME_SET 0x1009
#define OPCODE_SYSTEM_TIME_SET 0x1009
#define OPCODE_SYSTEM_TIME_GET 0x100A
#define OPCODE_SYSTEM_TIME_GET 0x100A
#define OPCODE_ACTION_NOTIFY 0x100B
#define OPCODE_ACTION_NOTIFY 0x100B
...
@@ -26,8 +27,8 @@
...
@@ -26,8 +27,8 @@
#define OPCODE_CONFIG_FILE_INFO_GET 0x100F
#define OPCODE_CONFIG_FILE_INFO_GET 0x100F
#define OPCODE_CONFIG_FILE_UPDATE_STATUS 0x1010
#define OPCODE_CONFIG_FILE_UPDATE_STATUS 0x1010
#define OPCODE_VOICE_CONTROL_NOTIFY 0x1022
#define OPCODE_VOICE_CONTROL_NOTIFY 0x1022
#define OPCODE_VOICE_SWITCH 0x1023
#define OPCODE_COMPLETED_TEST_OP 0xEDB4
#define OPCODE_VOICE_OTA_UPGRADE_STATR 0x1016
#define OPCODE_VOICE_OTA_UPGRADE_STATR 0x1016
#define OPCODE_VOICE_OTA_REQUEST 0x1017
#define OPCODE_VOICE_OTA_REQUEST 0x1017
#define OPCODE_VOICE_OTA_UPGRADE_STOP 0x1018
#define OPCODE_VOICE_OTA_UPGRADE_STOP 0x1018
...
@@ -64,7 +65,7 @@ void kk_vp_get_config_file_info(void);
...
@@ -64,7 +65,7 @@ void kk_vp_get_config_file_info(void);
void
kk_vp_get_ota_file_info
(
void
);
void
kk_vp_get_ota_file_info
(
void
);
void
kk_vp_ota_file_update_start
(
uint32_t
ver
);
void
kk_vp_ota_file_update_stop
(
uint32_t
ver
);
void
kk_vp_ota_file_update_stop
(
uint32_t
ver
);
...
@@ -85,15 +86,14 @@ void vp_scene_id_map_deinit(void);
...
@@ -85,15 +86,14 @@ void vp_scene_id_map_deinit(void);
int
vp_scene_id_item_add
(
int
scene_id
);
int
vp_scene_id_item_add
(
int
scene_id
);
int
vp_scene_id_item_load
(
int
scene_id
,
uint16_t
map_id
);
int
vp_scene_id_item_load
(
int
scene_id
,
uint16_t
map_id
);
int
vp_scene_id_map_save
(
void
);
int
vp_scene_id_map_save
(
void
);
int
_vp_get_cfg_file_crc32
(
void
);
int
_vp_get_cfg_file_crc32
(
void
);
int
_vp_get_cfg_file_size
(
void
);
int
_vp_get_cfg_file_size
(
void
);
void
kk_voice_control
(
int
val
);
int
kk_vp_voice_version_get
(
char
*
ver
,
int
len
);
void
kk_voice_switch
(
int
val
);
void
kk_vp_ota_file_update_start
(
char
*
file
);
void
vp_send_data_build
(
uint16_t
opCode
,
uint8_t
len
,
uint8_t
*
data
);
#endif
#endif
common/api/com_api.c
View file @
f7ac64c6
...
@@ -94,7 +94,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
...
@@ -94,7 +94,7 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
loop_ctrl
->
isconnect
=
1
;
loop_ctrl
->
isconnect
=
1
;
//if sub, need filter sbuscribe str
//if sub, need filter sbuscribe str
if
(
IPC_PLAT2MID
==
loop_ctrl
->
type
||
IPC_MID2PLAT
==
loop_ctrl
->
type
){
if
(
IPC_PLAT2MID
==
loop_ctrl
->
type
||
IPC_MID2PLAT
==
loop_ctrl
->
type
){
validDat
=
_parse_data_by_subscribe
((
char
*
)
dat
,
bytes
,
&
validLen
,
&
chlMark
);
validDat
=
_parse_data_by_subscribe
((
char
*
)
dat
,
bytes
,
&
validLen
,
(
void
**
)
&
chlMark
);
}
else
{
}
else
{
validDat
=
dat
;
validDat
=
dat
;
validLen
=
bytes
;
validLen
=
bytes
;
...
@@ -293,7 +293,7 @@ int __nanomsg_init(Bloop_ctrl_t *loop_ctrl, ipc_type type,char* chlMark, char* i
...
@@ -293,7 +293,7 @@ int __nanomsg_init(Bloop_ctrl_t *loop_ctrl, ipc_type type,char* chlMark, char* i
*
*
*
*
==================================*/
==================================*/
void
loop_thread
(
void
*
arg
){
void
*
loop_thread
(
void
*
arg
){
INFO_PRINT
(
"loop_thread start!
\r\n
"
);
INFO_PRINT
(
"loop_thread start!
\r\n
"
);
ev_run
(
gloop
,
0
);
ev_run
(
gloop
,
0
);
...
...
common/api/tcp_channel.c
View file @
f7ac64c6
...
@@ -615,23 +615,24 @@ static void accept_cb(struct ev_loop *loop, struct ev_io *watcher, int revents)
...
@@ -615,23 +615,24 @@ static void accept_cb(struct ev_loop *loop, struct ev_io *watcher, int revents)
return 0;
return 0;
}*/
}*/
static
void
loop_tcp_thread
(
void
*
arg
){
static
void
*
loop_tcp_thread
(
void
*
arg
){
INFO_PRINT
(
"loop_tcp_thread start!
\r\n
"
);
INFO_PRINT
(
"loop_tcp_thread start!
\r\n
"
);
int
sd
;
int
sd
;
g_loop
=
ev_loop_new
(
EVBACKEND_EPOLL
);
g_loop
=
ev_loop_new
(
EVBACKEND_EPOLL
);
if
(
NULL
==
g_loop
)
{
if
(
NULL
==
g_loop
)
{
INFO_PRINT
(
"loop create failed
\r\n
"
);
INFO_PRINT
(
"loop create failed
\r\n
"
);
return
;
return
NULL
;
}
}
if
(
server_socket_init
(
&
sd
,
NULL
,
CCU_TCP_PORT
)
<
0
)
{
if
(
server_socket_init
(
&
sd
,
NULL
,
CCU_TCP_PORT
)
<
0
)
{
INFO_PRINT
(
"server init failed
\r\n
"
);
INFO_PRINT
(
"server init failed
\r\n
"
);
return
;
return
NULL
;
}
}
ev_io_init
(
&
w_accept
,
accept_cb
,
sd
,
EV_READ
);
ev_io_init
(
&
w_accept
,
accept_cb
,
sd
,
EV_READ
);
ev_io_start
(
g_loop
,
&
w_accept
);
ev_io_start
(
g_loop
,
&
w_accept
);
ev_run
(
g_loop
,
0
);
ev_run
(
g_loop
,
0
);
close
(
sd
);
close
(
sd
);
return
NULL
;
INFO_PRINT
(
"loop_tcp_thread================== end
\n
"
);
INFO_PRINT
(
"loop_tcp_thread================== end
\n
"
);
}
}
...
@@ -828,7 +829,7 @@ err1:
...
@@ -828,7 +829,7 @@ err1:
return
-
1
;
return
-
1
;
}
}
static
void
loop_tcp_client_thread
(
void
*
arg
){
static
void
*
loop_tcp_client_thread
(
void
*
arg
){
INFO_PRINT
(
"loop_tcp_client_thread start!
\r\n
"
);
INFO_PRINT
(
"loop_tcp_client_thread start!
\r\n
"
);
char
buf
[
1024
]
=
{
0
};
char
buf
[
1024
]
=
{
0
};
int
ret
=
0
;
int
ret
=
0
;
...
@@ -904,6 +905,7 @@ static void loop_tcp_client_thread(void *arg){
...
@@ -904,6 +905,7 @@ static void loop_tcp_client_thread(void *arg){
INFO_PRINT
(
"network error, try connect again!
\n
"
);
INFO_PRINT
(
"network error, try connect again!
\n
"
);
close
(
g_client_ctrl
.
sd
);
close
(
g_client_ctrl
.
sd
);
}
}
return
NULL
;
INFO_PRINT
(
"loop_tcp_client_thread================== end
\n
"
);
INFO_PRINT
(
"loop_tcp_client_thread================== end
\n
"
);
}
}
...
...
common/hal/HAL_OS_linux.c
View file @
f7ac64c6
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdarg.h>
#include <memory.h>
#include <memory.h>
#include <ctype.h>
#include <pthread.h>
#include <pthread.h>
#include <unistd.h>
#include <unistd.h>
#include <sys/prctl.h>
#include <sys/prctl.h>
...
...
common/hal/kk_product.h
View file @
f7ac64c6
...
@@ -46,6 +46,8 @@
...
@@ -46,6 +46,8 @@
#define OTA_IMG_PATH "/data/OTA/"
#define OTA_IMG_PATH "/data/OTA/"
#define OTA_IMG_FILE "/data/OTA/app_squashfs.img"
#define OTA_IMG_FILE "/data/OTA/app_squashfs.img"
#define OTA_IMG_FILE_MD5 "/data/OTA/app_squashfs.img.md5"
#define OTA_IMG_FILE_MD5 "/data/OTA/app_squashfs.img.md5"
#define KK_DEVICESECRET_PATH "/data/kk/kk_deviceSecret.txt"
#define KK_TOKEN_PATH "/data/kk/kk_token.txt"
enum
{
enum
{
DEVICE_OFFLINE
=
0
,
DEVICE_OFFLINE
=
0
,
DEVICE_ONLINE
,
DEVICE_ONLINE
,
...
...
midware/midware/area/kk_area_handle.c
View file @
f7ac64c6
...
@@ -115,7 +115,7 @@ int kk_area_init(void)
...
@@ -115,7 +115,7 @@ int kk_area_init(void)
if
(
res
!=
SUCCESS_RETURN
){
if
(
res
!=
SUCCESS_RETURN
){
ERROR_PRINT
(
"[%s][%d]kk_area_init FAIL!!!
\n
"
,
__FUNCTION__
,
__LINE__
);
ERROR_PRINT
(
"[%s][%d]kk_area_init FAIL!!!
\n
"
,
__FUNCTION__
,
__LINE__
);
}
}
kk_floor_add
(
"默认"
,
"1"
);
//创建默认楼层
//
kk_floor_add("默认","1");//创建默认楼层
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
static
int
kk_check_room_exist
(
const
char
*
roomId
)
static
int
kk_check_room_exist
(
const
char
*
roomId
)
...
@@ -303,11 +303,13 @@ int kk_floor_add(const char *name,const char *floorId)
...
@@ -303,11 +303,13 @@ int kk_floor_add(const char *name,const char *floorId)
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
char
*
sqlCmd
=
NULL
;
char
*
sqlCmd
=
NULL
;
char
*
zErrMsg
=
0
;
char
*
zErrMsg
=
0
;
const
char
*
insertCmd
=
NULL
;
if
(
kk_check_floor_exist
(
floorId
)){
if
(
kk_check_floor_exist
(
floorId
)){
return
SUCCESS_RETURN
;
insertCmd
=
"UPDATE floorInfo SET name='%s' WHERE floorId= '%s'"
;
}
}
else
{
const
char
*
insertCmd
=
"insert into floorInfo (name, floorId) \
insertCmd
=
"insert into floorInfo (name, floorId) \
values ('%s','%s');"
;
values ('%s','%s');"
;
}
_kk_area_lock
();
_kk_area_lock
();
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
name
,
floorId
);
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
name
,
floorId
);
...
@@ -758,7 +760,7 @@ cJSON * kk_get_roomids_by_floorId(const char* floorId)
...
@@ -758,7 +760,7 @@ cJSON * kk_get_roomids_by_floorId(const char* floorId)
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
cJSON
*
roomJson
=
cJSON_CreateObject
();
cJSON
*
roomJson
=
cJSON_CreateObject
();
pRoomId
=
sqlite3_column_text
(
stmt
,
DB_ROOM_ID
);
pRoomId
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_ROOM_ID
);
cJSON_AddStringToObject
(
roomJson
,
"roomId"
,
pRoomId
);
cJSON_AddStringToObject
(
roomJson
,
"roomId"
,
pRoomId
);
cJSON_AddItemToArray
(
roomIdsAry
,
roomJson
);
cJSON_AddItemToArray
(
roomIdsAry
,
roomJson
);
}
}
...
@@ -766,7 +768,7 @@ cJSON * kk_get_roomids_by_floorId(const char* floorId)
...
@@ -766,7 +768,7 @@ cJSON * kk_get_roomids_by_floorId(const char* floorId)
sqlite3_free
(
sqlCmd
);
sqlite3_free
(
sqlCmd
);
return
roomIdsAry
;
return
roomIdsAry
;
}
}
char
*
kk_get_floorIds_ary
(
void
)
kk_floor_list_t
*
kk_get_floorIds_ary
(
void
)
{
{
sqlite3_stmt
*
stmt
;
sqlite3_stmt
*
stmt
;
char
*
pfloorId
=
NULL
;
char
*
pfloorId
=
NULL
;
...
@@ -880,7 +882,7 @@ static int kk_check_floorId(int nodeId)
...
@@ -880,7 +882,7 @@ static int kk_check_floorId(int nodeId)
_kk_area_lock
();
_kk_area_lock
();
sqlite3_prepare_v2
(
ctx
->
pDb
,
searchCmd
,
strlen
(
searchCmd
),
&
stmt
,
NULL
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
searchCmd
,
strlen
(
searchCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
pnode
=
sqlite3_column_text
(
stmt
,
DB_FLOOR_ID
);
pnode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_FLOOR_ID
);
if
(
atoi
(
pnode
)
==
nodeId
)
if
(
atoi
(
pnode
)
==
nodeId
)
{
{
isExist
=
1
;
isExist
=
1
;
...
@@ -891,7 +893,7 @@ static int kk_check_floorId(int nodeId)
...
@@ -891,7 +893,7 @@ static int kk_check_floorId(int nodeId)
_kk_area_unlock
();
_kk_area_unlock
();
return
isExist
;
return
isExist
;
}
}
int
kk_creater_
node
id
(
char
*
floorId
)
int
kk_creater_
floor
id
(
char
*
floorId
)
{
{
static
int
next
=
100
;
static
int
next
=
100
;
...
...
midware/midware/area/kk_area_handle.h
View file @
f7ac64c6
...
@@ -53,5 +53,11 @@ int kk_room_set_floor_info(const char*floorId,const char* floorName,const char *
...
@@ -53,5 +53,11 @@ int kk_room_set_floor_info(const char*floorId,const char* floorName,const char *
int
kk_floor_delete_all
(
void
);
int
kk_floor_delete_all
(
void
);
int
kk_floor_delete_by_id
(
char
*
floorId
);
int
kk_floor_delete_by_id
(
char
*
floorId
);
int
kk_set_floor_to_default
(
const
char
*
floorId
);
int
kk_set_floor_to_default
(
const
char
*
floorId
);
kk_floor_list_t
*
kk_get_floorIds_ary
(
void
);
int
kk_floor_add
(
const
char
*
name
,
const
char
*
floorId
);
cJSON
*
kk_get_roomids_by_floorId
(
const
char
*
floorId
);
int
kk_creater_floorid
(
char
*
floorId
);
void
kk_free_floor_list
(
void
);
cJSON
*
kk_get_roomIds_ary
(
void
);
#endif
#endif
midware/midware/dm/kk_dm_msg.h
View file @
f7ac64c6
...
@@ -40,7 +40,7 @@ typedef struct {
...
@@ -40,7 +40,7 @@ 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
;
//
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"
...
@@ -118,6 +118,8 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
...
@@ -118,6 +118,8 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
#define KK_THING_SERVICE_DEL_HISTORYALARM_REPLY "/thing/service/delAlarm_reply"
#define KK_THING_SERVICE_DEL_HISTORYALARM_REPLY "/thing/service/delAlarm_reply"
#define KK_THING_SERVICE_DELETEFLOORS "/thing/service/deleteFloors"
#define KK_THING_SERVICE_DELETEFLOORS "/thing/service/deleteFloors"
#define KK_THING_SERVICE_DELETEFLOORS_REPLY "/thing/service/deleteFloors_reply"
#define KK_THING_SERVICE_DELETEFLOORS_REPLY "/thing/service/deleteFloors_reply"
#define KK_THING_SERVICE_UPDATEFLOORS "/thing/service/updateFloors"
#define KK_THING_SERVICE_UPDATEFLOORS_REPLY "/thing/service/updateFloors_reply"
void
kk_sendData2app
(
void
*
info
,
void
*
payload
,
int
isAsync
);
void
kk_sendData2app
(
void
*
info
,
void
*
payload
,
int
isAsync
);
int
dm_msg_thing_sub_register
(
_IN_
char
productCode
[
DEVICE_CODE_MAXLEN
],
_IN_
char
deviceCode
[
DEVICE_CODE_MAXLEN
],
int
dm_msg_thing_sub_register
(
_IN_
char
productCode
[
DEVICE_CODE_MAXLEN
],
_IN_
char
deviceCode
[
DEVICE_CODE_MAXLEN
],
...
...
midware/midware/dm/kk_linkkit.c
View file @
f7ac64c6
...
@@ -706,19 +706,8 @@ static int kk_service_execute_action(cJSON *action,dm_mgr_dev_node_t *node)
...
@@ -706,19 +706,8 @@ static int kk_service_execute_action(cJSON *action,dm_mgr_dev_node_t *node)
}
}
void
*
param
=
cJSON_Print
(
action
);
void
*
param
=
cJSON_Print
(
action
);
kk_msg_execute_property_set
(
node
->
productCode
,
node
->
deviceCode
,
param
,
node
->
fatherDeviceCode
);
kk_msg_execute_property_set
(
node
->
productCode
,
node
->
deviceCode
,
param
,
node
->
fatherDeviceCode
);
#if 0
for(idx = 0; idx < shadow->property_number; idx++){
pCurrentItem = shadow->properties + idx;
if(pCurrentItem != NULL){
cJSON *pCurrentData = cJSON_GetObjectItem(action, pCurrentItem->identifier);
if(pCurrentData != NULL){
}
}
}
#endif
free
(
param
);
free
(
param
);
param
=
NULL
;
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
...
@@ -816,6 +805,25 @@ static int kk_service_setFloor_handle(cJSON *params)
...
@@ -816,6 +805,25 @@ static int kk_service_setFloor_handle(cJSON *params)
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
/************************************************************
/************************************************************
*功能描述:更新楼层
*输入参数:params:云端下发数据,包含房间号等
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
static
int
kk_service_updateFloor_handle
(
cJSON
*
params
)
{
if
(
params
==
NULL
){
return
INVALID_PARAMETER
;
}
cJSON
*
floorId
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ROOM_FLOOR_ID
);
if
(
floorId
==
NULL
)
return
INVALID_PARAMETER
;
cJSON
*
name
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ADDROOM_DEVICENAME
);
if
(
name
==
NULL
)
return
INVALID_PARAMETER
;
kk_floor_add
(
name
->
valuestring
,
floorId
->
valuestring
);
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述:添加楼层REPLY
*功能描述:添加楼层REPLY
*输入参数:params:云端下发数据,包含房间号等
*输入参数:params:云端下发数据,包含房间号等
*输出参数:无
*输出参数:无
...
@@ -878,32 +886,12 @@ static int kk_service_addFloor_handle(cJSON *params,cJSON *msgId,cJSON *root)
...
@@ -878,32 +886,12 @@ static int kk_service_addFloor_handle(cJSON *params,cJSON *msgId,cJSON *root)
if
(
params
==
NULL
||
msgId
==
NULL
||
root
==
NULL
){
if
(
params
==
NULL
||
msgId
==
NULL
||
root
==
NULL
){
return
INVALID_PARAMETER
;
return
INVALID_PARAMETER
;
}
}
cJSON
*
floorArray
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ROOM_FLOORS
);
cJSON
*
name
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ADDROOM_DEVICENAME
);
if
(
floorArray
==
NULL
){
ERROR_PRINT
(
"DATA ERROR!!!
\n
"
);
return
INVALID_PARAMETER
;
}
//kk_floor_delete_all();
cJSON
*
item
=
floorArray
->
child
;
while
(
item
!=
NULL
){
cJSON
*
name
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ADDROOM_DEVICENAME
);
if
(
name
==
NULL
)
return
INVALID_PARAMETER
;
if
(
name
==
NULL
)
return
INVALID_PARAMETER
;
kk_creater_node
id
(
floorId
);
kk_creater_floor
id
(
floorId
);
kk_floor_add
(
name
->
valuestring
,
floorId
);
kk_floor_add
(
name
->
valuestring
,
floorId
);
cJSON
*
rooms
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_FLOOR_ROOMS
);
if
(
rooms
==
NULL
)
return
INVALID_PARAMETER
;
cJSON
*
itemroom
=
rooms
->
child
;
while
(
itemroom
!=
NULL
){
cJSON
*
roomid
=
cJSON_GetObjectItem
(
itemroom
,
MSG_AREA_ROOM_ROOMID
);
if
(
roomid
==
NULL
){
return
INVALID_PARAMETER
;
}
kk_room_set_floor_info
(
floorId
,
name
->
valuestring
,
roomid
->
valuestring
);
itemroom
=
itemroom
->
next
;
}
kk_service_addFloor_reply
(
root
,
msgId
,
floorId
,
name
->
valuestring
);
kk_service_addFloor_reply
(
root
,
msgId
,
floorId
,
name
->
valuestring
);
item
=
item
->
next
;
}
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
...
@@ -916,23 +904,12 @@ static int kk_service_addFloor_handle(cJSON *params,cJSON *msgId,cJSON *root)
...
@@ -916,23 +904,12 @@ static int kk_service_addFloor_handle(cJSON *params,cJSON *msgId,cJSON *root)
*************************************************************/
*************************************************************/
static
int
kk_service_deleteFloor_handle
(
cJSON
*
params
)
static
int
kk_service_deleteFloor_handle
(
cJSON
*
params
)
{
{
char
floorId
[
16
]
=
{
0
};
if
(
params
==
NULL
){
if
(
params
==
NULL
){
return
INVALID_PARAMETER
;
return
INVALID_PARAMETER
;
}
}
cJSON
*
floorArray
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ROOM_FLOORS
);
cJSON
*
floorId
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ROOM_FLOOR_ID
);
if
(
floorArray
==
NULL
){
ERROR_PRINT
(
"DATA ERROR!!!
\n
"
);
return
INVALID_PARAMETER
;
}
cJSON
*
item
=
floorArray
->
child
;
while
(
item
!=
NULL
){
cJSON
*
floorId
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_FLOOR_ID
);
if
(
floorId
==
NULL
)
return
INVALID_PARAMETER
;
if
(
floorId
==
NULL
)
return
INVALID_PARAMETER
;
kk_floor_delete_by_id
(
floorId
->
valuestring
);
kk_floor_delete_by_id
(
floorId
->
valuestring
);
kk_set_floor_to_default
(
floorId
->
valuestring
);
item
=
item
->
next
;
}
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
/************************************************************
/************************************************************
...
@@ -1766,6 +1743,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -1766,6 +1743,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
kk_msg_execute_property_set
(
node
->
productCode
,
node
->
deviceCode
,
out_
,
node
->
fatherDeviceCode
);
kk_msg_execute_property_set
(
node
->
productCode
,
node
->
deviceCode
,
out_
,
node
->
fatherDeviceCode
);
cJSON_Delete
(
root_
);
cJSON_Delete
(
root_
);
free
(
out_
);
free
(
out_
);
out_
=
NULL
;
}
}
}
}
}
}
...
@@ -1870,6 +1848,13 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -1870,6 +1848,13 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
kk_service_getFloor_handle
(
info_root
,
msgId
);
kk_service_getFloor_handle
(
info_root
,
msgId
);
//kk_service_common_reply(info_root,msgId,KK_THING_SERVICE_SETFLOOR_REPLY);
//kk_service_common_reply(info_root,msgId,KK_THING_SERVICE_SETFLOOR_REPLY);
}
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_UPDATEFLOORS
)
==
0
){
INFO_PRINT
(
"UPDATEFLOOR
\n
"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
kk_service_updateFloor_handle
(
paramStr
);
kk_service_common_reply
(
info_root
,
msgId
,
KK_THING_SERVICE_UPDATEFLOORS_REPLY
);
}
else
{
else
{
INFO_PRINT
(
"Error msgtype!!!
\n
"
);
INFO_PRINT
(
"Error msgtype!!!
\n
"
);
}
}
...
@@ -1878,6 +1863,7 @@ directReturn:
...
@@ -1878,6 +1863,7 @@ directReturn:
_iotx_linkkit_mutex_unlock
();
_iotx_linkkit_mutex_unlock
();
if
(
payload_Str
!=
NULL
){
if
(
payload_Str
!=
NULL
){
free
(
payload_Str
);
free
(
payload_Str
);
payload_Str
=
NULL
;
}
}
cJSON_Delete
(
json
);
cJSON_Delete
(
json
);
}
}
...
...
midware/midware/dm/kk_sub_db.c
View file @
f7ac64c6
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "sqlite3.h"
#include "sqlite3.h"
#include "kk_log.h"
#include "kk_log.h"
#include "kk_hal.h"
#include "kk_hal.h"
#include "kk_area_handle.h"
extern
sqlite3
*
g_kk_pDb
;
extern
sqlite3
*
g_kk_pDb
;
typedef
struct
{
typedef
struct
{
...
@@ -699,7 +700,7 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
...
@@ -699,7 +700,7 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
continue
;
continue
;
}
}
if
(
strcmp
(
typeArray
[
k
],
"air conditioning gateway"
)
==
0
){
if
(
strcmp
(
typeArray
[
k
],
"air conditioning gateway"
)
==
0
){
_kk_indoor_air_handle
(
pDeviceCode
,
sceneId
,
propertyName
,
propertyValue
,
type
,
delay
,
node
->
fatherDeviceCode
);
_kk_indoor_air_handle
(
pDeviceCode
,
(
char
*
)
sceneId
,(
char
*
)
propertyName
,(
char
*
)
propertyValue
,(
char
*
)
type
,
delay
,
node
->
fatherDeviceCode
);
continue
;
continue
;
}
}
for
(
idx
=
0
;
idx
<
node
->
dev_shadow
->
property_number
;
idx
++
){
for
(
idx
=
0
;
idx
<
node
->
dev_shadow
->
property_number
;
idx
++
){
...
...
midware/midware/midware.c
View file @
f7ac64c6
...
@@ -1435,8 +1435,8 @@ int main(const int argc, const char **argv)
...
@@ -1435,8 +1435,8 @@ int main(const int argc, const char **argv)
}
}
kk_sqlite_init
();
kk_sqlite_init
();
kk_tsl_api_init
();
kk_tsl_api_init
();
kk_ipc_init
(
IPC_MID2APP
,
mid_cb
,
NULL
,
NULL
);
kk_ipc_init
(
IPC_MID2APP
,
(
ipc_cb
*
)
mid_cb
,
NULL
,
NULL
);
kk_ipc_init
(
IPC_MID2PLAT
,
mid2p_cb
,
NULL
,
"*"
);
kk_ipc_init
(
IPC_MID2PLAT
,
(
ipc_cb
*
)
mid2p_cb
,
NULL
,
"*"
);
kk_init_dmproc
();
kk_init_dmproc
();
kk_heartbeat_init
();
kk_heartbeat_init
();
...
...
midware/midware/ota/iotx_ota.c
View file @
f7ac64c6
...
@@ -510,7 +510,7 @@ do_exit:
...
@@ -510,7 +510,7 @@ do_exit:
#undef MSG_REQUEST_LEN
#undef MSG_REQUEST_LEN
}
}
const
char
OTA_DM_MSG_INFO
[]
=
"{
\"
msgtype
\"
:
\"
%s
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
deviceCode
\"
:
\"
%s
\"
}"
;
const
char
KK_URI_OTA_PROCESS
[]
=
"/ota/device/progress/%s/%s"
;
const
char
KK_URI_OTA_PROCESS
[]
=
"/ota/device/progress/%s/%s"
;
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
;
...
@@ -535,7 +535,7 @@ int OTA_publishProgress(void *handle, char* payload){
...
@@ -535,7 +535,7 @@ int OTA_publishProgress(void *handle, char* payload){
/* inform OTA to topic: "/ota/device/progress/$(product_key)/$(device_name)" */
/* inform OTA to topic: "/ota/device/progress/$(product_key)/$(device_name)" */
// int topicLen = strlen(DM_MSG_INFO) + strlen(h_ota->product_key) + strlen(h_ota->device_name) + 1;
// int topicLen = strlen(DM_MSG_INFO) + strlen(h_ota->product_key) + strlen(h_ota->device_name) + 1;
int
topicLen
=
strlen
(
DM_MSG_INFO
)
+
10
+
msgTypeLen
+
strlen
(
h_ota
->
product_key
)
+
strlen
(
h_ota
->
device_name
)
+
1
;
int
topicLen
=
strlen
(
OTA_
DM_MSG_INFO
)
+
10
+
msgTypeLen
+
strlen
(
h_ota
->
product_key
)
+
strlen
(
h_ota
->
device_name
)
+
1
;
char
*
topicBuf
=
malloc
(
topicLen
);
char
*
topicBuf
=
malloc
(
topicLen
);
if
(
topicBuf
==
NULL
){
if
(
topicBuf
==
NULL
){
OTA_LOG_ERROR
(
"MALLOC is NULL
\n
"
);
OTA_LOG_ERROR
(
"MALLOC is NULL
\n
"
);
...
@@ -543,7 +543,7 @@ int OTA_publishProgress(void *handle, char* payload){
...
@@ -543,7 +543,7 @@ int OTA_publishProgress(void *handle, char* payload){
return
IOT_OTAE_INVALID_PARAM
;
return
IOT_OTAE_INVALID_PARAM
;
}
}
HAL_Snprintf
(
topicBuf
,
topicLen
,
DM_MSG_INFO
,
msgTypeStr
,
h_ota
->
product_key
,
h_ota
->
device_name
,
""
);
HAL_Snprintf
(
topicBuf
,
topicLen
,
OTA_
DM_MSG_INFO
,
msgTypeStr
,
h_ota
->
product_key
,
h_ota
->
device_name
,
""
);
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
root
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
root
,
"info"
,
topicBuf
);
cJSON_AddStringToObject
(
root
,
"info"
,
topicBuf
);
...
...
midware/midware/scene/kk_scene_handle.c
View file @
f7ac64c6
...
@@ -46,6 +46,7 @@ static int kk_scene_embed_find(const char *sceneId);
...
@@ -46,6 +46,7 @@ static int kk_scene_embed_find(const char *sceneId);
static
int
kk_scene_invokeService_find
(
const
char
*
sceneId
);
static
int
kk_scene_invokeService_find
(
const
char
*
sceneId
);
int
kk_scene_push_timer_info
(
time_t
starttime
,
int
repeatday
,
char
*
sceneId
);
int
kk_scene_push_timer_info
(
time_t
starttime
,
int
repeatday
,
char
*
sceneId
);
int
bodySensor_load
(
void
);
/*************************************************************
/*************************************************************
函数实现
函数实现
*************************************************************/
*************************************************************/
...
...
midware/midware/scene/kk_scene_handle.h
View file @
f7ac64c6
...
@@ -84,5 +84,6 @@ int kk_scene_parse_deletescene(char *sceneId);
...
@@ -84,5 +84,6 @@ int kk_scene_parse_deletescene(char *sceneId);
int
kk_scene_parse_scene_action
(
const
cJSON
*
str
,
const
char
*
sceneId
,
int
isUpdate
);
int
kk_scene_parse_scene_action
(
const
cJSON
*
str
,
const
char
*
sceneId
,
int
isUpdate
);
int
kk_scene_execute_quickpanel
(
const
char
*
buttonId
,
char
*
deviceCode
);
int
kk_scene_execute_quickpanel
(
const
char
*
buttonId
,
char
*
deviceCode
);
int
kk_scene_action_add
(
const
char
*
gwdeviceCode
,
const
char
*
sceneId
,
kk_scene_action_detail_t
detail
);
int
kk_scene_action_add
(
const
char
*
gwdeviceCode
,
const
char
*
sceneId
,
kk_scene_action_detail_t
detail
);
int
BodySensorTrigger_check
(
void
);
#endif
#endif
midware/tsl/tsl_handle/kk_tsl_api.c
View file @
f7ac64c6
...
@@ -1388,7 +1388,7 @@ int kk_tsl_get_event_by_identifier(_IN_ kk_tsl_t *dev_shadow, _IN_ char *identif
...
@@ -1388,7 +1388,7 @@ int kk_tsl_get_event_by_identifier(_IN_ kk_tsl_t *dev_shadow, _IN_ char *identif
static
int
_kk_tsl_get_service_by_identifier
(
_IN_
kk_tsl_t
*
shadow
,
_IN_
char
*
identifier
,
_OU_
void
**
service
)
static
int
_kk_tsl_get_service_by_identifier
(
_IN_
kk_tsl_t
*
shadow
,
_IN_
char
*
identifier
,
_OU_
void
**
service
)
{
{
int
index
=
0
;
int
index
=
0
;
kk_tsl_
event_t
*
search_event
=
NULL
;
kk_tsl_
service_t
*
search_service
=
NULL
;
if
(
shadow
==
NULL
||
identifier
==
NULL
||
if
(
shadow
==
NULL
||
identifier
==
NULL
||
service
==
NULL
||
*
service
!=
NULL
)
{
service
==
NULL
||
*
service
!=
NULL
)
{
...
@@ -1396,10 +1396,10 @@ static int _kk_tsl_get_service_by_identifier(_IN_ kk_tsl_t *shadow, _IN_ char *i
...
@@ -1396,10 +1396,10 @@ static int _kk_tsl_get_service_by_identifier(_IN_ kk_tsl_t *shadow, _IN_ char *i
}
}
for
(
index
=
0
;
index
<
shadow
->
service_number
;
index
++
)
{
for
(
index
=
0
;
index
<
shadow
->
service_number
;
index
++
)
{
search_
event
=
shadow
->
services
+
index
;
search_
service
=
shadow
->
services
+
index
;
if
((
strlen
(
search_
event
->
identifier
)
==
strlen
(
identifier
))
&&
if
((
strlen
(
search_
service
->
identifier
)
==
strlen
(
identifier
))
&&
(
memcmp
(
search_
event
->
identifier
,
identifier
,
strlen
(
identifier
))
==
0
))
{
(
memcmp
(
search_
service
->
identifier
,
identifier
,
strlen
(
identifier
))
==
0
))
{
*
service
=
(
void
*
)
search_
event
;
*
service
=
(
void
*
)
search_
service
;
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
}
}
...
...
midware/tsl/tsl_handle/kk_tsl_parse.c
View file @
f7ac64c6
...
@@ -292,7 +292,7 @@ static int _kk_tsl_array_enum_parse(_IN_ kk_tsl_data_value_t *data_value, _IN_ l
...
@@ -292,7 +292,7 @@ static int _kk_tsl_array_enum_parse(_IN_ kk_tsl_data_value_t *data_value, _IN_ l
}
}
static
int
_kk_tsl_array_date_parse
(
_IN_
kk_tsl_data_value_t
*
data_value
,
_IN_
lite_cjson_t
*
root
)
static
int
_kk_tsl_array_date_parse
(
_IN_
kk_tsl_data_value_t
*
data_value
,
_IN_
lite_cjson_t
*
root
)
{
{
kk_tsl_data_value_complex_t
*
complex_array
=
(
kk_tsl_data_value_t
*
)
data_value
->
value
;
kk_tsl_data_value_complex_t
*
complex_array
=
(
kk_tsl_data_value_
complex_
t
*
)
data_value
->
value
;
complex_array
->
value
=
malloc
((
complex_array
->
size
)
*
(
sizeof
(
char
*
)));
complex_array
->
value
=
malloc
((
complex_array
->
size
)
*
(
sizeof
(
char
*
)));
if
(
complex_array
->
value
==
NULL
)
{
if
(
complex_array
->
value
==
NULL
)
{
...
...
tools/board/config.linux.nx5
View file @
f7ac64c6
CONFIG_ENV_CFLAGS += \
CONFIG_ENV_CFLAGS += \
-Os -W
all
\
-Os -W
error
\
-g3 --coverage \
-g3 --coverage \
-D_PLATFORM_IS_LINUX_ \
-D_PLATFORM_IS_LINUX_ \
...
...
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