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
6e3c8b10
Commit
6e3c8b10
authored
Sep 21, 2020
by
chen.weican
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【修改内容】支持彩带灯模式的设置和RGB色的设置
【提交人】陈伟灿
parent
47e91b73
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
207 additions
and
165 deletions
+207
-165
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_color_space.c
...form/zigbee/app/builder/Z3GatewayHost/ZB/kk_color_space.c
+96
-83
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_color_space.h
...form/zigbee/app/builder/Z3GatewayHost/ZB/kk_color_space.h
+33
-31
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
+56
-41
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
+19
-8
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
+3
-2
No files found.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_color_space.c
View file @
6e3c8b10
#include "kk_color_space.h"
#include "kk_color_space.h"
static
float
hue_to_rgb
(
float
m1
,
float
m2
,
float
h
)
void
RGB_to_HSL_base
(
unsigned
char
red
,
unsigned
char
green
,
unsigned
char
blue
,
double
*
H
,
double
*
S
,
double
*
L
)
{
{
h
=
(
h
<
0
)
?
h
+
1
:
((
h
>
1
)
?
h
-
1
:
h
);
double
min
=
0
,
max
=
0
,
delta
=
0
;
if
(
h
*
6
<
1
)
double
R
=
0
,
G
=
0
,
B
=
0
;
{
return
(
m1
+
(
m2
-
m1
)
*
h
*
6
);
R
=
red
/
255
.
0
;
}
G
=
green
/
255
.
0
;
else
if
(
h
*
2
<
1
)
B
=
blue
/
255
.
0
;
{
return
m2
;
min
=
(
R
<
G
)
?
((
R
<
B
)
?
R
:
B
)
:
((
G
<
B
)
?
G
:
B
);
}
max
=
(
R
>
G
)
?
((
R
>
B
)
?
R
:
B
)
:
((
G
>
B
)
?
G
:
B
);
else
if
(
h
*
3
<
2
)
{
delta
=
max
-
min
;
return
m1
+
(
m2
-
m1
)
*
(
0
.
66666
-
h
)
*
6
;
}
*
L
=
(
min
+
max
)
/
2
.
0
;
else
{
if
(
*
L
==
0
.
0
||
(
max
-
min
)
==
0
.
0
){
return
m1
;
*
S
=
0
;
}
}
else
if
(
*
L
>
0
.
5
){
}
*
S
=
delta
/
(
2
-
2
*
*
L
);
}
else
{
void
hsl_to_rgb
(
float
h
,
float
s
,
float
l
,
unsigned
char
*
r
,
unsigned
char
*
g
,
unsigned
char
*
b
)
*
S
=
delta
/
(
2
*
*
L
);
{
}
float
m1
,
m2
;
if
((
max
-
min
)
==
0
.
0
){
m2
=
(
l
<=
0
.
5
)
?
l
*
(
s
+
1
)
:
l
+
s
-
l
*
s
;
*
H
=
0
;
m1
=
l
*
2
-
m2
;
}
else
if
((
max
-
R
==
0
.
0
)
&&
(
G
>=
B
)){
*
r
=
255
*
hue_to_rgb
(
m1
,
m2
,
h
+
0
.
33333
);
*
H
=
(
G
-
B
)
/
delta
;
*
g
=
255
*
hue_to_rgb
(
m1
,
m2
,
h
);
}
else
if
((
max
-
R
==
0
.
0
)
&&
(
G
<
B
)){
*
b
=
255
*
hue_to_rgb
(
m1
,
m2
,
h
-
0
.
33333
);
*
H
=
(
G
-
B
)
/
delta
+
6
;
}
}
else
if
((
max
-
G
)
==
0
.
0
){
void
rgb_to_hsl
(
unsigned
char
r
,
unsigned
char
g
,
unsigned
char
b
,
unsigned
short
*
H
,
unsigned
char
*
S
,
unsigned
char
*
L
)
*
H
=
(
B
-
R
)
/
delta
+
2
;
{
}
else
if
((
max
-
B
)
==
0
.
0
){
float
min
=
0
,
max
=
0
,
delta
=
0
;
*
H
=
(
R
-
G
)
/
delta
+
4
;
float
h
=
0
,
s
=
0
,
l
=
0
,
R
=
0
,
G
=
0
,
B
=
0
;
}
else
{
R
=
r
/
255
.
0
;
G
=
g
/
255
.
0
;
}
B
=
b
/
255
.
0
;
*
H
/=
6
.
0
;
}
min
=
R
<
G
?
R
:
G
;
void
RGB_to_HSL
(
unsigned
char
red
,
unsigned
char
green
,
unsigned
char
blue
,
unsigned
short
*
H
,
unsigned
char
*
S
,
unsigned
char
*
L
)
min
=
B
<
min
?
B
:
min
;
{
double
h
,
s
,
l
;
max
=
R
>
G
?
R
:
G
;
RGB_to_HSL_base
(
red
,
green
,
blue
,
&
h
,
&
s
,
&
l
);
max
=
B
>
max
?
B
:
max
;
*
H
=
h
*
360
+
((
int
)(
h
*
3600
)
%
10
>=
5
?
1
:
0
);
*
S
=
s
*
100
+
((
int
)(
s
*
1000
)
%
10
>=
5
?
1
:
0
);
delta
=
max
-
min
;
*
L
=
l
*
100
+
((
int
)(
l
*
1000
)
%
10
>=
5
?
1
:
0
);
l
=
(
min
+
max
)
/
2
.
0
;
}
s
=
0
;
double
HSL_convert_color_to_RGB
(
double
p
,
double
q
,
double
tC
)
if
(
l
>
0
&&
l
<
1
)
{
{
tC
=
(
tC
<
0
)
?
(
tC
+
1
)
:
((
tC
>
1
)
?
(
tC
-
1
)
:
tC
);
s
=
delta
/
(
l
<
0
.
5
?
(
2
*
l
)
:
(
2
-
2
*
l
));
}
if
(
tC
*
6
<
1
){
return
(
p
+
(
q
-
p
)
*
6
*
tC
);
h
=
0
;
}
else
if
(
tC
*
2
<
1
){
if
(
delta
>
0
)
return
q
;
{
}
else
if
(
tC
*
3
<
2
){
if
(
max
==
R
&&
max
!=
G
)
return
p
+
((
q
-
p
)
*
6
*
(
2
/
3
.
0
-
tC
));
{
}
h
+=
(
G
-
B
)
/
delta
;
else
{
}
return
p
;
else
if
(
max
==
G
&&
max
!=
B
)
}
{
}
h
+=
(
2
+
(
B
-
R
)
/
delta
);
void
HSL_to_RGB_base
(
double
H
,
double
S
,
double
L
,
unsigned
char
*
red
,
unsigned
char
*
green
,
unsigned
char
*
blue
)
}
{
else
if
(
max
==
B
&&
max
!=
R
)
double
q
,
p
;
{
double
tR
,
tG
,
tB
;
h
+=
(
4
+
(
R
-
G
)
/
delta
);
double
r
,
g
,
b
;
}
q
=
(
L
<=
0
.
5
)
?
L
*
(
S
+
1
)
:
L
+
S
-
(
L
*
S
);
{
p
=
2
*
L
-
q
;
h
/=
6
.
0
;
}
tR
=
H
+
1
/
3
.
0
;
}
tG
=
H
;
tB
=
H
-
1
/
3
.
0
;
*
H
=
(
unsigned
char
)
h
;
*
S
=
(
unsigned
char
)
s
;
r
=
255
*
HSL_convert_color_to_RGB
(
p
,
q
,
tR
);
*
L
=
(
unsigned
char
)
l
;
g
=
255
*
HSL_convert_color_to_RGB
(
p
,
q
,
tG
);
}
b
=
255
*
HSL_convert_color_to_RGB
(
p
,
q
,
tB
);
*
red
=
r
+
(((
int
)(
r
*
10
)
%
10
>=
5
)
?
1
:
0
);
*
green
=
g
+
(((
int
)(
g
*
10
)
%
10
>=
5
)
?
1
:
0
);
*
blue
=
b
+
(((
int
)(
b
*
10
)
%
10
>=
5
)
?
1
:
0
);
}
void
HSL_to_RGB
(
unsigned
short
H
,
unsigned
char
S
,
unsigned
char
L
,
unsigned
char
*
red
,
unsigned
char
*
green
,
unsigned
char
*
blue
)
{
double
h
=
H
/
360
.
0
;
double
s
=
S
/
100
.
0
;
double
l
=
L
/
100
.
0
;
HSL_to_RGB_base
(
h
,
s
,
l
,
red
,
green
,
blue
);
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_color_space.h
View file @
6e3c8b10
#ifndef __KK_COLOR_SPACE_H
#ifndef __KK_COLOR_SPACE_H
#define __KK_COLOR_SPACE_H
#define __KK_COLOR_SPACE_H
#include <stdio.h>
#include <stdio.h>
void
rgb_to_hsl
(
unsigned
char
r
,
unsigned
char
g
,
unsigned
char
b
,
unsigned
short
*
H
,
unsigned
char
*
S
,
unsigned
char
*
L
);
void
RGB_to_HSL_base
(
unsigned
char
red
,
unsigned
char
green
,
unsigned
char
blue
,
double
*
H
,
double
*
S
,
double
*
L
);
void
hsl_to_rgb
(
float
h
,
float
s
,
float
l
,
unsigned
char
*
r
,
unsigned
char
*
g
,
unsigned
char
*
b
);
void
RGB_to_HSL
(
unsigned
char
red
,
unsigned
char
green
,
unsigned
char
blue
,
unsigned
short
*
H
,
unsigned
char
*
S
,
unsigned
char
*
L
);
#endif
#endif
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
View file @
6e3c8b10
...
@@ -368,33 +368,13 @@ int kk_tsl_report_CO2(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,Emb
...
@@ -368,33 +368,13 @@ int kk_tsl_report_CO2(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,Emb
return
kk_tsl_report_Concentration
(
eui64
,
EP
,
clusterId
,
attributeId
,
dataType
,
len
,
data
);
return
kk_tsl_report_Concentration
(
eui64
,
EP
,
clusterId
,
attributeId
,
dataType
,
len
,
data
);
}
}
int
kk_tsl_report_colorControl_Brightness
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
uint8_t
value
=
data
[
0
];
emberAfAppPrintln
(
"[tsl report:kk_tsl_report_global_Brightness] value:%d
\n
"
,
value
);
if
(
dataType
==
ZCL_INT8U_ATTRIBUTE_TYPE
){
if
(
len
==
1
){
kk_tsl_report
(
eui64
,
EP
,
value
,
clusterId
,
attributeId
);
return
tsl_rpt_success
;
}
return
tsl_rpt_invaild_len
;
}
return
tsl_rpt_invaild_type
;
}
static
int
s_HSLCount
=
0
;
static
int
s_HSLCount
=
0
;
static
unsigned
short
s_H
=
0
;
static
unsigned
char
s_S
=
0
;
static
unsigned
char
s_L
=
0
;
COLOR_HSL
g_hsl
=
{
0
,
0
,
0
};
static
int
kk_tsl_report_colorControl_RGB_Str
(
EmberEUI64
eui64
)
int
kk_tsl_report_colorControl_RGB
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
{
uint8_t
value
=
data
[
0
];
kk_device_table_s
*
dev
;
kk_device_table_s
*
dev
;
kk_dev_config_map
*
dev_info
=
NULL
;
kk_dev_config_map
*
dev_info
=
NULL
;
kk_dev_config_item
*
item
=
NULL
;
kk_dev_config_item
*
item
=
NULL
;
...
@@ -403,22 +383,14 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
...
@@ -403,22 +383,14 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
int
startIdx
=
0
;
int
startIdx
=
0
;
cJSON
*
root_color
=
NULL
;
cJSON
*
root_color
=
NULL
;
char
tmp_Identity
[
64
]
=
{
0
};
char
tmp_Identity
[
64
]
=
{
0
};
COLOR_RGB
g_rgb
=
{
0
,
0
,
0
}
;
unsigned
char
r
,
g
,
b
;
emberAfAppPrintln
(
"[tsl report:kk_tsl_report_global_RGB] value:%d
\n
"
,
value
);
if
(
s_HSLCount
>=
3
&&
s_H
!=
0
&&
s_S
!=
0
){
if
(
dataType
==
ZCL_INT8U_ATTRIBUTE_TYPE
){
HSL_to_RGB
(
s_H
*
360
/
254
,
s_S
*
100
/
254
,
s_L
,
&
r
,
&
g
,
&
b
);
if
(
attributeId
==
0x0001
){
g_hsl
.
saturation
=
value
;
s_HSLCount
++
;
}
else
if
(
attributeId
==
0x0
){
g_hsl
.
hue
=
value
;
s_HSLCount
++
;
}
}
if
(
s_HSLCount
>=
2
){
s_HSLCount
=
0
;
s_HSLCount
=
0
;
HSLtoRGB
(
&
g_hsl
,
&
g_rgb
);
s_H
=
0
;
s_S
=
0
;
//printf("[%s][%d]%d %d %d\n",__FUNCTION__,__LINE__,r,g,b);
dev
=
kk_device_find_by_mac
(
eui64
);
dev
=
kk_device_find_by_mac
(
eui64
);
if
(
dev
==
NULL
){
if
(
dev
==
NULL
){
return
tsl_rpt_err
;
return
tsl_rpt_err
;
...
@@ -436,7 +408,7 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
...
@@ -436,7 +408,7 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
rev
=
kk_tsl_utils_memtok
(
item
->
identity
,
'.'
,
1
,
&
startIdx
);
rev
=
kk_tsl_utils_memtok
(
item
->
identity
,
'.'
,
1
,
&
startIdx
);
if
(
!
rev
){
if
(
!
rev
){
memcpy
(
tmp_Identity
,
item
->
identity
,
startIdx
);
memcpy
(
tmp_Identity
,
item
->
identity
,
startIdx
);
rpc_cJSON_AddNumberToObject
(
root_color
,
item
->
identity
+
1
+
startIdx
,
g_rgb
.
red
);
rpc_cJSON_AddNumberToObject
(
root_color
,
item
->
identity
+
1
+
startIdx
,
r
);
}
}
}
}
else
if
(
strstr
(
item
->
identity
,
".green"
)
!=
NULL
){
else
if
(
strstr
(
item
->
identity
,
".green"
)
!=
NULL
){
...
@@ -446,7 +418,7 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
...
@@ -446,7 +418,7 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
rev
=
kk_tsl_utils_memtok
(
item
->
identity
,
'.'
,
1
,
&
startIdx
);
rev
=
kk_tsl_utils_memtok
(
item
->
identity
,
'.'
,
1
,
&
startIdx
);
if
(
!
rev
){
if
(
!
rev
){
memcpy
(
tmp_Identity
,
item
->
identity
,
startIdx
);
memcpy
(
tmp_Identity
,
item
->
identity
,
startIdx
);
rpc_cJSON_AddNumberToObject
(
root_color
,
item
->
identity
+
1
+
startIdx
,
g
_rgb
.
green
);
rpc_cJSON_AddNumberToObject
(
root_color
,
item
->
identity
+
1
+
startIdx
,
g
);
}
}
}
}
else
if
(
strstr
(
item
->
identity
,
".blue"
)
!=
NULL
){
else
if
(
strstr
(
item
->
identity
,
".blue"
)
!=
NULL
){
...
@@ -456,7 +428,7 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
...
@@ -456,7 +428,7 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
rev
=
kk_tsl_utils_memtok
(
item
->
identity
,
'.'
,
1
,
&
startIdx
);
rev
=
kk_tsl_utils_memtok
(
item
->
identity
,
'.'
,
1
,
&
startIdx
);
if
(
!
rev
){
if
(
!
rev
){
memcpy
(
tmp_Identity
,
item
->
identity
,
startIdx
);
memcpy
(
tmp_Identity
,
item
->
identity
,
startIdx
);
rpc_cJSON_AddNumberToObject
(
root_color
,
item
->
identity
+
1
+
startIdx
,
g_rgb
.
blue
);
rpc_cJSON_AddNumberToObject
(
root_color
,
item
->
identity
+
1
+
startIdx
,
b
);
}
}
}
}
item
=
item
->
next
;
item
=
item
->
next
;
...
@@ -469,6 +441,49 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
...
@@ -469,6 +441,49 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
}
}
}
}
return
tsl_rpt_err
;
return
tsl_rpt_err
;
}
int
kk_tsl_report_colorControl_Brightness
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
uint8_t
value
=
data
[
0
];
emberAfAppPrintln
(
"[tsl report:kk_tsl_report_global_Brightness] value:%d
\n
"
,
value
);
if
(
dataType
==
ZCL_INT8U_ATTRIBUTE_TYPE
){
if
(
len
==
1
){
kk_tsl_report
(
eui64
,
EP
,
value
,
clusterId
,
attributeId
);
s_L
=
value
;
s_HSLCount
++
;
kk_tsl_report_colorControl_RGB_Str
(
eui64
);
if
(
s_HSLCount
>=
3
){
s_HSLCount
=
0
;
}
}
return
tsl_rpt_success
;
}
return
tsl_rpt_invaild_type
;
}
int
kk_tsl_report_colorControl_RGB
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
uint8_t
value
=
data
[
0
];
emberAfAppPrintln
(
"[tsl report:kk_tsl_report_global_RGB] value:%d
\n
"
,
value
);
if
(
dataType
==
ZCL_INT8U_ATTRIBUTE_TYPE
){
if
(
attributeId
==
0x0001
){
s_S
=
value
;
s_HSLCount
++
;
kk_tsl_report_colorControl_RGB_Str
(
eui64
);
}
else
if
(
attributeId
==
0x0
){
s_H
=
value
;
s_HSLCount
++
;
kk_tsl_report_colorControl_RGB_Str
(
eui64
);
}
}
return
tsl_rpt_success
;
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
View file @
6e3c8b10
...
@@ -140,8 +140,10 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
...
@@ -140,8 +140,10 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
}
}
else
{
else
{
propertyItem
=
rpc_cJSON_GetObjectItem
(
params
,
item
->
identity
);
propertyItem
=
rpc_cJSON_GetObjectItem
(
params
,
item
->
identity
);
if
(
propertyItem
!=
NULL
){
if
(
propertyItem
!=
NULL
){
// printf("[%s][%d]item->identity:%s\n",__FUNCTION__,__LINE__,item->identity);
findFlag
=
1
;
findFlag
=
1
;
}
}
}
}
...
@@ -154,7 +156,12 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
...
@@ -154,7 +156,12 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
value
=
propertyItem
->
valueint
;
value
=
propertyItem
->
valueint
;
}
}
func
=
item
->
controlFunc
;
func
=
item
->
controlFunc
;
res
=
func
(
ctx
,
nodeId
,
item
->
endpoint
,
&
value
);
if
(
func
!=
NULL
){
res
=
func
(
ctx
,
nodeId
,
item
->
endpoint
,
&
value
);
}
else
{
// printf("[%s][%d] can not find the func!!!\n",__FUNCTION__,__LINE__);
}
findFlag
=
0
;
findFlag
=
0
;
}
}
item
=
item
->
next
;
item
=
item
->
next
;
...
@@ -302,21 +309,24 @@ error_return:
...
@@ -302,21 +309,24 @@ error_return:
static
uint8_t
s_RgbCount
=
0
;
static
uint8_t
s_RgbCount
=
0
;
static
COLOR_RGB
s_rgb
;
static
COLOR_RGB
s_rgb
;
static
int
kk_zclColorControlMovetohueandsat
(
EmberNodeId
node
,
unsigned
char
ep
)
static
int
kk_zclColorControlMovetohueandsat
(
EmberNodeId
node
,
unsigned
char
ep
)
{
{
int
h
,
s
,
l
;
unsigned
short
h
;
unsigned
short
s
,
l
;
COLOR_HSL
hsl
;
COLOR_HSL
hsl
;
EmberStatus
status
=
0
;
EmberStatus
status
=
0
;
if
(
s_RgbCount
>=
3
){
if
(
s_RgbCount
>=
3
){
RGBtoHSL
(
&
s_rgb
,
&
hsl
);
//
RGBtoHSL(&s_rgb,&hsl);
emberAfAppPrintln
(
"[kk_zclColorControlMovetohueandsat]"
);
emberAfAppPrintln
(
"[kk_zclColorControlMovetohueandsat]"
);
rgb_to_hsl
(
s_rgb
.
red
,
s_rgb
.
green
,
s_rgb
.
blue
,
h
,
s
,
l
);
RGB_to_HSL
(
s_rgb
.
red
,
s_rgb
.
green
,
s_rgb
.
blue
,
&
h
,
&
s
,
&
l
);
emberAfAppPrintln
(
"[kk_zclColorControlMovetohueandsat] h:%d,s:%d,l:%d
\n
,"
,
h
,
s
,
l
);
status
=
zclColorControlMovetohueandsat
(
node
,
ep
,
h
*
254
,
s
*
254
,
0
,
0
,
0
,
0
);
status
=
zclColorControlMovetohueandsat
(
node
,
ep
,
h
*
254
/
360
,
s
*
254
/
100
,
0
,
0
,
0
,
0
);
status
|=
zclLevel_MoveToLevel
(
node
,
ep
,
l
,
0
,
NULL
,
NULL
);
s_RgbCount
=
0
;
s_RgbCount
=
0
;
}
}
return
0
;
return
status
;
}
}
int
kk_tsl_set_colorlight_RGB_red
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
)
int
kk_tsl_set_colorlight_RGB_red
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
)
{
{
...
@@ -384,6 +394,7 @@ int kk_tsl_set_colorlight_mode(jrpc_context * ctx,EmberNodeId node,unsigned char
...
@@ -384,6 +394,7 @@ int kk_tsl_set_colorlight_mode(jrpc_context * ctx,EmberNodeId node,unsigned char
mode
=
kk_find_extra_data
(
node
,
"Mode"
);
mode
=
kk_find_extra_data
(
node
,
"Mode"
);
while
(
mode
!=
NULL
){
while
(
mode
!=
NULL
){
if
(
ix
++==
value
){
if
(
ix
++==
value
){
kk_global_len
=
mode
->
len
+
1
;
kk_global_len
=
mode
->
len
+
1
;
kk_global_buffer
[
0
]
=
mode
->
len
;
kk_global_buffer
[
0
]
=
mode
->
len
;
memcpy
(
&
kk_global_buffer
[
1
],
mode
->
data
,
kk_global_buffer
[
0
]
-
1
);
memcpy
(
&
kk_global_buffer
[
1
],
mode
->
data
,
kk_global_buffer
[
0
]
-
1
);
...
@@ -394,7 +405,7 @@ int kk_tsl_set_colorlight_mode(jrpc_context * ctx,EmberNodeId node,unsigned char
...
@@ -394,7 +405,7 @@ int kk_tsl_set_colorlight_mode(jrpc_context * ctx,EmberNodeId node,unsigned char
emberAfCorePrintln
(
"
\n
"
);
emberAfCorePrintln
(
"
\n
"
);
break
;
break
;
}
}
mode
->
next
;
mode
=
mode
->
next
;
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
View file @
6e3c8b10
...
@@ -26,13 +26,14 @@ void kk_rpc_test(void);
...
@@ -26,13 +26,14 @@ void kk_rpc_test(void);
{
"kk_tsl_set_colorlight_RGB_green"
,
kk_tsl_set_colorlight_RGB_green
},
\
{
"kk_tsl_set_colorlight_RGB_green"
,
kk_tsl_set_colorlight_RGB_green
},
\
{
"kk_tsl_set_colorlight_RGB_blue"
,
kk_tsl_set_colorlight_RGB_blue
},
\
{
"kk_tsl_set_colorlight_RGB_blue"
,
kk_tsl_set_colorlight_RGB_blue
},
\
{
"kk_tsl_set_colorlight_Brightness"
,
kk_tsl_set_colorlight_Brightness
},
\
{
"kk_tsl_set_colorlight_Brightness"
,
kk_tsl_set_colorlight_Brightness
},
\
{
"kk_tsl_
report_colorControl
_mode"
,
kk_tsl_set_colorlight_mode
},
\
{
"kk_tsl_
set_colorlight
_mode"
,
kk_tsl_set_colorlight_mode
},
\
}
}
#define KK_RPC_REPORT_FUNCTION_TABLE {\
#define KK_RPC_REPORT_FUNCTION_TABLE {\
{
"kk_tsl_report_global_onoff"
,
kk_tsl_report_global_onoff
},
\
{
"kk_tsl_report_global_onoff"
,
kk_tsl_report_global_onoff
},
\
{
"kk_tsl_report_colorControl_Brightness"
,
kk_tsl_report_colorControl_Brightness
},
\
{
"kk_tsl_report_colorControl_Brightness"
,
kk_tsl_report_colorControl_Brightness
},
\
{
"kk_tsl_report_colorControl_RGB"
,
kk_tsl_report_colorControl_RGB
},
\
}
}
kk_rpc_set_api_s
kk_rpc_set_api
[];
kk_rpc_set_api_s
kk_rpc_set_api
[];
...
...
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