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
a37d38b7
Commit
a37d38b7
authored
Jul 27, 2021
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
f7abf54d
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
2863 additions
and
4 deletions
+2863
-4
application/klansdk/kk_ccu_msg.c
application/klansdk/kk_ccu_msg.c
+353
-0
application/klansdk/kk_ccu_msg.h
application/klansdk/kk_ccu_msg.h
+46
-0
application/klansdk/kk_data_mng.c
application/klansdk/kk_data_mng.c
+5
-2
application/klansdk/kk_lan_ctrl.c
application/klansdk/kk_lan_ctrl.c
+332
-0
application/klansdk/kk_lan_ctrl.h
application/klansdk/kk_lan_ctrl.h
+32
-0
application/klansdk/kk_lan_main.c
application/klansdk/kk_lan_main.c
+3
-2
application/klansdk/kk_lan_new_dev_notify.c
application/klansdk/kk_lan_new_dev_notify.c
+393
-0
application/klansdk/kk_lan_new_dev_notify.h
application/klansdk/kk_lan_new_dev_notify.h
+149
-0
application/klansdk/kk_lan_node_db.c
application/klansdk/kk_lan_node_db.c
+427
-0
application/klansdk/kk_lan_node_db.h
application/klansdk/kk_lan_node_db.h
+36
-0
application/klansdk/kk_lan_queue.c
application/klansdk/kk_lan_queue.c
+166
-0
application/klansdk/kk_lan_queue.h
application/klansdk/kk_lan_queue.h
+30
-0
application/klansdk/kk_newccu_msg.c
application/klansdk/kk_newccu_msg.c
+91
-0
application/klansdk/kk_newccu_msg.h
application/klansdk/kk_newccu_msg.h
+26
-0
application/klansdk/kk_oldccu_msg.c
application/klansdk/kk_oldccu_msg.c
+747
-0
application/klansdk/kk_oldccu_msg.h
application/klansdk/kk_oldccu_msg.h
+27
-0
No files found.
application/klansdk/kk_ccu_msg.c
0 → 100644
View file @
a37d38b7
#include "kk_ccu_msg.h"
cJSON
*
bool_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
cJSON
*
int_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
cJSON
*
double_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
cJSON
*
string_bool_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
cJSON
*
string_int_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
cJSON
*
string_double_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
cJSON
*
string_time_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
);
typedef
cJSON
*
(
*
convert_func
)(
cJSON
*
,
cJSON
*
);
typedef
struct
{
char
*
type
;
convert_func
func
;
}
CONVERT_ITEM_S
;
static
CONVERT_ITEM_S
convert_table
[]
=
{
{
"bool"
,
bool_type_convert
},
{
"int"
,
int_type_convert
},
{
"double"
,
double_type_convert
},
{
"string_bool"
,
string_bool_type_convert
},
{
"string_int"
,
string_int_type_convert
},
{
"string_double"
,
string_double_type_convert
},
{
"string_time"
,
string_time_type_convert
}
};
cJSON
*
bool_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
cJSON
*
args
=
NULL
;
int
bVal
=
0
;
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
if
(
strcmp
(
n_dataType
->
valuestring
,
"dummy"
)
==
0
)
{
return
NULL
;
}
if
((
strcmp
(
n_dataType
->
valuestring
,
"int"
)
==
0
)
||
(
strcmp
(
n_dataType
->
valuestring
,
"bool"
)
==
0
)){
args
=
cJSON_CreateBool
(
n_id
->
valueint
);
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"double"
)
==
0
)
{
bVal
=
(
n_id
->
valuedouble
>
0
)
?
1
:
0
;
args
=
cJSON_CreateBool
(
bVal
);
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_bool"
)
==
0
)
{
if
(
strcmp
(
n_id
->
valuestring
,
"true"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"TRUE"
)
==
0
){
args
=
cJSON_CreateBool
(
1
);
}
else
if
(
strcmp
(
n_id
->
valuestring
,
"true"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"TRUE"
)
==
0
){
args
=
cJSON_CreateBool
(
0
);
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_int"
)
==
0
)
{
int
iVal
=
atoi
(
n_id
->
valuestring
);
bVal
=
(
iVal
>
0
)
?
1
:
0
;
args
=
cJSON_CreateBool
(
bVal
);
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_double"
)
==
0
)
{
double
dVal
=
atof
(
n_id
->
valuestring
);
bVal
=
(
dVal
>
0
)
?
1
:
0
;
args
=
cJSON_CreateBool
(
bVal
);
}
return
args
;
}
cJSON
*
int_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
cJSON
*
args
=
NULL
;
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
if
(
strcmp
(
n_dataType
->
valuestring
,
"dummy"
)
==
0
)
{
return
NULL
;
}
if
((
strcmp
(
n_dataType
->
valuestring
,
"int"
)
==
0
)
||
(
strcmp
(
n_dataType
->
valuestring
,
"bool"
)
==
0
)){
args
=
cJSON_CreateNumber
(
n_id
->
valueint
);
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"double"
)
==
0
)
{
args
=
cJSON_CreateNumber
(
n_id
->
valuedouble
);
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_bool"
)
==
0
)
{
if
(
strcmp
(
n_id
->
valuestring
,
"true"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"TRUE"
)
==
0
){
args
=
cJSON_CreateNumber
(
1
);
}
else
if
(
strcmp
(
n_id
->
valuestring
,
"true"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"TRUE"
)
==
0
){
args
=
cJSON_CreateNumber
(
0
);
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_int"
)
==
0
)
{
args
=
cJSON_CreateNumber
(
atoi
(
n_id
->
valuestring
));
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_double"
)
==
0
)
{
args
=
cJSON_CreateNumber
((
int
)
atof
(
n_id
->
valuestring
));
}
return
args
;
}
cJSON
*
double_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
return
int_type_convert
(
n_id
,
n_dataType
);
}
cJSON
*
string_bool_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
cJSON
*
args
=
NULL
;
int
flag
=
-
1
;
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
if
(
strcmp
(
n_dataType
->
valuestring
,
"dummy"
)
==
0
)
{
return
NULL
;
}
if
((
strcmp
(
n_dataType
->
valuestring
,
"int"
)
==
0
)
||
(
strcmp
(
n_dataType
->
valuestring
,
"bool"
)
==
0
)){
flag
=
(
n_id
->
valueint
>
0
)
?
1
:
0
;
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"double"
)
==
0
)
{
flag
=
(
n_id
->
valuedouble
>
0
)
?
1
:
0
;
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_bool"
)
==
0
)
{
if
(
strcmp
(
n_id
->
valuestring
,
"true"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"TRUE"
)
==
0
){
flag
=
1
;
}
else
if
(
strcmp
(
n_id
->
valuestring
,
"false"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"FALSE"
)
==
0
){
flag
=
0
;
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_int"
)
==
0
)
{
flag
=
(
atoi
(
n_id
->
valuestring
)
>
0
)
?
1
:
0
;
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_double"
)
==
0
)
{
flag
=
(
atof
(
n_id
->
valuestring
)
>
0
)
?
1
:
0
;
}
if
(
flag
==
1
)
{
args
=
cJSON_CreateString
(
"true"
);
}
else
if
(
flag
==
0
){
args
=
cJSON_CreateString
(
"false"
);
}
return
args
;
}
static
cJSON
*
string_val_type_convert
(
int
type
,
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
cJSON
*
args
=
NULL
;
char
sVal
[
32
]
=
{
0
};
union
{
int
iVal
;
double
dVal
;
}
val
=
{
0
};
memset
(
sVal
,
0
,
sizeof
(
sVal
));
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
if
(
strcmp
(
n_dataType
->
valuestring
,
"dummy"
)
==
0
)
{
return
NULL
;
}
if
((
strcmp
(
n_dataType
->
valuestring
,
"int"
)
==
0
)
||
(
strcmp
(
n_dataType
->
valuestring
,
"bool"
)
==
0
)){
if
(
type
==
1
){
val
.
dVal
=
(
n_id
->
valueint
>
0
)
?
1
:
0
;
}
else
{
val
.
iVal
=
(
n_id
->
valueint
>
0
)
?
1
:
0
;
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"double"
)
==
0
)
{
if
(
type
==
1
){
val
.
dVal
=
n_id
->
valuedouble
;
}
else
{
val
.
iVal
=
n_id
->
valueint
;
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_bool"
)
==
0
)
{
if
(
strcmp
(
n_id
->
valuestring
,
"true"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"TRUE"
)
==
0
){
if
(
type
==
1
){
val
.
dVal
=
1
;
}
else
{
val
.
iVal
=
1
;
}
}
else
if
(
strcmp
(
n_id
->
valuestring
,
"false"
)
==
0
||
strcmp
(
n_id
->
valuestring
,
"FALSE"
)
==
0
)
if
(
type
==
1
){
val
.
dVal
=
0
;
}
else
{
val
.
iVal
=
0
;
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_int"
)
==
0
)
{
if
(
type
==
1
){
val
.
dVal
=
atoi
(
n_id
->
valuestring
);
}
else
{
val
.
iVal
=
atoi
(
n_id
->
valuestring
);
}
}
else
if
(
strcmp
(
n_dataType
->
valuestring
,
"string_double"
)
==
0
)
{
if
(
type
==
1
){
val
.
dVal
=
atof
(
n_id
->
valuestring
);
}
else
{
val
.
iVal
=
atof
(
n_id
->
valuestring
);
}
}
if
(
type
==
1
){
snprintf
(
sVal
,
sizeof
(
sVal
),
"%f"
,
val
.
dVal
);
}
else
{
snprintf
(
sVal
,
sizeof
(
sVal
),
"%d"
,
val
.
iVal
);
}
args
=
cJSON_CreateString
(
sVal
);
return
args
;
}
cJSON
*
string_int_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
return
string_val_type_convert
(
0
,
n_id
,
n_dataType
);
}
cJSON
*
string_double_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
return
string_val_type_convert
(
1
,
n_id
,
n_dataType
);
}
cJSON
*
string_time_type_convert
(
cJSON
*
n_id
,
cJSON
*
n_dataType
)
{
cJSON
*
args
=
NULL
;
int
val
;
char
tm
[
10
]
=
{
0
};
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
if
(
strcmp
(
n_dataType
->
valuestring
,
"dummy"
)
==
0
)
{
return
NULL
;
}
if
(
strcmp
(
n_dataType
->
valuestring
,
"double"
)
==
0
){
val
=
n_id
->
valuedouble
*
10
;
memset
(
tm
,
0
,
sizeof
(
tm
));
snprintf
(
tm
,
sizeof
(
tm
),
"%02d:%2s"
,(
int
)
n_id
->
valuedouble
,((
val
%
10
>=
5
)
?
"30"
:
"00"
));
args
=
cJSON_CreateString
(
tm
);
}
return
args
;
}
cJSON
*
msg_convert_value
(
cJSON
*
d_type
,
cJSON
*
s_type
,
cJSON
*
value
)
{
int
i
,
size
;
cJSON
*
rlt
=
NULL
;
CONVERT_ITEM_S
*
crt
;
printf
(
"[%s][%d]type:%s->%s,val=%s
\n
"
,
__FUNCTION__
,
__LINE__
,
d_type
->
valuestring
,
s_type
->
valuestring
,
cJSON_Print
(
value
));
size
=
sizeof
(
convert_table
)
/
sizeof
(
CONVERT_ITEM_S
);
crt
=
&
convert_table
[
0
];
for
(
i
=
0
;
i
<
size
;
i
++
,
crt
++
){
if
(
strcmp
(
d_type
->
valuestring
,
crt
->
type
)
==
0
)
{
rlt
=
crt
->
func
(
value
,
s_type
);
break
;
}
}
return
rlt
;
}
cJSON
*
map_type_convert
(
cJSON
*
s_dataType
,
cJSON
*
s_valueRange
,
cJSON
*
value
,
cJSON
*
d_valueRange
)
{
cJSON
*
args
=
NULL
;
cJSON
*
rlt
;
int
j
;
int
vra_size
=
cJSON_GetArraySize
(
s_valueRange
);
printf
(
"[%s][%d]type:%s
\n
"
,
__FUNCTION__
,
__LINE__
,
s_dataType
->
valuestring
);
printf
(
"s_valueRange=%s
\n
"
,
cJSON_Print
(
s_valueRange
));
printf
(
"d_valueRange=%s
\n
"
,
cJSON_Print
(
d_valueRange
));
printf
(
"value=%s
\n
"
,
cJSON_Print
(
value
));
for
(
j
=
0
;
j
<
vra_size
;
j
++
){
if
(
strcmp
(
s_dataType
->
valuestring
,
"dummy"
)
==
0
){
continue
;
}
rlt
=
cJSON_GetArrayItem
(
s_valueRange
,
j
);
if
(
strcmp
(
s_dataType
->
valuestring
,
"bool"
)
==
0
||
strcmp
(
s_dataType
->
valuestring
,
"int"
)
==
0
)
{
if
(
rlt
->
valueint
==
value
->
valueint
)
{
args
=
cJSON_GetArrayItem
(
d_valueRange
,
j
);
break
;
}
}
else
if
(
strcmp
(
s_dataType
->
valuestring
,
"double"
)
==
0
){
if
(
rlt
->
valuedouble
==
value
->
valuedouble
)
{
args
=
cJSON_GetArrayItem
(
d_valueRange
,
j
);
break
;
}
}
else
if
(
strstr
(
s_dataType
->
valuestring
,
"string"
)){
if
(
strcmp
(
rlt
->
valuestring
,
value
->
valuestring
)
==
0
){
args
=
cJSON_GetArrayItem
(
d_valueRange
,
j
);
break
;
}
}
else
if
(
strstr
(
s_dataType
->
valuestring
,
"map"
)){
printf
(
"rlt=%d
\n
"
,
rlt
->
type
);
if
(
rlt
->
type
==
cJSON_String
){
printf
(
"111111
\n
"
);
if
(
strcmp
(
rlt
->
valuestring
,
value
->
valuestring
)
==
0
){
printf
(
"22222
\n
"
);
args
=
cJSON_GetArrayItem
(
d_valueRange
,
j
);
break
;
}
}
else
if
(
rlt
->
type
==
cJSON_Number
){
printf
(
"44444
\n
"
);
if
(
rlt
->
valueint
==
value
->
valueint
)
{
printf
(
"33333
\n
"
);
args
=
cJSON_GetArrayItem
(
d_valueRange
,
j
);
break
;
}
}
}
}
return
args
;
}
application/klansdk/kk_ccu_msg.h
0 → 100644
View file @
a37d38b7
#ifndef _KK_CCU_MSG_H
#define _KK_CCU_MSG_H
#include "kk_log.h"
#include "klist.h"
#include "kk_product.h"
#include "com_api.h"
#include "kk_opcode.h"
#include "kk_lan_ctrl.h"
#include "kk_data_mng.h"
#include "cJSON.h"
#define SWITCH_ARG_ON "ON"
#define SWITCH_ARG_OFF "OFF"
#define HJ_SERVER "HJ_Server"
#define SUCCESS_STATUS_STR "success"
#define NODEID_STR "nodeid"
#define OPCODE_STR "opcode"
#define ARG_STR "arg"
#define REQUEST_STR "requester"
#define INFO_STRING "info"
#define PAYLOAD_STRING "payload"
#define PARAMS_STRING "params"
cJSON
*
msg_convert_value
(
cJSON
*
d_type
,
cJSON
*
s_type
,
cJSON
*
value
);
cJSON
*
map_type_convert
(
cJSON
*
s_dataType
,
cJSON
*
s_valueRange
,
cJSON
*
value
,
cJSON
*
d_valueRange
);
#endif
application/klansdk/kk_data_mng.c
View file @
a37d38b7
...
@@ -422,12 +422,15 @@ int kk_create_devicestatus_to_sdk(cJSON *root)
...
@@ -422,12 +422,15 @@ int kk_create_devicestatus_to_sdk(cJSON *root)
cJSON
*
device_status
=
cJSON_CreateArray
();
cJSON
*
device_status
=
cJSON_CreateArray
();
cJSON
*
args
;
cJSON
*
args
;
cJSON
*
sub_device
;
cJSON
*
sub_device
;
list_for_each_entry
(
node
,
&
ctx
->
dev_list
,
linked_list
,
kk_map_dev_node_t
){
kk_map_dev_node_t
*
n
=
NULL
;
list_for_each_entry_safe
(
node
,
n
,
&
ctx
->
dev_list
,
linked_list
,
kk_map_dev_node_t
){
if
(
node
->
syn_type
==
1
){
if
(
node
->
syn_type
==
1
){
kk_creater_nodeid
(
node
->
deviceCode
,
1
,
nodeid
);
kk_creater_nodeid
(
node
->
deviceCode
,
1
,
nodeid
);
if
((
args
=
kk_devicestatus_build
(
node
))
!=
NULL
){
if
((
args
=
kk_devicestatus_build
(
node
))
!=
NULL
){
sub_device
=
old_ccu_msg_build_json_node_int
(
atoi
(
nodeid
),
node
->
syn_opcode
,
NULL
,
args
);
sub_device
=
old_ccu_msg_build_json_node_int
(
atoi
(
nodeid
),
node
->
syn_opcode
,
NULL
,
args
);
if
(
sub_device
){
if
(
sub_device
){
cJSON_AddItemToArray
(
device_status
,
sub_device
);
cJSON_AddItemToArray
(
device_status
,
sub_device
);
...
...
application/klansdk/kk_lan_ctrl.c
0 → 100644
View file @
a37d38b7
#include "kk_log.h"
#include "klist.h"
#include "kk_product.h"
#include "com_api.h"
#include "kk_opcode.h"
#include "kk_lan_ctrl.h"
#include "kk_data_mng.h"
#include "cJSON.h"
#include "kk_ccu_msg.h"
#include "kk_oldccu_msg.h"
#include "kk_newccu_msg.h"
int
find_match_pos
(
cJSON
*
array
,
const
char
*
tag
,
const
char
*
match
)
{
int
i
=
0
;
int
pos
=
-
1
;
cJSON
*
item
;
cJSON
*
mh
;
int
size
=
cJSON_GetArraySize
(
array
);
for
(;
i
<
size
;
i
++
){
item
=
cJSON_GetArrayItem
(
array
,
i
);
mh
=
cJSON_GetObjectItem
(
item
,
tag
);
if
(
strcmp
(
mh
->
valuestring
,
match
)
==
0
){
pos
=
i
;
break
;
}
}
return
pos
;
}
int
match_opcode_pos
(
cJSON
*
array
,
const
char
*
opcode
,
int
ch
)
{
int
i
=
0
;
int
pos
=
-
1
;
cJSON
*
item
;
cJSON
*
mh
;
cJSON
*
channel
;
int
size
=
cJSON_GetArraySize
(
array
);
for
(;
i
<
size
;
i
++
){
item
=
cJSON_GetArrayItem
(
array
,
i
);
mh
=
cJSON_GetObjectItem
(
item
,
"opcode"
);
channel
=
cJSON_GetObjectItem
(
item
,
"channel"
);
if
((
strcmp
(
mh
->
valuestring
,
opcode
)
==
0
)
&&
(
atoi
(
channel
->
valuestring
)
==
ch
)){
pos
=
i
;
break
;
}
}
return
pos
;
}
int
match_value_string
(
cJSON
*
valueRange
,
const
char
*
val
)
{
cJSON
*
item
;
int
i
=
0
;
int
pos
=
-
1
;
int
size
=
cJSON_GetArraySize
(
valueRange
);
for
(;
i
<
size
;
i
++
){
item
=
cJSON_GetArrayItem
(
valueRange
,
i
);
if
(
strcmp
(
item
->
valuestring
,
val
)
==
0
){
pos
=
i
;
break
;
}
}
return
pos
;
}
cJSON
*
ctrl_conver
(
kk_map_dev_node_t
*
devNode
,
int
nodeId
,
cJSON
*
arg
,
cJSON
*
opcode
)
{
cJSON
*
params
=
cJSON_CreateObject
();
cJSON
*
val
;
cJSON
*
newccuItem
;
cJSON
*
oldccuItem
;
cJSON
*
o_dataType
;
cJSON
*
n_dataType
;
cJSON
*
n_valueRange
;
cJSON
*
o_valueRange
;
cJSON
*
n_identifier
;
int
pos
;
int
channel
;
char
ch
[
33
];
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
kk_lan_db_channel_get
(
nodeId
,
&
channel
);
snprintf
(
ch
,
33
,
"%d"
,
channel
);
printf
(
"nodeId=%d,channel=%d,ch=%s
\n
"
,
nodeId
,
channel
,
ch
);
pos
=
match_opcode_pos
(
devNode
->
oldccu
,
opcode
->
valuestring
,
channel
);
printf
(
"[opcode->valuestring]%s
\n
"
,
opcode
->
valuestring
);
printf
(
"[match pos]%d
\n
"
,
pos
);
if
(
pos
==-
1
){
return
NULL
;
}
newccuItem
=
cJSON_GetArrayItem
(
devNode
->
newccu
,
pos
);
oldccuItem
=
cJSON_GetArrayItem
(
devNode
->
oldccu
,
pos
);
o_dataType
=
cJSON_GetObjectItem
(
oldccuItem
,
"dataType"
);
o_valueRange
=
cJSON_GetObjectItem
(
oldccuItem
,
"valueRange"
);
n_dataType
=
cJSON_GetObjectItem
(
newccuItem
,
"dataType"
);
n_valueRange
=
cJSON_GetObjectItem
(
newccuItem
,
"valueRange"
);
n_identifier
=
cJSON_GetObjectItem
(
newccuItem
,
"identifier"
);
printf
(
"1111
\n
"
);
if
(
strcmp
(
o_dataType
->
valuestring
,
"map"
)
==
0
){
printf
(
"2222
\n
"
);
val
=
map_type_convert
(
o_dataType
,
o_valueRange
,
arg
,
n_valueRange
);
}
else
{
printf
(
"3333
\n
"
);
val
=
msg_convert_value
(
o_dataType
,
n_dataType
,
arg
);
}
printf
(
"4444-->%d
\n
"
,
val
->
type
);
if
(
val
->
type
==
cJSON_False
){
cJSON_AddFalseToObject
(
params
,
n_identifier
->
valuestring
);
}
else
if
(
val
->
type
==
cJSON_True
){
cJSON_AddTrueToObject
(
params
,
n_identifier
->
valuestring
);
}
else
if
(
val
->
type
==
cJSON_NULL
){
cJSON_AddNullToObject
(
params
,
n_identifier
->
valuestring
);
}
else
if
(
val
->
type
==
cJSON_Number
){
cJSON_AddNumberToObject
(
params
,
n_identifier
->
valuestring
,
val
->
valuedouble
);
}
else
if
(
val
->
type
==
cJSON_String
){
cJSON_AddStringToObject
(
params
,
n_identifier
->
valuestring
,
val
->
valuestring
);
}
else
if
(
val
->
type
==
cJSON_Array
){
printf
(
"......................
\n
"
);
}
return
params
;
}
typedef
int
(
*
match_func
)(
cJSON
*
);
typedef
struct
{
char
*
Opcode
;
match_func
func
;
}
MATCH_ITEM_S
;
int
opcode_switch
(
cJSON
*
root
);
static
MATCH_ITEM_S
match_table
[]
=
{
{
SWITCH_OPCODE
,
opcode_switch
}
};
MATCH_ITEM_S
*
get_match_table
(
void
)
{
return
&
match_table
;
}
int
kk_ccu_opcode_handle
(
cJSON
*
root
)
{
int
i
;
//int size = sizeof(match_table)/sizeof(MATCH_ITEM_S);
cJSON
*
opcode
=
cJSON_GetObjectItem
(
root
,
OPCODE_STR
);
//MATCH_ITEM_S *pMh = get_match_table();
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
if
(
opcode
==
NULL
||
opcode
->
type
!=
cJSON_String
){
return
-
1
;
}
/*for(i=0;i<size;i++,pMh++) {
if(strcmp(opcode->valuestring,pMh->Opcode)==0){
if(pMh->func){
printf("[%s][%d]match table[%d]\n",__FUNCTION__,__LINE__,i);
pMh->func(root);
}
}
}*/
opcode_switch
(
root
);
}
//向midware发送数据
int
kk_ipc_send_json
(
cJSON
*
root
)
{
char
*
msg
;
if
(
root
==
NULL
){
return
-
1
;
}
msg
=
cJSON_Print
(
root
);
printf
(
"[lan->midware]json:
\n
%s
\n
"
,
msg
);
cJSON_Minify
(
msg
);
kk_ipc_send
(
IPC_APP2MID
,
msg
,
strlen
(
msg
)
+
1
);
free
(
msg
);
return
0
;
}
int
opcode_switch
(
cJSON
*
root
)
{
cJSON
*
msg
;
cJSON
*
nodeId
;
cJSON
*
opcode
;
cJSON
*
arg
;
cJSON
*
requester
;
char
deviceCode
[
33
]
=
{
0
};
kk_map_dev_node_t
*
dev
;
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
nodeId
=
cJSON_GetObjectItem
(
root
,
NODEID_STR
);
opcode
=
cJSON_GetObjectItem
(
root
,
OPCODE_STR
);
arg
=
cJSON_GetObjectItem
(
root
,
ARG_STR
);
requester
=
cJSON_GetObjectItem
(
root
,
REQUEST_STR
);
if
(
nodeId
==
NULL
||
opcode
==
NULL
||
arg
==
NULL
){
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
return
;
}
if
((
requester
!=
NULL
)
&&
(
strcmp
(
requester
->
valuestring
,
HJ_SERVER
)
!=
0
)){
WARNING_PRINT
(
"[%s] err,%s,%s
\n
"
,
REQUEST_STR
,
HJ_SERVER
,
requester
->
valuestring
);
}
kk_lan_db_deviceCode_get
(
atoi
(
nodeId
->
valuestring
),
deviceCode
);
if
(
kk_map_dev_search_by_deviceCode
(
deviceCode
,
&
dev
)
==
0
){
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
cJSON
*
params
=
ctrl_conver
(
dev
,
atoi
(
nodeId
->
valuestring
),
arg
,
opcode
);
msg
=
property_set
(
dev
->
productCode
,
dev
->
deviceCode
,
"*"
,
"*"
,
params
);
kk_ipc_send_json
(
msg
);
}
else
{
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
}
}
char
*
node_string
(
int
nodeId
)
{
char
*
node
=
(
char
*
)
malloc
(
33
);
memset
(
node
,
0
,
33
);
snprintf
(
node
,
32
,
"%d"
,
nodeId
);
return
node
;
}
char
*
double_string
(
double
dVal
,
int
size
)
{
char
*
buff
=
(
char
*
)
malloc
(
size
+
1
);
memset
(
buff
,
0
,
size
+
1
);
snprintf
(
buff
,
size
,
"%6f"
,
dVal
);
return
buff
;
}
int
update_device_status_2_oldccu
(
int
nodeId
,
const
char
*
opcode
,
const
char
*
arg
)
{
cJSON
*
msg
;
char
*
nodeStr
;
if
(
arg
==
NULL
){
return
-
1
;
}
printf
(
"[%s][%d]nodeId=%d,status=%s
\n
"
,
__FUNCTION__
,
__LINE__
,
nodeId
,
arg
);
if
((
nodeStr
=
node_string
(
nodeId
))
!=
NULL
){
msg
=
old_ccu_msg_build
(
nodeStr
,
opcode
,
"success"
,
arg
);
send_msg_to_module
(
msg
);
cJSON_Delete
(
msg
);
free
(
nodeStr
);
return
0
;
}
return
-
1
;
}
application/klansdk/kk_lan_ctrl.h
0 → 100644
View file @
a37d38b7
#ifndef _KK_LAN_CTRL_H
#define _KK_LAN_CTRL_H
#include "cJSON.h"
int
kk_ccu_opcode_handle
(
cJSON
*
root
);
void
property_post_deal
(
const
char
*
deviceCode
,
cJSON
*
payload
);
#endif
application/klansdk/kk_lan_main.c
View file @
a37d38b7
...
@@ -37,6 +37,7 @@ static void sig_handler(int sig)
...
@@ -37,6 +37,7 @@ static void sig_handler(int sig)
extern
void
ttttt_test
();
extern
void
ttttt_test
();
extern
void
kk_scene_build_test
(
void
);
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
...
@@ -44,6 +45,7 @@ int main(int argc, char* argv[])
...
@@ -44,6 +45,7 @@ int main(int argc, char* argv[])
char
*
ppp
;
char
*
ppp
;
open
(
"kk_lan"
,
LOG_PID
,
LOG_USER
);
open
(
"kk_lan"
,
LOG_PID
,
LOG_USER
);
ttttt_test
();
ttttt_test
();
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
();
...
@@ -63,8 +65,7 @@ int main(int argc, char* argv[])
...
@@ -63,8 +65,7 @@ int main(int argc, char* argv[])
while
(
1
){
while
(
1
){
extern
void
kk_scene_build_test
(
void
);
kk_scene_build_test
();
//count++;
//count++;
//if(count == 10){
//if(count == 10){
//kk_ipc_send(IPC_APP2MID, "wooooooooooooooooooooooooooooooooooollllll!", strlen("wooooooooooooooooooooooooooooooooooollllll!")+1);
//kk_ipc_send(IPC_APP2MID, "wooooooooooooooooooooooooooooooooooollllll!", strlen("wooooooooooooooooooooooooooooooooooollllll!")+1);
...
...
application/klansdk/kk_lan_new_dev_notify.c
0 → 100644
View file @
a37d38b7
This diff is collapsed.
Click to expand it.
application/klansdk/kk_lan_new_dev_notify.h
0 → 100644
View file @
a37d38b7
#ifndef __KK_LAN_NEW_DEV_NOTIFY_H
#define __KK_LAN_NEW_DEV_NOTIFY_H
#include "kk_ccu_msg.h"
typedef
struct
{
cJSON
*
new_device_count
;
cJSON
*
new_devices
;
cJSON
*
new_hue_lights_count
;
cJSON
*
new_hue_lights
;
cJSON
*
new_ipc_count
;
cJSON
*
new_ipcs
;
cJSON
*
new_konke_count
;
cJSON
*
new_konke_sockets
;
cJSON
*
new_konke_lights_count
;
cJSON
*
new_konke_lights
;
cJSON
*
new_cnwise_music_controllers_count
;
cJSON
*
new_cnwise_music_controllers
;
cJSON
*
new_modbus_devs_count
;
cJSON
*
new_modbus_devs
;
cJSON
*
new_modbus_daikin_indoorunits_count
;
cJSON
*
new_modbus_daikin_indoorunits
;
cJSON
*
new_konke_humidifiers_count
;
cJSON
*
new_konke_humidifiers
;
cJSON
*
new_konke_aircleaners_count
;
cJSON
*
new_konke_aircleaners
;
cJSON
*
new_central_ac_gws_count
;
cJSON
*
new_central_ac_gws
;
cJSON
*
new_central_ac_indoorunits_count
;
cJSON
*
new_central_ac_indoorunits
;
cJSON
*
new_youzhuan_music_controllers_count
;
cJSON
*
new_youzhuan_music_controllers
;
}
NEW_DEVICE_NOTIFY
;
typedef
struct
{
char
*
channel
;
char
*
mac
;
char
*
nodeid
;
char
*
operate_type
;
char
*
gw_mac
;
char
*
status
;
}
new_dev_item
;
typedef
struct
{
char
*
hue_light_id
;
char
*
hue_gw_id
;
char
*
hue_light_status
;
}
HUE_LIGHT_ITEM
;
typedef
struct
{
char
*
konke_socket_id
;
char
*
konke_socket_mac
;
char
*
konke_socket_online
;
char
*
konke_socket_status
;
}
KK_SOCKET_ITEM
;
typedef
struct
{
char
*
konke_light_id
;
char
*
konke_light_mac
;
char
*
konke_light_online
;
char
*
konke_light_status
;
}
KK_LIGHT_ITEM
;
typedef
struct
{
char
*
id
;
char
*
music_controller_mac
;
char
*
music_controller_type
;
char
*
music_controller_online
;
char
*
music_controller_status
;
}
MC_CTRL_ITEM
;
typedef
struct
{
char
*
id
;
char
*
dev_type
;
char
*
daikin_gw
;
char
*
dev_addr
;
char
*
bind_modbus_gw_node_id
;
}
MODBUS_DEV_ITEM
;
typedef
struct
{
char
*
id
;
char
*
indooruint_addr
;
char
*
bind_daikin_gw_devid
;
}
MODBUS_DAIKIN_INDOORUNIT_ITEM
;
typedef
struct
{
char
*
konke_humidifier_id
;
char
*
konke_humidifier_mac
;
char
*
konke_humidifier_online
;
char
*
konke_humidifier_status
;
}
KK_HUMIDIFIER_ITEM
;
typedef
struct
{
char
*
konke_aircleaner_id
;
char
*
konke_aircleaner_mac
;
char
*
konke_aircleaner_online
;
char
*
konke_aircleaner_status
;
}
KK_AIRCLEANER_ITEM
;
typedef
struct
{
char
*
id
;
char
*
bind_central_ac_gw_node_id
;
char
*
ac_gw_status
;
}
CENTRAL_AC_ITEM
;
typedef
struct
{
char
*
id
;
char
*
bind_central_ac_gw_node_id
;
char
*
ac_gw_status
;
}
CENTRAL_AC_INDOOR_ITEM
;
typedef
struct
{
char
*
id
;
char
*
music_controller_mac
;
char
*
music_controller_type
;
char
*
music_controller_online
;
char
*
music_controller_status
;
}
YOUZHUAN_MC_CTRL_ITEM
;
#endif
application/klansdk/kk_lan_node_db.c
0 → 100644
View file @
a37d38b7
This diff is collapsed.
Click to expand it.
application/klansdk/kk_lan_node_db.h
0 → 100644
View file @
a37d38b7
#ifndef __KK_LAN_NODE_DB_H_
#define __KK_LAN_NODE_DB_H_
#include "sqlite3.h"
#define KK_LAN_NODE_DB_FILE "./kk_lan_node.db"
typedef
struct
{
void
*
mutex
;
sqlite3
*
pDb
;
}
kk_lan_node_db_ctx_t
;
enum
{
LAN_DB_IDX
=
0
,
LAN_DB_DEVICECODE
,
LAN_DB_CHANNEL
,
LAN_DB_NODE
,
};
int
kk_lan_db_node_init
(
void
);
int
kk_lan_db_node_insert
(
const
char
*
deviceCode
,
int
channel
,
int
node
);
int
kk_lan_db_node_get
(
const
char
*
deviceCode
,
int
channel
);
int
kk_lan_db_node_get_all
(
const
char
*
deviceCode
,
int
*
nodes
);
int
kk_lan_db_deviceCode_get
(
int
node
,
char
*
deviceCode
);
int
kk_lan_db_channel_get
(
int
node
,
int
*
channel
);
int
kk_lan_db_get_item_by_node
(
int
node
,
char
*
deviceCode
,
int
*
channel
);
int
kk_lan_db_node_delete
(
char
*
deviceCode
);
int
kk_check_lan_node_exist
(
const
char
*
deviceCode
,
int
channel
);
int
kk_check_lan_node
(
int
nodeId
);
#endif
application/klansdk/kk_lan_queue.c
0 → 100644
View file @
a37d38b7
#include <pthread.h>
#include "kk_lan_queue.h"
#include "kk_log.h"
static
lan_queue_s
g_lan_queue
[
LAN_QUEUE_END
];
static
lan_queue_s
*
_lan_queue_get_ctx
(
LAN_QUEUE_ENUM
ix
)
{
return
&
g_lan_queue
[
ix
];
}
static
void
_lan_queue_lock
(
LAN_QUEUE_ENUM
ix
)
{
int
err_num
;
lan_queue_s
*
ctx
=
_lan_queue_get_ctx
(
ix
);
if
(
0
!=
(
err_num
=
pthread_mutex_lock
((
pthread_mutex_t
*
)
ctx
->
mutex
)))
{
WARNING_PRINT
(
"
\n
lock queue mutex[%d] failed: - '%s' (%d)
\n
"
,
ix
,
strerror
(
err_num
),
err_num
);
}
}
static
void
_lan_queue_unlock
(
LAN_QUEUE_ENUM
ix
)
{
int
err_num
;
lan_queue_s
*
ctx
=
_lan_queue_get_ctx
(
ix
);
if
(
0
!=
(
err_num
=
pthread_mutex_unlock
((
pthread_mutex_t
*
)
ctx
->
mutex
)))
{
WARNING_PRINT
(
"unlock queue mutex[%d] failed - '%s' (%d)
\n
"
,
ix
,
strerror
(
err_num
),
err_num
);
}
}
static
int
_lan_queue_init
(
LAN_QUEUE_ENUM
ix
,
int
max_size
)
{
int
err_num
;
lan_queue_s
*
ctx
=
_lan_queue_get_ctx
(
ix
);
memset
(
ctx
,
0
,
sizeof
(
lan_queue_s
));
ctx
->
mutex
=
(
pthread_mutex_t
*
)
malloc
(
sizeof
(
pthread_mutex_t
));
if
(
ctx
->
mutex
==
NULL
)
{
WARNING_PRINT
(
"
\n
malloc queue mutex[%d] failed: - '%s' (%d)
\n
"
,
ix
,
strerror
(
err_num
),
err_num
);
return
-
1
;
}
if
(
0
!=
(
err_num
=
pthread_mutex_init
(
ctx
->
mutex
,
NULL
)))
{
WARNING_PRINT
(
"
\n
init queue mutex[%d] failed
\n
"
,
ix
);
free
(
ctx
->
mutex
);
return
-
2
;
}
ctx
->
max_size
=
max_size
;
INIT_LIST_HEAD
(
&
ctx
->
list
);
INFO_PRINT
(
"
\n
lan queue[%d] init success~~~
\n
"
,
ix
);
return
0
;
}
int
lan_queue_init
(
void
)
{
_lan_queue_init
(
NODE_MAP
,
LAN_QUEUE_SIZE
(
1
));
}
void
lan_queue_deinit
(
void
)
{
//do it;
}
int
lan_queue_enqueue
(
LAN_QUEUE_ENUM
ix
,
void
*
data
)
{
lan_queue_s
*
ctx
=
_lan_queue_get_ctx
(
ix
);
lan_queue_msg_s
*
node
=
NULL
;
if
(
data
==
NULL
)
{
INFO_PRINT
(
"
\n
enqueue-[%d] fail,data is NULL!!!
\n
"
,
ix
);
return
-
2
;
}
_lan_queue_lock
(
ix
);
INFO_PRINT
(
"
\n
list size: %d, max size: %d
\n
"
,
ctx
->
size
,
ctx
->
max_size
);
if
(
ctx
->
size
>=
ctx
->
max_size
)
{
INFO_PRINT
(
"
\n
enqueue-[%d] fail,queue full!!!
\n
"
,
ix
);
_lan_queue_unlock
(
ix
);
return
-
3
;
}
node
=
malloc
(
sizeof
(
lan_queue_msg_s
));
if
(
node
==
NULL
)
{
INFO_PRINT
(
"
\n
enqueue-[%d] fail,node is NULL!!!
\n
"
,
ix
);
_lan_queue_unlock
(
ix
);
return
-
4
;
}
memset
(
node
,
0
,
sizeof
(
lan_queue_msg_s
));
node
->
data
=
data
;
INIT_LIST_HEAD
(
&
node
->
list
);
ctx
->
size
++
;
list_add_tail
(
&
node
->
list
,
&
ctx
->
list
);
_lan_queue_unlock
(
ix
);
INFO_PRINT
(
"
\n
enqueue-[%d] success~~~
\n
"
,
ix
);
return
0
;
}
int
lan_queue_dequeue
(
LAN_QUEUE_ENUM
ix
,
void
**
data
)
{
lan_queue_s
*
ctx
=
_lan_queue_get_ctx
(
ix
);
lan_queue_msg_s
*
node
=
NULL
;
if
(
data
==
NULL
)
{
return
-
2
;
}
_lan_queue_lock
(
ix
);
if
(
list_empty
(
&
ctx
->
list
))
{
_lan_queue_unlock
(
ix
);
return
-
3
;
}
node
=
list_first_entry
(
&
ctx
->
list
,
lan_queue_msg_s
,
list
);
list_del
(
&
node
->
list
);
ctx
->
size
--
;
*
data
=
node
->
data
;
free
(
node
);
_lan_queue_unlock
(
ix
);
INFO_PRINT
(
"
\n
dequeue queue[%d] success~~~
\n
"
,
ix
);
return
0
;
}
application/klansdk/kk_lan_queue.h
0 → 100644
View file @
a37d38b7
#ifndef _LAN_QUEUE_H_
#define _LAN_QUEUE_H_
#include "klist.h"
typedef
struct
{
void
*
data
;
struct
list_head
list
;
}
lan_queue_msg_s
;
typedef
struct
{
void
*
mutex
;
int
max_size
;
int
size
;
struct
list_head
list
;
}
lan_queue_s
;
typedef
enum
{
NODE_MAP
=
0
,
LAN_QUEUE_END
}
LAN_QUEUE_ENUM
;
#define LAN_QUEUE1_SIZE 50
#define LAN_QUEUE2_SIZE 20
#define LAN_QUEUE_SIZE(x) LAN_QUEUE##x##_SIZE
int
lan_queue_init
(
void
);
int
lan_queue_dequeue
(
LAN_QUEUE_ENUM
ix
,
void
**
data
);
int
lan_queue_enqueue
(
LAN_QUEUE_ENUM
ix
,
void
*
data
);
#endif
application/klansdk/kk_newccu_msg.c
0 → 100644
View file @
a37d38b7
#include "kk_log.h"
#include "klist.h"
#include "kk_product.h"
#include "com_api.h"
#include "kk_opcode.h"
#include "kk_lan_ctrl.h"
#include "kk_data_mng.h"
#include "kk_newccu_msg.h"
cJSON
*
property_info_build
(
const
char
*
msgtype
,
const
char
*
productCode
,
const
char
*
deviceCode
)
{
cJSON
*
info
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
info
,
"msgtype"
,
msgtype
);
cJSON_AddStringToObject
(
info
,
"productCode"
,
productCode
);
cJSON_AddStringToObject
(
info
,
"deviceCode"
,
deviceCode
);
return
info
;
}
cJSON
*
property_payload_build
(
const
char
*
method
,
const
char
*
msgId
,
const
char
*
version
,
cJSON
*
params
)
{
cJSON
*
payload
=
cJSON_CreateObject
();
cJSON_AddStringToObject
(
payload
,
"msgId"
,
msgId
);
cJSON_AddStringToObject
(
payload
,
"version"
,
version
);
cJSON_AddItemToObject
(
payload
,
PARAMS_STRING
,
params
);
cJSON_AddStringToObject
(
payload
,
"method"
,
method
);
return
payload
;
}
cJSON
*
property_set
(
const
char
*
productCode
,
const
char
*
deviceCode
,
const
char
*
msgId
,
const
char
*
version
,
cJSON
*
params
)
{
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
info
=
property_info_build
(
"/thing/service/property/set"
,
productCode
,
deviceCode
);
cJSON
*
payload
=
property_payload_build
(
"thing.service.property.set"
,
msgId
,
version
,
params
);
cJSON_AddItemToObject
(
root
,
INFO_STRING
,
info
);
cJSON_AddItemToObject
(
root
,
PAYLOAD_STRING
,
payload
);
return
root
;
}
cJSON
*
property_report
(
const
char
*
productCode
,
const
char
*
deviceCode
,
const
char
*
msgId
,
const
char
*
version
,
cJSON
*
params
)
{
cJSON
*
root
=
cJSON_CreateObject
();
cJSON
*
info
=
property_info_build
(
"/thing/event/{tsl.event.identifier}/post"
,
productCode
,
deviceCode
);
cJSON
*
payload
=
property_payload_build
(
"thing.event.{tsl.event.identifier}.post"
,
msgId
,
version
,
params
);
cJSON_AddItemToObject
(
root
,
INFO_STRING
,
info
);
cJSON_AddItemToObject
(
root
,
PAYLOAD_STRING
,
payload
);
return
root
;
}
application/klansdk/kk_newccu_msg.h
0 → 100644
View file @
a37d38b7
#ifndef _KK_NEWCCU_MSG_H
#define _KK_NEWCCU_MSG_H
#include "kk_ccu_msg.h"
cJSON
*
property_info_build
(
const
char
*
msgtype
,
const
char
*
productCode
,
const
char
*
deviceCode
);
cJSON
*
property_payload_build
(
const
char
*
method
,
const
char
*
msgId
,
const
char
*
version
,
cJSON
*
params
);
cJSON
*
property_set
(
const
char
*
productCode
,
const
char
*
deviceCode
,
const
char
*
msgId
,
const
char
*
version
,
cJSON
*
params
);
cJSON
*
property_report
(
const
char
*
productCode
,
const
char
*
deviceCode
,
const
char
*
msgId
,
const
char
*
version
,
cJSON
*
params
);
#endif
application/klansdk/kk_oldccu_msg.c
0 → 100644
View file @
a37d38b7
This diff is collapsed.
Click to expand it.
application/klansdk/kk_oldccu_msg.h
0 → 100644
View file @
a37d38b7
#ifndef _KK_OLDCCU_MSG_H
#define _KK_OLDCCU_MSG_H
#include "kk_ccu_msg.h"
cJSON
*
old_ccu_msg_build_json
(
const
char
*
nodeid
,
const
char
*
opcode
,
const
char
*
status
,
cJSON
*
arg
);
cJSON
*
old_ccu_msg_build
(
const
char
*
nodeid
,
const
char
*
opcode
,
const
char
*
status
,
const
char
*
arg
);
int
send_msg_to_module
(
cJSON
*
root
);
#endif
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