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
4b4226d7
Commit
4b4226d7
authored
Oct 28, 2021
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】调整房间和楼层相关功能
【提交人】陈伟灿
parent
ca07461a
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1192 additions
and
118 deletions
+1192
-118
midware/midware/area/kk_area_handle.c
midware/midware/area/kk_area_handle.c
+273
-9
midware/midware/area/kk_area_handle.h
midware/midware/area/kk_area_handle.h
+13
-0
midware/midware/dm/kk_dm_mng.c
midware/midware/dm/kk_dm_mng.c
+3
-0
midware/midware/dm/kk_dm_mng.h
midware/midware/dm/kk_dm_mng.h
+1
-0
midware/midware/dm/kk_dm_msg.h
midware/midware/dm/kk_dm_msg.h
+6
-4
midware/midware/dm/kk_linkkit.c
midware/midware/dm/kk_linkkit.c
+176
-18
midware/midware/dm/kk_property_db.c
midware/midware/dm/kk_property_db.c
+174
-0
midware/midware/dm/kk_property_db.h
midware/midware/dm/kk_property_db.h
+12
-0
midware/midware/midware.c
midware/midware/midware.c
+57
-8
nx5_soc_gw/kk_device_def.json
nx5_soc_gw/kk_device_def.json
+38
-0
nx5_soc_gw/smarthome_z3gw_nx5
nx5_soc_gw/smarthome_z3gw_nx5
+0
-0
tsl/product_3062.json
tsl/product_3062.json
+0
-78
tsl/product_3109.json
tsl/product_3109.json
+438
-0
tsl/version
tsl/version
+1
-1
No files found.
midware/midware/area/kk_area_handle.c
View file @
4b4226d7
...
...
@@ -10,7 +10,7 @@
extern
sqlite3
*
g_kk_pDb
;
static
kk_dev_list_t
*
s_device_list
=
NULL
;
static
kk_floor_list_t
*
s_floor_list
=
NULL
;
typedef
struct
{
void
*
mutex
;
int
roomNum
;
...
...
@@ -68,7 +68,19 @@ static int _kk_area_db_init(void)
_kk_area_unlock
();
return
FAIL_RETURN
;
}
const
char
*
pFloorTable
=
"CREATE TABLE IF NOT EXISTS floorInfo( \
idx INTEGER PRIMARY KEY, \
name varchar(256), \
floorId varchar(256))"
;
if
(
sqlite3_exec
(
ctx
->
pDb
,
pFloorTable
,
NULL
,
NULL
,
&
pcErr
)
!=
SQLITE_OK
)
{
ERROR_PRINT
(
"Error creating table (%s)
\n
"
,
pcErr
);
sqlite3_free
(
pcErr
);
//eUtils_LockUnlock(&sLock);
_kk_area_unlock
();
return
FAIL_RETURN
;
}
const
char
*
pAreaDevTable
=
"CREATE TABLE IF NOT EXISTS AreaDevInfo( \
idx INTEGER PRIMARY KEY, \
roomId varchar(256), \
...
...
@@ -99,11 +111,11 @@ int kk_area_init(void)
if
(
ctx
->
mutex
==
NULL
)
{
return
FAIL_RETURN
;
}
res
=
_kk_area_db_init
();
if
(
res
!=
SUCCESS_RETURN
){
ERROR_PRINT
(
"[%s][%d]kk_area_init FAIL!!!
\n
"
,
__FUNCTION__
,
__LINE__
);
}
kk_floor_add
(
"默认"
,
"1"
);
//创建默认楼层
return
SUCCESS_RETURN
;
}
static
int
kk_check_room_exist
(
const
char
*
roomId
)
...
...
@@ -140,12 +152,12 @@ static int _kk_room_add(const char *name,const char *roomId)
char
*
sqlCmd
=
NULL
;
char
*
zErrMsg
=
0
;
const
char
*
insertCmd
=
"insert into AreaInfo (name, roomId) \
values ('%s','%s');"
;
const
char
*
insertCmd
=
"insert into AreaInfo (name, roomId
,armingstate,floorId,floorName
) \
values ('%s','%s'
,'%d','%s','%s'
);"
;
_kk_area_lock
();
ctx
->
roomNum
++
;
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
name
,
roomId
);
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
name
,
roomId
,
-
1
,
"1"
,
"默认"
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
res
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
...
...
@@ -263,6 +275,53 @@ int kk_room_update_armingstate(int state,const char *roomid)
_kk_area_unlock
();
return
SUCCESS_RETURN
;
}
static
int
kk_check_floor_exist
(
const
char
*
floorId
)
{
int
isExist
=
0
;
sqlite3_stmt
*
stmt
;
char
*
pfloorId
=
NULL
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
const
char
*
searchCmd
=
"select * from floorInfo;"
;
_kk_area_lock
();
sqlite3_prepare_v2
(
ctx
->
pDb
,
searchCmd
,
strlen
(
searchCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
pfloorId
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_FLOOR_ID
);
if
(
!
strcmp
(
pfloorId
,
floorId
))
{
isExist
=
1
;
break
;
}
}
sqlite3_finalize
(
stmt
);
_kk_area_unlock
();
return
isExist
;
}
int
kk_floor_add
(
const
char
*
name
,
const
char
*
floorId
)
{
int
res
=
0
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
char
*
sqlCmd
=
NULL
;
char
*
zErrMsg
=
0
;
if
(
kk_check_floor_exist
(
floorId
)){
return
SUCCESS_RETURN
;
}
const
char
*
insertCmd
=
"insert into floorInfo (name, floorId) \
values ('%s','%s');"
;
_kk_area_lock
();
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
name
,
floorId
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
res
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
sqlite3_free
(
zErrMsg
);
}
else
{
//INFO_PRINT("sub device insert data successfully\n");
}
sqlite3_free
(
sqlCmd
);
_kk_area_unlock
();
return
SUCCESS_RETURN
;
}
int
kk_room_set_floor_info
(
const
char
*
floorId
,
const
char
*
floorName
,
const
char
*
roomid
)
{
char
*
sqlCmd
=
NULL
;
...
...
@@ -271,7 +330,28 @@ int kk_room_set_floor_info(const char*floorId,const char* floorName,const char *
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
_kk_area_lock
();
sqlCmd
=
sqlite3_mprintf
(
"UPDATE AreaInfo SET floorId=%s,floorName=%s WHERE roomId= '%s'"
,
floorId
,
floorName
,
roomid
);
printf
(
"----------------------floorId:%s,floorName:%s,roomid:%s
\n
"
,
floorId
,
floorName
,
roomid
);
sqlCmd
=
sqlite3_mprintf
(
"UPDATE AreaInfo SET floorId='%s',floorName='%s' WHERE roomId= '%s'"
,
floorId
,
floorName
,
roomid
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
sqlite3_free
(
zErrMsg
);
}
else
{
INFO_PRINT
(
"Table updata data successfully
\n
"
);
}
sqlite3_free
(
sqlCmd
);
_kk_area_unlock
();
return
SUCCESS_RETURN
;
}
int
kk_set_floor_to_default
(
const
char
*
floorId
)
{
char
*
sqlCmd
=
NULL
;
int
rc
=
0
;
char
*
zErrMsg
=
0
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
_kk_area_lock
();
sqlCmd
=
sqlite3_mprintf
(
"UPDATE AreaInfo SET floorId='%s',floorName='%s' WHERE floorId= '%s'"
,
"1"
,
"默认"
,
floorId
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
...
...
@@ -308,7 +388,52 @@ int kk_room_delete(const char *roomId)
_kk_area_unlock
();
return
SUCCESS_RETURN
;
}
int
kk_floor_delete_all
(
void
)
{
int
res
=
0
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
char
*
sqlCmd
=
NULL
;
char
*
zErrMsg
=
0
;
const
char
*
deleteCmd
=
"delete from floorInfo where floorId != '%s';"
;
_kk_area_lock
();
sqlCmd
=
sqlite3_mprintf
(
deleteCmd
,
"1"
);
INFO_PRINT
(
"Table delete data sqlCmd:%s
\n
"
,
sqlCmd
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
res
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
sqlite3_free
(
zErrMsg
);
}
else
{
//INFO_PRINT("Table delete data successfully\n");
}
sqlite3_free
(
sqlCmd
);
_kk_area_unlock
();
return
SUCCESS_RETURN
;
}
int
kk_floor_delete_by_id
(
char
*
floorId
)
{
int
res
=
0
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
char
*
sqlCmd
=
NULL
;
char
*
zErrMsg
=
0
;
const
char
*
deleteCmd
=
"delete from floorInfo where floorId = '%s';"
;
_kk_area_lock
();
sqlCmd
=
sqlite3_mprintf
(
deleteCmd
,
floorId
);
INFO_PRINT
(
"Table delete data sqlCmd:%s
\n
"
,
sqlCmd
);
res
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
res
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
sqlite3_free
(
zErrMsg
);
}
else
{
//INFO_PRINT("Table delete data successfully\n");
}
sqlite3_free
(
sqlCmd
);
_kk_area_unlock
();
return
SUCCESS_RETURN
;
}
static
int
_kk_check_dev_exist
(
const
char
*
deviceCode
,
const
char
*
epNum
)
{
int
isExist
=
0
;
...
...
@@ -571,7 +696,97 @@ int kk_room_device_list_add(const char *deviceCode)
return
SUCCESS_RETURN
;
}
static
int
kk_room_floor_list_add
(
char
*
floorId
,
char
*
floorName
)
{
//int len;
kk_floor_list_t
*
ptr
,
*
pre
;
ptr
=
pre
=
s_floor_list
;
if
(
floorId
==
NULL
||
floorName
==
NULL
){
return
FAIL_RETURN
;
}
while
(
ptr
!=
NULL
){
pre
=
ptr
;
if
(
strcmp
(
ptr
->
floorId
,
floorId
)
==
0
){
return
SUCCESS_RETURN
;
}
ptr
=
ptr
->
next
;
}
ptr
=
(
kk_floor_list_t
*
)
malloc
(
sizeof
(
kk_floor_list_t
));
memset
(
ptr
,
0
,
sizeof
(
kk_floor_list_t
));
ptr
->
floorId
=
(
char
*
)
malloc
(
strlen
(
floorId
)
+
1
);
memset
(
ptr
->
floorId
,
0x0
,
strlen
(
floorId
)
+
1
);
strncpy
(
ptr
->
floorId
,
floorId
,
strlen
(
floorId
));
ptr
->
floorName
=
(
char
*
)
malloc
(
strlen
(
floorName
)
+
1
);
memset
(
ptr
->
floorName
,
0x0
,
strlen
(
floorName
)
+
1
);
strncpy
(
ptr
->
floorName
,
floorName
,
strlen
(
floorName
));
if
(
s_floor_list
==
NULL
){
s_floor_list
=
ptr
;
}
else
{
pre
->
next
=
ptr
;
}
return
SUCCESS_RETURN
;
}
void
kk_free_floor_list
(
void
)
{
kk_floor_list_t
*
ptr
=
s_floor_list
;
kk_floor_list_t
*
ptmp
=
NULL
;
while
(
ptr
!=
NULL
){
ptmp
=
ptr
->
next
;
free
(
ptr
->
floorId
);
ptr
->
floorId
=
NULL
;
free
(
ptr
->
floorName
);
ptr
->
floorName
=
NULL
;
free
(
ptr
);
ptr
=
NULL
;
ptr
=
ptmp
;
}
s_floor_list
=
NULL
;
}
cJSON
*
kk_get_roomids_by_floorId
(
const
char
*
floorId
)
{
sqlite3_stmt
*
stmt
;
char
*
pRoomId
=
NULL
;
int
count
=
0
;
char
*
sqlCmd
=
NULL
;
cJSON
*
roomIdsAry
=
cJSON_CreateArray
();
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
const
char
*
searchCmd
=
"select * from AreaInfo where floorId = '%s';"
;
sqlCmd
=
sqlite3_mprintf
(
searchCmd
,
floorId
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
cJSON
*
roomJson
=
cJSON_CreateObject
();
pRoomId
=
sqlite3_column_text
(
stmt
,
DB_ROOM_ID
);
cJSON_AddStringToObject
(
roomJson
,
"roomId"
,
pRoomId
);
cJSON_AddItemToArray
(
roomIdsAry
,
roomJson
);
}
sqlite3_finalize
(
stmt
);
sqlite3_free
(
sqlCmd
);
return
roomIdsAry
;
}
char
*
kk_get_floorIds_ary
(
void
)
{
sqlite3_stmt
*
stmt
;
char
*
pfloorId
=
NULL
;
char
*
pfloorName
=
NULL
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
const
char
*
searchCmd
=
"select * from floorInfo;"
;
_kk_area_lock
();
sqlite3_prepare_v2
(
ctx
->
pDb
,
searchCmd
,
strlen
(
searchCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
pfloorId
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_FLOOR_ID
);
pfloorName
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_FLOOR_NAME
);
printf
(
"------------->pfloorId:%s,pfloorName:%s
\n
"
,
pfloorId
,
pfloorName
);
kk_room_floor_list_add
(
pfloorId
,
pfloorName
);
}
sqlite3_finalize
(
stmt
);
_kk_area_unlock
();
return
s_floor_list
;
}
cJSON
*
kk_get_roomIds_ary
(
void
)
{
int
isExist
=
0
;
...
...
@@ -594,16 +809,34 @@ cJSON *kk_get_roomIds_ary(void)
}
}
sqlite3_finalize
(
stmt
);
_kk_area_unlock
();
return
roomIdsAry
;
}
cJSON
*
kk_get_roomIds_ary_by_floorid
(
char
*
floorid
)
{
int
isExist
=
0
;
sqlite3_stmt
*
stmt
;
char
*
proomId
=
NULL
;
int
armingstate
=
0
;
cJSON
*
roomIdsAry
=
cJSON_CreateArray
();
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
const
char
*
searchCmd
=
"select * from AreaInfo whre;"
;
sqlite3_prepare_v2
(
ctx
->
pDb
,
searchCmd
,
strlen
(
searchCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
armingstate
=
(
int
)
sqlite3_column_int
(
stmt
,
DB_ROOM_ARMING
);
if
(
armingstate
!=
0
){
proomId
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_ROOM_ID
);
cJSON_AddItemToArray
(
roomIdsAry
,
cJSON_CreateNumber
(
atoi
(
proomId
)));
}
}
sqlite3_finalize
(
stmt
);
return
roomIdsAry
;
}
kk_dev_list_t
*
kk_get_room_deviceCode
(
const
char
*
roomId
)
{
...
...
@@ -637,5 +870,36 @@ void kk_free_room_dev_list(void)
s_device_list
=
NULL
;
}
static
int
kk_check_floorId
(
int
nodeId
)
{
int
isExist
=
0
;
sqlite3_stmt
*
stmt
;
char
*
pnode
=
0
;
kk_area_ctx_t
*
ctx
=
_kk_area_get_ctx
();
const
char
*
searchCmd
=
"select * from floorInfo;"
;
_kk_area_lock
();
sqlite3_prepare_v2
(
ctx
->
pDb
,
searchCmd
,
strlen
(
searchCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
pnode
=
sqlite3_column_text
(
stmt
,
DB_FLOOR_ID
);
if
(
atoi
(
pnode
)
==
nodeId
)
{
isExist
=
1
;
break
;
}
}
sqlite3_finalize
(
stmt
);
_kk_area_unlock
();
return
isExist
;
}
int
kk_creater_nodeid
(
char
*
floorId
)
{
static
int
next
=
100
;
while
(
kk_check_floorId
(
next
)){
++
next
;
}
sprintf
(
floorId
,
"%d"
,
next
);
return
0
;
}
midware/midware/area/kk_area_handle.h
View file @
4b4226d7
...
...
@@ -7,6 +7,11 @@ typedef struct kk_dev_list{
struct
kk_dev_list
*
next
;
}
kk_dev_list_t
;
typedef
struct
kk_floor_list
{
char
*
floorId
;
char
*
floorName
;
struct
kk_floor_list
*
next
;
}
kk_floor_list_t
;
enum
{
DB_ROOM_IDX
=
0
,
DB_ROOM_NAME
,
...
...
@@ -24,6 +29,11 @@ enum{
DB_DEV_EPNUM
,
DB_DEV_DEV_NAME
,
};
enum
{
DB_FLOOR_IDX
=
0
,
DB_FLOOR_NAME
,
DB_FLOOR_ID
,
};
int
kk_room_delete
(
const
char
*
roomId
);
int
kk_room_add
(
const
char
*
name
,
const
char
*
roomId
);
int
kk_area_init
(
void
);
...
...
@@ -40,5 +50,8 @@ int kk_get_device_roomInfo(const char* deviceCode,int epNum,char *roomName,char
int
kk_room_reset_armingstate
(
void
);
int
kk_room_dev_remove_by_roomid
(
const
char
*
roomid
);
int
kk_room_set_floor_info
(
const
char
*
floorId
,
const
char
*
floorName
,
const
char
*
roomid
);
int
kk_floor_delete_all
(
void
);
int
kk_floor_delete_by_id
(
char
*
floorId
);
int
kk_set_floor_to_default
(
const
char
*
floorId
);
#endif
midware/midware/dm/kk_dm_mng.c
View file @
4b4226d7
...
...
@@ -1684,6 +1684,9 @@ int dm_mgr_subdev_delete(_IN_ char deviceCode[DEVICE_CODE_MAXLEN])
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
){
kk_indoorAir_delete_by_dcode
(
deviceCode
);
}
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_SWITCH_GATEWAY_TYPE
)
==
0
){
kk_subAirSwitch_delete_by_dcode
(
deviceCode
);
}
if
(
node
->
dev_type
==
KK_DM_DEVICE_CCU
){
ERROR_PRINT
(
"ERROR [%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
return
FAIL_RETURN
;
...
...
midware/midware/dm/kk_dm_mng.h
View file @
4b4226d7
...
...
@@ -16,6 +16,7 @@
#define KK_DM_GW_DEVICE_PRODUCT_TYPE "gw"
#define KK_DM_GW_DEVICE_PRODUCT_CODE "2"
#define KK_DM_AIR_GATEWAY_TYPE "air conditioning gateway"
#define KK_DM_AIR_SWITCH_GATEWAY_TYPE "airswitch gateway"
#define KK_DM_DEVICE_CCU_DEVICEID (0x00)
#define MSG_MAX_LEN (64)
...
...
midware/midware/dm/kk_dm_msg.h
View file @
4b4226d7
...
...
@@ -97,14 +97,14 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
#define KK_THING_SERVICE_SYNCDEVICEINFO_REPLY "/thing/service/syncDeviceInfo_reply"
#define KK_THING_SERVICE_CLOUDSTATUS "/thing/service/cloudStatus"
#define KK_THING_SERVICE_EXECUTEDNDMODE "/thing/service/executeDNDMode"
#define KK_THING_SERVICE_SETFLOOR "/thing/service/set
All
Floors"
#define KK_THING_SERVICE_SETFLOOR_REPLY "/thing/service/set
All
Floors_reply"
#define KK_THING_SERVICE_SETFLOOR "/thing/service/set
RoomsTo
Floors"
#define KK_THING_SERVICE_SETFLOOR_REPLY "/thing/service/set
RoomsTo
Floors_reply"
#define KK_THING_SERVICE_GETFLOOR "/thing/service/getAllFloors"
#define KK_THING_SERVICE_GETFLOOR_REPLY "/thing/service/getAllFloors_reply"
#define KK_THING_SERVICE_SYNCINFO_REPLY "/thing/service/syncinfo_reply"
#define KK_THING_SERVICE_SYNCINFOPUSH_REPLY "/thing/service/syncinfopush_reply"
#define KK_THING_SERVICE_ADDFLOORS "/thing/service/addFloors"
#define KK_THING_SERVICE_ADDFLOORS_REPLY "/thing/service/addFloors_reply"
#define KK_THING_EVENT_MESSAGE "/thing/event/"
#define KK_THING_SERVICE_GETGUARDSENSORS "/thing/service/getGuardSensors"
#define KK_THING_EVENT_POST "/post"
...
...
@@ -116,6 +116,8 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
#define KK_THING_SERVICE_HISTORYALARM_REPLY "/thing/service/historyAlarm_reply"
#define KK_THING_SERVICE_DEL_HISTORYALARM "/thing/service/delAlarm"
#define KK_THING_SERVICE_DEL_HISTORYALARM_REPLY "/thing/service/delAlarm_reply"
#define KK_THING_SERVICE_DELETEFLOORS "/thing/service/deleteFloors"
#define KK_THING_SERVICE_DELETEFLOORS_REPLY "/thing/service/deleteFloors_reply"
void
kk_sendData2app
(
void
*
info
,
void
*
payload
,
int
isAsync
);
int
dm_msg_thing_sub_register
(
_IN_
char
productCode
[
DEVICE_CODE_MAXLEN
],
_IN_
char
deviceCode
[
DEVICE_CODE_MAXLEN
],
...
...
midware/midware/dm/kk_linkkit.c
View file @
4b4226d7
...
...
@@ -621,6 +621,8 @@ static int kk_service_addDeviceToRoom_handle(cJSON *params)
if
(
epNum
==
NULL
){
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
){
isAirGwFlag
=
1
;
}
else
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_SWITCH_GATEWAY_TYPE
)
==
0
){
isAirGwFlag
=
2
;
}
strcpy
(
epNumStr
,
"1"
);
}
else
{
...
...
@@ -629,7 +631,7 @@ static int kk_service_addDeviceToRoom_handle(cJSON *params)
kk_room_dev_add
(
roomId
->
valuestring
,
room_name
->
valuestring
,
deviceCode
->
valuestring
,
epNumStr
,
dev_name
->
valuestring
);
//内机默认添加到跟网关同个房间
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
&&
isAirGwFlag
){
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
&&
isAirGwFlag
==
1
){
int
eplist
[
64
]
=
{
0
};
char
name
[
128
]
=
{
0
};
int
i
=
0
;
...
...
@@ -641,6 +643,19 @@ static int kk_service_addDeviceToRoom_handle(cJSON *params)
sprintf
(
name
,
"空调%d"
,
eplist
[
i
]);
kk_room_dev_add
(
roomId
->
valuestring
,
room_name
->
valuestring
,
deviceCode
->
valuestring
,
epNumStr
,
name
);
}
}
if
(
strcmp
(
node
->
productType
,
KK_DM_AIR_SWITCH_GATEWAY_TYPE
)
==
0
&&
isAirGwFlag
==
2
){
int
eplist
[
64
]
=
{
0
};
char
name
[
128
]
=
{
0
};
int
i
=
0
;
int
count
=
kk_subAirSwitch_query_epnums
(
deviceCode
->
valuestring
,
eplist
);
for
(
i
=
0
;
i
<
count
;
i
++
){
memset
(
epNumStr
,
0x0
,
sizeof
(
epNumStr
));
memset
(
name
,
0x0
,
sizeof
(
name
));
sprintf
(
epNumStr
,
"%d"
,
eplist
[
i
]);
sprintf
(
name
,
"空开%d"
,
eplist
[
i
]);
kk_room_dev_add
(
roomId
->
valuestring
,
room_name
->
valuestring
,
deviceCode
->
valuestring
,
epNumStr
,
name
);
}
}
return
SUCCESS_RETURN
;
}
...
...
@@ -768,10 +783,6 @@ static int kk_service_executeDNDMode_handle(cJSON *params)
*************************************************************/
static
int
kk_service_setFloor_handle
(
cJSON
*
params
)
{
int
res
=
0
;
char
roomIdStr
[
16
]
=
{
0
};
kk_dev_list_t
*
pList
=
NULL
;
if
(
params
==
NULL
){
return
INVALID_PARAMETER
;
}
...
...
@@ -781,12 +792,14 @@ static int kk_service_setFloor_handle(cJSON *params)
ERROR_PRINT
(
"DATA ERROR!!!
\n
"
);
return
INVALID_PARAMETER
;
}
kk_floor_delete_all
();
cJSON
*
item
=
floorArray
->
child
;
while
(
item
!=
NULL
){
cJSON
*
floorId
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_FLOOR_ID
);
if
(
floorId
==
NULL
)
return
INVALID_PARAMETER
;
cJSON
*
name
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ADDROOM_DEVICENAME
);
if
(
name
==
NULL
)
return
INVALID_PARAMETER
;
kk_floor_add
(
name
->
valuestring
,
floorId
->
valuestring
);
cJSON
*
rooms
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_FLOOR_ROOMS
);
if
(
rooms
==
NULL
)
return
INVALID_PARAMETER
;
cJSON
*
itemroom
=
rooms
->
child
;
...
...
@@ -803,33 +816,80 @@ static int kk_service_setFloor_handle(cJSON *params)
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述:
设置楼层
*功能描述:
添加楼层REPLY
*输入参数:params:云端下发数据,包含房间号等
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
static
int
kk_service_
getFloor_handle
(
cJSON
*
params
)
static
int
kk_service_
addFloor_reply
(
cJSON
*
root
,
cJSON
*
msgId
,
char
*
floorId
,
char
*
name
)
{
int
res
=
0
;
char
roomIdStr
[
16
]
=
{
0
};
kk_dev_list_t
*
pList
=
NULL
;
if
(
params
==
NULL
){
if
(
root
==
NULL
||
msgId
==
NULL
||
floorId
==
NULL
){
return
INVALID_PARAMETER
;
}
cJSON
*
deviceCode
=
cJSON_GetObjectItem
(
root
,
MSG_DEVICE_CODE_STR
);
if
(
deviceCode
==
NULL
){
return
FAIL_RETURN
;
}
cJSON
*
productCode
=
cJSON_GetObjectItem
(
root
,
MSG_PRODUCT_CODE_STR
);
if
(
productCode
==
NULL
){
return
FAIL_RETURN
;
}
cJSON
*
info
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
info
,
MSG_TYPE_STR
,
KK_THING_SERVICE_ADDFLOORS_REPLY
);
cJSON_AddStringToObject
(
info
,
MSG_DEVICE_CODE_STR
,
deviceCode
->
valuestring
);
cJSON_AddStringToObject
(
info
,
MSG_PRODUCT_CODE_STR
,
productCode
->
valuestring
);
char
*
infff
=
cJSON_Print
(
info
);
cJSON
*
payload
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
payload
,
"desc"
,
"success"
);
cJSON_AddStringToObject
(
payload
,
"version"
,
"1.0"
);
cJSON_AddStringToObject
(
payload
,
"code"
,
"0"
);
cJSON_AddStringToObject
(
payload
,
"msgId"
,
msgId
->
valuestring
);
cJSON
*
paramInfo
=
cJSON_CreateObject
();
cJSON
*
floorIdsAry
=
cJSON_CreateArray
();
cJSON
*
Item
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
Item
,
"floorId"
,
floorId
);
cJSON_AddStringToObject
(
Item
,
"name"
,
name
);
cJSON_AddItemToObject
(
Item
,
"rooms"
,
kk_get_roomids_by_floorId
(
floorId
));
cJSON_AddItemToArray
(
floorIdsAry
,
Item
);
cJSON_AddItemToObject
(
paramInfo
,
"floors"
,
floorIdsAry
);
cJSON_AddItemToObject
(
payload
,
"params"
,
paramInfo
);
char
*
payload11
=
cJSON_Print
(
payload
);
printf
(
"------------------------------>payload11:%s
\n
"
,
payload11
);
kk_sendData2app
(
infff
,
payload11
,
0
);
free
(
payload11
);
free
(
infff
);
cJSON_Delete
(
payload
);
cJSON_Delete
(
info
);
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述:添加楼层
*输入参数:params:云端下发数据,包含房间号等
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
static
int
kk_service_addFloor_handle
(
cJSON
*
params
,
cJSON
*
msgId
,
cJSON
*
root
)
{
char
floorId
[
16
]
=
{
0
};
if
(
params
==
NULL
||
msgId
==
NULL
||
root
==
NULL
){
return
INVALID_PARAMETER
;
}
cJSON
*
floorArray
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ROOM_FLOORS
);
if
(
floorArray
==
NULL
){
ERROR_PRINT
(
"DATA ERROR!!!
\n
"
);
return
INVALID_PARAMETER
;
}
//kk_floor_delete_all();
cJSON
*
item
=
floorArray
->
child
;
while
(
item
!=
NULL
){
cJSON
*
floorId
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_FLOOR_ID
);
if
(
floorId
==
NULL
)
return
INVALID_PARAMETER
;
cJSON
*
name
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ADDROOM_DEVICENAME
);
if
(
name
==
NULL
)
return
INVALID_PARAMETER
;
kk_creater_nodeid
(
floorId
);
kk_floor_add
(
name
->
valuestring
,
floorId
);
cJSON
*
rooms
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_FLOOR_ROOMS
);
if
(
rooms
==
NULL
)
return
INVALID_PARAMETER
;
cJSON
*
itemroom
=
rooms
->
child
;
...
...
@@ -838,13 +898,99 @@ static int kk_service_getFloor_handle(cJSON *params)
if
(
roomid
==
NULL
){
return
INVALID_PARAMETER
;
}
kk_room_set_floor_info
(
floorId
->
valuestring
,
name
->
valuestring
,
roomid
->
valuestring
);
kk_room_set_floor_info
(
floorId
,
name
->
valuestring
,
roomid
->
valuestring
);
itemroom
=
itemroom
->
next
;
}
kk_service_addFloor_reply
(
root
,
msgId
,
floorId
,
name
->
valuestring
);
item
=
item
->
next
;
}
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述:删除楼层
*输入参数:params:云端下发数据,包含房间号等
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
static
int
kk_service_deleteFloor_handle
(
cJSON
*
params
)
{
char
floorId
[
16
]
=
{
0
};
if
(
params
==
NULL
){
return
INVALID_PARAMETER
;
}
cJSON
*
floorArray
=
cJSON_GetObjectItem
(
params
,
MSG_AREA_ROOM_FLOORS
);
if
(
floorArray
==
NULL
){
ERROR_PRINT
(
"DATA ERROR!!!
\n
"
);
return
INVALID_PARAMETER
;
}
cJSON
*
item
=
floorArray
->
child
;
while
(
item
!=
NULL
){
cJSON
*
floorId
=
cJSON_GetObjectItem
(
item
,
MSG_AREA_ROOM_FLOOR_ID
);
if
(
floorId
==
NULL
)
return
INVALID_PARAMETER
;
kk_floor_delete_by_id
(
floorId
->
valuestring
);
kk_set_floor_to_default
(
floorId
->
valuestring
);
item
=
item
->
next
;
}
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述:获取楼层
*输入参数:params:云端下发数据,包含房间号等
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
static
int
kk_service_getFloor_handle
(
cJSON
*
param
,
cJSON
*
msgId
)
{
kk_floor_list_t
*
pFloorList
=
kk_get_floorIds_ary
();
if
(
param
==
NULL
||
msgId
==
NULL
){
return
INVALID_PARAMETER
;
}
cJSON
*
deviceCode
=
cJSON_GetObjectItem
(
param
,
MSG_DEVICE_CODE_STR
);
if
(
deviceCode
==
NULL
){
return
FAIL_RETURN
;
}
cJSON
*
productCode
=
cJSON_GetObjectItem
(
param
,
MSG_PRODUCT_CODE_STR
);
if
(
productCode
==
NULL
){
return
FAIL_RETURN
;
}
cJSON
*
info
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
info
,
MSG_TYPE_STR
,
KK_THING_SERVICE_GETFLOOR_REPLY
);
cJSON_AddStringToObject
(
info
,
MSG_DEVICE_CODE_STR
,
deviceCode
->
valuestring
);
cJSON_AddStringToObject
(
info
,
MSG_PRODUCT_CODE_STR
,
productCode
->
valuestring
);
char
*
infff
=
cJSON_Print
(
info
);
cJSON
*
payload
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
payload
,
"desc"
,
"success"
);
cJSON_AddStringToObject
(
payload
,
"version"
,
"1.0"
);
cJSON_AddStringToObject
(
payload
,
"code"
,
"0"
);
cJSON_AddStringToObject
(
payload
,
"msgId"
,
msgId
->
valuestring
);
cJSON
*
paramInfo
=
cJSON_CreateObject
();
cJSON
*
floorIdsAry
=
cJSON_CreateArray
();
while
(
pFloorList
!=
NULL
){
cJSON
*
Item
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
Item
,
"floorId"
,
pFloorList
->
floorId
);
cJSON_AddStringToObject
(
Item
,
"name"
,
pFloorList
->
floorName
);
cJSON_AddItemToObject
(
Item
,
"rooms"
,
kk_get_roomids_by_floorId
(
pFloorList
->
floorId
));
cJSON_AddItemToArray
(
floorIdsAry
,
Item
);
pFloorList
=
pFloorList
->
next
;
}
cJSON_AddItemToObject
(
paramInfo
,
"floors"
,
floorIdsAry
);
cJSON_AddItemToObject
(
payload
,
"params"
,
paramInfo
);
char
*
payload11
=
cJSON_Print
(
payload
);
printf
(
"------------------------------>payload11:%s
\n
"
,
payload11
);
kk_sendData2app
(
infff
,
payload11
,
0
);
free
(
payload11
);
free
(
infff
);
cJSON_Delete
(
payload
);
cJSON_Delete
(
info
);
kk_free_floor_list
();
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述:批量执行房间设备处理
*输入参数:params:云端下发数据,包含房间号,productCode等
...
...
@@ -1629,8 +1775,7 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_SYNCINFOPUSH
)
==
0
){
INFO_PRINT
(
"SYNCINFOPUSH service
\n
"
);
dm_msg_thing_syncinfopush_reply
();
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_BINDSCENE
)
==
0
){
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_BINDSCENE
)
==
0
){
INFO_PRINT
(
"bind scene
\n
"
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
if
(
paramStr
!=
NULL
){
...
...
@@ -1706,10 +1851,23 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
kk_service_setFloor_handle
(
paramStr
);
kk_service_common_reply
(
info_root
,
msgId
,
KK_THING_SERVICE_SETFLOOR_REPLY
);
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_ADDFLOORS
)
==
0
){
INFO_PRINT
(
"ADDFLOOR
\n
"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
kk_service_addFloor_handle
(
paramStr
,
msgId
,
info_root
);
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_DELETEFLOORS
)
==
0
){
INFO_PRINT
(
"DELETEFLOOR
\n
"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
cJSON
*
paramStr
=
cJSON_GetObjectItem
(
payload
,
MSG_PARAMS_STR
);
kk_service_deleteFloor_handle
(
paramStr
);
kk_service_common_reply
(
info_root
,
msgId
,
KK_THING_SERVICE_DELETEFLOORS_REPLY
);
}
else
if
(
strcmp
(
typeJson
->
valuestring
,
KK_THING_SERVICE_GETFLOOR
)
==
0
){
INFO_PRINT
(
"GETFLOOR
\n
"
);
cJSON
*
msgId
=
cJSON_GetObjectItem
(
payload
,
MSG_COMMON_MSGID
);
//kk_service_setFloor_handle(
);
kk_service_getFloor_handle
(
info_root
,
msgId
);
//kk_service_common_reply(info_root,msgId,KK_THING_SERVICE_SETFLOOR_REPLY);
}
else
{
...
...
midware/midware/dm/kk_property_db.c
View file @
4b4226d7
...
...
@@ -115,6 +115,22 @@ static int _kk_property_db_Init(void)
_kk_property_db_unlock
();
return
FAIL_RETURN
;
}
const
char
*
pSubAirSwitchtable
=
"CREATE TABLE IF NOT EXISTS subAirSwitchProperties( \
idx INTEGER PRIMARY KEY, \
deviceCode varchar(33), \
identifier varchar(33), \
value varchar(33), \
valueType INTEGER, \
epNum INTEGER)"
;
if
(
sqlite3_exec
(
ctx
->
pDb
,
pSubAirSwitchtable
,
NULL
,
NULL
,
&
pcErr
)
!=
SQLITE_OK
)
{
ERROR_PRINT
(
"Error creating table (%s)
\n
"
,
pcErr
);
sqlite3_free
(
pcErr
);
//eUtils_LockUnlock(&sLock);
_kk_property_db_unlock
();
return
FAIL_RETURN
;
}
//eUtils_LockUnlock(&sLock);
_kk_property_db_unlock
();
return
SUCCESS_RETURN
;
...
...
@@ -330,6 +346,164 @@ static int _kk_check_indoorAir_exist(const char* deviceCode,const char *identifi
_kk_property_db_unlock
();
return
isExist
;
}
static
int
_kk_check_subAirSwitch_exist
(
const
char
*
deviceCode
,
const
char
*
identifier
,
int
epNum
)
{
int
isExist
=
0
;
sqlite3_stmt
*
stmt
;
char
*
pDeviceCode
=
NULL
;
char
*
pIdentifier
=
NULL
;
int
epNumDb
=
0
;
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
const
char
*
searchCmd
=
"select * from subAirSwitchProperties;"
;
_kk_property_db_lock
();
sqlite3_prepare_v2
(
ctx
->
pDb
,
searchCmd
,
strlen
(
searchCmd
),
&
stmt
,
NULL
);
//INFO_PRINT("total_column = %d\n", sqlite3_column_count(stmt));
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
pDeviceCode
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_INDOORAIR_DEVICECODE
);
pIdentifier
=
(
char
*
)
sqlite3_column_text
(
stmt
,
DB_INDOORAIR_IDENTIFITER
);
epNumDb
=
sqlite3_column_int
(
stmt
,
DB_INDOORAIR_EPNUM
);
if
((
strcmp
(
deviceCode
,
pDeviceCode
)
==
0
)
&&
(
strcmp
(
identifier
,
pIdentifier
)
==
0
)
&&
(
epNumDb
==
epNum
))
{
isExist
=
1
;
break
;
}
}
//INFO_PRINT("\n");
sqlite3_finalize
(
stmt
);
_kk_property_db_unlock
();
return
isExist
;
}
/************************************************************
*功能描述: 插入空开子设备属性到数据库
*输入参数: deviceCode:设备deviceCode
epNum:端点
*输出参数: 无
*返 回 值: 0:成功;其他:失败
*其他说明:属性的值插入的时候先置空,后续再update
*************************************************************/
int
kk_subAirSwitch_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
,
int
epNum
)
{
const
char
*
insertCmd
=
"insert into subAirSwitchProperties (deviceCode,identifier,value,valueType,epNum) \
values ('%s','%s','%s','%d','%d');"
;
char
*
sqlCmd
=
NULL
;
int
rc
=
0
;
char
*
zErrMsg
=
0
;
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
if
(
_kk_check_subAirSwitch_exist
(
deviceCode
,
identifier
,
epNum
)
==
1
){
return
SUCCESS_RETURN
;
}
_kk_property_db_lock
();
sqlCmd
=
sqlite3_mprintf
(
insertCmd
,
deviceCode
,
identifier
,
""
,
valuetype
,
epNum
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
sqlite3_free
(
zErrMsg
);
}
else
{
//INFO_PRINT("sub device insert data successfully\n");
}
sqlite3_free
(
sqlCmd
);
_kk_property_db_unlock
();
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述: 查询空开子设备数量
*输入参数: deviceCode:设备deviceCode
epList:端点列表
*输出参数: 子设备个数
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
int
kk_subAirSwitch_query_epnums
(
const
char
*
deviceCode
,
int
epList
[])
{
char
*
sqlCmd
=
NULL
;
//int rc = 0;
//char *zErrMsg = 0;
sqlite3_stmt
*
stmt
;
char
*
valueStr
=
NULL
;
int
count
=
0
;
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
_kk_property_db_lock
();
sqlCmd
=
sqlite3_mprintf
(
"select * from subAirSwitchProperties WHERE deviceCode= '%s' and identifier = '%s'"
,
deviceCode
,
"PowerSwitch"
);
sqlite3_prepare_v2
(
ctx
->
pDb
,
sqlCmd
,
strlen
(
sqlCmd
),
&
stmt
,
NULL
);
while
(
sqlite3_step
(
stmt
)
==
SQLITE_ROW
){
if
(
count
>
32
){
return
count
;
}
epList
[
count
]
=
sqlite3_column_int
(
stmt
,
DB_SUBAIRSWITCH_EPNUM
);
printf
(
"epList[count] :%d
\n
"
,
epList
[
count
]);
count
++
;
}
sqlite3_free
(
sqlCmd
);
_kk_property_db_unlock
();
sqlite3_finalize
(
stmt
);
return
count
;
}
/************************************************************
*功能描述:通过deviceCode删除空开子设备
*输入参数: deviceCode:设备deviceCode
*输出参数: 无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
int
kk_subAirSwitch_delete_by_dcode
(
char
deviceCode
[
DEVICE_CODE_MAXLEN
])
{
const
char
*
deleteCmd
=
"delete from subAirSwitchProperties where deviceCode = '%s';"
;
char
*
sqlCmd
=
NULL
;
int
rc
=
0
;
char
*
zErrMsg
=
0
;
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
_kk_property_db_lock
();
sqlCmd
=
sqlite3_mprintf
(
deleteCmd
,
deviceCode
);
INFO_PRINT
(
"Table delete data sqlCmd:%s
\n
"
,
sqlCmd
);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
sqlite3_free
(
zErrMsg
);
}
else
{
INFO_PRINT
(
"Table delete data successfully
\n
"
);
}
sqlite3_free
(
sqlCmd
);
_kk_property_db_unlock
();
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述: 更新属性值
*输入参数: deviceCode:设备deviceCode
identifier:属性名称
value:属性值
*输出参数: 无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
int
kk_subAirSwitch_db_update_value
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
value
,
int
epNum
)
{
char
*
sqlCmd
=
NULL
;
int
rc
=
0
;
char
*
zErrMsg
=
0
;
kk_property_db_ctx_t
*
ctx
=
_kk_property_db_get_ctx
();
_kk_property_db_lock
();
//if()
sqlCmd
=
sqlite3_mprintf
(
"UPDATE subAirSwitchProperties SET value='%s' WHERE (deviceCode= '%s' and epNum = '%d') and (identifier = '%s') "
,
value
,
deviceCode
,
epNum
,
identifier
);
//DEBUG_PRINT("kk_property_db_update_value sqlCmd:%s\n",sqlCmd);
rc
=
sqlite3_exec
(
ctx
->
pDb
,
sqlCmd
,
NULL
,
NULL
,
&
zErrMsg
);
if
(
rc
!=
SQLITE_OK
){
ERROR_PRINT
(
"SQL error: %s
\n
"
,
zErrMsg
);
sqlite3_free
(
zErrMsg
);
}
else
{
//DEBUG_PRINT("kk_property_db_update_value successfully\n");
}
sqlite3_free
(
sqlCmd
);
_kk_property_db_unlock
();
return
SUCCESS_RETURN
;
}
/************************************************************
*功能描述: 插入空调内机属性到数据库
*输入参数: deviceCode:设备deviceCode
...
...
midware/midware/dm/kk_property_db.h
View file @
4b4226d7
...
...
@@ -40,6 +40,14 @@ enum{
DB_INDOORAIR_VALUETYPE
,
DB_INDOORAIR_EPNUM
};
enum
{
DB_SUBAIRSWITCH_IDX
=
0
,
DB_SUBAIRSWITCH_DEVICECODE
,
DB_SUBAIRSWITCH_IDENTIFITER
,
DB_SUBAIRSWITCH_VALUE
,
DB_SUBAIRSWITCH_VALUETYPE
,
DB_SUBAIRSWITCH_EPNUM
};
int
kk_property_db_init
(
void
);
int
kk_property_db_get_rawdata
(
const
char
*
identifier
,
const
int
dev_type
,
kk_prop_raw_struct_t
*
raw
,
int
count
);
int
kk_property_db_update_value
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
value
);
...
...
@@ -57,5 +65,9 @@ int kk_indoorAir_db_update_value(const char *deviceCode,const char *identifier,c
int
kk_indoorAir_query_epnums
(
const
char
*
deviceCode
,
int
epList
[]);
int
kk_check_property_exist
(
const
char
*
deviceCode
,
const
char
*
identifier
);
int
kk_indoorAir_delete_by_dcode
(
char
deviceCode
[
DEVICE_CODE_MAXLEN
]);
int
kk_subAirSwitch_db_update_value
(
const
char
*
deviceCode
,
const
char
*
identifier
,
const
char
*
value
,
int
epNum
);
int
kk_subAirSwitch_delete_by_dcode
(
char
deviceCode
[
DEVICE_CODE_MAXLEN
]);
int
kk_subAirSwitch_query_epnums
(
const
char
*
deviceCode
,
int
epList
[]);
int
kk_subAirSwitch_db_insert
(
const
char
*
deviceCode
,
const
char
*
identifier
,
kk_tsl_data_type_e
valuetype
,
int
epNum
);
#endif
midware/midware/midware.c
View file @
4b4226d7
...
...
@@ -654,7 +654,7 @@ static int kk_alarm_notify_handle(dm_mgr_dev_node_t *node,char *identifier,char
cJSON_Delete
(
info
);
return
0
;
}
static
int
kk_
indoorAir_property_save
(
cJSON
*
payload
,
char
*
deviceCod
e
)
static
int
kk_
subDevice_property_save
(
cJSON
*
payload
,
char
*
deviceCode
,
int
typ
e
)
{
dm_mgr_dev_node_t
*
node
=
NULL
;
kk_tsl_data_t
*
property
=
NULL
;
...
...
@@ -698,13 +698,27 @@ static int kk_indoorAir_property_save(cJSON *payload,char *deviceCode)
char
valBuf
[
16
]
=
{
0
};
int
value
=
propertyItem
->
valueint
;
sprintf
(
valBuf
,
"%d"
,
value
);
kk_indoorAir_db_update_value
(
deviceCode
,
property
->
identifier
,
valBuf
,
epNumInt
);
if
(
type
==
0
){
kk_indoorAir_db_update_value
(
deviceCode
,
property
->
identifier
,
valBuf
,
epNumInt
);
}
else
if
(
type
==
1
){
kk_subAirSwitch_db_update_value
(
deviceCode
,
property
->
identifier
,
valBuf
,
epNumInt
);
}
}
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_FLOAT
||
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_DOUBLE
){
char
valBuf
[
16
]
=
{
0
};
sprintf
(
valBuf
,
"%f"
,
propertyItem
->
valuedouble
);
kk_indoorAir_db_update_value
(
deviceCode
,
property
->
identifier
,
valBuf
,
epNumInt
);
if
(
type
==
0
){
kk_indoorAir_db_update_value
(
deviceCode
,
property
->
identifier
,
valBuf
,
epNumInt
);
}
else
if
(
type
==
1
){
kk_subAirSwitch_db_update_value
(
deviceCode
,
property
->
identifier
,
valBuf
,
epNumInt
);
}
}
else
if
(
property
->
data_value
.
type
==
KK_TSL_DATA_TYPE_TEXT
){
kk_indoorAir_db_update_value
(
deviceCode
,
property
->
identifier
,
propertyItem
->
valuestring
,
epNumInt
);
if
(
type
==
0
){
kk_indoorAir_db_update_value
(
deviceCode
,
property
->
identifier
,
propertyItem
->
valuestring
,
epNumInt
);
}
else
if
(
type
==
1
){
kk_subAirSwitch_db_update_value
(
deviceCode
,
property
->
identifier
,
propertyItem
->
valuestring
,
epNumInt
);
}
}
}
...
...
@@ -713,9 +727,10 @@ static int kk_indoorAir_property_save(cJSON *payload,char *deviceCode)
}
return
0
;
}
static
int
kk_indoorAir_property_handle
(
cJSON
*
info
,
cJSON
*
payload
,
char
*
deviceCode
)
/*type : 0,air condition gw;1,air switch gw*/
static
int
kk_subDevice_property_handle
(
cJSON
*
info
,
cJSON
*
payload
,
char
*
deviceCode
,
int
type
)
{
kk_
indoorAir_property_save
(
payload
,
deviceCod
e
);
kk_
subDevice_property_save
(
payload
,
deviceCode
,
typ
e
);
cJSON_AddStringToObject
(
payload
,
MSG_DEVICE_CODE_STR
,
deviceCode
);
char
*
payload11
=
cJSON_Print
(
payload
);
char
*
infff
=
cJSON_Print
(
info
);
...
...
@@ -752,6 +767,34 @@ static int kk_indoorAir_online_handle(dm_mgr_dev_node_t *node ,char *deviceCode,
}
return
0
;
}
static
int
kk_subAirSwitch_online_handle
(
dm_mgr_dev_node_t
*
node
,
char
*
deviceCode
,
int
epNum
)
{
int
idx
=
0
;
int
gwExist
=
0
;
char
roomId
[
32
]
=
{
0
};
char
roomName
[
256
]
=
{
0
};
char
epNumStr
[
10
]
=
{
0
};
kk_tsl_data_t
*
property
=
NULL
;
if
(
node
==
NULL
){
return
-
1
;
}
for
(
idx
=
0
;
idx
<
node
->
dev_shadow
->
property_number
;
idx
++
){
property
=
(
kk_tsl_data_t
*
)(
node
->
dev_shadow
->
properties
+
idx
);
if
(
property
==
NULL
){
continue
;
}
kk_subAirSwitch_db_insert
(
deviceCode
,
property
->
identifier
,
property
->
data_value
.
type
,
epNum
);
}
gwExist
=
kk_get_device_roomInfo
(
deviceCode
,
1
,
roomName
,
roomId
);
//获取网关房间信息
if
(
gwExist
){
char
name
[
128
]
=
{
0
};
sprintf
(
name
,
"空开%d"
,
epNum
);
sprintf
(
epNumStr
,
"%d"
,
epNum
);
kk_room_dev_add
(
roomId
,
roomName
,
deviceCode
,
epNumStr
,
name
);
}
return
0
;
}
void
kk_platMsg_handle
(
void
*
data
,
char
*
chalMark
){
int
res
=
0
;
cJSON
*
json
;
...
...
@@ -828,7 +871,11 @@ void kk_platMsg_handle(void* data, char* chalMark){
cJSON
*
epNumJson
=
cJSON_GetObjectItem
(
jsonPay
,
"epNum"
);
if
(
epNumJson
==
NULL
)
goto
error
;
kk_indoorAir_online_handle
(
search_node
,
devCode
->
valuestring
,
epNumJson
->
valueint
);
}
}
else
if
(
strcmp
(
search_node
->
productType
,
KK_DM_AIR_SWITCH_GATEWAY_TYPE
)
==
0
){
cJSON
*
epNumJson
=
cJSON_GetObjectItem
(
jsonPay
,
"epNum"
);
if
(
epNumJson
==
NULL
)
goto
error
;
kk_subAirSwitch_online_handle
(
search_node
,
devCode
->
valuestring
,
epNumJson
->
valueint
);
}
}
else
if
(
strstr
(
msgType
->
valuestring
,
KK_THING_TOPO_BATCH_ADD_MSG
)
!=
NULL
){
kk_ipc_send
(
IPC_MID2APP
,
data
,
strlen
(
data
));
...
...
@@ -859,7 +906,9 @@ void kk_platMsg_handle(void* data, char* chalMark){
dm_mgr_set_dev_onoffline
(
search_node
,
0
);
}
if
(
strcmp
(
search_node
->
productType
,
KK_DM_AIR_GATEWAY_TYPE
)
==
0
){
kk_indoorAir_property_handle
(
info
,
payload
,
info_dcode
->
valuestring
);
kk_subDevice_property_handle
(
info
,
payload
,
info_dcode
->
valuestring
,
0
);
}
else
if
(
strcmp
(
search_node
->
productType
,
KK_DM_AIR_SWITCH_GATEWAY_TYPE
)
==
0
){
kk_subDevice_property_handle
(
info
,
payload
,
info_dcode
->
valuestring
,
1
);
}
else
{
/*插座类设备保存功率历史记录*/
...
...
nx5_soc_gw/kk_device_def.json
View file @
4b4226d7
...
...
@@ -1857,6 +1857,25 @@
}
]
},
{
"pid"
:
"00803109"
,
"name"
:
"Air Switch Gateway"
,
"type"
:
"ZR"
,
"ota"
:
true
,
"b_pid"
:
3109
,
"productType"
:
"airSwitchGateway"
,
"eps"
:
[
{
"zid"
:
"0300"
,
"cluster"
:
{
"client"
:
"0003:0006"
,
"server"
:
"0000:0003:0004:0005:0006:0201:0202:fcc0"
}
}
]
},
{
"pid"
:
"00048612"
,
"name"
:
"XC Scene Panel 6G"
,
...
...
@@ -1933,6 +1952,25 @@
}
]
},
{
"pid"
:
"00800000"
,
"name"
:
"BL Fresh Air Gateway"
,
"type"
:
"ZR"
,
"ota"
:
true
,
"b_pid"
:
3122
,
"productType"
:
"freshAirGateway"
,
"eps"
:
[
{
"zid"
:
"0300"
,
"cluster"
:
{
"client"
:
"0003:0006"
,
"server"
:
"0000:0003:0004:0005:0006:0201:0202:fcc0"
}
}
]
},
{
"pid"
:
"04022115"
,
"name"
:
"XB SOS Button"
,
...
...
nx5_soc_gw/smarthome_z3gw_nx5
View file @
4b4226d7
No preview for this file type
tsl/product_3062.json
View file @
4b4226d7
...
...
@@ -270,84 +270,6 @@
}
}
]
},
{
"identifier"
:
"post"
,
"name"
:
"post"
,
"type"
:
"info"
,
"required"
:
true
,
"desc"
:
"属性上报"
,
"method"
:
"thing.event.property.post"
,
"outputData"
:
[
{
"identifier"
:
"Temperature"
,
"name"
:
"目标温度"
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"min"
:
"16"
,
"max"
:
"30"
,
"unit"
:
"°C"
,
"unitName"
:
"摄氏度"
,
"step"
:
"0.5"
}
}
},
{
"identifier"
:
"CurrentTemperature"
,
"name"
:
"当前温度"
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"min"
:
"-30"
,
"max"
:
"50"
,
"unit"
:
"°C"
,
"unitName"
:
"摄氏度"
,
"step"
:
"1"
}
}
},
{
"identifier"
:
"PowerSwitch"
,
"name"
:
"电源开关"
,
"dataType"
:
{
"type"
:
"bool"
,
"specs"
:
{
"0"
:
"关闭"
,
"1"
:
"开启"
}
}
},
{
"identifier"
:
"WindSpeed"
,
"name"
:
"风速"
,
"dataType"
:
{
"type"
:
"enum"
,
"specs"
:
{
"0"
:
"自动"
,
"2"
:
"低档"
,
"3"
:
"中档"
,
"4"
:
"高档"
,
"6"
:
"未知"
}
}
},
{
"identifier"
:
"WorkMode"
,
"name"
:
"工作模式"
,
"dataType"
:
{
"type"
:
"enum"
,
"specs"
:
{
"0"
:
"自动"
,
"1"
:
"制冷"
,
"2"
:
"制热"
,
"3"
:
"通风"
,
"4"
:
"除湿"
,
"5"
:
"未知"
}
}
}
]
}
]
}
\ No newline at end of file
tsl/product_3109.json
0 → 100644
View file @
4b4226d7
{
"schema"
:
"https://iot-ap.ikonke.com/model/product_3109.json"
,
"productType"
:
"airswitch gateway"
,
"version"
:
"1.1"
,
"profile"
:
{
"heartbeat"
:
"300"
,
"productCode"
:
"3109"
,
"productName"
:
"智能三相空开管理器Z3S(KONKE)"
},
"services"
:
[
{
"identifier"
:
"set"
,
"name"
:
"set"
,
"required"
:
true
,
"callType"
:
"async"
,
"desc"
:
"属性设置"
,
"method"
:
"thing.service.property.set"
,
"inputData"
:
[
{
"identifier"
:
"PowerSwitch"
,
"dataType"
:{
"specs"
:{
"0"
:
"关闭"
,
"1"
:
"打开"
},
"type"
:
"bool"
},
"name"
:
"电源开关"
},
{
"identifier"
:
"OverloadCurrent"
,
"name"
:
"最大电流设定值"
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"unit"
:
"A"
,
"unitName"
:
"安培"
,
"step"
:
"0.01"
}
}
},
{
"identifier"
:
"ExcessiveTemperature"
,
"name"
:
"最大温度设定值"
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"unit"
:
"°C"
,
"unitName"
:
"摄氏度"
,
"step"
:
"0.1"
}
}
},
{
"identifier"
:
"SwitchEnable"
,
"name"
:
"禁用物理开关"
,
"dataType"
:
{
"type"
:
"bool"
,
"specs"
:
{
"1"
:
"禁用"
,
"0"
:
"使能"
}
}
},
{
"identifier"
:
"BreakTime"
,
"name"
:
"最大电流断开时间"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"s"
,
"unitName"
:
"秒"
,
"step"
:
"1"
}
}
},
{
"identifier"
:
"RatedVoltage"
,
"name"
:
"额定电压"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"V"
,
"unitName"
:
"伏特"
,
"step"
:
"1"
}
}
},
{
"identifier"
:
"RatedCurrent"
,
"name"
:
"额定电流"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"A"
,
"unitName"
:
"安培"
,
"step"
:
"1"
}
}
}
],
"outputData"
:
[]
},
{
"identifier"
:
"get"
,
"name"
:
"get"
,
"required"
:
true
,
"callType"
:
"async"
,
"desc"
:
"属性获取"
,
"method"
:
"thing.service.property.get"
,
"inputData"
:
[
"PowerSwitch"
,
"OverloadCurrent"
,
"ExcessiveTemperature"
,
"SwitchEnable"
,
"BreakTime"
,
"RatedVoltage"
,
"RatedCurrent"
],
"outputData"
:
[]
}
],
"properties"
:
[
{
"identifier"
:
"PowerSwitch"
,
"name"
:
"电源开关"
,
"accessMode"
:
"rw"
,
"required"
:
true
,
"dataType"
:
{
"type"
:
"enum"
,
"specs"
:
{
"0"
:
"关闭"
,
"1"
:
"开启"
}
}
},
{
"identifier"
:
"LoadAlarmState"
,
"name"
:
"负载报警状态"
,
"accessMode"
:
"r"
,
"required"
:
true
,
"dataType"
:{
"specs"
:{
"0"
:
"未报警"
,
"1"
:
"正在报警"
},
"type"
:
"bool"
}
},
{
"identifier"
:
"TemperatureAlarmState"
,
"name"
:
"温度报警状态"
,
"accessMode"
:
"r"
,
"required"
:
true
,
"dataType"
:{
"specs"
:{
"0"
:
"未报警"
,
"1"
:
"正在报警"
},
"type"
:
"bool"
}
},
{
"identifier"
:
"AlarmType"
,
"name"
:
"报警类型"
,
"accessMode"
:
"r"
,
"required"
:
true
,
"dataType"
:{
"specs"
:{
"1"
:
"过载1倍"
,
"2"
:
"过载2倍"
,
"3"
:
"过载5倍"
,
"4"
:
"过载7倍"
,
"5"
:
"过压"
,
"6"
:
"欠压"
,
"7"
:
"过温"
,
"8"
:
"漏电"
,
"9"
:
"短路"
,
"10"
:
"长延时故障"
,
"11"
:
"短延时故障"
,
"12"
:
"瞬时故障"
},
"type"
:
"enum"
}
},
{
"identifier"
:
"OverloadCurrent"
,
"name"
:
"最大电流设定值"
,
"accessMode"
:
"rw"
,
"required"
:
true
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"unit"
:
"A"
,
"unitName"
:
"安培"
,
"step"
:
"0.01"
}
}
},
{
"identifier"
:
"ExcessiveTemperature"
,
"name"
:
"最大温度设定值"
,
"accessMode"
:
"rw"
,
"required"
:
true
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"unit"
:
"°C"
,
"unitName"
:
"摄氏度"
,
"step"
:
"0.1"
}
}
},
{
"identifier"
:
"SwitchEnable"
,
"name"
:
"禁用物理开关"
,
"accessMode"
:
"rw"
,
"required"
:
true
,
"dataType"
:
{
"type"
:
"bool"
,
"specs"
:
{
"1"
:
"禁用"
,
"0"
:
"使能"
}
}
},
{
"identifier"
:
"BreakTime"
,
"name"
:
"最大电流断开时间"
,
"accessMode"
:
"rw"
,
"required"
:
true
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"s"
,
"unitName"
:
"秒"
,
"step"
:
"1"
}
}
},
{
"identifier"
:
"RatedVoltage"
,
"name"
:
"额定电压"
,
"accessMode"
:
"rw"
,
"required"
:
true
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"V"
,
"unitName"
:
"伏特"
,
"step"
:
"1"
}
}
},
{
"identifier"
:
"RatedCurrent"
,
"name"
:
"额定电流"
,
"accessMode"
:
"rw"
,
"required"
:
true
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"A"
,
"unitName"
:
"安培"
,
"step"
:
"1"
}
}
}
],
"events"
:
[
{
"identifier"
:
"post"
,
"name"
:
"post"
,
"type"
:
"info"
,
"required"
:
true
,
"desc"
:
"属性上报"
,
"method"
:
"thing.event.property.post"
,
"outputData"
:
[
{
"identifier"
:
"CombineDeviceFlag"
,
"name"
:
"复合设备标识"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"value"
:
1
}
}
},
{
"identifier"
:
"EpTotal"
,
"name"
:
"内机数+1"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"desc"
:
"内机+网关 的数量"
}
}
},
{
"identifier"
:
"eps"
,
"name"
:
"内机属性集"
,
"dataType"
:
{
"type"
:
"array"
,
"specs"
:
{
"item"
:
[
{
"identifier"
:
"PowerSwitch"
,
"dataType"
:{
"specs"
:{
"0"
:
"关闭"
,
"1"
:
"打开"
},
"type"
:
"bool"
},
"name"
:
"电源开关"
},
{
"identifier"
:
"LoadAlarmState"
,
"name"
:
"负载报警状态"
,
"dataType"
:{
"specs"
:{
"0"
:
"未报警"
,
"1"
:
"正在报警"
},
"type"
:
"bool"
}
},
{
"identifier"
:
"TemperatureAlarmState"
,
"name"
:
"温度报警状态"
,
"dataType"
:{
"specs"
:{
"0"
:
"未报警"
,
"1"
:
"正在报警"
},
"type"
:
"bool"
}
},
{
"identifier"
:
"AlarmType"
,
"name"
:
"报警类型"
,
"dataType"
:{
"specs"
:{
"1"
:
"过载1倍"
,
"2"
:
"过载2倍"
,
"3"
:
"过载5倍"
,
"4"
:
"过载7倍"
,
"5"
:
"过压"
,
"6"
:
"欠压"
,
"7"
:
"过温"
,
"8"
:
"漏电"
,
"9"
:
"短路"
,
"10"
:
"长延时故障"
,
"11"
:
"短延时故障"
,
"12"
:
"瞬时故障"
},
"type"
:
"enum"
}
},
{
"identifier"
:
"OverloadCurrent"
,
"name"
:
"最大电流设定值"
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"unit"
:
"A"
,
"unitName"
:
"安培"
,
"step"
:
"0.01"
}
}
},
{
"identifier"
:
"ExcessiveTemperature"
,
"name"
:
"最大温度设定值"
,
"dataType"
:
{
"type"
:
"double"
,
"specs"
:
{
"unit"
:
"°C"
,
"unitName"
:
"摄氏度"
,
"step"
:
"0.1"
}
}
},
{
"identifier"
:
"SwitchEnable"
,
"name"
:
"禁用物理开关"
,
"dataType"
:
{
"type"
:
"bool"
,
"specs"
:
{
"1"
:
"禁用"
,
"0"
:
"使能"
}
}
},
{
"identifier"
:
"BreakTime"
,
"name"
:
"最大电流断开时间"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"s"
,
"unitName"
:
"秒"
,
"step"
:
"1"
}
}
},
{
"identifier"
:
"RatedVoltage"
,
"name"
:
"额定电压"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"V"
,
"unitName"
:
"伏特"
,
"step"
:
"1"
}
}
},
{
"identifier"
:
"RatedCurrent"
,
"name"
:
"额定电流"
,
"dataType"
:
{
"type"
:
"int"
,
"specs"
:
{
"unit"
:
"A"
,
"unitName"
:
"安培"
,
"step"
:
"1"
}
}
}
]
}
}
}
]
}
]
}
\ No newline at end of file
tsl/version
View file @
4b4226d7
1.1.4
\ No newline at end of file
1.1.5
\ No newline at end of file
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