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
5604b305
Commit
5604b305
authored
Aug 30, 2021
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】一些bug修改
【提交人】陈伟灿
parent
9da143b4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
31 deletions
+31
-31
application/kcloud/kk_topic_mng.c
application/kcloud/kk_topic_mng.c
+2
-3
application/klansdk/kk_oldccu_msg.c
application/klansdk/kk_oldccu_msg.c
+1
-1
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+5
-3
midware/midware/dm/kk_property_db.c
midware/midware/dm/kk_property_db.c
+0
-6
midware/midware/midware.c
midware/midware/midware.c
+1
-0
onboot.sh
onboot.sh
+20
-18
tools/build-rules/_rules-top.mk
tools/build-rules/_rules-top.mk
+2
-0
No files found.
application/kcloud/kk_topic_mng.c
View file @
5604b305
...
@@ -115,16 +115,15 @@ void KK_reset_sub_flag(void)
...
@@ -115,16 +115,15 @@ void KK_reset_sub_flag(void)
int
KK_CCU_TOPIC_Subscribe
(
void
)
int
KK_CCU_TOPIC_Subscribe
(
void
)
{
{
char
productCode
[
PRODUCT_CODE_LEN
]
=
{
0
};
char
productCode
[
PRODUCT_CODE_LEN
]
=
{
0
};
char
deviceCode
[
MAC_ADDR_LEN
]
=
{
0
};
if
(
s_ccu_topic_sub
==
1
){
if
(
s_ccu_topic_sub
==
1
){
INFO_PRINT
(
"[%s][%d] already Subscribe
\n
"
,
__FUNCTION__
,
__LINE__
);
INFO_PRINT
(
"[%s][%d] already Subscribe
\n
"
,
__FUNCTION__
,
__LINE__
);
return
-
1
;
//
return -1;
}
}
char
ccuid
[
32
]
=
{
0
};
char
ccuid
[
32
]
=
{
0
};
KK_Get_ccuid
(
ccuid
);
KK_Get_ccuid
(
ccuid
);
s_ccu_topic_sub
=
1
;
s_ccu_topic_sub
=
1
;
HAL_GetProduct_Code
(
productCode
);
HAL_GetProduct_Code
(
productCode
);
HAL_Get_mac
(
deviceCode
);
return
_kk_ccu_topic_subscribe
(
productCode
,
ccuid
);
return
_kk_ccu_topic_subscribe
(
productCode
,
ccuid
);
}
}
...
...
application/klansdk/kk_oldccu_msg.c
View file @
5604b305
...
@@ -505,7 +505,7 @@ int kk_lan_device_delete_notify(cJSON *payload)
...
@@ -505,7 +505,7 @@ int kk_lan_device_delete_notify(cJSON *payload)
}
}
if
((
deviceCode
=
cJSON_GetObjectItem
(
params
,
"deviceCode"
))
==
NULL
||
if
((
deviceCode
=
cJSON_GetObjectItem
(
params
,
"deviceCode"
))
==
NULL
||
params
->
type
!=
cJSON_String
){
deviceCode
->
type
!=
cJSON_String
){
debug_log
(
LOG_DEBUG
,
"[err] deviceCode.
\n
"
);
debug_log
(
LOG_DEBUG
,
"[err] deviceCode.
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
...
midware/midware/dm/kk_linkkit.c
View file @
5604b305
...
@@ -351,10 +351,10 @@ int kk_topo_delete_handle(cJSON *payload,cJSON *buf)
...
@@ -351,10 +351,10 @@ int kk_topo_delete_handle(cJSON *payload,cJSON *buf)
cJSON_AddItemToObject
(
rootData
,
"payload"
,
payload
);
cJSON_AddItemToObject
(
rootData
,
"payload"
,
payload
);
char
*
pnewout
=
cJSON_Print
(
rootData
);
char
*
pnewout
=
cJSON_Print
(
rootData
);
kk_sendData2gw
(
pnewout
,
strlen
(
pnewout
),
node
->
fatherDeviceCode
);
//send to gw itself
kk_sendData2gw
(
pnewout
,
strlen
(
pnewout
),
node
->
fatherDeviceCode
);
//send to gw itself
dm_mgr_subdev_delete
(
deviceCode
);
free
(
pnewout
);
free
(
pnewout
);
cJSON_Delete
(
rootData
);
cJSON_Delete
(
rootData
);
dm_mgr_subdev_delete
(
deviceCode
);
return
SUCCESS_RETURN
;
item
=
item
->
next
;
}
}
}
}
...
@@ -1094,9 +1094,10 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -1094,9 +1094,10 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
char
*
payload_Str
=
NULL
;
char
*
payload_Str
=
NULL
;
cJSON
*
deviceCode
=
NULL
;
cJSON
*
deviceCode
=
NULL
;
json
=
cJSON_Parse
(
data
);
json
=
cJSON_Parse
(
data
);
_iotx_linkkit_mutex_lock
();
if
(
json
==
NULL
)
{
if
(
json
==
NULL
)
{
WARNING_PRINT
(
"Error before: [%s]
\n
"
,
"cJSON_Parse"
);
WARNING_PRINT
(
"Error before: [%s]
\n
"
,
"cJSON_Parse"
);
_iotx_linkkit_mutex_unlock
();
return
;
return
;
}
}
info_root
=
cJSON_GetObjectItem
(
json
,
MSG_INFO_STR
);
info_root
=
cJSON_GetObjectItem
(
json
,
MSG_INFO_STR
);
...
@@ -1370,6 +1371,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -1370,6 +1371,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
directReturn:
directReturn:
free
(
payload_Str
);
free
(
payload_Str
);
cJSON_Delete
(
json
);
cJSON_Delete
(
json
);
_iotx_linkkit_mutex_unlock
();
}
}
/************************************************************
/************************************************************
...
...
midware/midware/dm/kk_property_db.c
View file @
5604b305
...
@@ -228,8 +228,6 @@ static int _kk_check_door_induction_device(char *productCode){
...
@@ -228,8 +228,6 @@ static int _kk_check_door_induction_device(char *productCode){
int
kk_property_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
,
int
devtype
)
int
kk_property_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
,
int
devtype
)
{
{
printf
(
"---------------------------------------->identifier:%s
\n
"
,
identifier
);
dm_mgr_dev_node_t
*
node
=
NULL
;
dm_mgr_dev_node_t
*
node
=
NULL
;
int
res
=
0
;
int
res
=
0
;
const
char
*
insertCmd
=
"insert into PropertiesInfo (deviceCode,identifier,value,valueType,devType) \
const
char
*
insertCmd
=
"insert into PropertiesInfo (deviceCode,identifier,value,valueType,devType) \
...
@@ -238,12 +236,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
...
@@ -238,12 +236,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
int
rc
=
0
;
int
rc
=
0
;
char
*
zErrMsg
=
0
;
char
*
zErrMsg
=
0
;
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
printf
(
"---------------------------------------->1
\n
"
);
if
(
_kk_check_property_exist
(
deviceCode
,
identifier
)
==
1
)
if
(
_kk_check_property_exist
(
deviceCode
,
identifier
)
==
1
)
{
{
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
printf
(
"---------------------------------------->2
\n
"
);
_kk_property_db_lock
();
_kk_property_db_lock
();
//传感器类默认安防等级为离家安防
//传感器类默认安防等级为离家安防
if
(
strcmp
(
identifier
,
"SensorType"
)
==
0
&&
devtype
==
KK_DM_DEVICE_SUBDEV
){
if
(
strcmp
(
identifier
,
"SensorType"
)
==
0
&&
devtype
==
KK_DM_DEVICE_SUBDEV
){
...
@@ -251,12 +247,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
...
@@ -251,12 +247,10 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
if
(
res
!=
SUCCESS_RETURN
)
{
if
(
res
!=
SUCCESS_RETURN
)
{
return
FAIL_RETURN
;
return
FAIL_RETURN
;
}
}
printf
(
"---------------------------------------->3
\n
"
);
if
(
_kk_check_human_induction_device
(
node
->
productCode
)
==
1
||
//门磁和人体默认室外安防
if
(
_kk_check_human_induction_device
(
node
->
productCode
)
==
1
||
//门磁和人体默认室外安防
_kk_check_door_induction_device
(
node
->
productCode
)
==
1
){
_kk_check_door_induction_device
(
node
->
productCode
)
==
1
){
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
"1"
,
valuetype
,
devtype
);
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
"1"
,
valuetype
,
devtype
);
}
else
{
}
else
{
printf
(
"---------------------------------------->
\n
"
);
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
"2"
,
valuetype
,
devtype
);
//其他24小时警戒
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
"2"
,
valuetype
,
devtype
);
//其他24小时警戒
}
}
}
else
{
}
else
{
...
...
midware/midware/midware.c
View file @
5604b305
...
@@ -783,6 +783,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
...
@@ -783,6 +783,7 @@ void kk_platMsg_handle(void* data, char* chalMark){
if
(
sceneSupportStr
!=
NULL
&&!
strcmp
(
sceneSupportStr
->
valuestring
,
"1"
)){
if
(
sceneSupportStr
!=
NULL
&&!
strcmp
(
sceneSupportStr
->
valuestring
,
"1"
)){
kk_subDev_update_sceneSupport
(
1
,
devCode
->
valuestring
);
kk_subDev_update_sceneSupport
(
1
,
devCode
->
valuestring
);
}
}
kk_dm_gw_status_update_online
(
info_dcode
->
valuestring
);
}
else
{
}
else
{
kk_mid_subdev_add
(
KK_DM_DEVICE_SUBDEV
,
proCode
->
valuestring
,
devCode
->
valuestring
,
mac
->
valuestring
,
info_dcode
->
valuestring
);
kk_mid_subdev_add
(
KK_DM_DEVICE_SUBDEV
,
proCode
->
valuestring
,
devCode
->
valuestring
,
mac
->
valuestring
,
info_dcode
->
valuestring
);
}
}
...
...
onboot.sh
View file @
5604b305
#!/bin/sh
#!/bin/sh
#filepath="/home/kk"
filepath
=
"/app/nx5Apps"
if
[
!
-f
"/sbin/jq"
]
if
[
!
-f
"/sbin/jq"
]
then
then
cp
/app/ccuApps
/jq /sbin
cp
$filepath
/jq /sbin
fi
fi
if
[
-f
"
/app/nx5Apps
/syscfg.json"
]
if
[
-f
"
$filepath
/syscfg.json"
]
then
then
if
[
!
-f
"/data/syscfg.json"
]
if
[
!
-f
"/data/syscfg.json"
]
then
then
cp
/app/nx5Apps
/syscfg.json /data
cp
$filepath
/syscfg.json /data
fi
fi
embbedflag
=
`
cat
/data/syscfg.json|jq .
"ccuembbed"
`
embbedflag
=
`
cat
/data/syscfg.json|jq .
"ccuembbed"
`
#embbedflag="0"
#embbedflag="0"
...
@@ -19,9 +21,9 @@ then
...
@@ -19,9 +21,9 @@ then
fi
fi
fi
fi
nanomsg_File
=
"
/app/ccuApps
/lib/libnanomsg.so.5"
nanomsg_File
=
"
$filepath
/lib/libnanomsg.so.5"
ev_File
=
"
/app/ccuApps
/lib/libev.so.4"
ev_File
=
"
$filepath
/lib/libev.so.4"
sqlite_File
=
"
/app/ccuApps
/lib/libsqlite3.so.0"
sqlite_File
=
"
$filepath
/lib/libsqlite3.so.0"
run_Dir
=
"/data/kk"
run_Dir
=
"/data/kk"
tsl_Dir
=
"
${
run_Dir
}
/tsl"
tsl_Dir
=
"
${
run_Dir
}
/tsl"
...
@@ -38,36 +40,36 @@ if [ ! -d "$run_Dir" ]; then
...
@@ -38,36 +40,36 @@ if [ ! -d "$run_Dir" ]; then
fi
fi
if
[
!
-d
"
$tsl_Dir
"
]
;
then
if
[
!
-d
"
$tsl_Dir
"
]
;
then
cp
-rf
/app/ccuApps
/tsl
${
run_Dir
}
/
cp
-rf
$filepath
/tsl
${
run_Dir
}
/
fi
fi
if
[
!
-d
"
$map_Dir
"
]
;
then
if
[
!
-d
"
$map_Dir
"
]
;
then
cp
-rf
/app/ccuApps
/map
${
run_Dir
}
/
cp
-rf
$filepath
/map
${
run_Dir
}
/
fi
fi
cd
/app/ccuApps
/lib
cd
$filepath
/lib
if
[
!
-f
"
$nanomsg_File
"
]
;
then
if
[
!
-f
"
$nanomsg_File
"
]
;
then
ln
-sf
/app/ccuApps
/lib/libnanomsg.so /lib/libnanomsg.so.5
ln
-sf
$filepath
/lib/libnanomsg.so /lib/libnanomsg.so.5
fi
fi
if
[
!
-f
"
$ev_File
"
]
;
then
if
[
!
-f
"
$ev_File
"
]
;
then
ln
-sf
/app/ccuApps
/lib/libev.so /lib/libev.so.4
ln
-sf
$filepath
/lib/libev.so /lib/libev.so.4
fi
fi
if
[
!
-f
"
$sqlite_File
"
]
;
then
if
[
!
-f
"
$sqlite_File
"
]
;
then
ln
-sf
/app/ccuApps
/lib/libsqlite3.so /lib/libsqlite3.so.0
ln
-sf
$filepath
/lib/libsqlite3.so /lib/libsqlite3.so.0
fi
fi
export
LD_LIBRARY_PATH
=
/app/ccuApps
/lib
export
LD_LIBRARY_PATH
=
$filepath
/lib
/app/ccuApps
/bin/kk_midware &
$filepath
/bin/kk_midware &
sleep
3
sleep
3
/app/ccuApps
/bin/kk_cloud &
$filepath
/bin/kk_cloud &
sleep
1
sleep
1
#/home/kk/process_check.sh >/dev/null 2>&1 &
#/home/kk/process_check.sh >/dev/null 2>&1 &
/app/ccuApps/bin/smarthome_z3gw_nx5
-r0
-l3
--device-def
=
/app/ccuApps
/kk_device_def.json
--db
=
/data/kk/kk_z3gw.db
--uart
=
/dev/ttyS1&
$filepath
/bin/smarthome_z3gw_nx5
-r0
-l3
--device-def
=
$filepath
/kk_device_def.json
--db
=
/data/kk/kk_z3gw.db
--uart
=
/dev/ttyS1&
sleep
2
sleep
2
/app/ccuApps
/bin/kk_lan &
$filepath
/bin/kk_lan &
sleep
1
sleep
1
echo
"*/1 * * * * /app/ccuApps/process_check.sh"
>
/etc/cron.d/ccu
||
{
echo
"ERROR:add ccu crontab rule failed."
;
exit
1
;
}
#
echo "*/1 * * * * /app/ccuApps/process_check.sh" > /etc/cron.d/ccu || { echo "ERROR:add ccu crontab rule failed."; exit 1;}
ntpd
-n
-q
-d
-p
stdtime.gov.hk &
ntpd
-n
-q
-d
-p
stdtime.gov.hk &
exit
0
exit
0
\ No newline at end of file
tools/build-rules/_rules-top.mk
View file @
5604b305
...
@@ -210,6 +210,7 @@ package:
...
@@ -210,6 +210,7 @@ package:
cp
-rf
$(TOP_DIR)/process_check.sh
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/process_check.sh
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/onboot.sh
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/onboot.sh
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/killall.sh
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/VERSION
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/VERSION
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/opcodeMapCfg/*
$(TOP_DIR)/$(releaseDir)/map
cp
-rf
$(TOP_DIR)/opcodeMapCfg/*
$(TOP_DIR)/$(releaseDir)/map
#cp -rf $(TOP_DIR)/platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table $(TOP_DIR)/$(releaseDir)/
#cp -rf $(TOP_DIR)/platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table $(TOP_DIR)/$(releaseDir)/
...
@@ -218,6 +219,7 @@ ifeq ($(CONFIG_MODEL),ubuntu)
...
@@ -218,6 +219,7 @@ ifeq ($(CONFIG_MODEL),ubuntu)
cp
-rf
$(TOP_DIR)/common/nanomsg/libnanomsg_ubuntu.so
$(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so.5
cp
-rf
$(TOP_DIR)/common/nanomsg/libnanomsg_ubuntu.so
$(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so.5
cp
-rf
$(TOP_DIR)/common/ev/libev_ubuntu.so
$(TOP_DIR)/$(releaseDir)/lib
cp
-rf
$(TOP_DIR)/common/ev/libev_ubuntu.so
$(TOP_DIR)/$(releaseDir)/lib
else
ifeq
($(CONFIG_MODEL),nx5)
else
ifeq
($(CONFIG_MODEL),nx5)
cp
-rf
$(TOP_DIR)/jq
$(TOP_DIR)/$(releaseDir)/
cp
-rf
$(TOP_DIR)/common/nanomsg/libnanomsg_nx5.so
$(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so
cp
-rf
$(TOP_DIR)/common/nanomsg/libnanomsg_nx5.so
$(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so
cp
-rf
$(TOP_DIR)/common/ev/libev_nx5.so
$(TOP_DIR)/$(releaseDir)/lib/libev.so
cp
-rf
$(TOP_DIR)/common/ev/libev_nx5.so
$(TOP_DIR)/$(releaseDir)/lib/libev.so
cp
-rf
$(TOP_DIR)/common/sqlite/libsqlite3_nx5.so
$(TOP_DIR)/$(releaseDir)/lib/libsqlite3.so
cp
-rf
$(TOP_DIR)/common/sqlite/libsqlite3_nx5.so
$(TOP_DIR)/$(releaseDir)/lib/libsqlite3.so
...
...
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