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
c811884f
Commit
c811884f
authored
Aug 26, 2021
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【20210826】
parent
8325f75c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
114 deletions
+32
-114
application/klansdk/kk_data_handle.c
application/klansdk/kk_data_handle.c
+8
-2
application/klansdk/kk_findccu_handle.c
application/klansdk/kk_findccu_handle.c
+3
-3
application/klansdk/kk_lan_main.c
application/klansdk/kk_lan_main.c
+1
-1
application/klansdk/kk_lan_vp_ctrl.c
application/klansdk/kk_lan_vp_ctrl.c
+1
-0
application/klansdk/kk_login_handle.c
application/klansdk/kk_login_handle.c
+7
-8
application/klansdk/kk_oldccu_msg.c
application/klansdk/kk_oldccu_msg.c
+12
-100
No files found.
application/klansdk/kk_data_handle.c
View file @
c811884f
...
...
@@ -395,7 +395,9 @@ static int kk_parse_syncinfo(cJSON *payload)
cJSON
*
newccuItem
;
cJSON
*
valuejson
;
int
value
;
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
kk_map_dev_deinit
();
...
...
@@ -426,9 +428,13 @@ static int kk_parse_syncinfo(cJSON *payload)
properties
=
cJSON_GetObjectItem
(
subitem
,
MSG_PROPERTIES_STR
);
kk_map_dev_node_add
(
deviceCode
,
productCode
,
gwdevicecode
,(
onlineStatus
->
valueint
==
1
)
?
"1"
:
"0"
);
kk_lan_property_post_deal
(
deviceCode
,
properties
);
//property_syn_deal(deviceCode,properties);
kk_lan_property_syn_deal
(
deviceCode
,
properties
);
subitem
=
subitem
->
next
;
}
}
...
...
application/klansdk/kk_findccu_handle.c
View file @
c811884f
application/klansdk/kk_lan_main.c
View file @
c811884f
application/klansdk/kk_lan_vp_ctrl.c
View file @
c811884f
#include "kk_data_mng.h"
#include "kk_lan_vp_ctrl.h"
#include "kk_lan_debug.h"
#include "cJSON.h"
cJSON
*
PowerSwitch_msg_build
(
int
ep
,
int
onoff
)
...
...
application/klansdk/kk_login_handle.c
View file @
c811884f
...
...
@@ -66,7 +66,6 @@ static int _kk_handle_data(char *buf,int sockfd){
}
else
{
kk_data_handle
(
json
,
sockfd
);
cJSON_Delete
(
json
);
}
}
...
...
application/klansdk/kk_oldccu_msg.c
View file @
c811884f
...
...
@@ -85,13 +85,20 @@ int send_msg_to_module(cJSON *root)
cJSON
*
val_conver_new2old
(
cJSON
*
newccuItem
,
cJSON
*
oldccuItem
,
int
syn_type
)
{
cJSON
*
n_dataType
=
cJSON_GetObjectItem
(
newccuItem
,
DATATYPE_STRING
);
cJSON
*
n_value
=
cJSON_GetObjectItem
(
newccuItem
,
"value"
);
cJSON
*
n_value
=
NULL
,
*
n_dataType
=
NULL
,
*
o_dataType
=
NULL
;
cJSON
*
o_valueRange
=
NULL
,
*
n_valueRange
=
NULL
;
if
(
newccuItem
==
NULL
||
newccuItem
->
type
!=
cJSON_Object
||
oldccuItem
==
NULL
||
oldccuItem
->
type
!=
cJSON_Object
){
debug_log
(
LOG_DEBUG
,
"[err] para.
\n
"
);
return
NULL
;
}
cJSON
*
o_dataType
;
o_valueRange
=
cJSON_GetObjectItem
(
oldccuItem
,
"valueRange"
);
n_valueRange
=
cJSON_GetObjectItem
(
newccuItem
,
"valueRange"
);
cJSON
*
o_valueRange
=
cJSON_GetObjectItem
(
oldccuItem
,
"valueRange"
);
cJSON
*
n_valueRange
=
cJSON_GetObjectItem
(
newccuItem
,
"valueRang
e"
);
n_dataType
=
cJSON_GetObjectItem
(
newccuItem
,
DATATYPE_STRING
);
n_value
=
cJSON_GetObjectItem
(
newccuItem
,
"valu
e"
);
if
(
syn_type
==
1
){
o_dataType
=
cJSON_GetObjectItem
(
oldccuItem
,
"synType"
);
...
...
@@ -101,101 +108,6 @@ cJSON * val_conver_new2old(cJSON *newccuItem,cJSON *oldccuItem,int syn_type)
return
ccu_value_convert
(
n_dataType
,
n_valueRange
,
o_dataType
,
o_valueRange
,
n_value
);
}
cJSON
*
kk_devicestatus_build
(
kk_map_dev_node_t
*
node
)
{
int
i
,
num
=
0
;
char
nodeid
[
32
]
=
{
0
};
cJSON
*
newccu
,
*
oldccu
;
cJSON
*
dev_status
;
if
(
node
==
NULL
||
node
->
syn_opcode
==
NULL
){
return
NULL
;
}
newccu
=
node
->
newccu
;
oldccu
=
node
->
oldccu
;
if
(
newccu
==
NULL
||
newccu
->
type
!=
cJSON_Object
||
oldccu
==
NULL
||
oldccu
->
type
!=
cJSON_Object
){
return
NULL
;
}
dev_status
=
cJSON_CreateObject
();
num
=
cJSON_GetArraySize
(
newccu
);
for
(
i
=
0
;
i
<
num
;
i
++
){
cJSON
*
newccuItem
=
cJSON_GetArrayItem
(
newccu
,
i
);
cJSON
*
oldccuItem
=
cJSON_GetArrayItem
(
oldccu
,
i
);
cJSON
*
synType
=
cJSON_GetObjectItem
(
oldccuItem
,
"synType"
);
cJSON
*
synKey
=
cJSON_GetObjectItem
(
oldccuItem
,
"syn"
);
cJSON
*
val
=
NULL
;
cJSON
*
status
=
NULL
;
char
indexId
[
4
]
=
{
0
};
if
(
synType
){
if
(
synType
->
type
!=
cJSON_String
||
synKey
==
NULL
||
synKey
->
type
!=
cJSON_String
)
{
continue
;
}
status
=
cJSON_CreateObject
();
kk_creater_nodeid
(
node
->
deviceCode
,
1
,
nodeid
,
atoi
(
node
->
opearteType
));
cJSON_AddStringToObject
(
status
,
OPCODE_STRING
,
node
->
syn_opcode
);
cJSON_AddNumberToObject
(
status
,
NODEID_STRING
,
atoi
(
nodeid
));
memset
(
indexId
,
0
,
sizeof
(
indexId
));
snprintf
(
indexId
,
sizeof
(
indexId
),
"%d"
,
i
+
1
);
cJSON_AddStringToObject
(
status
,
"index"
,
indexId
);
//todo:
if
(
strcmp
(
synType
->
valuestring
,
"timing_shutdown"
)
==
0
)
{
cJSON
*
syn_obj
=
cJSON_CreateObject
();
double
t
=
cJSON_GetObjectItem
(
newccuItem
,
"value"
)
->
valuedouble
;
char
buff
[
32
]
=
{
0
};
snprintf
(
buff
,
32
,
"%f"
,
t
);
if
(
t
>
0
){
cJSON_AddBoolToObject
(
syn_obj
,
"enable"
,
1
);
cJSON_AddStringToObject
(
syn_obj
,
"time"
,
buff
);
}
else
{
cJSON_AddBoolToObject
(
syn_obj
,
"enable"
,
0
);
cJSON_AddNullToObject
(
syn_obj
,
"time"
);
}
cJSON_AddItemToObject
(
dev_status
,
synKey
->
valuestring
,
syn_obj
);
}
else
{
if
((
val
=
val_conver_new2old
(
newccuItem
,
oldccuItem
,
1
))
!=
NULL
){
kk_lan_add_val_to_obj
(
dev_status
,
val
,
synKey
->
valuestring
);
}
}
}
}
return
dev_status
;
}
//更新设备状态
static
int
_kk_lan_update_device_status
(
int
nodeId
,
cJSON
*
opcode
,
cJSON
*
arg
)
{
...
...
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