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
4660895f
Commit
4660895f
authored
Sep 06, 2021
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】增加主机未连接云的标记文件
【提交人】陈伟灿
parent
19aa848a
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
27 deletions
+53
-27
application/kcloud/kcloud_main.c
application/kcloud/kcloud_main.c
+2
-0
application/kcloud/kk_register.c
application/kcloud/kk_register.c
+3
-2
application/kcloud/kk_topic_mng.c
application/kcloud/kk_topic_mng.c
+1
-1
application/kcloud/mqtt_api.c
application/kcloud/mqtt_api.c
+15
-0
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+13
-2
common/api/tcp_channel.c
common/api/tcp_channel.c
+2
-2
common/hal/HAL_OS_linux.c
common/hal/HAL_OS_linux.c
+1
-6
makefile
makefile
+1
-1
midware/midware/dm/kk_sync_data.c
midware/midware/dm/kk_sync_data.c
+0
-4
midware/midware/midware.c
midware/midware/midware.c
+3
-3
onboot.sh
onboot.sh
+11
-5
tsl/gateway_2.json
tsl/gateway_2.json
+1
-1
No files found.
application/kcloud/kcloud_main.c
View file @
4660895f
...
@@ -107,10 +107,12 @@ again:
...
@@ -107,10 +107,12 @@ again:
if
(
rc
==
0
){
if
(
rc
==
0
){
rc
=
mqtt_start
();
rc
=
mqtt_start
();
if
(
rc
<
0
){
if
(
rc
<
0
){
kk_write_disconnect_flag
();
sleep
(
2
);
sleep
(
2
);
goto
again
;
goto
again
;
}
}
}
else
{
}
else
{
kk_write_disconnect_flag
();
sleep
(
2
);
sleep
(
2
);
goto
again
;
goto
again
;
}
}
...
...
application/kcloud/kk_register.c
View file @
4660895f
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#define BUFSIZE 1024
#define BUFSIZE 1024
#define PRODUCTSECRET "123456"
#define PRODUCTSECRET "123456"
int
kk_execel_cmd
(
char
*
cmd
,
char
*
buf
,
int
buf_len
,
int
*
ret_len
)
int
kk_execel_cmd
(
char
*
cmd
,
char
*
buf
,
int
buf_len
,
int
*
ret_len
)
{
{
if
(
cmd
==
NULL
||
buf
==
NULL
||
buf_len
==
0
)
if
(
cmd
==
NULL
||
buf
==
NULL
||
buf_len
==
0
)
...
@@ -347,7 +348,7 @@ int kk_start_ccu_register(void)
...
@@ -347,7 +348,7 @@ int kk_start_ccu_register(void)
while
(
1
){
while
(
1
){
h
=
select
(
sockfd
+
1
,
&
t_set1
,
NULL
,
NULL
,
&
tv
);
h
=
select
(
sockfd
+
1
,
&
t_set1
,
NULL
,
NULL
,
&
tv
);
//if (h == 0) continue;
//if (h == 0) continue;
if
(
h
==
-
1
)
{
if
(
h
<
0
)
{
close
(
sockfd
);
close
(
sockfd
);
return
-
1
;
return
-
1
;
};
};
...
@@ -355,7 +356,7 @@ int kk_start_ccu_register(void)
...
@@ -355,7 +356,7 @@ int kk_start_ccu_register(void)
memset
(
buf
,
0
,
1024
);
memset
(
buf
,
0
,
1024
);
memset
(
buf2
,
0
,
1024
);
memset
(
buf2
,
0
,
1024
);
i
=
read
(
sockfd
,
buf
,
1024
);
i
=
read
(
sockfd
,
buf
,
1024
);
if
(
i
==
0
){
if
(
i
<=
0
){
close
(
sockfd
);
close
(
sockfd
);
return
-
1
;
return
-
1
;
}
}
...
...
application/kcloud/kk_topic_mng.c
View file @
4660895f
...
@@ -256,7 +256,7 @@ char* KK_Make_Topic(cJSON *info,cJSON *data)
...
@@ -256,7 +256,7 @@ char* KK_Make_Topic(cJSON *info,cJSON *data)
if
(
device_code
==
NULL
){
if
(
device_code
==
NULL
){
goto
errorreturn
;
goto
errorreturn
;
}
}
if
((
!
strcmp
(
product_code
->
valuestring
,
"15"
)
||
!
strcmp
(
product_code
->
valuestring
,
"ccu_n12"
))
&&
\
if
((
!
strcmp
(
product_code
->
valuestring
,
"15"
)
||
!
strcmp
(
product_code
->
valuestring
,
KK_CCU_PRODUCTID
))
&&
\
(
strstr
(
type
->
valuestring
,
"thing/status/online"
)
!=
NULL
)){
(
strstr
(
type
->
valuestring
,
"thing/status/online"
)
!=
NULL
)){
KK_CCU_TOPIC_Subscribe
();
KK_CCU_TOPIC_Subscribe
();
}
}
...
...
application/kcloud/mqtt_api.c
View file @
4660895f
...
@@ -15,6 +15,17 @@ int KK_Send_CloudState(int state);
...
@@ -15,6 +15,17 @@ int KK_Send_CloudState(int state);
int
kk_get_cloud_status
(
void
){
int
kk_get_cloud_status
(
void
){
return
s_cloudStatus
;
return
s_cloudStatus
;
}
}
void
kk_write_disconnect_flag
(
void
)
{
if
((
access
(
"/tmp/CLOUD_STATUS_FAIL"
,
F_OK
))
!=
0
){
system
(
"touch /tmp/CLOUD_STATUS_FAIL"
);
}
}
void
kk_remove_disconnect_flag
(
void
){
if
((
access
(
"/tmp/CLOUD_STATUS_FAIL"
,
F_OK
))
==
0
){
system
(
"rm /tmp/CLOUD_STATUS_FAIL"
);
}
}
/*Connect lost callback*/
/*Connect lost callback*/
static
void
connlost
(
void
*
context
,
char
*
cause
)
static
void
connlost
(
void
*
context
,
char
*
cause
)
{
{
...
@@ -23,6 +34,7 @@ static void connlost(void *context, char *cause)
...
@@ -23,6 +34,7 @@ static void connlost(void *context, char *cause)
ERROR_PRINT
(
"PARAM ERROR
\n
"
);
ERROR_PRINT
(
"PARAM ERROR
\n
"
);
s_mqttStop
=
1
;
s_mqttStop
=
1
;
s_cloudStatus
=
DEVICE_OFFLINE
;
s_cloudStatus
=
DEVICE_OFFLINE
;
kk_write_disconnect_flag
();
KK_Send_CloudState
(
s_cloudStatus
);
KK_Send_CloudState
(
s_cloudStatus
);
return
;
return
;
}
}
...
@@ -33,6 +45,7 @@ static void connlost(void *context, char *cause)
...
@@ -33,6 +45,7 @@ static void connlost(void *context, char *cause)
INFO_PRINT
(
"
\n
Connection lost
\n
"
);
INFO_PRINT
(
"
\n
Connection lost
\n
"
);
INFO_PRINT
(
"cause: %s
\n
"
,
cause
);
INFO_PRINT
(
"cause: %s
\n
"
,
cause
);
s_cloudStatus
=
DEVICE_OFFLINE
;
s_cloudStatus
=
DEVICE_OFFLINE
;
kk_write_disconnect_flag
();
KK_Send_CloudState
(
s_cloudStatus
);
KK_Send_CloudState
(
s_cloudStatus
);
conn_opts
.
keepAliveInterval
=
20
;
conn_opts
.
keepAliveInterval
=
20
;
conn_opts
.
cleansession
=
1
;
conn_opts
.
cleansession
=
1
;
...
@@ -106,6 +119,7 @@ void onConnect(void* context, MQTTAsync_successData* response)
...
@@ -106,6 +119,7 @@ void onConnect(void* context, MQTTAsync_successData* response)
{
{
INFO_PRINT
(
"Successful connection
\n
"
);
INFO_PRINT
(
"Successful connection
\n
"
);
s_cloudStatus
=
DEVICE_ONLINE
;
s_cloudStatus
=
DEVICE_ONLINE
;
kk_remove_disconnect_flag
();
KK_Send_CloudState
(
s_cloudStatus
);
KK_Send_CloudState
(
s_cloudStatus
);
}
}
...
@@ -138,6 +152,7 @@ static void onConnectBuild(void *context, char *cause)
...
@@ -138,6 +152,7 @@ static void onConnectBuild(void *context, char *cause)
//ERROR_PRINT("KK_MQTT_SubTopic ERROR rc = %d\n",rc);
//ERROR_PRINT("KK_MQTT_SubTopic ERROR rc = %d\n",rc);
//}
//}
s_cloudStatus
=
DEVICE_ONLINE
;
s_cloudStatus
=
DEVICE_ONLINE
;
kk_remove_disconnect_flag
();
KK_Send_CloudState
(
s_cloudStatus
);
KK_Send_CloudState
(
s_cloudStatus
);
}
}
static
void
onDisConnected
(
void
*
context
,
MQTTProperties
*
properties
,
enum
MQTTReasonCodes
reasonCode
)
static
void
onDisConnected
(
void
*
context
,
MQTTProperties
*
properties
,
enum
MQTTReasonCodes
reasonCode
)
...
...
application/klansdk/kk_data_handle.c
View file @
4660895f
...
@@ -786,16 +786,19 @@ void KK_Data_FromMid(void* str,int len)
...
@@ -786,16 +786,19 @@ void KK_Data_FromMid(void* str,int len)
}
}
if
(
strstr
(
msgtype
->
valuestring
,
SYNC_MSG_TYPE_REPLY
)
!=
NULL
){
if
(
strstr
(
msgtype
->
valuestring
,
SYNC_MSG_TYPE_REPLY
)
!=
NULL
){
INFO_PRINT
(
"syncinfo_reply handle!!!"
);
kk_parse_syncinfo
(
payload
);
kk_parse_syncinfo
(
payload
);
kk_create_syncinfo_to_sdk
(
payload
,
0
);
kk_create_syncinfo_to_sdk
(
payload
,
0
);
kk_vp_syncinfo_handle
(
payload
);
kk_vp_syncinfo_handle
(
payload
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
SYNCPUSH_MSG_TYPE_REPLY
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
SYNCPUSH_MSG_TYPE_REPLY
)
!=
NULL
){
INFO_PRINT
(
"syncinfopush_reply handle!!!"
);
kk_parse_syncinfo
(
payload
);
kk_parse_syncinfo
(
payload
);
kk_create_syncinfo_to_sdk
(
payload
,
1
);
kk_create_syncinfo_to_sdk
(
payload
,
1
);
kk_vp_syncinfo_handle
(
payload
);
kk_vp_syncinfo_handle
(
payload
);
}
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/property/post"
)
!=
NULL
){
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/property/post"
)
!=
NULL
){
INFO_PRINT
(
"property post handle!!!"
);
if
(
is_ccu_msg
(
productCode
,
deviceCode
)){
if
(
is_ccu_msg
(
productCode
,
deviceCode
)){
int
type
;
int
type
;
...
@@ -806,25 +809,33 @@ void KK_Data_FromMid(void* str,int len)
...
@@ -806,25 +809,33 @@ void KK_Data_FromMid(void* str,int len)
kk_lan_property_post_deal
(
deviceCode
->
valuestring
,
payload
);
kk_lan_property_post_deal
(
deviceCode
->
valuestring
,
payload
);
}
}
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/topo/delete"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/topo/delete"
)
!=
NULL
){
INFO_PRINT
(
"topo delete handle!!!"
);
kk_lan_device_delete_notify
(
payload
);
kk_lan_device_delete_notify
(
payload
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/status/online"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/status/online"
)
!=
NULL
){
INFO_PRINT
(
"online handle!!!"
);
kk_device_onoffline_handle
(
payload
,
1
);
kk_device_onoffline_handle
(
payload
,
1
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/status/offline"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/status/offline"
)
!=
NULL
){
INFO_PRINT
(
"offline handle!!!"
);
kk_device_onoffline_handle
(
payload
,
0
);
kk_device_onoffline_handle
(
payload
,
0
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/service/addDeviceToRoom_reply"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/service/addDeviceToRoom_reply"
)
!=
NULL
){
sleep
(
3
);
sleep
(
3
);
INFO_PRINT
(
"addDeviceToRoom_reply handle!!!"
);
device_add_sync
(
payload
);
device_add_sync
(
payload
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/alarmNotify"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/alarmNotify"
)
!=
NULL
){
INFO_PRINT
(
"alarmNotify handle!!!"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
"msgId"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
"msgId"
);
kk_device_alarm_handle
(
payload
,
productCode
->
valuestring
,
deviceCode
->
valuestring
,
msgId
->
valuestring
);
kk_device_alarm_handle
(
payload
,
productCode
->
valuestring
,
deviceCode
->
valuestring
,
msgId
->
valuestring
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/service/historyAlarm_reply"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/service/historyAlarm_reply"
)
!=
NULL
){
printf
(
"----------------->1
\n
"
);
INFO_PRINT
(
"historyAlarm_reply handle!!!
"
);
kk_device_historyalarm_handle
(
payload
);
kk_device_historyalarm_handle
(
payload
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/service/delAlarm_reply"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/service/delAlarm_reply"
)
!=
NULL
){
INFO_PRINT
(
"delAlarm_reply handle!!!"
);
kk_del_historyalarm_handle
(
payload
);
kk_del_historyalarm_handle
(
payload
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/addSceneNotification/post"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/addSceneNotification/post"
)
!=
NULL
){
INFO_PRINT
(
"addSceneNotification handle!!!"
);
kk_lan_scene_handle
(
payload
,
1
);
kk_lan_scene_handle
(
payload
,
1
);
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/deleteSceneNotification/post"
)
!=
NULL
){
}
else
if
(
strstr
(
msgtype
->
valuestring
,
"/thing/event/deleteSceneNotification/post"
)
!=
NULL
){
INFO_PRINT
(
"deleteSceneNotification handle!!!"
);
kk_lan_scene_handle
(
payload
,
0
);
kk_lan_scene_handle
(
payload
,
0
);
}
}
...
...
common/api/tcp_channel.c
View file @
4660895f
...
@@ -352,10 +352,10 @@ int kk_is_tcp_channel(char devCode[DEVICE_CODE_LEN]){
...
@@ -352,10 +352,10 @@ int kk_is_tcp_channel(char devCode[DEVICE_CODE_LEN]){
if
(
devCode
==
NULL
||
strlen
(
devCode
)
==
0
){
if
(
devCode
==
NULL
||
strlen
(
devCode
)
==
0
){
return
-
1
;
return
-
1
;
}
}
INFO_PRINT
(
"[%s] devCode=%s
\n
"
,
__FUNCTION__
,
devCode
);
//
INFO_PRINT("[%s] devCode=%s \n", __FUNCTION__,devCode);
for
(;
i
<
MAX_LISTEN_NUM
;
i
++
){
for
(;
i
<
MAX_LISTEN_NUM
;
i
++
){
if
(
strcmp
(
devCode
,
g_tcp_ctrl
[
i
].
deviceCode
)
==
0
){
if
(
strcmp
(
devCode
,
g_tcp_ctrl
[
i
].
deviceCode
)
==
0
){
INFO_PRINT
(
"[%s] idx=%d ip=%s sock=%d
\n
"
,
__FUNCTION__
,
i
,
g_tcp_ctrl
[
i
].
ip
,
g_tcp_ctrl
[
i
].
sock
);
//
INFO_PRINT("[%s] idx=%d ip=%s sock=%d\n", __FUNCTION__,i, g_tcp_ctrl[i].ip, g_tcp_ctrl[i].sock);
return
g_tcp_ctrl
[
i
].
sock
;
return
g_tcp_ctrl
[
i
].
sock
;
}
}
}
}
...
...
common/hal/HAL_OS_linux.c
View file @
4660895f
...
@@ -293,12 +293,7 @@ int HAL_GetProduct_Code(_OU_ char *product_code)
...
@@ -293,12 +293,7 @@ int HAL_GetProduct_Code(_OU_ char *product_code)
return
strlen
(
KK_CCU_PRODUCTID
);
return
strlen
(
KK_CCU_PRODUCTID
);
}
}
int
HAL_GetDevice_Code
(
_OU_
char
*
dev_code
)
{
strncpy
(
dev_code
,
KK_CCU_ID
,
strlen
(
KK_CCU_ID
));
dev_code
[
strlen
(
KK_CCU_ID
)]
=
'\0'
;
return
strlen
(
KK_CCU_ID
);
}
/*
/*
* This need to be same with app version as in uOTA module (ota_version.h)
* This need to be same with app version as in uOTA module (ota_version.h)
...
...
makefile
View file @
4660895f
...
@@ -23,7 +23,7 @@ SUBDIRS += common/nanomsg
...
@@ -23,7 +23,7 @@ SUBDIRS += common/nanomsg
SUBDIRS
+=
common/ev
SUBDIRS
+=
common/ev
SUBDIRS
+=
common/sqlite
SUBDIRS
+=
common/sqlite
SUBDIRS
+=
common/hal
SUBDIRS
+=
common/hal
SUBDIRS
+=
factory_test_src/src
#
SUBDIRS += factory_test_src/src
#SUBDIRS += common/zlog
#SUBDIRS += common/zlog
#SUBDIRS += platform/zigbee
#SUBDIRS += platform/zigbee
...
...
midware/midware/dm/kk_sync_data.c
View file @
4660895f
...
@@ -247,7 +247,6 @@ static cJSON *kk_get_gw_properties_info(cJSON *data)
...
@@ -247,7 +247,6 @@ static cJSON *kk_get_gw_properties_info(cJSON *data)
propertyStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_IDENTIFITER
);
propertyStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_IDENTIFITER
);
valueType
=
sqlite3_column_int
(
stmt
,
DB_VALUETYPE
);
valueType
=
sqlite3_column_int
(
stmt
,
DB_VALUETYPE
);
valueStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_VALUE
);
valueStr
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_VALUE
);
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
if
(
valueType
==
KK_TSL_DATA_TYPE_TEXT
){
if
(
valueType
==
KK_TSL_DATA_TYPE_TEXT
){
cJSON_AddStringToObject
(
property
,
propertyStr
,
valueStr
);
cJSON_AddStringToObject
(
property
,
propertyStr
,
valueStr
);
}
else
if
(
valueType
==
KK_TSL_DATA_TYPE_INT
||
}
else
if
(
valueType
==
KK_TSL_DATA_TYPE_INT
||
...
@@ -1024,7 +1023,6 @@ static int kk_get_scenes_info(cJSON *data)
...
@@ -1024,7 +1023,6 @@ static int kk_get_scenes_info(cJSON *data)
cJSON_AddNumberToObject
(
sceneArrayItem
,
KK_SYNC_SCENE_ENABLE_STR
,
1
);
cJSON_AddNumberToObject
(
sceneArrayItem
,
KK_SYNC_SCENE_ENABLE_STR
,
1
);
}
else
{
}
else
{
cJSON_AddNumberToObject
(
sceneArrayItem
,
KK_SYNC_SCENE_ENABLE_STR
,
0
);
cJSON_AddNumberToObject
(
sceneArrayItem
,
KK_SYNC_SCENE_ENABLE_STR
,
0
);
}
}
type
=
sqlite3_column_int
(
stmt
,
DB_SCENEINFO_SCENETYPE
);
type
=
sqlite3_column_int
(
stmt
,
DB_SCENEINFO_SCENETYPE
);
cJSON_AddNumberToObject
(
sceneArrayItem
,
KK_SYNC_SCENE_SCENETYPE_STR
,
type
);
cJSON_AddNumberToObject
(
sceneArrayItem
,
KK_SYNC_SCENE_SCENETYPE_STR
,
type
);
...
@@ -1102,12 +1100,10 @@ char *kk_sync_get_info()
...
@@ -1102,12 +1100,10 @@ char *kk_sync_get_info()
char
version
[
32
]
=
{
0
};
char
version
[
32
]
=
{
0
};
char
cloudstatus_str
[
16
]
=
{
0
};
char
cloudstatus_str
[
16
]
=
{
0
};
cJSON
*
data
=
cJSON_CreateObject
();
cJSON
*
data
=
cJSON_CreateObject
();
kk_get_rooms_info
(
data
);
kk_get_rooms_info
(
data
);
kk_get_devices_info
(
data
);
kk_get_devices_info
(
data
);
kk_get_scenes_info
(
data
);
kk_get_scenes_info
(
data
);
//HAL_GetDevice_Code(ccu_deviceCode);
HAL_Get_ccuid
(
ccu_deviceCode
);
HAL_Get_ccuid
(
ccu_deviceCode
);
HAL_GetProduct_Code
(
ccu_productCode
);
HAL_GetProduct_Code
(
ccu_productCode
);
HAL_GetVersion
(
version
);
HAL_GetVersion
(
version
);
...
...
midware/midware/midware.c
View file @
4660895f
...
@@ -187,9 +187,9 @@ void kk_sendData2gw(void* data, int len, char* chalMark){
...
@@ -187,9 +187,9 @@ void kk_sendData2gw(void* data, int len, char* chalMark){
}
else
{
}
else
{
kk_ipc_send_ex
(
IPC_MID2PLAT
,
data
,
newLen
+
1
,
chalMark
);
kk_ipc_send_ex
(
IPC_MID2PLAT
,
data
,
newLen
+
1
,
chalMark
);
}
}
INFO_PRINT
(
"start to send data to gw srart
\n
"
);
//
INFO_PRINT("start to send data to gw srart\n");
kk_print_long_data
(
data
,
newLen
);
kk_print_long_data
(
data
,
newLen
);
INFO_PRINT
(
"start to send data to gw end
\n
"
);
//
INFO_PRINT("start to send data to gw end\n");
}
}
void
split
(
char
*
src
,
const
char
*
separator
,
char
**
dest
,
int
*
num
)
{
void
split
(
char
*
src
,
const
char
*
separator
,
char
**
dest
,
int
*
num
)
{
char
*
pNext
;
char
*
pNext
;
...
@@ -1142,7 +1142,7 @@ void *udp_dispatch_yield(void *args){
...
@@ -1142,7 +1142,7 @@ void *udp_dispatch_yield(void *args){
kk_property_db_get_rawdata
(
"IPAddress"
,
4
,
ipList
,
sizeof
(
ipList
));
kk_property_db_get_rawdata
(
"IPAddress"
,
4
,
ipList
,
sizeof
(
ipList
));
for
(;
idx
<
10
;
idx
++
){
for
(;
idx
<
10
;
idx
++
){
DEBUG_PRINT
(
"ipList[%d][%s][%s]
\n
"
,
idx
,
ipList
[
idx
].
deviceCode
,
ipList
[
idx
].
raw
);
//
DEBUG_PRINT("ipList[%d][%s][%s] \n", idx, ipList[idx].deviceCode, ipList[idx].raw);
if
(
strlen
(
ipList
[
idx
].
deviceCode
)
>
0
&&
strlen
(
ipList
[
idx
].
raw
)
>
0
){
if
(
strlen
(
ipList
[
idx
].
deviceCode
)
>
0
&&
strlen
(
ipList
[
idx
].
raw
)
>
0
){
kk_set_tcp_channel_by_idx
(
idx
,
ipList
[
idx
].
deviceCode
,
ipList
[
idx
].
raw
);
kk_set_tcp_channel_by_idx
(
idx
,
ipList
[
idx
].
deviceCode
,
ipList
[
idx
].
raw
);
}
}
...
...
onboot.sh
View file @
4660895f
#!/bin/sh
#!/bin/sh
#filepath="/home/kk"
#filepath="/home/kk"
filepath
=
"/app/ccuApps"
filepath
=
"/app/ccuApps"
/etc/init.d/S90dcron stop
if
[
!
-f
"/sbin/jq"
]
if
[
!
-f
"/sbin/jq"
]
then
then
cp
$filepath
/jq /sbin
cp
$filepath
/jq /sbin
...
@@ -39,9 +40,15 @@ if [ ! -d "$run_Dir" ]; then
...
@@ -39,9 +40,15 @@ if [ ! -d "$run_Dir" ]; then
mkdir
${
run_Dir
}
mkdir
${
run_Dir
}
fi
fi
#if [ ! -d "$tsl_Dir" ]; then
if
[
!
-d
"
$tsl_Dir
"
]
;
then
cp
-rf
$filepath
/tsl
${
run_Dir
}
/
cp
-rf
$filepath
/tsl
${
run_Dir
}
/
#fi
else
defaultVer
=
`
cat
${
filepath
}
/tsl/version
`
curVer
=
`
cat
${
run_Dir
}
/tsl/version
`
if
[
$defaultVer
!=
$curVer
]
;
then
cp
-rf
$filepath
/tsl
${
run_Dir
}
/
fi
fi
#if [ ! -d "$map_Dir" ]; then
#if [ ! -d "$map_Dir" ]; then
cp
-rf
$filepath
/map
${
run_Dir
}
/
cp
-rf
$filepath
/map
${
run_Dir
}
/
#fi
#fi
...
@@ -68,11 +75,10 @@ sleep 2
...
@@ -68,11 +75,10 @@ sleep 2
$filepath
/bin/kk_cloud &
$filepath
/bin/kk_cloud &
sleep
5
sleep
5
$filepath
/bin/smarthome_z3gw_nx5
-r0
-l3
--device-def
=
$filepath
/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
$filepath
/bin/kk_lan
--uart
=
/dev/ttyS3&
sleep
1
sleep
1
if
[
!
-f
/etc/cron.d/ccu
]
;
then
if
[
!
-f
/etc/cron.d/ccu
]
;
then
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
;
}
fi
fi
/etc/init.d/S90dcron restart
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
tsl/gateway_2.json
View file @
4660895f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"schema"
:
"https://iot-ap.ikonke.com/model/gateway_2.json"
,
"schema"
:
"https://iot-ap.ikonke.com/model/gateway_2.json"
,
"productType"
:
"gw"
,
"productType"
:
"gw"
,
"profile"
:{
"profile"
:{
"heartbeat"
:
"300
0
"
,
"heartbeat"
:
"300"
,
"productCode"
:
"2"
,
"productCode"
:
"2"
,
"productName"
:
"网关"
"productName"
:
"网关"
},
},
...
...
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