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
90005f06
Commit
90005f06
authored
Aug 03, 2021
by
尹佳钦
Browse files
Options
Browse Files
Download
Plain Diff
20210803
parents
570bd950
cc48e429
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
664 additions
and
296 deletions
+664
-296
application/kcloud/kcloud_data_handle.c
application/kcloud/kcloud_data_handle.c
+20
-16
application/kcloud/kcloud_main.c
application/kcloud/kcloud_main.c
+28
-2
application/kcloud/kk_info_report.c
application/kcloud/kk_info_report.c
+19
-9
application/kcloud/kk_register.c
application/kcloud/kk_register.c
+9
-25
application/kcloud/kk_topic_mng.c
application/kcloud/kk_topic_mng.c
+10
-5
application/kcloud/mqtt_api.c
application/kcloud/mqtt_api.c
+3
-1
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+3
-1
application/klansdk/kk_findccu_handle.c
application/klansdk/kk_findccu_handle.c
+3
-1
application/klansdk/kk_lan_main.c
application/klansdk/kk_lan_main.c
+47
-6
application/oled/main.c
application/oled/main.c
+35
-35
common/api/com_api.c
common/api/com_api.c
+2
-3
common/api/kk_log.h
common/api/kk_log.h
+55
-17
common/hal/HAL_OS_linux.c
common/hal/HAL_OS_linux.c
+25
-21
common/hal/kk_hal.h
common/hal/kk_hal.h
+5
-0
common/hal/kk_product.h
common/hal/kk_product.h
+1
-5
midware/midware/dm/kk_dm_mng.c
midware/midware/dm/kk_dm_mng.c
+25
-8
midware/midware/dm/kk_dm_mng.h
midware/midware/dm/kk_dm_mng.h
+17
-0
midware/midware/dm/kk_dm_msg.c
midware/midware/dm/kk_dm_msg.c
+101
-5
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+19
-3
midware/midware/dm/kk_property_db.c
midware/midware/dm/kk_property_db.c
+6
-1
midware/midware/history/kk_history_db.c
midware/midware/history/kk_history_db.c
+7
-7
midware/midware/history/kk_history_db.h
midware/midware/history/kk_history_db.h
+3
-3
midware/midware/midware.c
midware/midware/midware.c
+174
-78
midware/midware/scene/kk_scene_handle.c
midware/midware/scene/kk_scene_handle.c
+4
-4
midware/tsl/tsl_handle/kk_tsl_common.h
midware/tsl/tsl_handle/kk_tsl_common.h
+2
-1
tsl/ccu_12.json
tsl/ccu_12.json
+20
-19
tsl/ccu_15.json
tsl/ccu_15.json
+21
-20
No files found.
application/kcloud/kcloud_data_handle.c
View file @
90005f06
...
@@ -52,7 +52,7 @@ const char DM_MSG_TO_MIDDWARE[] = "{\"msgtype\":\"%s\",\"productCode\":\"%s\",\"
...
@@ -52,7 +52,7 @@ const char DM_MSG_TO_MIDDWARE[] = "{\"msgtype\":\"%s\",\"productCode\":\"%s\",\"
#define KK_POWER_SWITCH_2 "PowerSwitch_2"
#define KK_POWER_SWITCH_2 "PowerSwitch_2"
#define KK_POWER_SWITCH_3 "PowerSwitch_3"
#define KK_POWER_SWITCH_3 "PowerSwitch_3"
#define KK_POWER_SWITCH_4 "PowerSwitch_4"
#define KK_POWER_SWITCH_4 "PowerSwitch_4"
extern
char
*
KK_Make_Topic
(
cJSON
*
info
);
extern
char
*
KK_Make_Topic
(
cJSON
*
info
,
cJSON
*
data
);
extern
int
KK_Subdev_UnSubscribe
(
cJSON
*
payload
);
extern
int
KK_Subdev_UnSubscribe
(
cJSON
*
payload
);
extern
int
KK_Subdev_UnSubscribe_By_DeviceCode
(
const
char
*
deviceCode
,
const
char
*
productCode
);
extern
int
KK_Subdev_UnSubscribe_By_DeviceCode
(
const
char
*
deviceCode
,
const
char
*
productCode
);
extern
int
KK_Subdev_Subscribe
(
const
cJSON
*
root
);
extern
int
KK_Subdev_Subscribe
(
const
cJSON
*
root
);
...
@@ -214,15 +214,16 @@ int _kk_sendto_cloud(cJSON *root)
...
@@ -214,15 +214,16 @@ int _kk_sendto_cloud(cJSON *root)
if
(
msgTypeStr
==
NULL
){
if
(
msgTypeStr
==
NULL
){
return
RETURN_FAIL
;
return
RETURN_FAIL
;
}
}
topic
=
KK_Make_Topic
(
info
);
if
(
topic
==
NULL
){
return
RETURN_FAIL
;
}
pData
=
cJSON_GetObjectItem
(
root
,
MSG_PAYLOAD_STR
);
pData
=
cJSON_GetObjectItem
(
root
,
MSG_PAYLOAD_STR
);
if
(
pData
==
NULL
){
if
(
pData
==
NULL
){
free
(
topic
);
free
(
topic
);
return
RETURN_FAIL
;
return
RETURN_FAIL
;
}
}
topic
=
KK_Make_Topic
(
info
,
pData
);
if
(
topic
==
NULL
){
return
RETURN_FAIL
;
}
//If topo delete,need UnSubscribe the topic
//If topo delete,need UnSubscribe the topic
if
(
strstr
(
msgTypeStr
->
valuestring
,
KK_FILTER_DELETE_TOPIC
)
!=
NULL
){
if
(
strstr
(
msgTypeStr
->
valuestring
,
KK_FILTER_DELETE_TOPIC
)
!=
NULL
){
KK_Subdev_UnSubscribe
(
pData
);
KK_Subdev_UnSubscribe
(
pData
);
...
@@ -258,10 +259,12 @@ int _kk_sendto_cloud(cJSON *root)
...
@@ -258,10 +259,12 @@ int _kk_sendto_cloud(cJSON *root)
free
(
topic
);
free
(
topic
);
return
RETURN_SUCCESS
;
return
RETURN_SUCCESS
;
}
}
if
(
kk_check_need_split
(
info
)){
//if(kk_check_need_split(info)){
kk_split_send_data
(
pData
,
topic
);
//kk_split_send_data(pData,topic);
}
//}
else
{
//else
{
#if 0
cJSON *pParam = NULL;
cJSON *pParam = NULL;
cJSON *PowerSwitch = NULL;
cJSON *PowerSwitch = NULL;
int i = 0;
int i = 0;
...
@@ -282,6 +285,7 @@ int _kk_sendto_cloud(cJSON *root)
...
@@ -282,6 +285,7 @@ int _kk_sendto_cloud(cJSON *root)
break;
break;
}
}
}
}
#endif
char
*
out
=
cJSON_Print
(
pData
);
char
*
out
=
cJSON_Print
(
pData
);
KK_MQTT_SendMsg
(
topic
,(
const
char
*
)
out
);
KK_MQTT_SendMsg
(
topic
,(
const
char
*
)
out
);
free
(
out
);
free
(
out
);
...
@@ -511,7 +515,7 @@ static char * _kk_data_create(const char *topic,const char *data)
...
@@ -511,7 +515,7 @@ static char * _kk_data_create(const char *topic,const char *data)
root
=
cJSON_CreateObject
();
root
=
cJSON_CreateObject
();
cJSON
*
infoObj
=
cJSON_Parse
(
infoStr
);
cJSON
*
infoObj
=
cJSON_Parse
(
infoStr
);
cJSON
*
payloadObj
=
cJSON_Parse
(
data
);
cJSON
*
payloadObj
=
cJSON_Parse
(
data
);
#if
1
#if
0
cJSON * params = cJSON_GetObjectItem(payloadObj,"params");
cJSON * params = cJSON_GetObjectItem(payloadObj,"params");
if(params != NULL){
if(params != NULL){
cJSON * PowerSwitch = cJSON_GetObjectItem(params,"PowerSwitch");
cJSON * PowerSwitch = cJSON_GetObjectItem(params,"PowerSwitch");
...
@@ -564,7 +568,7 @@ int KK_Send_CloudState(int state)
...
@@ -564,7 +568,7 @@ int KK_Send_CloudState(int state)
infoStr_len
=
strlen
(
DM_MSG_TO_MIDDWARE
)
+
strlen
(
KK_CLOUDSTATE_MSG_REPLY
)
+
10
;
infoStr_len
=
strlen
(
DM_MSG_TO_MIDDWARE
)
+
strlen
(
KK_CLOUDSTATE_MSG_REPLY
)
+
10
;
infoStr
=
malloc
(
infoStr_len
);
infoStr
=
malloc
(
infoStr_len
);
if
(
infoStr
==
NULL
){
if
(
infoStr
==
NULL
){
ERROR_PRINT
(
"
[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
ERROR_PRINT
(
"
infoStr == NULL
\n
"
);
return
RETURN_FAIL
;
return
RETURN_FAIL
;
}
}
memset
(
infoStr
,
0x0
,
infoStr_len
);
memset
(
infoStr
,
0x0
,
infoStr_len
);
...
@@ -573,7 +577,7 @@ int KK_Send_CloudState(int state)
...
@@ -573,7 +577,7 @@ int KK_Send_CloudState(int state)
payloadStr_len
=
strlen
(
DM_MSG_CLOUDSTATE
)
+
10
;
payloadStr_len
=
strlen
(
DM_MSG_CLOUDSTATE
)
+
10
;
payloadStr
=
malloc
(
payloadStr_len
);
payloadStr
=
malloc
(
payloadStr_len
);
if
(
payloadStr
==
NULL
){
if
(
payloadStr
==
NULL
){
ERROR_PRINT
(
"
[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
ERROR_PRINT
(
"
payloadStr == NULL
\n
"
);
return
RETURN_FAIL
;
return
RETURN_FAIL
;
}
}
memset
(
payloadStr
,
0x0
,
payloadStr_len
);
memset
(
payloadStr
,
0x0
,
payloadStr_len
);
...
@@ -589,7 +593,7 @@ int KK_Send_CloudState(int state)
...
@@ -589,7 +593,7 @@ int KK_Send_CloudState(int state)
cJSON_Delete
(
root
);
cJSON_Delete
(
root
);
free
(
payloadStr
);
free
(
payloadStr
);
free
(
infoStr
);
free
(
infoStr
);
INFO_PRINT
(
"
[%s][%d]%s
\n
"
,
__FUNCTION__
,
__LINE__
,
out
);
INFO_PRINT
(
"
%s
\n
"
,
out
);
free
(
out
);
free
(
out
);
return
RETURN_SUCCESS
;
return
RETURN_SUCCESS
;
}
}
...
@@ -605,11 +609,11 @@ void KK_Sendto_DevData(const char *topic,const char *data)
...
@@ -605,11 +609,11 @@ void KK_Sendto_DevData(const char *topic,const char *data)
{
{
if
(
_check_invalid_topic
(
topic
))
if
(
_check_invalid_topic
(
topic
))
{
{
INFO_PRINT
(
"
[%s][%d]ingore the topic:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
topic
);
INFO_PRINT
(
"
ingore the topic:%s
\n
"
,
topic
);
return
;
//ingore the message
return
;
//ingore the message
}
}
INFO_PRINT
(
"
[%s][%d]receive from cloud,topic:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
topic
);
INFO_PRINT
(
"
receive from cloud,topic:%s
\n
"
,
topic
);
INFO_PRINT
(
"
[%s][%d]receive from cloud,data:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
data
);
INFO_PRINT
(
"
receive from cloud,data:%s
\n
"
,
data
);
char
*
send_data
=
_kk_data_create
(
topic
,
data
);
char
*
send_data
=
_kk_data_create
(
topic
,
data
);
if
(
send_data
==
NULL
){
if
(
send_data
==
NULL
){
return
;
return
;
...
...
application/kcloud/kcloud_main.c
View file @
90005f06
...
@@ -27,7 +27,32 @@
...
@@ -27,7 +27,32 @@
#include "com_api.h"
#include "com_api.h"
#include "kk_product.h"
#include "kk_product.h"
//#include "kcloud_log.h"
//#include "kcloud_log.h"
static
char
s_ccuid
[
DEVICE_CODE_LEN
]
=
{
0
};
int
KK_Get_ccuid
(
_OU_
char
*
device_code
)
{
strncpy
(
device_code
,
s_ccuid
,
strlen
(
s_ccuid
));
printf
(
"HAL_Get_ccuid:%s
\n
"
,
s_ccuid
);
return
strlen
(
s_ccuid
);
}
static
int
_setDevice_Code
(
_IN_
char
*
device_code
,
int
len
)
{
memset
(
s_ccuid
,
0x0
,
DEVICE_CODE_LEN
);
printf
(
"_setDevice_Code:%s
\n
"
,
device_code
);
strncpy
(
s_ccuid
,
device_code
,
len
);
return
len
;
}
static
void
KK_Ccuid_init
(
void
)
{
uint8_t
ccuid
[
DEVICE_CODE_LEN
]
=
{
0
};
int
ccuid_len
=
0
;
HAL_Execel_cmd
(
GET_CCUID_CMD
,(
char
*
)
ccuid
,
sizeof
(
ccuid
),
&
ccuid_len
);
printf
(
"GET_CCUID_CMD:%s
\n
"
,
ccuid
);
if
(
ccuid_len
>
0
&&
ccuid_len
<=
DEVICE_CODE_LEN
){
_setDevice_Code
(
ccuid
,
ccuid_len
-
1
);
}
else
{
_setDevice_Code
(
KK_CCU_ID
,
strlen
(
KK_CCU_ID
));
}
}
static
int
mqtt_start
(
void
)
static
int
mqtt_start
(
void
)
{
{
int
count
=
0
;
int
count
=
0
;
...
@@ -63,8 +88,9 @@ int main(int argc, char* argv[])
...
@@ -63,8 +88,9 @@ int main(int argc, char* argv[])
int
rc
=
0
;
int
rc
=
0
;
open
(
"kcloud"
,
LOG_PID
,
LOG_USER
);
open
(
"kcloud"
,
LOG_PID
,
LOG_USER
);
/*set the callback to get the device date to cloud*/
/*set the callback to get the device date to cloud*/
KK_Ccuid_init
();
kk_ipc_init
(
IPC_APP2MID
,(
ipc_cb
*
)
KK_Data_FromDev
,
NULL
,
NULL
);
kk_ipc_init
(
IPC_APP2MID
,(
ipc_cb
*
)
KK_Data_FromDev
,
NULL
,
NULL
);
//
kk_info_report_start();
kk_info_report_start
();
again:
again:
rc
=
kk_start_ccu_register
();
rc
=
kk_start_ccu_register
();
if
(
rc
==
0
){
if
(
rc
==
0
){
...
...
application/kcloud/kk_info_report.c
View file @
90005f06
...
@@ -40,10 +40,13 @@ static int kk_info_get(char *str)
...
@@ -40,10 +40,13 @@ static int kk_info_get(char *str)
int
ret
=
0
;
int
ret
=
0
;
char
version
[
VERSION_MAXLEN
]
=
{
0
};
char
version
[
VERSION_MAXLEN
]
=
{
0
};
char
*
str_tmp
=
NULL
;
char
*
str_tmp
=
NULL
;
char
ccuid
[
32
]
=
{
0
};
if
(
str
==
NULL
){
if
(
str
==
NULL
){
return
-
1
;
return
-
1
;
}
}
HAL_GetVersion
(
version
);
HAL_GetVersion
(
version
);
KK_Get_ccuid
(
ccuid
);
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
root
=
cJSON_CreateObject
();
if
(
root
)
if
(
root
)
{
{
...
@@ -56,20 +59,25 @@ static int kk_info_get(char *str)
...
@@ -56,20 +59,25 @@ static int kk_info_get(char *str)
if
(
ccu
)
if
(
ccu
)
{
{
char
status
[
4
]
=
{
0
};
char
status
[
4
]
=
{
0
};
cJSON_AddItemToObject
(
args
,
"ccu"
,
ccu
);
cJSON_AddItemToObject
(
args
,
"ccu"
,
ccu
);
cJSON_AddStringToObject
(
ccu
,
"id"
,
"12345"
);
cJSON_AddStringToObject
(
ccu
,
"id"
,
&
ccuid
[
4
]
);
cJSON_AddStringToObject
(
ccu
,
"version"
,
version
);
cJSON_AddStringToObject
(
ccu
,
"version"
,
version
);
cJSON_AddStringToObject
(
ccu
,
"name"
,
"kk_new_ccu"
);
cJSON_AddStringToObject
(
ccu
,
"name"
,
"kk_new_ccu"
);
//INFO_PRINT("---222kk_get_cloud_status():%d\n",kk_get_cloud_status());
if
(
kk_get_gw_status
()
==
DEVICE_OFFLINE
){
//if(kk_get_gw_status() == DEVICE_OFFLINE){
strcpy
(
status
,
"2"
);
//memcpy(status,"2",strlen("2"));
}
//}
else
if
(
kk_get_cloud_status
()
==
DEVICE_OFFLINE
){
if
(
kk_get_cloud_status
()
==
DEVICE_OFFLINE
)
{
//cJSON_AddStringToObject(ccu, "status", "1");
//cJSON_AddStringToObject(ccu, "status", "1");
strcpy
(
status
,
"1"
);
//INFO_PRINT("_-----------------------------------------------------------11\n");
memcpy
(
status
,
"1"
,
strlen
(
"1"
));
}
else
{
}
else
{
strcpy
(
status
,
"0"
);
//INFO_PRINT("_-----------------------------------------------------------22\n");
memcpy
(
status
,
"0"
,
strlen
(
"0"
));
}
}
//INFO_PRINT("------------------------------------->status :%s\n",status);
cJSON_AddStringToObject
(
ccu
,
"status"
,
status
);
cJSON_AddStringToObject
(
ccu
,
"status"
,
status
);
}
}
...
@@ -91,8 +99,10 @@ static int kk_info_get(char *str)
...
@@ -91,8 +99,10 @@ static int kk_info_get(char *str)
cJSON
*
qr_code
=
cJSON_CreateObject
();
cJSON
*
qr_code
=
cJSON_CreateObject
();
if
(
qr_code
)
if
(
qr_code
)
{
{
char
qrcodeStr
[
256
]
=
{
0
};
sprintf
(
qrcodeStr
,
"KONKE-CCU:%s:%s:BBE3C5A5FC1FDB6CA1A386AB321D02AB"
,
KK_CCU_PRODUCTID
,
&
ccuid
[
4
]);
cJSON_AddItemToObject
(
args
,
"qr_code"
,
qr_code
);
cJSON_AddItemToObject
(
args
,
"qr_code"
,
qr_code
);
cJSON_AddStringToObject
(
qr_code
,
"string"
,
"KONKE-CCU:15:95972:E53AC78A40C4EBD4ABFFA1009794641B"
);
cJSON_AddStringToObject
(
qr_code
,
"string"
,
qrcodeStr
);
cJSON_AddBoolToObject
(
qr_code
,
"show"
,
1
);
cJSON_AddBoolToObject
(
qr_code
,
"show"
,
1
);
}
}
cJSON
*
service
=
cJSON_CreateObject
();
cJSON
*
service
=
cJSON_CreateObject
();
...
...
application/kcloud/kk_register.c
View file @
90005f06
...
@@ -20,27 +20,7 @@
...
@@ -20,27 +20,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
)
{
if
(
cmd
==
NULL
||
buf
==
NULL
||
buf_len
==
0
)
{
printf
(
"arg error
\n
"
);
return
-
1
;
}
memset
(
buf
,
0
,
buf_len
);
FILE
*
fp
=
NULL
;
fp
=
popen
(
cmd
,
"r"
);
while
(
fgets
(
buf
,
buf_len
,
fp
)
!=
NULL
){
printf
(
"%s return %s"
,
cmd
,
buf
);
}
pclose
(
fp
);
*
ret_len
=
strlen
(
buf
);
return
0
;
}
int
kk_parse_deviceSecret
(
char
*
info
){
int
kk_parse_deviceSecret
(
char
*
info
){
FILE
*
fp
;
FILE
*
fp
;
if
(
info
==
NULL
){
if
(
info
==
NULL
){
...
@@ -205,14 +185,16 @@ static char * kk_create_register_info()
...
@@ -205,14 +185,16 @@ static char * kk_create_register_info()
unsigned
char
sign_hex
[
32
]
=
{
0
};
unsigned
char
sign_hex
[
32
]
=
{
0
};
char
sign_hex_str
[
65
]
=
{
0
};
char
sign_hex_str
[
65
]
=
{
0
};
uint8_t
productSecret
[
64
]
=
{
0
};
uint8_t
productSecret
[
64
]
=
{
0
};
char
ccuid
[
32
]
=
{
0
};
int
productSecret_len
=
0
;
int
productSecret_len
=
0
;
root
=
cJSON_CreateObject
();
root
=
cJSON_CreateObject
();
HAL_Get_mac
(
mac
);
HAL_Get_mac
(
mac
);
HAL_GetTime_s
(
ramdonId
);
HAL_GetTime_s
(
ramdonId
);
cJSON_AddStringToObject
(
root
,
"deviceCode"
,
KK_CCU_ID
);
KK_Get_ccuid
(
ccuid
);
cJSON_AddStringToObject
(
root
,
"deviceCode"
,
ccuid
);
cJSON_AddStringToObject
(
root
,
"productCode"
,
productCode
);
cJSON_AddStringToObject
(
root
,
"productCode"
,
productCode
);
signSource
=
kk_dictionary_order
(
KK_CCU_ID
,
productCode
,
KK_CCU_RANDOM
);
signSource
=
kk_dictionary_order
(
ccuid
,
productCode
,
KK_CCU_RANDOM
);
kk_e
xecel_cmd
(
GET_KEY_CMD
,(
char
*
)
productSecret
,
sizeof
(
productSecret
),
&
productSecret_len
);
HAL_E
xecel_cmd
(
GET_KEY_CMD
,(
char
*
)
productSecret
,
sizeof
(
productSecret
),
&
productSecret_len
);
if
(
productSecret_len
==
0
){
if
(
productSecret_len
==
0
){
utils_hmac_sha256
((
const
uint8_t
*
)
signSource
,
strlen
(
signSource
),
(
const
uint8_t
*
)
PRODUCTSECRET
,
strlen
(
PRODUCTSECRET
),
sign_hex
);
utils_hmac_sha256
((
const
uint8_t
*
)
signSource
,
strlen
(
signSource
),
(
const
uint8_t
*
)
PRODUCTSECRET
,
strlen
(
PRODUCTSECRET
),
sign_hex
);
}
else
{
}
else
{
...
@@ -247,10 +229,12 @@ static char * kk_create_get_jwt_info()
...
@@ -247,10 +229,12 @@ static char * kk_create_get_jwt_info()
char
*
out
=
NULL
;
char
*
out
=
NULL
;
char
timestamp
[
16
]
=
{
0
};
char
timestamp
[
16
]
=
{
0
};
char
deviceSecret
[
64
]
=
{
0
};
char
deviceSecret
[
64
]
=
{
0
};
char
ccuid
[
32
]
=
{
0
};
HAL_GetTime_s
(
timestamp
);
HAL_GetTime_s
(
timestamp
);
sprintf
(
g_clientId
,
CLIENTID
,
KK_CCU_ID
,
timestamp
);
KK_Get_ccuid
(
ccuid
);
sprintf
(
g_clientId
,
CLIENTID
,
ccuid
,
timestamp
);
root
=
cJSON_CreateObject
();
root
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
root
,
"deviceCode"
,
KK_CCU_ID
);
cJSON_AddStringToObject
(
root
,
"deviceCode"
,
ccuid
);
cJSON_AddStringToObject
(
root
,
"productCode"
,
KK_CCU_PRODUCTID
);
cJSON_AddStringToObject
(
root
,
"productCode"
,
KK_CCU_PRODUCTID
);
cJSON_AddStringToObject
(
root
,
"clientId"
,
g_clientId
);
cJSON_AddStringToObject
(
root
,
"clientId"
,
g_clientId
);
fp
=
fopen
(
"/usr/kk/kk_deviceSecret.txt"
,
"r"
);
fp
=
fopen
(
"/usr/kk/kk_deviceSecret.txt"
,
"r"
);
...
...
application/kcloud/kk_topic_mng.c
View file @
90005f06
...
@@ -83,7 +83,7 @@ static int _kk_ccu_topic_subscribe(char productCode[PRODUCT_CODE_LEN],char devic
...
@@ -83,7 +83,7 @@ static int _kk_ccu_topic_subscribe(char productCode[PRODUCT_CODE_LEN],char devic
int
res
=
0
;
int
res
=
0
;
int
url_len
=
0
;
int
url_len
=
0
;
url_len
=
strlen
(
KK_URI_SYS_PREFIX
_SERVICE
)
+
strlen
(
productCode
)
+
strlen
(
deviceCode
)
+
1
;
url_len
=
strlen
(
KK_URI_SYS_PREFIX
)
+
strlen
(
productCode
)
+
strlen
(
deviceCode
)
+
1
;
char
*
url
=
malloc
(
url_len
);
char
*
url
=
malloc
(
url_len
);
if
(
url
==
NULL
)
{
if
(
url
==
NULL
)
{
return
-
1
;
return
-
1
;
...
@@ -95,12 +95,14 @@ static int _kk_ccu_topic_subscribe(char productCode[PRODUCT_CODE_LEN],char devic
...
@@ -95,12 +95,14 @@ static int _kk_ccu_topic_subscribe(char productCode[PRODUCT_CODE_LEN],char devic
//res = KK_MQTT_SubTopic(url);
//res = KK_MQTT_SubTopic(url);
memset
(
url
,
0
,
url_len
);
memset
(
url
,
0
,
url_len
);
snprintf
(
url
,
url_len
,
KK_URI_SYS_PREFIX_SERVICE
,
productCode
,
deviceCode
);
snprintf
(
url
,
url_len
,
KK_URI_SYS_PREFIX_SERVICE
,
productCode
,
deviceCode
);
INFO_PRINT
(
"sys [%s][%d] URL:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
url
);
INFO_PRINT
(
"sys [%s][%d] URL:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
url
);
res
=
KK_MQTT_SubTopic
(
url
);
res
=
KK_MQTT_SubTopic
(
url
);
memset
(
url
,
0
,
url_len
);
snprintf
(
url
,
url_len
,
KK_URI_SYS_PREFIX
,
productCode
,
deviceCode
);
INFO_PRINT
(
"sys [%s][%d] URL:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
url
);
res
=
KK_MQTT_SubTopic
(
url
);
free
(
url
);
free
(
url
);
return
res
;
return
res
;
}
}
...
@@ -113,10 +115,12 @@ int KK_CCU_TOPIC_Subscribe(void)
...
@@ -113,10 +115,12 @@ int KK_CCU_TOPIC_Subscribe(void)
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
};
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
);
HAL_Get_mac
(
deviceCode
);
return
_kk_ccu_topic_subscribe
(
productCode
,
KK_CCU_ID
);
return
_kk_ccu_topic_subscribe
(
productCode
,
ccuid
);
}
}
static
int
_kk_utils_topic
(
_IN_
const
char
*
name
,
_IN_
char
*
product_code
,
static
int
_kk_utils_topic
(
_IN_
const
char
*
name
,
_IN_
char
*
product_code
,
...
@@ -212,7 +216,7 @@ errorreturn:
...
@@ -212,7 +216,7 @@ errorreturn:
return
-
1
;
return
-
1
;
}
}
char
*
KK_Make_Topic
(
cJSON
*
info
)
char
*
KK_Make_Topic
(
cJSON
*
info
,
cJSON
*
data
)
{
{
cJSON
*
type
,
*
product_code
,
*
device_code
;
cJSON
*
type
,
*
product_code
,
*
device_code
;
char
*
topic
=
NULL
;
char
*
topic
=
NULL
;
...
@@ -236,6 +240,7 @@ char* KK_Make_Topic(cJSON *info)
...
@@ -236,6 +240,7 @@ char* KK_Make_Topic(cJSON *info)
KK_CCU_TOPIC_Subscribe
();
KK_CCU_TOPIC_Subscribe
();
}
}
if
(
!
strcmp
(
product_code
->
valuestring
,
KK_GW_PRODUCTID
)){
if
(
!
strcmp
(
product_code
->
valuestring
,
KK_GW_PRODUCTID
)){
//printf("[%s][%d]:%s\n",__FUNCTION__,__LINE__,type->valuestring);
if
(
strstr
(
type
->
valuestring
,
"/thing/status/offline"
)
!=
NULL
){
if
(
strstr
(
type
->
valuestring
,
"/thing/status/offline"
)
!=
NULL
){
kk_set_gw_status
(
DEVICE_OFFLINE
);
kk_set_gw_status
(
DEVICE_OFFLINE
);
}
else
if
(
strstr
(
type
->
valuestring
,
"/thing/status/online"
)
!=
NULL
){
}
else
if
(
strstr
(
type
->
valuestring
,
"/thing/status/online"
)
!=
NULL
){
...
...
application/kcloud/mqtt_api.c
View file @
90005f06
...
@@ -206,7 +206,9 @@ MQTTAsync KK_MQTT_Connect(void)
...
@@ -206,7 +206,9 @@ MQTTAsync KK_MQTT_Connect(void)
fclose
(
fp
);
fclose
(
fp
);
}
}
HAL_Get_mac
(
mac
);
HAL_Get_mac
(
mac
);
sprintf
(
usrname
,
"%s.%s"
,
KK_CCU_ID
,
KK_CCU_PRODUCTID
);
char
ccuid
[
32
]
=
{
0
};
KK_Get_ccuid
(
ccuid
);
sprintf
(
usrname
,
"%s.%s"
,
ccuid
,
KK_CCU_PRODUCTID
);
printf
(
"cliendid:%s,usrname:%s
\n
"
,
g_clientId
,
usrname
);
printf
(
"cliendid:%s,usrname:%s
\n
"
,
g_clientId
,
usrname
);
printf
(
"------------>token:%s
\n
"
,
token
);
printf
(
"------------>token:%s
\n
"
,
token
);
if
((
rc
=
MQTTAsync_createWithOptions
(
&
s_Client
,
ADDRESS
,
g_clientId
,
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
,
&
opts
))
!=
MQTTASYNC_SUCCESS
)
if
((
rc
=
MQTTAsync_createWithOptions
(
&
s_Client
,
ADDRESS
,
g_clientId
,
MQTTCLIENT_PERSISTENCE_NONE
,
NULL
,
&
opts
))
!=
MQTTASYNC_SUCCESS
)
...
...
application/klansdk/kk_data_handle.c
View file @
90005f06
...
@@ -158,9 +158,11 @@ static int kk_loginccu_ack(cJSON *arg,int sockfd)
...
@@ -158,9 +158,11 @@ static int kk_loginccu_ack(cJSON *arg,int sockfd)
if
(
arg
==
NULL
){
if
(
arg
==
NULL
){
return
-
1
;
return
-
1
;
}
}
char
ccuid
[
32
]
=
{
0
};
kk_lan_get_ccuid
(
ccuid
);
zkid
=
cJSON_GetObjectItem
(
arg
,
ZKID_STRING
);
zkid
=
cJSON_GetObjectItem
(
arg
,
ZKID_STRING
);
if
(
zkid
!=
NULL
){
if
(
zkid
!=
NULL
){
if
(
strstr
(
KK_CCU_ID
,
zkid
->
valuestring
)
!=
NULL
){
if
(
strstr
(
ccuid
,
zkid
->
valuestring
)
!=
NULL
){
root
=
cJSON_CreateObject
();
root
=
cJSON_CreateObject
();
if
(
root
){
if
(
root
){
args
=
cJSON_CreateObject
();
args
=
cJSON_CreateObject
();
...
...
application/klansdk/kk_findccu_handle.c
View file @
90005f06
...
@@ -26,12 +26,14 @@ static int kk_findccu_ack(int sockfd,struct sockaddr_in *addr){
...
@@ -26,12 +26,14 @@ static int kk_findccu_ack(int sockfd,struct sockaddr_in *addr){
if
(
addr
==
NULL
||
sockfd
<
0
){
if
(
addr
==
NULL
||
sockfd
<
0
){
return
-
1
;
return
-
1
;
}
}
char
ccuid
[
32
]
=
{
0
};
kk_lan_get_ccuid
(
ccuid
);
json
=
cJSON_CreateObject
();
json
=
cJSON_CreateObject
();
if
(
json
){
if
(
json
){
args
=
cJSON_CreateObject
();
args
=
cJSON_CreateObject
();
if
(
args
){
if
(
args
){
cJSON_AddItemToObject
(
json
,
"arg"
,
args
);
cJSON_AddItemToObject
(
json
,
"arg"
,
args
);
cJSON_AddStringToObject
(
args
,
"zkid"
,
KK_CCU_ID
);
cJSON_AddStringToObject
(
args
,
"zkid"
,
ccuid
);
cJSON_AddStringToObject
(
args
,
"zk"
,
KK_CCU_NAME
);
cJSON_AddStringToObject
(
args
,
"zk"
,
KK_CCU_NAME
);
HAL_Get_IP
(
s_IP
,
NULL
);
HAL_Get_IP
(
s_IP
,
NULL
);
cJSON_AddStringToObject
(
args
,
"ip"
,
s_IP
);
cJSON_AddStringToObject
(
args
,
"ip"
,
s_IP
);
...
...
application/klansdk/kk_lan_main.c
View file @
90005f06
...
@@ -19,10 +19,6 @@
...
@@ -19,10 +19,6 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <pthread.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "com_api.h"
#include "com_api.h"
#include "kk_product.h"
#include "kk_product.h"
#include "kk_findccu_handle.h"
#include "kk_findccu_handle.h"
...
@@ -31,30 +27,75 @@
...
@@ -31,30 +27,75 @@
//#include "kk_lan_queue.h"
//#include "kk_lan_queue.h"
#include "kk_lan_node_db.h"
#include "kk_lan_node_db.h"
#include "kk_data_mng.h"
static
char
s_ccuid
[
DEVICE_CODE_LEN
]
=
{
0
};
int
kk_lan_get_ccuid
(
_OU_
char
*
device_code
)
{
strncpy
(
device_code
,
s_ccuid
,
strlen
(
s_ccuid
));
printf
(
"kk_lan_get_ccuid:%s
\n
"
,
s_ccuid
);
return
strlen
(
s_ccuid
);
}
static
int
_setDevice_Code
(
_IN_
char
*
device_code
,
int
len
)
{
memset
(
s_ccuid
,
0x0
,
DEVICE_CODE_LEN
);
printf
(
"_setDevice_Code:%s
\n
"
,
device_code
);
strncpy
(
s_ccuid
,
device_code
,
len
);
return
len
;
}
static
void
kk_lan_ccuid_init
(
void
)
{
uint8_t
ccuid
[
DEVICE_CODE_LEN
]
=
{
0
};
int
ccuid_len
=
0
;
HAL_Execel_cmd
(
GET_CCUID_CMD
,(
char
*
)
ccuid
,
sizeof
(
ccuid
),
&
ccuid_len
);
printf
(
"GET_CCUID_CMD:%s
\n
"
,
ccuid
);
if
(
ccuid_len
>
0
&&
ccuid_len
<=
DEVICE_CODE_LEN
){
_setDevice_Code
(
ccuid
,
ccuid_len
-
1
);
}
else
{
_setDevice_Code
(
KK_CCU_ID
,
strlen
(
KK_CCU_ID
));
}
}
static
void
sig_handler
(
int
sig
)
{
printf
(
"Received signal: %d
\n
"
,
sig
);
abort
();
}
extern
void
ttttt_test
();
extern
void
kk_scene_build_test
(
void
);
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
int
rc
=
0
;
int
rc
=
0
;
char
*
ppp
;
open
(
"kk_lan"
,
LOG_PID
,
LOG_USER
);
open
(
"kk_lan"
,
LOG_PID
,
LOG_USER
);
kk_scene_build_test
();
/*set the callback to get the device date to cloud*/
/*set the callback to get the device date to cloud*/
kk_ipc_init
(
IPC_APP2MID
,(
ipc_cb
*
)
KK_Data_FromMid
,
NULL
,
NULL
);
kk_ipc_init
(
IPC_APP2MID
,(
ipc_cb
*
)
KK_Data_FromMid
,
NULL
,
NULL
);
kk_findccu_handle_init
();
kk_findccu_handle_init
();
kk_map_dev_init
();
kk_map_dev_init
();
kk_login_init
();
kk_login_init
();
struct
sigaction
sig
=
{
0
};
sig
.
sa_handler
=
sig_handler
;
sig
.
sa_flags
=
0
;
for
(
int
i
=
0
;
i
<
31
;
i
++
){
//sigaction(i, &sig, NULL);
}
//lan_queue_init();
//lan_queue_init();
kk_lan_db_node_init
();
kk_lan_db_node_init
();
//
kk_handle_sync_info();
kk_handle_sync_info
();
while
(
1
){
while
(
1
){
//count++;
//if(count == 10){
//kk_ipc_send(IPC_APP2MID, "wooooooooooooooooooooooooooooooooooollllll!", strlen("wooooooooooooooooooooooooooooooooooollllll!")+1);
//}
sleep
(
1
);
sleep
(
1
);
}
}
return
rc
;
return
rc
;
...
...
application/oled/main.c
View file @
90005f06
This diff is collapsed.
Click to expand it.
common/api/com_api.c
View file @
90005f06
...
@@ -81,10 +81,10 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
...
@@ -81,10 +81,10 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
//ERROR_PRINT("nn_recv failed with error code %d, %s \n", nn_errno(), nn_strerror(nn_errno ()));
//ERROR_PRINT("nn_recv failed with error code %d, %s \n", nn_errno(), nn_strerror(nn_errno ()));
return
;
return
;
}
}
//INFO_PRINT("watcher_cb:-------------------------\n");
dat_bak
=
malloc
(
bytes
+
1
);
dat_bak
=
malloc
(
bytes
+
1
);
if
(
dat_bak
!=
NULL
){
if
(
dat_bak
!=
NULL
){
memset
(
dat_bak
,
0x0
,
bytes
);
memset
(
dat_bak
,
0x0
,
bytes
+
1
);
memcpy
(
dat_bak
,
dat
,
bytes
);
memcpy
(
dat_bak
,
dat
,
bytes
);
cJSON_Minify
((
char
*
)
dat_bak
);
cJSON_Minify
((
char
*
)
dat_bak
);
INFO_PRINT
(
"watcher_cb:%s
\n
"
,
(
char
*
)
dat_bak
);
INFO_PRINT
(
"watcher_cb:%s
\n
"
,
(
char
*
)
dat_bak
);
...
@@ -125,7 +125,6 @@ void __loop_init(Bloop_ctrl_t *loop_ctrl, struct ev_loop* loop)
...
@@ -125,7 +125,6 @@ void __loop_init(Bloop_ctrl_t *loop_ctrl, struct ev_loop* loop)
loop_ctrl
->
watcher
.
data
=
loop_ctrl
;
loop_ctrl
->
watcher
.
data
=
loop_ctrl
;
if
(
loop_ctrl
->
type
==
IPC_PLAT2MID
||
loop_ctrl
->
type
==
IPC_APP2MID
){
if
(
loop_ctrl
->
type
==
IPC_PLAT2MID
||
loop_ctrl
->
type
==
IPC_APP2MID
){
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
ev_io_init
(
&
(
loop_ctrl
->
watcher
),
watcher_cb
,
loop_ctrl
->
ab
.
s
,
EV_READ
);
ev_io_init
(
&
(
loop_ctrl
->
watcher
),
watcher_cb
,
loop_ctrl
->
ab
.
s
,
EV_READ
);
}
else
{
}
else
{
ev_io_init
(
&
(
loop_ctrl
->
watcher
),
watcher_cb
,
loop_ctrl
->
ba
.
s
,
EV_READ
);
ev_io_init
(
&
(
loop_ctrl
->
watcher
),
watcher_cb
,
loop_ctrl
->
ba
.
s
,
EV_READ
);
...
...
common/api/kk_log.h
View file @
90005f06
#ifndef _LOGDEF_H_
#ifndef _LOGDEF_H_
#define _LOGDEF_H_
#define _LOGDEF_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <memory.h>
#include <syslog.h>
#include <syslog.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/prctl.h>
#include <sys/time.h>
#include <semaphore.h>
#include <errno.h>
#include <assert.h>
#include <net/if.h> // struct ifreq
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <sys/reboot.h>
#include <sys/time.h>
#include <time.h>
#include <signal.h>
static
int
g_enable_printf
=
1
;
#define LOG_STRING(level) ((level == LOG_EMERG) ? "EMERG " : \
(level == LOG_ALERT) ? "ALERT " : \
(level == LOG_CRIT) ? "CRIT " : \
(level == LOG_ERR) ? "ERR " : \
(level == LOG_WARNING) ? "WARNING " : \
(level == LOG_NOTICE) ? "NOTICE " : \
(level == LOG_INFO) ? "INFO " : \
(level == LOG_DEBUG) ? "DEBUG " : "NONE ")
#define KK_LOG(level,fmt,args...) do {\
time_t t; \
t = time(NULL); \
struct tm ptm; \
memset(&ptm, 0, sizeof(ptm)); \
localtime_r(&t, &ptm); \
syslog(level,"%s %4d-%02d-%02d %02d:%02d:%02d [%s:%d]:" fmt ,LOG_STRING(level), \
ptm.tm_year + 1900, ptm.tm_mon + 1, ptm.tm_mday, ptm.tm_hour,ptm.tm_min, ptm.tm_sec,\
__FILE__,__LINE__,##args);\
if(g_enable_printf == 1){\
printf("%s %4d-%02d-%02d %02d:%02d:%02d [%s:%d]:" fmt ,LOG_STRING(level), \
ptm.tm_year + 1900, ptm.tm_mon + 1, ptm.tm_mday, ptm.tm_hour,ptm.tm_min, \
ptm.tm_sec,__FILE__,__LINE__,##args);\
}}while(0)
#define DEBUG_PRINT(info,args...) do { \
#define DEBUG_PRINT(fmt, args...) KK_LOG(LOG_DEBUG, fmt, ##args)
syslog(LOG_DEBUG, "[%s][%d]"info,__FUNCTION__,__LINE__ ,##args); \
#define INFO_PRINT(fmt, args...) KK_LOG(LOG_INFO, fmt, ##args)
printf("\n["__FILE__":%d] "info,__LINE__, ##args); \
#define ERROR_PRINT(fmt, args...) KK_LOG(LOG_ERR, fmt, ##args)
}while(0)
#define WARNING_PRINT(fmt, args...) KK_LOG(LOG_WARNING, fmt, ##args)
#define INFO_PRINT(info,args...) do { \
syslog(LOG_INFO, "[%s][%d]"info,__FUNCTION__,__LINE__ , ##args); \
printf("\n["__FILE__":%d] "info,__LINE__, ##args); \
}while(0)
#define ERROR_PRINT(info,args...) do { \
syslog(LOG_ERR, "[%s][%d]"info,__FUNCTION__,__LINE__ , ##args); \
printf("\n["__FILE__":%d] "info,__LINE__, ##args); \
}while(0)
#define WARNING_PRINT(info,args...) do { \
syslog(LOG_WARNING, "[%s][%d]"info,__FUNCTION__,__LINE__ , ##args); \
printf("\n["__FILE__":%d] "info,__LINE__, ##args); \
}while(0)
#ifdef __cplusplus
}
#endif
#endif
#endif
common/hal/HAL_OS_linux.c
View file @
90005f06
...
@@ -32,10 +32,30 @@
...
@@ -32,10 +32,30 @@
#include "com_api.h"
#include "com_api.h"
char
g_product_type
[
PRODUCT_TYPE_LEN
]
=
{
0
};
char
g_product_type
[
PRODUCT_TYPE_LEN
]
=
{
0
};
char
g_product_code
[
PRODUCT_CODE_LEN
]
=
{
0
};
char
g_product_code
[
PRODUCT_CODE_LEN
]
=
{
0
};
char
g_device_code
[
DEVICE_CODE_LEN
]
=
{
0
};
#define PLATFORM_WAIT_INFINITE (~0)
#define PLATFORM_WAIT_INFINITE (~0)
int
HAL_Execel_cmd
(
char
*
cmd
,
char
*
buf
,
int
buf_len
,
int
*
ret_len
)
{
if
(
cmd
==
NULL
||
buf
==
NULL
||
buf_len
==
0
)
{
printf
(
"arg error
\n
"
);
return
-
1
;
}
memset
(
buf
,
0
,
buf_len
);
FILE
*
fp
=
NULL
;
fp
=
popen
(
cmd
,
"r"
);
while
(
fgets
(
buf
,
buf_len
,
fp
)
!=
NULL
){
printf
(
"%s return %s"
,
cmd
,
buf
);
}
pclose
(
fp
);
*
ret_len
=
strlen
(
buf
);
return
0
;
}
void
*
HAL_Malloc
(
_IN_
uint32_t
size
)
void
*
HAL_Malloc
(
_IN_
uint32_t
size
)
{
{
return
malloc
(
size
);
return
malloc
(
size
);
...
@@ -255,20 +275,6 @@ int HAL_SetProduct_Code(_IN_ char *product_code)
...
@@ -255,20 +275,6 @@ int HAL_SetProduct_Code(_IN_ char *product_code)
}
}
int
HAL_SetDevice_Code
(
_IN_
char
*
device_code
)
{
int
len
=
strlen
(
device_code
);
if
(
len
>
DEVICE_CODE_LEN
)
{
return
-
1
;
}
memset
(
g_device_code
,
0x0
,
DEVICE_CODE_LEN
);
strncpy
(
g_device_code
,
device_code
,
len
);
return
len
;
}
int
HAL_GetProduct_Code
(
_OU_
char
*
product_code
)
int
HAL_GetProduct_Code
(
_OU_
char
*
product_code
)
{
{
strncpy
(
product_code
,
KK_CCU_PRODUCTID
,
strlen
(
KK_CCU_PRODUCTID
));
strncpy
(
product_code
,
KK_CCU_PRODUCTID
,
strlen
(
KK_CCU_PRODUCTID
));
...
@@ -276,12 +282,8 @@ int HAL_GetProduct_Code(_OU_ char *product_code)
...
@@ -276,12 +282,8 @@ int HAL_GetProduct_Code(_OU_ char *product_code)
return
strlen
(
KK_CCU_PRODUCTID
);
return
strlen
(
KK_CCU_PRODUCTID
);
}
}
int
HAL_GetDevice_Code
(
_OU_
char
*
device_code
)
{
strncpy
(
device_code
,
KK_CCU_ID
,
strlen
(
KK_CCU_ID
));
device_code
[
strlen
(
KK_CCU_ID
)]
=
'\0'
;
return
strlen
(
KK_CCU_ID
);
}
int
HAL_GetVersion
(
_OU_
char
*
version
)
int
HAL_GetVersion
(
_OU_
char
*
version
)
{
{
strncpy
(
version
,
KK_CCU_VERSION
,
strlen
(
KK_CCU_VERSION
));
strncpy
(
version
,
KK_CCU_VERSION
,
strlen
(
KK_CCU_VERSION
));
...
@@ -747,6 +749,8 @@ uint32_t HAL_Get_IP(char ip_str[NETWORK_ADDR_LEN], const char *ifname)
...
@@ -747,6 +749,8 @@ uint32_t HAL_Get_IP(char ip_str[NETWORK_ADDR_LEN], const char *ifname)
return
((
struct
sockaddr_in
*
)
&
ifreq
.
ifr_addr
)
->
sin_addr
.
s_addr
;
return
((
struct
sockaddr_in
*
)
&
ifreq
.
ifr_addr
)
->
sin_addr
.
s_addr
;
}
}
#if 0
#if 0
static kv_file_t *kvfile = NULL;
static kv_file_t *kvfile = NULL;
...
...
common/hal/kk_hal.h
View file @
90005f06
...
@@ -37,4 +37,9 @@ void HAL_MutexDestroy(_IN_ void *mutex);
...
@@ -37,4 +37,9 @@ void HAL_MutexDestroy(_IN_ void *mutex);
int
HAL_GetVersion
(
_OU_
char
*
version
);
int
HAL_GetVersion
(
_OU_
char
*
version
);
int
HAL_Get_mac
(
char
*
mac
);
int
HAL_Get_mac
(
char
*
mac
);
int
HAL_Get_SN
(
char
sn
[
SN_ADDR_LEN
]);
int
HAL_Get_SN
(
char
sn
[
SN_ADDR_LEN
]);
int
HAL_Execel_cmd
(
char
*
cmd
,
char
*
buf
,
int
buf_len
,
int
*
ret_len
);
int
HAL_SetProduct_Type
(
_IN_
char
*
product_type
);
int
HAL_SetProduct_Code
(
_IN_
char
*
product_code
);
int
HAL_GetProduct_Code
(
_OU_
char
*
product_code
);
#endif
#endif
common/hal/kk_product.h
View file @
90005f06
...
@@ -37,17 +37,13 @@
...
@@ -37,17 +37,13 @@
#define KK_CCU_RANDOM "0000000000"
#define KK_CCU_RANDOM "0000000000"
#define KK_CCU_NAME "NEW_CCU"
#define KK_CCU_NAME "NEW_CCU"
#define KK_DEVICE_MAP_FILE_PATH "/usr/kk/map/device_%s.json"
#define KK_DEVICE_MAP_FILE_PATH "/usr/kk/map/device_%s.json"
#define GET_CCUID_CMD "/usr/sbin/fw_printenv uuid -n"
enum
{
enum
{
DEVICE_OFFLINE
=
0
,
DEVICE_OFFLINE
=
0
,
DEVICE_ONLINE
,
DEVICE_ONLINE
,
DEVICE_UNKNOW
,
DEVICE_UNKNOW
,
};
};
int
HAL_SetProduct_Type
(
_IN_
char
*
product_type
);
int
HAL_SetProduct_Code
(
_IN_
char
*
product_code
);
int
HAL_SetDevice_Code
(
_IN_
char
*
device_code
);
int
HAL_GetProduct_Code
(
_OU_
char
*
product_code
);
int
HAL_GetDevice_Code
(
_OU_
char
*
device_code
);
...
...
midware/midware/dm/kk_dm_mng.c
View file @
90005f06
...
@@ -83,7 +83,7 @@ static int _dm_mgr_search_dev_by_pkdn(_IN_ char deviceCode[DEVICE_CODE_MAXLEN],
...
@@ -83,7 +83,7 @@ static int _dm_mgr_search_dev_by_pkdn(_IN_ char deviceCode[DEVICE_CODE_MAXLEN],
}
}
}
}
ERROR_PRINT
(
"Device Not Found, Device Code: %s"
,
deviceCode
);
ERROR_PRINT
(
"Device Not Found, Device Code: %s
\n
"
,
deviceCode
);
return
FAIL_RETURN
;
return
FAIL_RETURN
;
}
}
static
int
_dm_mgr_next_devid
(
void
)
static
int
_dm_mgr_next_devid
(
void
)
...
@@ -92,7 +92,7 @@ static int _dm_mgr_next_devid(void)
...
@@ -92,7 +92,7 @@ static int _dm_mgr_next_devid(void)
return
ctx
->
global_devid
++
;
return
ctx
->
global_devid
++
;
}
}
static
int
_dm_init_tsl_params
(
kk_tsl_t
*
dev_shadow
)
static
int
_dm_init_tsl_params
(
kk_tsl_t
*
dev_shadow
,
char
*
deviceCode
)
{
{
int
res
=
0
;
int
res
=
0
;
char
version
[
VERSION_MAXLEN
]
=
{
0
};
char
version
[
VERSION_MAXLEN
]
=
{
0
};
...
@@ -150,6 +150,21 @@ static int _dm_init_tsl_params(kk_tsl_t * dev_shadow)
...
@@ -150,6 +150,21 @@ static int _dm_init_tsl_params(kk_tsl_t * dev_shadow)
{
{
ERROR_PRINT
(
"[%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
ERROR_PRINT
(
"[%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
}
}
char
currentValue
[
16
]
=
{
0
};
kk_property_db_get_value
(
deviceCode
,
KK_TSL_CCU_ARMINGSTATE_IDENTIFIER
,
currentValue
);
if
(
strlen
(
currentValue
)
==
0
){
res
=
kk_tsl_set_value
(
kk_tsl_set_property_value
,
dev_shadow
,
KK_TSL_CCU_ARMINGSTATE_IDENTIFIER
,
NULL
,
"1"
);
//默认撤防设置
if
(
res
!=
SUCCESS_RETURN
)
{
ERROR_PRINT
(
"[%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
}
}
else
{
res
=
kk_tsl_set_value
(
kk_tsl_set_property_value
,
dev_shadow
,
KK_TSL_CCU_ARMINGSTATE_IDENTIFIER
,
NULL
,
currentValue
);
//默认撤防设置
if
(
res
!=
SUCCESS_RETURN
)
{
ERROR_PRINT
(
"[%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
}
}
return
res
;
return
res
;
}
}
...
@@ -282,7 +297,7 @@ int dm_mgr_device_create(_IN_ int dev_type,_IN_ char productCode[PRODUCT_CODE_MA
...
@@ -282,7 +297,7 @@ int dm_mgr_device_create(_IN_ int dev_type,_IN_ char productCode[PRODUCT_CODE_MA
list_add_tail
(
&
node
->
linked_list
,
&
ctx
->
dev_list
);
list_add_tail
(
&
node
->
linked_list
,
&
ctx
->
dev_list
);
if
(
dev_type
==
KK_DM_DEVICE_CCU
){
if
(
dev_type
==
KK_DM_DEVICE_CCU
){
_dm_init_tsl_params
(
node
->
dev_shadow
);
_dm_init_tsl_params
(
node
->
dev_shadow
,
node
->
deviceCode
);
}
}
if
(
devid
)
{
if
(
devid
)
{
...
@@ -515,7 +530,9 @@ int dm_mgr_init(void)
...
@@ -515,7 +530,9 @@ int dm_mgr_init(void)
{
{
int
res
=
0
;
int
res
=
0
;
dm_mgr_ctx
*
ctx
=
_dm_mgr_get_ctx
();
dm_mgr_ctx
*
ctx
=
_dm_mgr_get_ctx
();
char
mac
[
DEVICE_MAC_MAXLEN
]
=
{
0
};
char
mac
[
DEVICE_MAC_MAXLEN
]
=
{
0
};
char
ccuid
[
32
]
=
{
0
};
int
devId
=
0
,
heartbeat
=
0
;
int
devId
=
0
,
heartbeat
=
0
;
memset
(
ctx
,
0
,
sizeof
(
dm_mgr_ctx
));
memset
(
ctx
,
0
,
sizeof
(
dm_mgr_ctx
));
...
@@ -527,19 +544,19 @@ int dm_mgr_init(void)
...
@@ -527,19 +544,19 @@ int dm_mgr_init(void)
/* Init Device Id*/
/* Init Device Id*/
ctx
->
global_devid
=
1
;
ctx
->
global_devid
=
1
;
kk_property_db_init
();
kk_property_db_init
();
HAL_Get_ccuid
(
ccuid
);
/* Init Device List */
/* Init Device List */
INIT_LIST_HEAD
(
&
ctx
->
dev_list
);
INIT_LIST_HEAD
(
&
ctx
->
dev_list
);
HAL_Get_mac
(
mac
);
HAL_Get_mac
(
mac
);
kk_sync_init
();
kk_sync_init
();
//kk_sync_get_info();
//kk_sync_get_info();
res
=
dm_mgr_device_create
(
KK_DM_DEVICE_CCU
,
KK_DM_CCU_DEVICE_PRODUCT_CODE
,
KK_CCU_ID
,
mac
,
""
,
KK_DEV_UNKNOW
,
&
devId
,
&
heartbeat
);
res
=
dm_mgr_device_create
(
KK_DM_DEVICE_CCU
,
KK_DM_CCU_DEVICE_PRODUCT_CODE
,
ccuid
,
mac
,
""
,
KK_DEV_UNKNOW
,
&
devId
,
&
heartbeat
);
if
(
res
!=
SUCCESS_RETURN
)
{
if
(
res
!=
SUCCESS_RETURN
)
{
goto
ERROR
;
goto
ERROR
;
}
}
else
{
else
{
kk_property_db_update
(
KK_CCU_ID
);
kk_property_db_update
(
ccuid
);
}
}
...
@@ -1090,7 +1107,7 @@ int dm_mgr_upstream_thing_topo_get(void)
...
@@ -1090,7 +1107,7 @@ int dm_mgr_upstream_thing_topo_get(void)
memset
(
&
request
,
0
,
sizeof
(
dm_msg_request_t
));
memset
(
&
request
,
0
,
sizeof
(
dm_msg_request_t
));
request
.
msgTypeStr
=
(
char
*
)
DM_URI_THING_TOPO_GET
;
request
.
msgTypeStr
=
(
char
*
)
DM_URI_THING_TOPO_GET
;
HAL_Get
Device_Code
(
request
.
deviceCode
);
HAL_Get
_ccuid
(
request
.
deviceCode
);
res
=
_dm_mgr_search_dev_by_pkdn
(
request
.
deviceCode
,
&
node
);
res
=
_dm_mgr_search_dev_by_pkdn
(
request
.
deviceCode
,
&
node
);
...
...
midware/midware/dm/kk_dm_mng.h
View file @
90005f06
...
@@ -41,6 +41,23 @@ typedef struct {
...
@@ -41,6 +41,23 @@ typedef struct {
struct
list_head
dev_list
;
struct
list_head
dev_list
;
}
dm_mgr_ctx
;
}
dm_mgr_ctx
;
typedef
struct
kk_dm_property_handle
{
char
property
[
DEVICE_PROPERTY_NAME_MAX
];
union
{
char
*
valueStr
;
double
value
;
};
int
type
;
}
kk_dm_property_handle_t
;
typedef
struct
kk_dm_property_e
{
kk_dm_property_handle_t
info
[
DEVICE_PROPERTY_NUM_MAX
];
int
num
;
}
kk_dm_property_e_t
;
typedef
struct
{
typedef
struct
{
char
msgid
[
MSG_MAX_LEN
];
char
msgid
[
MSG_MAX_LEN
];
int
devid
;
int
devid
;
...
...
midware/midware/dm/kk_dm_msg.c
View file @
90005f06
...
@@ -911,16 +911,40 @@ int dm_msg_ccu_property_post(dm_mgr_dev_node_t *node)
...
@@ -911,16 +911,40 @@ int dm_msg_ccu_property_post(dm_mgr_dev_node_t *node)
}
}
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
static
void
kk_split
(
char
*
src
,
const
char
*
separator
,
char
**
dest
,
int
*
num
)
{
char
*
pNext
;
int
count
=
0
;
if
(
src
==
NULL
||
strlen
(
src
)
==
0
)
return
;
if
(
separator
==
NULL
||
strlen
(
separator
)
==
0
)
return
;
pNext
=
strtok
(
src
,
separator
);
while
(
pNext
!=
NULL
)
{
*
dest
++
=
pNext
;
++
count
;
pNext
=
strtok
(
NULL
,
separator
);
}
*
num
=
count
;
}
int
dm_msg_thing_property_post_by_identify
(
char
*
deviceCode
,
cJSON
*
params
)
int
dm_msg_thing_property_post_by_identify
(
char
*
deviceCode
,
cJSON
*
params
)
{
{
int
res
=
0
;
int
res
=
0
;
int
nums
=
0
;
int
nums
=
0
;
int
idx
=
0
;
int
idx
=
0
;
int
i
=
0
;
dm_mgr_dev_node_t
*
node
=
NULL
;
dm_mgr_dev_node_t
*
node
=
NULL
;
kk_tsl_data_t
*
property
=
NULL
;
kk_tsl_data_t
*
property
=
NULL
;
cJSON
*
propertyItem
=
NULL
;
cJSON
*
propertyItem
=
NULL
;
char
tmpValue
[
20
]
=
{
0
};
char
tmpValue
[
20
]
=
{
0
};
kk_dm_property_e_t
propertyInfoBuf
[
DEVICE_PROPERTY_NUM_MAX
];
char
propertiesTmp
[
DEVICE_PROPERTY_NAME_MAX
]
=
{
0
};
char
pFinal
[
DEVICE_PROPERTY_NAME_MAX
]
=
{
0
};
int
num
=
0
;
int
countPro
=
0
;
int
epNumInt
=
1
;
int
maxEpNum
=
1
;
if
(
params
==
NULL
||
deviceCode
==
NULL
){
if
(
params
==
NULL
||
deviceCode
==
NULL
){
return
INVALID_PARAMETER
;
return
INVALID_PARAMETER
;
}
}
...
@@ -930,13 +954,37 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
...
@@ -930,13 +954,37 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
return
FAIL_RETURN
;
return
FAIL_RETURN
;
}
}
//printf("dm_msg_thing_property_post_by_identify:%s\n",params->valuestring);
//printf("dm_msg_thing_property_post_by_identify:%s\n",params->valuestring);
memset
(
propertyInfoBuf
,
0x0
,
sizeof
(
kk_dm_property_e_t
)
*
16
);
nums
=
node
->
dev_shadow
->
property_number
;
nums
=
node
->
dev_shadow
->
property_number
;
for
(
idx
=
0
;
idx
<
nums
;
idx
++
){
for
(
idx
=
0
;
idx
<
nums
;
idx
++
){
property
=
(
kk_tsl_data_t
*
)(
node
->
dev_shadow
->
properties
+
idx
);
property
=
(
kk_tsl_data_t
*
)(
node
->
dev_shadow
->
properties
+
idx
);
if
(
property
==
NULL
){
if
(
property
==
NULL
){
continue
;
continue
;
}
}
memset
(
propertiesTmp
,
0x0
,
sizeof
(
propertiesTmp
));
memset
(
pFinal
,
0x0
,
sizeof
(
pFinal
));
memcpy
(
propertiesTmp
,
property
->
identifier
,
strlen
(
property
->
identifier
));
//printf("---------------------------------->propertiesTmp:%s\n",propertiesTmp);
if
(
strstr
(
propertiesTmp
,
"_"
)
!=
NULL
){
char
*
propertiesbuf
[
DEVICE_PROPERTY_NAME_MAX
]
=
{
0
};
kk_split
(
propertiesTmp
,
"_"
,
propertiesbuf
,
&
num
);
if
(
num
==
2
){
epNumInt
=
atoi
(
propertiesbuf
[
1
]);
}
if
(
epNumInt
<
1
||
epNumInt
>=
16
){
epNumInt
=
1
;
}
memcpy
(
pFinal
,
propertiesbuf
[
0
],
strlen
(
propertiesbuf
[
0
]));
//printf("---------------------------------------->pFinal:%s,num:%d\n",pFinal,epNumInt);
}
else
{
//printf("---------------------------------->property->identifier:%s\n",property->identifier);
memcpy
(
pFinal
,
property
->
identifier
,
strlen
(
property
->
identifier
));
//memset(propertiesbuf[0],0x0,sizeof(propertiesbuf[0]));
//memcpy(propertiesbuf[0],property->identifier,strlen(property->identifier));
//printf("propertiesbuf[0]:%s,num:%d\n",propertiesbuf[0],num);
epNumInt
=
1
;
}
propertyItem
=
cJSON_GetObjectItem
(
params
,
property
->
identifier
);
propertyItem
=
cJSON_GetObjectItem
(
params
,
property
->
identifier
);
if
(
propertyItem
!=
NULL
){
if
(
propertyItem
!=
NULL
){
...
@@ -946,19 +994,43 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
...
@@ -946,19 +994,43 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_BOOL
){
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_BOOL
){
sprintf
(
tmpValue
,
"%d"
,
property
->
data_value
.
value_int
);
sprintf
(
tmpValue
,
"%d"
,
property
->
data_value
.
value_int
);
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
tmpValue
);
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
tmpValue
);
propertyInfoBuf
[
epNumInt
-
1
].
num
++
;
countPro
=
propertyInfoBuf
[
epNumInt
-
1
].
num
;
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
type
=
property
->
data_value
.
type
;
memset
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
0x0
,
sizeof
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
));
memcpy
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
pFinal
,
strlen
(
pFinal
));
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
value
=
property
->
data_value
.
value_int
;
}
}
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_FLOAT
){
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_FLOAT
){
sprintf
(
tmpValue
,
"%f"
,
property
->
data_value
.
value_float
);
sprintf
(
tmpValue
,
"%f"
,
property
->
data_value
.
value_float
);
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
tmpValue
);
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
tmpValue
);
propertyInfoBuf
[
epNumInt
-
1
].
num
++
;
countPro
=
propertyInfoBuf
[
epNumInt
-
1
].
num
;
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
type
=
property
->
data_value
.
type
;
memset
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
0x0
,
sizeof
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
));
memcpy
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
pFinal
,
strlen
(
pFinal
));
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
value
=
property
->
data_value
.
value_float
;
}
}
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DOUBLE
){
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DOUBLE
){
sprintf
(
tmpValue
,
"%f"
,
property
->
data_value
.
value_double
);
sprintf
(
tmpValue
,
"%f"
,
property
->
data_value
.
value_double
);
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
tmpValue
);
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
tmpValue
);
propertyInfoBuf
[
epNumInt
-
1
].
num
++
;
countPro
=
propertyInfoBuf
[
epNumInt
-
1
].
num
;
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
type
=
property
->
data_value
.
type
;
memset
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
0x0
,
sizeof
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
));
memcpy
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
pFinal
,
strlen
(
pFinal
));
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
value
=
property
->
data_value
.
value_double
;
}
}
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_TEXT
||
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_TEXT
||
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DATE
){
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DATE
){
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
property
->
data_value
.
value
);
kk_property_db_update_value
(
deviceCode
,
property
->
identifier
,
property
->
data_value
.
value
);
propertyInfoBuf
[
epNumInt
-
1
].
num
++
;
countPro
=
propertyInfoBuf
[
epNumInt
-
1
].
num
;
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
type
=
property
->
data_value
.
type
;
memset
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
0x0
,
sizeof
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
));
memcpy
(
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
property
,
pFinal
,
strlen
(
pFinal
));
propertyInfoBuf
[
epNumInt
-
1
].
info
[
countPro
-
1
].
valueStr
=
property
->
data_value
.
value
;
}
}
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_STRUCT
){
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_STRUCT
){
kk_tsl_data_value_complex_t
*
complex_struct
=
NULL
;
kk_tsl_data_value_complex_t
*
complex_struct
=
NULL
;
...
@@ -991,6 +1063,7 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
...
@@ -991,6 +1063,7 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
current_data
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DATE
){
current_data
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DATE
){
kk_property_db_update_value
(
deviceCode
,
tmp_identifiers
,
current_data
->
data_value
.
value
);
kk_property_db_update_value
(
deviceCode
,
tmp_identifiers
,
current_data
->
data_value
.
value
);
}
}
#if 0
else if(current_data->data_value.type == KK_TSL_DATA_TYPE_STRUCT){
else if(current_data->data_value.type == KK_TSL_DATA_TYPE_STRUCT){
kk_tsl_data_value_complex_t *complex_struct_1 = NULL;
kk_tsl_data_value_complex_t *complex_struct_1 = NULL;
complex_struct_1 = current_data->data_value.value;
complex_struct_1 = current_data->data_value.value;
...
@@ -1029,6 +1102,7 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
...
@@ -1029,6 +1102,7 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
}
}
}
}
#endif
else
{
else
{
ERROR_PRINT
(
"Unsupport Type
\n
"
);
ERROR_PRINT
(
"Unsupport Type
\n
"
);
}
}
...
@@ -1039,11 +1113,33 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
...
@@ -1039,11 +1113,33 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
else
{
else
{
ERROR_PRINT
(
"Unkonwn Number Type"
);
ERROR_PRINT
(
"Unkonwn Number Type"
);
}
}
//cJSON_DeleteItemFromObject(params,property->identifier);
}
}
}
}
char
*
outstr
=
cJSON_Print
(
params
);
int
epIdx
[
4
]
=
{
0
};
dm_mgr_upstream_thing_property_post
(
node
->
devid
,
outstr
,
strlen
(
outstr
),
0
);
for
(
idx
=
0
;
idx
<
epNumInt
;
idx
++
){
free
(
outstr
);
countPro
=
propertyInfoBuf
[
idx
].
num
;
memset
(
epIdx
,
0x0
,
sizeof
(
epIdx
));
sprintf
(
epIdx
,
"%d"
,
idx
+
1
);
cJSON
*
rootData
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
rootData
,
"epNum"
,
epIdx
);
for
(
i
=
0
;
i
<
countPro
;
i
++
){
int
vtype
=
propertyInfoBuf
[
idx
].
info
[
i
].
type
;
if
(
vtype
==
KK_TSL_DATA_TYPE_INT
||
vtype
==
KK_TSL_DATA_TYPE_ENUM
\
||
vtype
==
KK_TSL_DATA_TYPE_BOOL
||
vtype
==
KK_TSL_DATA_TYPE_FLOAT
\
||
vtype
==
KK_TSL_DATA_TYPE_DOUBLE
)
{
cJSON_AddNumberToObject
(
rootData
,
propertyInfoBuf
[
idx
].
info
[
i
].
property
,
propertyInfoBuf
[
idx
].
info
[
i
].
value
);
}
else
if
(
vtype
==
KK_TSL_DATA_TYPE_TEXT
||
vtype
==
KK_TSL_DATA_TYPE_DATE
){
cJSON_AddStringToObject
(
rootData
,
propertyInfoBuf
[
idx
].
info
[
i
].
property
,
propertyInfoBuf
[
idx
].
info
[
i
].
valueStr
);
}
}
char
*
outstr
=
cJSON_Print
(
rootData
);
dm_mgr_upstream_thing_property_post
(
node
->
devid
,
outstr
,
strlen
(
outstr
),
0
);
free
(
outstr
);
cJSON_Delete
(
rootData
);
}
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
...
...
midware/midware/dm/kk_linkkit.c
View file @
90005f06
...
@@ -930,9 +930,25 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -930,9 +930,25 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
_iotx_linkkit_upstream_mutex_unlock
();
_iotx_linkkit_upstream_mutex_unlock
();
}
else
if
(
strstr
(
typeJson
->
valuestring
,
KK_THING_SERVICE_PROPERTY_SET
)){
}
else
if
(
strstr
(
typeJson
->
valuestring
,
KK_THING_SERVICE_PROPERTY_SET
)){
INFO_PRINT
(
"property set
\n
"
);
INFO_PRINT
(
"property set
\n
"
);
dm_msg_thing_property_set_reply
(
deviceCode
->
valuestring
,
payload_Str
,
strlen
(
payload_Str
),
NULL
);
char
ccuid
[
32
]
=
{
0
};
dm_mgr_dev_node_t
*
node
=
NULL
;
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
cJSON
*
state
=
cJSON_GetObjectItem
(
paramStr
,
KK_TSL_CCU_ARMINGSTATE_IDENTIFIER
);
if
(
state
!=
NULL
){
dm_mgr_search_dev_by_devid
(
KK_DM_DEVICE_CCU_DEVICEID
,
&
node
);
res
=
kk_tsl_set_value
(
kk_tsl_set_property_value
,
node
->
dev_shadow
,
KK_TSL_CCU_ARMINGSTATE_IDENTIFIER
,
NULL
,
state
->
valuestring
);
if
(
res
!=
SUCCESS_RETURN
)
{
ERROR_PRINT
(
"[%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
}
HAL_Get_ccuid
(
ccuid
);
kk_property_db_update
(
ccuid
);
//dm_msg_thing_property_set_reply(deviceCode->valuestring,payload_Str, strlen(payload_Str), NULL);
dm_msg_ccu_property_post
(
node
);
}
}
else
if
(
strstr
(
typeJson
->
valuestring
,
KK_THING_CLOUDSTATE_MSG
)){
}
else
if
(
strstr
(
typeJson
->
valuestring
,
KK_THING_CLOUDSTATE_MSG
)){
INFO_PRINT
(
"cloud state notify
\n
"
);
INFO_PRINT
(
"cloud state notify
\n
"
);
char
ccuid
[
32
]
=
{
0
};
s_CloudStatusRecv
=
1
;
s_CloudStatusRecv
=
1
;
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
cJSON
*
state
=
cJSON_GetObjectItem
(
paramStr
,
MSG_IOTClOUDSTATE_STR
);
cJSON
*
state
=
cJSON_GetObjectItem
(
paramStr
,
MSG_IOTClOUDSTATE_STR
);
...
@@ -951,8 +967,8 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
...
@@ -951,8 +967,8 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
{
{
ERROR_PRINT
(
"[%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
ERROR_PRINT
(
"[%s][%d] res:%d
\n
"
,
__FUNCTION__
,
__LINE__
,
res
);
}
}
HAL_Get_ccuid
(
ccuid
);
kk_property_db_update
(
KK_CCU_ID
);
kk_property_db_update
(
ccuid
);
if
(
s_CloudStatus
){
if
(
s_CloudStatus
){
node
->
isOffline
=
KK_DEV_ONLINE
;
node
->
isOffline
=
KK_DEV_ONLINE
;
...
...
midware/midware/dm/kk_property_db.c
View file @
90005f06
...
@@ -189,7 +189,12 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
...
@@ -189,7 +189,12 @@ int kk_property_db_insert(const char *deviceCode,const char *identifier,kk_tsl_d
return
SUCCESS_RETURN
;
return
SUCCESS_RETURN
;
}
}
_kk_property_db_lock
();
_kk_property_db_lock
();
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
""
,
valuetype
,
devtype
);
//传感器类默认安防等级为离家安防
if
(
strcmp
(
identifier
,
"SensorType"
)
==
0
&&
devtype
==
KK_DM_DEVICE_SUBDEV
){
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
"1"
,
valuetype
,
devtype
);
}
else
{
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
""
,
valuetype
,
devtype
);
}
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
if
(
rc
!=
SQLITE_OK
){
...
...
midware/midware/history/kk_history_db.c
View file @
90005f06
...
@@ -113,12 +113,12 @@ int kk_history_db_init(void)
...
@@ -113,12 +113,12 @@ int kk_history_db_init(void)
/************************************************************
/************************************************************
*功能描述:删除历史数据
*功能描述:删除历史数据
*输入参数:time:记录时间
*输入参数:
i
time:记录时间
*输出参数:无
*输出参数:无
*返 回 值:0:成功;其他:失败
*返 回 值:0:成功;其他:失败
*其他说明:
*其他说明:
*************************************************************/
*************************************************************/
int
kk_history_delete_by_recordtime
(
const
char
*
table
,
time_t
time
)
int
kk_history_delete_by_recordtime
(
const
char
*
table
,
time_t
i
time
)
{
{
const
char
*
deleteCmd
=
"delete from '%s' where recordtime = '%d';"
;
const
char
*
deleteCmd
=
"delete from '%s' where recordtime = '%d';"
;
char
*
sqlCmd
=
NULL
;
char
*
sqlCmd
=
NULL
;
...
@@ -126,7 +126,7 @@ int kk_history_delete_by_recordtime(const char *table,time_t time)
...
@@ -126,7 +126,7 @@ int kk_history_delete_by_recordtime(const char *table,time_t time)
char
*
zErrMsg
=
0
;
char
*
zErrMsg
=
0
;
kk_history_ctx_t
*
ctx
=
_kk_history_get_ctx
();
kk_history_ctx_t
*
ctx
=
_kk_history_get_ctx
();
sqlCmd
=
sqlite3_mprintf
(
deleteCmd
,
table
,
time
);
sqlCmd
=
sqlite3_mprintf
(
deleteCmd
,
table
,
i
time
);
INFO_PRINT
(
"Table delete data sqlCmd:%s
\n
"
,
sqlCmd
);
INFO_PRINT
(
"Table delete data sqlCmd:%s
\n
"
,
sqlCmd
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
if
(
rc
!=
SQLITE_OK
){
...
@@ -179,7 +179,7 @@ err1:
...
@@ -179,7 +179,7 @@ err1:
*返 回 值: 0:成功;其他:失败
*返 回 值: 0:成功;其他:失败
*其他说明:
*其他说明:
*************************************************************/
*************************************************************/
int
kk_history_insert_sensor_info
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
valueStr
,
time_t
time
)
int
kk_history_insert_sensor_info
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
valueStr
,
time_t
i
time
)
{
{
int
res
=
0
;
int
res
=
0
;
kk_history_ctx_t
*
ctx
=
_kk_history_get_ctx
();
kk_history_ctx_t
*
ctx
=
_kk_history_get_ctx
();
...
@@ -194,7 +194,7 @@ int kk_history_insert_sensor_info(const char* deviceCode,const char* identifier,
...
@@ -194,7 +194,7 @@ int kk_history_insert_sensor_info(const char* deviceCode,const char* identifier,
INFO_PRINT
(
"kk_history_insert_sensor_info,deviceCode:%s,identifier:%s,value:%s
\n
"
,
deviceCode
,
identifier
,
valueStr
);
INFO_PRINT
(
"kk_history_insert_sensor_info,deviceCode:%s,identifier:%s,value:%s
\n
"
,
deviceCode
,
identifier
,
valueStr
);
_kk_history_lock
();
_kk_history_lock
();
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
valueStr
,
time
);
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
valueStr
,
i
time
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
res
!=
SQLITE_OK
){
if
(
res
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
...
@@ -235,7 +235,7 @@ int kk_history_insert_sensor_info(const char* deviceCode,const char* identifier,
...
@@ -235,7 +235,7 @@ int kk_history_insert_sensor_info(const char* deviceCode,const char* identifier,
*返 回 值: 0:成功;其他:失败
*返 回 值: 0:成功;其他:失败
*其他说明:
*其他说明:
*************************************************************/
*************************************************************/
int
kk_history_insert_Outlet_info
(
const
char
*
deviceCode
,
const
char
*
power
,
const
char
*
metering
,
time_t
time
)
int
kk_history_insert_Outlet_info
(
const
char
*
deviceCode
,
const
char
*
power
,
const
char
*
metering
,
time_t
i
time
)
{
{
int
res
=
0
;
int
res
=
0
;
kk_history_ctx_t
*
ctx
=
_kk_history_get_ctx
();
kk_history_ctx_t
*
ctx
=
_kk_history_get_ctx
();
...
@@ -250,7 +250,7 @@ int kk_history_insert_Outlet_info(const char* deviceCode,const char* power,const
...
@@ -250,7 +250,7 @@ int kk_history_insert_Outlet_info(const char* deviceCode,const char* power,const
INFO_PRINT
(
"kk_history_insert_Outlet_info,deviceCode:%s,power:%s,metering:%s
\n
"
,
deviceCode
,
power
,
metering
);
INFO_PRINT
(
"kk_history_insert_Outlet_info,deviceCode:%s,power:%s,metering:%s
\n
"
,
deviceCode
,
power
,
metering
);
_kk_history_lock
();
_kk_history_lock
();
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
power
,
metering
,
time
);
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
power
,
metering
,
i
time
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
res
!=
SQLITE_OK
){
if
(
res
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
...
...
midware/midware/history/kk_history_db.h
View file @
90005f06
...
@@ -15,8 +15,8 @@ enum{
...
@@ -15,8 +15,8 @@ enum{
DB_OUTLET_RECORDTIME
,
DB_OUTLET_RECORDTIME
,
};
};
int
kk_history_db_init
(
void
);
int
kk_history_db_init
(
void
);
int
kk_history_delete_by_recordtime
(
const
char
*
table
,
time_t
time
);
int
kk_history_delete_by_recordtime
(
const
char
*
table
,
time_t
i
time
);
int
kk_history_insert_sensor_info
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
valueStr
,
time_t
time
);
int
kk_history_insert_sensor_info
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
valueStr
,
time_t
i
time
);
int
kk_history_insert_Outlet_info
(
const
char
*
deviceCode
,
const
char
*
power
,
const
char
*
metering
,
time_t
time
);
int
kk_history_insert_Outlet_info
(
const
char
*
deviceCode
,
const
char
*
power
,
const
char
*
metering
,
time_t
i
time
);
#endif
#endif
midware/midware/midware.c
View file @
90005f06
This diff is collapsed.
Click to expand it.
midware/midware/scene/kk_scene_handle.c
View file @
90005f06
...
@@ -627,7 +627,7 @@ int kk_scene_parse_scene_trigger(const cJSON* str,const char *sceneId)
...
@@ -627,7 +627,7 @@ int kk_scene_parse_scene_trigger(const cJSON* str,const char *sceneId)
cJSON
*
items
,
*
item
;
cJSON
*
items
,
*
item
;
cJSON
*
type
;
cJSON
*
type
;
cJSON
*
week
;
cJSON
*
week
;
cJSON
*
time
;
cJSON
*
time
str
;
int
res
=
0
;
int
res
=
0
;
int
weekflag
=
0
;
int
weekflag
=
0
;
if
(
str
==
NULL
||
sceneId
==
NULL
){
if
(
str
==
NULL
||
sceneId
==
NULL
){
...
@@ -653,10 +653,10 @@ int kk_scene_parse_scene_trigger(const cJSON* str,const char *sceneId)
...
@@ -653,10 +653,10 @@ int kk_scene_parse_scene_trigger(const cJSON* str,const char *sceneId)
week
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_WEEK
);
week
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_WEEK
);
if
(
week
==
NULL
)
return
FAIL_RETURN
;
if
(
week
==
NULL
)
return
FAIL_RETURN
;
weekflag
=
kk_scene_parse_repeatday
(
week
);
weekflag
=
kk_scene_parse_repeatday
(
week
);
time
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_TIME
);
time
str
=
cJSON_GetObjectItem
(
item
,
MSG_SCENE_TIME
);
if
(
time
==
NULL
)
return
FAIL_RETURN
;
if
(
time
str
==
NULL
)
return
FAIL_RETURN
;
time_t
current
=
HAL_GetTime
();
time_t
current
=
HAL_GetTime
();
time_t
newStart
=
kk_scene_creat_timer_starttime
(
weekflag
,
atoi
(
time
->
valuestring
),
current
);
time_t
newStart
=
kk_scene_creat_timer_starttime
(
weekflag
,
atoi
(
time
str
->
valuestring
),
current
);
kk_scene_insert_scene_timer
(
newStart
,
weekflag
,
sceneId
);
kk_scene_insert_scene_timer
(
newStart
,
weekflag
,
sceneId
);
kk_scene_push_timer_info
(
newStart
,
weekflag
,(
char
*
)
sceneId
);
kk_scene_push_timer_info
(
newStart
,
weekflag
,(
char
*
)
sceneId
);
}
}
...
...
midware/tsl/tsl_handle/kk_tsl_common.h
View file @
90005f06
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#define DM_UTILS_UINT64_STRLEN (20)
#define DM_UTILS_UINT64_STRLEN (20)
#define DEVICE_PROPERTY_NAME_MAX (64+1)
#define DEVICE_PROPERTY_NAME_MAX (64+1)
#define DEVICE_PROPERTY_VALUE_MAX (64+1)
#define DEVICE_PROPERTY_VALUE_MAX (64+1)
#define DEVICE_PROPERTY_NUM_MAX (16)
#define KK_TSL_KEY_SCHEMA "schema"
#define KK_TSL_KEY_SCHEMA "schema"
#define KK_TSL_KEY_LINK "link"
#define KK_TSL_KEY_LINK "link"
...
@@ -77,6 +77,7 @@
...
@@ -77,6 +77,7 @@
#define KK_TSL_CCU_WANIP_IDENTIFIER "WanIPAddress"
#define KK_TSL_CCU_WANIP_IDENTIFIER "WanIPAddress"
#define KK_TSL_CCU_WANSTATE_IDENTIFIER "WanState"
#define KK_TSL_CCU_WANSTATE_IDENTIFIER "WanState"
#define KK_TSL_CCU_IOTCLOUD_IDENTIFIER "IOTCloudState"
#define KK_TSL_CCU_IOTCLOUD_IDENTIFIER "IOTCloudState"
#define KK_TSL_CCU_ARMINGSTATE_IDENTIFIER "ArmingState"
#define KK_TSL_GATAWAY_VERSION_IDENTIFIER "Version"
#define KK_TSL_GATAWAY_VERSION_IDENTIFIER "Version"
#define KK_TSL_GATAWAY_IP_IDENTIFIER "IPAddress"
#define KK_TSL_GATAWAY_IP_IDENTIFIER "IPAddress"
...
...
tsl/ccu_12.json
View file @
90005f06
...
@@ -95,15 +95,12 @@
...
@@ -95,15 +95,12 @@
},
},
{
{
"identifier"
:
"ArmingState"
,
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"dataType"
:
{
"specs"
:
{
"specs"
:
{
"0"
:
"离家布防"
,
"length"
:
"255"
"1"
:
"撤防"
,
},
"2"
:
"在家布防"
,
"type"
:
"text"
"3"
:
"区域布防"
},
},
"type"
:
"bool"
},
"name"
:
"安防状态"
,
"name"
:
"安防状态"
,
"accessMode"
:
"rw"
,
"accessMode"
:
"rw"
,
"required"
:
false
"required"
:
false
...
@@ -118,12 +115,9 @@
...
@@ -118,12 +115,9 @@
"identifier"
:
"ArmingState"
,
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"dataType"
:
{
"specs"
:
{
"specs"
:
{
"0"
:
"离家布防"
,
"length"
:
"255"
"1"
:
"撤防"
,
"2"
:
"在家布防"
,
"3"
:
"区域布防"
},
},
"type"
:
"
bool
"
"type"
:
"
text
"
},
},
"name"
:
"安防状态"
"name"
:
"安防状态"
}
}
...
@@ -212,12 +206,9 @@
...
@@ -212,12 +206,9 @@
"identifier"
:
"ArmingState"
,
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"dataType"
:
{
"specs"
:
{
"specs"
:
{
"0"
:
"离家布防"
,
"length"
:
"255"
"1"
:
"撤防"
,
"2"
:
"在家布防"
,
"3"
:
"区域布防"
},
},
"type"
:
"
bool
"
"type"
:
"
text
"
},
},
"name"
:
"安防状态"
"name"
:
"安防状态"
}
}
...
@@ -488,6 +479,16 @@
...
@@ -488,6 +479,16 @@
"type"
:
"text"
"type"
:
"text"
},
},
"name"
:
"版本"
"name"
:
"版本"
},
{
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"specs"
:
{
"length"
:
"255"
},
"type"
:
"text"
},
"name"
:
"安防状态"
}
}
],
],
"identifier"
:
"property"
,
"identifier"
:
"property"
,
...
...
tsl/ccu_15.json
View file @
90005f06
...
@@ -95,15 +95,12 @@
...
@@ -95,15 +95,12 @@
},
},
{
{
"identifier"
:
"ArmingState"
,
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"dataType"
:
{
"specs"
:
{
"specs"
:
{
"0"
:
"离家布防"
,
"length"
:
"255"
"1"
:
"撤防"
,
},
"2"
:
"在家布防"
,
"type"
:
"text"
"3"
:
"区域布防"
},
},
"type"
:
"bool"
},
"name"
:
"安防状态"
,
"name"
:
"安防状态"
,
"accessMode"
:
"rw"
,
"accessMode"
:
"rw"
,
"required"
:
false
"required"
:
false
...
@@ -118,12 +115,9 @@
...
@@ -118,12 +115,9 @@
"identifier"
:
"ArmingState"
,
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"dataType"
:
{
"specs"
:
{
"specs"
:
{
"0"
:
"离家布防"
,
"length"
:
"255"
"1"
:
"撤防"
,
"2"
:
"在家布防"
,
"3"
:
"区域布防"
},
},
"type"
:
"
bool
"
"type"
:
"
text
"
},
},
"name"
:
"安防状态"
"name"
:
"安防状态"
}
}
...
@@ -212,12 +206,9 @@
...
@@ -212,12 +206,9 @@
"identifier"
:
"ArmingState"
,
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"dataType"
:
{
"specs"
:
{
"specs"
:
{
"0"
:
"离家布防"
,
"length"
:
"255"
"1"
:
"撤防"
,
"2"
:
"在家布防"
,
"3"
:
"区域布防"
},
},
"type"
:
"
bool
"
"type"
:
"
text
"
},
},
"name"
:
"安防状态"
"name"
:
"安防状态"
}
}
...
@@ -488,7 +479,17 @@
...
@@ -488,7 +479,17 @@
"type"
:
"text"
"type"
:
"text"
},
},
"name"
:
"版本"
"name"
:
"版本"
}
},
{
"identifier"
:
"ArmingState"
,
"dataType"
:
{
"specs"
:
{
"length"
:
"255"
},
"type"
:
"text"
},
"name"
:
"安防状态"
}
],
],
"identifier"
:
"property"
,
"identifier"
:
"property"
,
"method"
:
"thing.event.property.post"
,
"method"
:
"thing.event.property.post"
,
...
...
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