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
64166551
Commit
64166551
authored
Sep 04, 2020
by
尹佳钦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据modle id 识别设备
parent
87d2de68
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
481 additions
and
469 deletions
+481
-469
platform/zigbee/app/builder/Z3GatewayHost/Makefile
platform/zigbee/app/builder/Z3GatewayHost/Makefile
+1
-0
platform/zigbee/app/builder/Z3GatewayHost/Z3GatewayHost.h
platform/zigbee/app/builder/Z3GatewayHost/Z3GatewayHost.h
+4
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
+272
-67
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
+17
-3
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_product_code.c
...orm/zigbee/app/builder/Z3GatewayHost/ZB/kk_product_code.c
+109
-43
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_product_code.h
...orm/zigbee/app/builder/Z3GatewayHost/ZB/kk_product_code.h
+3
-131
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
+36
-29
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
+1
-0
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
...form/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
+1
-0
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/inc/rpc_interface_parse.h
...p/builder/Z3GatewayHost/rpc_api/inc/rpc_interface_parse.h
+1
-0
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
...p/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
+30
-73
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_onoff.c
.../zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_onoff.c
+0
-114
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
+2
-2
platform/zigbee/protocol/zigbee/app/framework/plugin/ias-zone-client/ias-zone-client.c
...ee/app/framework/plugin/ias-zone-client/ias-zone-client.c
+3
-0
platform/zigbee/protocol/zigbee/app/framework/util/af-main-host.c
.../zigbee/protocol/zigbee/app/framework/util/af-main-host.c
+1
-7
No files found.
platform/zigbee/app/builder/Z3GatewayHost/Makefile
View file @
64166551
...
@@ -282,6 +282,7 @@ APPLICATION_FILES= \
...
@@ -282,6 +282,7 @@ APPLICATION_FILES= \
./ZB/kk_device_manager.c
\
./ZB/kk_device_manager.c
\
./ZB/kk_product_code.c
\
./ZB/kk_product_code.c
\
./ZB/kk_device_control.c
\
./ZB/kk_device_control.c
\
./ZB/kk_zigbee_api.c
\
./kk_test.c
\
./kk_test.c
\
./kk_sub_tsl.c
\
./kk_sub_tsl.c
\
./kk_tsl_zigbee_map.c
\
./kk_tsl_zigbee_map.c
\
...
...
platform/zigbee/app/builder/Z3GatewayHost/Z3GatewayHost.h
View file @
64166551
...
@@ -223,6 +223,10 @@
...
@@ -223,6 +223,10 @@
// Individual areas
// Individual areas
#define EMBER_AF_PRINT_CORE 0x0001
#define EMBER_AF_PRINT_CORE 0x0001
#define EMBER_AF_PRINT_APP 0x0002
#define EMBER_AF_PRINT_APP 0x0002
#define EMBER_AF_PRINT_DEBUG 0x0002
#define EMBER_AF_PRINT_SECURITY 0x0004
#define EMBER_AF_PRINT_SECURITY 0x0004
#define EMBER_AF_PRINT_ATTRIBUTES 0x0008
#define EMBER_AF_PRINT_ATTRIBUTES 0x0008
#define EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER 0x0010
#define EMBER_AF_PRINT_OTA_BOOTLOAD_CLUSTER 0x0010
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
View file @
64166551
This diff is collapsed.
Click to expand it.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
View file @
64166551
...
@@ -12,19 +12,33 @@
...
@@ -12,19 +12,33 @@
typedef
struct
kk_device_table_s
{
typedef
struct
kk_device_table_s
{
EmberEUI64
mac
;
EmberEUI64
mac
;
uint8_t
epNumber
;
EmberNodeId
nodeId
;
uint8_t
*
epValue
;
uint16_t
deviceId
;
uint16_t
identifyCnt
;
char
*
productCode
;
char
*
productCode
;
struct
kk_device_table_s
*
next
;
struct
kk_device_table_s
*
next
;
}
kk_device_table_s
;
}
kk_device_table_s
;
#define KK_MAX_SUPPORT_ENDPOINT_NUMBER 32
#define KK_MAX_SUPPORT_ENDPOINT_NUMBER 32
#define KK_MAX_READ_MODLE_ID_COUNT 30
void
kk_print_device_table
(
void
);
void
kk_print_device_table
(
void
);
kk_device_table_s
*
kk_device_find_by_mac
(
EmberEUI64
mac
);
kk_device_table_s
*
kk_device_find_by_mac
(
EmberEUI64
mac
);
void
kk_device_table_add
(
EmberEUI64
mac
,
uint8_t
epNum
,
uint8_t
*
epVal
,
char
*
productCode
);
void
kk_device_table_add
(
EmberEUI64
mac
,
EmberNodeId
nodeId
,
const
char
*
productCode
,
uint16_t
deviceId
);
void
kk_device_table_delete
(
EmberEUI64
mac
);
void
kk_device_table_delete
(
EmberEUI64
mac
);
void
kk_add_device_to_table
(
EmberEUI64
mac
,
EmberNodeId
nodeId
,
uint16_t
deviceId
);
void
kk_productCode_tick
();
void
kk_read_attr_response
(
EmberNodeId
nodeId
,
uint8_t
ep
,
EmberAfClusterId
cluster
,
EmberAfAttributeId
attribute
,
uint8_t
status
,
uint8_t
dataType
,
uint8_t
dataSize
,
uint8_t
*
data
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_product_code.c
View file @
64166551
This diff is collapsed.
Click to expand it.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_product_code.h
View file @
64166551
...
@@ -9,144 +9,15 @@
...
@@ -9,144 +9,15 @@
#define KK_PRODUCT_CODE_STRING_ENABLE
#define KK_PRODUCT_CODE_STRING_ENABLE
typedef
struct
{
typedef
struct
{
char
*
code
;
char
*
modelId
;
char
*
modelId
;
char
*
code
;
#ifdef KK_PRODUCT_CODE_STRING_ENABLE
#ifdef KK_PRODUCT_CODE_STRING_ENABLE
char
*
name
;
char
*
name
;
#endif
#endif
}
kk_product_code_s
;
}
kk_product_code_s
;
#define _2EP_ZERO_FIRE_LIGHTING_MODULE_CODE "11"
#define DOOYA_CURTAIN_MOTOR_CODE "24"
#define _1EP_ZERO_FIRE_PANEL_CODE "83"
#define _2EP_ZERO_FIRE_PANEL_CODE "84"
#define _3EP_ZERO_FIRE_PANEL_CODE "85"
#define ADJUSTABLE_LIGHT_KNOB_PANEL_CODE "89"
#define CHOPIN_WALL_OUTLET_10A_CODE "90"
#define CHOPIN_WALL_OUTLET_16A_CODE "91"
#define _1EP_STARS_ZERO_FIRE_PANEL_CODE "96"
#define _2EP_STARS_ZERO_FIRE_PANEL_CODE "97"
#define _3EP_STARS_ZERO_FIRE_PANEL_CODE "98"
#define _1EP_CHOPIN_ZERO_FIRE_PANEL_CODE "102"
#define _2EP_CHOPIN_ZERO_FIRE_PANEL_CODE "103"
#define _3EP_CHOPIN_ZERO_FIRE_PANEL_CODE "104"
#define _1EP_CHOPIN_CURTAIN_MOTOR_CODE "105"
#define _2EP_CHOPIN_CURTAIN_MOTOR_CODE "106"
#define _1EP_PLATINUM_SWITCH_CODE "1002"
#define _2EP_PLATINUM_SWITCH_CODE "1003"
#define _3EP_PLATINUM_SWITCH_CODE "1004"
#define PLATINUM_ACTUATOR_PANEL_CODE "1007"
#define RGB_LIGHT_CODE "1022"
#define DOOYA_CURTAIN_MOTOR_MODEL_ID "02020000"
#define CHOPIN_WALL_OUTLET_10A_CODE_NAME_MODEL_ID "00518620"
#define CHOPIN_WALL_OUTLET_16A_CODE_NAME_MODEL_ID "00518626"
#define _1EP_STARS_ZERO_FIRE_PANEL_MODEL_ID "00068611"
#define _2EP_STARS_ZERO_FIRE_PANEL_MODEL_ID "00068612"
#define _3EP_STARS_ZERO_FIRE_PANEL_MODEL_ID "00068613"
#define _1EP_PLATINUM_SWITCH_MODEL_ID "00068601"
#define _2EP_PLATINUM_SWITCH_MODEL_ID "00068602"
#define _3EP_PLATINUM_SWITCH_MODEL_ID "00068603"
#define PLATINUM_ACTUATOR_PANEL_NAME_MODEL_ID "00038603"
#define RGB_LIGHT_NAME_MODEL_ID "01020001"
#define _1EP_CHOPIN_ZERO_FIRE_PANEL_MODEL_ID "00068621"
#define _2EP_CHOPIN_ZERO_FIRE_PANEL_MODEL_ID "00068622"
#define _3EP_CHOPIN_ZERO_FIRE_PANEL_MODEL_ID "00068623"
#define _1EP_CHOPIN_CURTAIN_MOTOR_MODEL_ID "00038621"
#define _2EP_CHOPIN_CURTAIN_MOTOR_MODEL_ID "00038622"
#ifdef KK_PRODUCT_CODE_STRING_ENABLE
#define _2EP_ZERO_FIRE_LIGHTING_MODULE_NAME "两路零火灯光模块"
#define DOOYA_CURTAIN_MOTOR_NAME "智能窗帘电机(杜亚)"
#define _1EP_ZERO_FIRE_PANEL_NAME "一路零火面板(肖邦系列)"
#define _2EP_ZERO_FIRE_PANEL_NAME "两路零火面板(肖邦系列)"
#define _3EP_ZERO_FIRE_PANE_NAME "三路零火面板(肖邦系列)"
#define ADJUSTABLE_LIGHT_KNOB_PANEL_NAME "可调光旋钮面板(肖邦系列)"
#define CHOPIN_WALL_OUTLET_10A_CODE_NAME "入墙插座10A(肖邦系列)"
#define CHOPIN_WALL_OUTLET_16A_CODE_NAME "入墙插座16A(肖邦系列)"
#define _1EP_STARS_ZERO_FIRE_PANEL_NAME "星辰一路零火面板"
#define _2EP_STARS_ZERO_FIRE_PANEL_NAME "星辰两路零火面板"
#define _3EP_STARS_ZERO_FIRE_PANEL_NAME "星辰三路零火面板"
#define _1EP_CHOPIN_ZERO_FIRE_PANEL_NAME "一路零火面板(肖邦系列)定制版"
#define _2EP_CHOPIN_ZERO_FIRE_PANEL_NAME "两路零火面板(肖邦系列)定制版"
#define _3EP_CHOPIN_ZERO_FIRE_PANEL_NAME "三路零火面板(肖邦系列)定制版"
#define _1EP_CHOPIN_CURTAIN_MOTOR_NAME "一路窗帘面板(肖邦系列)定制版"
#define _2EP_CHOPIN_CURTAIN_MOTOR_NAME "两路窗帘面板(肖邦系列)定制版"
#define _1EP_PLATINUM_SWITCH_NAME "铂金系列一路灯控"
#define _2EP_PLATINUM_SWITCH_NAME "铂金系列两路灯控"
#define _3EP_PLATINUM_SWITCH_NAME "铂金系列三路灯控"
#define PLATINUM_ACTUATOR_PANEL_NAME "铂金系列推窗面板"
#define RGB_LIGHT_NAME "RGBW灯带"
#endif
/*
Z3D_IASZONE = 0x04020000, // IAS Zone 设备ID,不表示具体设备
Z3D_IASWD = 0x04030000, // IAS WD 设备ID,不表示具体设备
// 高级别状态指示类设备,APP客户端中显示状态需要和设备实际状态保持高度一致!状态上报不允许丢失,所以需要尝试多次上报!
Z3D_SMARTPLUG = 0x00510000, // 智能插座插座
Z3D_IAS_CONTACT_SWITCH = 0x04020015, // 门磁: IAS Zone device id + device type
Z3D_IAS_FIRE_SENSOR = 0x04020028, // 烟雾传感器: IAS Zone device id + device type
Z3D_IAS_WATER_SENSOR = 0x0402002A, // 水浸传感器: IAS Zone device id + device type
Z3D_IAS_GAS_SENSOR = 0x0402002B, // 气体传感器: IAS Zone device id + device type
Z3D_IAS_WD = 0x04030225, // 标准报警器(声光报警等): IAS WD device id + device type[in IAS Zone]
Z3D_WINDOW_COVERING = 0x02020000, // 窗帘电机(杜亚)
// Serial - 铂金
Z3D_BJSP_S1G = 0x00068601, // 铂金开关面板1路
Z3D_BJSP_S2G = 0x00068602, // 铂金开关面板2路
Z3D_BJSP_S3G = 0x00068603, // 铂金开关面板3路
Z3D_BJPP_C20 = 0x00518610, // 铂金墙插面板10A
Z3D_BJPP_C26 = 0x00518616, // 铂金墙插面板16A
Z3D_BJCP_S1G = 0x00038601, // 铂金窗帘面板1路
Z3D_BJOWP_S1G = 0x00038603, // 铂金一路推窗器面板
Z3D_BJDLP_S1G = 0x01018601, // 铂金调光面板
Z3D_BJSCP_S3G = 0x00048601, // 铂金情景面板(3路)
Z3D_BJQKP_S3G = 0x00048602, // 铂金快捷面板(3路)
Z3D_BJSOS_PANEL = 0X0402802C, // 铂金SOS面板(零火线)
Z3D_BJSOS_BUTTON= 0X0402812C, // 铂金SOS按钮(电池)
// Serial - 星辰
Z3D_XCSP_S1G = 0x00068611, // 星辰开关面板1路
Z3D_XCSP_S2G = 0x00068612, // 星辰开关面板2路
Z3D_XCSP_S3G = 0x00068613, // 星辰开关面板3路
Z3D_XCCP_S1G = 0x00038611, // 星辰窗帘面板1路
Z3D_XCCP_S2G = 0x00038612, // 星辰窗帘面板2路
Z3D_XCSCP_S4G = 0x00048611, // 星辰情景面板(4路)
// Serial - 肖邦
Z3D_XBSP_S1G = 0x00068621, // 肖邦开关面板1路
Z3D_XBSP_S2G = 0x00068622, // 肖邦开关面板2路
Z3D_XBSP_S3G = 0x00068623, // 肖邦开关面板3路
Z3D_XBPP_D20 = 0x00518620, // 肖邦墙插面板10A
Z3D_XBPP_D26 = 0x00518626, // 肖邦墙插面板16A
Z3D_XBCP_S1G = 0x00038621, // 肖邦窗帘面板1路
Z3D_XBCP_S2G = 0x00038622, // 肖邦窗帘面板2路
Z3D_XBSCP_S4G = 0x00048621, // 肖邦情景面板(4路)
Z3D_LMCW_LOCK0 = 0x01018000, // 创维门锁不带指纹
Z3D_LMCW_LOCK1 = 0x01018001, // 创维门锁带指纹
// 低等级状态指示类设备,APP客户端中仅记录历史状态,状态上报允许存在丢失
Z3D_ENVI_SENSOR = 0x03020000, // 温度传感器: Temperature device id + model id,注意控客环境同时存在温度和湿度,为了兼容其他厂家仅有温度的传感,这里设备类型仅使用温度device_id+model_id来确定!
// 动作触发类设备,APP客户端中仅记录历史操作,动作触发上报为实时,且允许存在丢失
Z3D_SWITCH = 0x00510001, // 快捷按钮
Z3D_IAS_MOTION_SENSOR = 0x0402000D, // 移动传感器: IAS Zone device id + device type
Z3D_UNKNOW = 0xFFFFFFFF, // 未知类型
*/
int
kk_get_product_code_table_size
(
void
);
extern
kk_product_code_s
kk_product_code
[];
extern
kk_product_code_s
kk_product_code
[];
...
@@ -173,6 +44,7 @@ extern kk_product_code_s kk_product_code[];
...
@@ -173,6 +44,7 @@ extern kk_product_code_s kk_product_code[];
#endif
#endif
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
View file @
64166551
...
@@ -103,22 +103,23 @@ int kk_sendData2CCU(char* data, int len){
...
@@ -103,22 +103,23 @@ int kk_sendData2CCU(char* data, int len){
void
kk_rpc_reportDevices
(
EmberEUI64
mac
)
void
kk_rpc_reportDevices
(
EmberEUI64
mac
,
const
char
*
productCode
)
{
{
cJSON
*
devicesJson
;
cJSON
*
devicesJson
;
EmberEUI64
eui64
;
emberAfGetEui64
(
eui64
);
char
macString
[
19
]
=
{
0
};
char
macString
[
19
]
=
{
0
};
UTIL_LOG_WARNING
(
"report tsl product code:%s
\n
"
,
productCode
);
emberAfPrintBigEndianEui64
(
mac
);
emberAfDebugPrintln
(
""
);
devicesJson
=
rpc_cJSON_CreateObject
();
devicesJson
=
rpc_cJSON_CreateObject
();
rpc_eui64ToString
(
mac
,
macString
);
rpc_eui64ToString
(
mac
,
macString
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productCode"
,
TEST_PRODUCT_CODE
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productCode"
,
productCode
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceCode"
,
macString
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceCode"
,
macString
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"mac"
,
macString
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"mac"
,
macString
);
//
//
kk_sub_tsl_add
(
mac
,
TEST_PRODUCT_CODE
);
kk_sub_tsl_add
(
mac
,
productCode
);
kk_rpc_report_devices
(
devicesJson
,
eui64
);
kk_rpc_report_devices
(
devicesJson
,
mac
);
}
}
...
@@ -555,35 +556,34 @@ error_return:
...
@@ -555,35 +556,34 @@ error_return:
void
emberAfPluginDeviceTableNewDeviceCallback
(
EmberEUI64
nodeEui64
)
{
uint16_t
deviceTableIndex
=
emberAfDeviceTableGetFirstIndexFromEui64
(
nodeEui64
);
if
(
deviceTableIndex
==
0xffff
){
kk_print_info
(
"not find item!"
);
return
;
}
EmberAfPluginDeviceTableEntry
*
deviceTable
=
emberAfDeviceTablePointer
();
//cJSON* nodeJson = rpc_reportDeviceState("joined",deviceTable[deviceTableIndex].eui64);
//rpc_printfJSON("joined",nodeJson);
//rpc_send_message(nodeJson,"device joined");
//rpc_add_device(deviceTable[deviceTableIndex].nodeId);
//kk_report_device_s device;
#define KK_NETWORK_PARAMETER_TX_POWER 10
//device.mac = nodeEui64;
#define KK_NETWORK_PARAMETER_CHANNEL 0x0B
//device.AppVersion = 0x10;
void
kk_network_check
(
void
)
//memcpy(device.mac,nodeEui64,EUI64_SIZE);
{
kk_rpc_reportDevices
(
deviceTable
[
deviceTableIndex
].
eui64
);
EmberEUI64
eui64
;
EmberPanId
panId
;
EmberStatus
status
;
if
(
ezspNetworkState
()
!=
EMBER_JOINED_NETWORK
){
emberAfGetEui64
(
eui64
);
panId
=
HIGH_LOW_TO_INT
(
eui64
[
1
],
eui64
[
0
]);
status
=
kk_network_form
(
true
,
panId
,
KK_NETWORK_PARAMETER_TX_POWER
,
KK_NETWORK_PARAMETER_CHANNEL
);
if
(
status
==
EMBER_SUCCESS
){
emberAfAppPrintln
(
"network form success~~~~~~"
);
}
else
{
emberAfAppPrintln
(
"network form fail!!!,status=0x%x"
,
status
);
}
}
else
{
kk_print_network_info
();
}
}
}
int
kk_report_global_onoff_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
int
kk_report_global_onoff_attribute
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
)
{
{
emberAfAppPrintln
(
"kk_report_global_onoff_attribute"
);
emberAfAppPrintln
(
"kk_report_global_onoff_attribute"
);
...
@@ -643,14 +643,21 @@ int kk_report_windowCovering_position_attribute(EmberEUI64 eui64,uint8_t EP,Embe
...
@@ -643,14 +643,21 @@ int kk_report_windowCovering_position_attribute(EmberEUI64 eui64,uint8_t EP,Embe
return
-
3
;
return
-
3
;
}
}
void
emberAfMainTickCallback
(
void
)
void
emberAfMainTickCallback
(
void
)
{
{
static
int
last_time
;
static
int
last_time
;
int
time
=
halCommonGetInt32uMillisecondTick
();
int
time
=
halCommonGetInt32uMillisecondTick
();
if
((
time
-
last_time
)
>=
3
000
){
if
((
time
-
last_time
)
>=
1
000
){
last_time
=
time
;
last_time
=
time
;
//printf("loop 3 test!\n");
kk_productCode_tick
();
//printf("kk_productCode_tick!\n");
}
}
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
View file @
64166551
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "com_api.h"
#include "com_api.h"
#include "zb_device_id.h"
#include "zb_device_id.h"
#include "kk_device_manager.h"
#include "kk_device_manager.h"
#include "kk_zigbee_api.h"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_tsl_zigbee_map.c
View file @
64166551
#include "kk_tsl_zigbee_map.h"
#include "kk_tsl_zigbee_map.h"
#include "kk_test.h"
#include "kk_test.h"
#include "kk_product_code.h"
kk_tsl_zigbee_map_t
g_tsl_zigbee_map
[]
=
{
kk_tsl_zigbee_map_t
g_tsl_zigbee_map
[]
=
{
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/inc/rpc_interface_parse.h
View file @
64166551
...
@@ -15,6 +15,7 @@ void ipcHandle(void);
...
@@ -15,6 +15,7 @@ void ipcHandle(void);
void
rpc_reportDevices
(
void
);
void
rpc_reportDevices
(
void
);
void
rpc_control_devices
(
cJSON
*
data
,
char
*
method
);
void
rpc_control_devices
(
cJSON
*
data
,
char
*
method
);
cJSON
*
rpc_reportDeviceState
(
char
*
state
,
EmberEUI64
eui64
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
View file @
64166551
...
@@ -266,21 +266,7 @@ int _init_param(struct jrpc_server *server) {
...
@@ -266,21 +266,7 @@ int _init_param(struct jrpc_server *server) {
return
0
;
return
0
;
}
}
char
g_mac
[
19
]
=
{
0
};
char
*
kk_get_gw_mac
(){
int
cnt
=
0
;
EmberEUI64
eui64
;
emberAfGetEui64
(
eui64
);
while
(
eui64
[
0
]
==
0
&&
eui64
[
1
]
==
0
&&
eui64
[
2
]
==
0
&&
cnt
++
<
3
){
sleep
(
1
);
}
if
(
eui64
[
0
]
==
0
&&
eui64
[
1
]
==
0
&&
eui64
[
2
]
==
0
){
printf
(
"get gw mac error !!!
\n
"
);
return
NULL
;
}
rpc_eui64ToString
(
eui64
,
g_mac
);
return
g_mac
;
}
int
search_ccu
(
char
devcode
[
33
],
char
ip
[
16
],
int
*
port
){
int
search_ccu
(
char
devcode
[
33
],
char
ip
[
16
],
int
*
port
){
...
@@ -297,13 +283,7 @@ int search_ccu(char devcode[33], char ip[16], int* port){
...
@@ -297,13 +283,7 @@ int search_ccu(char devcode[33], char ip[16], int* port){
struct
sockaddr_in
Addrto
;
struct
sockaddr_in
Addrto
;
struct
sockaddr_in
AddrRev
;
struct
sockaddr_in
AddrRev
;
char
*
macString
=
kk_get_gw_mac
();
sprintf
(
sendMessage
,
sendCmdFmt
,
GW_DEVICE_CODE
,
GW2CCU_PROTOCOL
);
if
(
macString
==
NULL
){
printf
(
"[%s] get mac fail
\n
"
,
__FUNCTION__
);
return
-
1
;
}
sprintf
(
sendMessage
,
sendCmdFmt
,
macString
/*GW_DEVICE_CODE*/
,
GW2CCU_PROTOCOL
);
if
((
sock
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
if
((
sock
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
{
{
printf
(
"[%s] socket fail
\n
"
,
__FUNCTION__
);
printf
(
"[%s] socket fail
\n
"
,
__FUNCTION__
);
...
@@ -451,12 +431,7 @@ void* _msg_topo_add(){
...
@@ -451,12 +431,7 @@ void* _msg_topo_add(){
char
msgFmt
[]
=
"{
\"
info
\"
:{
\"
msgtype
\"
:
\"
/thing/topo/add
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
deviceCode
\"
:
\"
%s
\"
},\
char
msgFmt
[]
=
"{
\"
info
\"
:{
\"
msgtype
\"
:
\"
/thing/topo/add
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
deviceCode
\"
:
\"
%s
\"
},\
\"
payload
\"
:{
\"
msgId
\"
:
\"
%d
\"
,
\"
version
\"
:
\"
1.0
\"
,
\"
params
\"
:{
\"
deviceCode
\"
:
\"
%s
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
mac
\"
:
\"
%s
\"
}}}"
;
\"
payload
\"
:{
\"
msgId
\"
:
\"
%d
\"
,
\"
version
\"
:
\"
1.0
\"
,
\"
params
\"
:{
\"
deviceCode
\"
:
\"
%s
\"
,
\"
productCode
\"
:
\"
%s
\"
,
\"
mac
\"
:
\"
%s
\"
}}}"
;
char
msg
[
520
]
=
{
0
};
char
msg
[
520
]
=
{
0
};
char
*
macString
=
kk_get_gw_mac
();
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
GW_DEVICE_CODE
,
1
,
GW_DEVICE_CODE
,
GW_PRODUCT_CODE
,
GW_MAC
);
if
(
macString
==
NULL
){
printf
(
"[%s] get mac fail
\n
"
,
__FUNCTION__
);
return
NULL
;
}
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
macString
,
1
,
macString
/*GW_DEVICE_CODE*/
,
GW_PRODUCT_CODE
,
macString
);
cJSON
*
msgObj
=
cJSON_Parse
(
msg
);
cJSON
*
msgObj
=
cJSON_Parse
(
msg
);
char
*
outbuf
=
cJSON_Print
(
msgObj
);
char
*
outbuf
=
cJSON_Print
(
msgObj
);
cJSON_Delete
(
msgObj
);
cJSON_Delete
(
msgObj
);
...
@@ -472,14 +447,8 @@ void* _msg_event_property_post(char ip[16], int port){
...
@@ -472,14 +447,8 @@ void* _msg_event_property_post(char ip[16], int port){
\"
time
\"
:1524448722000,
\"
method
\"
:
\"
thing.event.property.post
\"
}\
\"
time
\"
:1524448722000,
\"
method
\"
:
\"
thing.event.property.post
\"
}\
}"
;
}"
;
char
msg
[
620
]
=
{
0
};
char
msg
[
620
]
=
{
0
};
char
*
macString
=
kk_get_gw_mac
();
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
GW_DEVICE_CODE
,
if
(
macString
==
NULL
){
1
,
0
,
0
,
0
,
"12345"
,
ip
,
GW_MAC
,
port
);
printf
(
"[%s] get mac fail
\n
"
,
__FUNCTION__
);
return
NULL
;
}
sprintf
(
msg
,
msgFmt
,
GW_PRODUCT_CODE
,
macString
/*GW_DEVICE_CODE*/
,
1
,
0
,
0
,
0
,
"12345"
,
ip
,
macString
,
port
);
cJSON
*
msgObj
=
cJSON_Parse
(
msg
);
cJSON
*
msgObj
=
cJSON_Parse
(
msg
);
char
*
outbuf
=
cJSON_Print
(
msgObj
);
char
*
outbuf
=
cJSON_Print
(
msgObj
);
cJSON_Delete
(
msgObj
);
cJSON_Delete
(
msgObj
);
...
@@ -495,16 +464,11 @@ void ipcHandle(void)
...
@@ -495,16 +464,11 @@ void ipcHandle(void)
int
port
=
0
;
int
port
=
0
;
emberAfAppPrint
(
"Thread rpc Interface Parse create
\n
"
);
emberAfAppPrint
(
"Thread rpc Interface Parse create
\n
"
);
search_ccu
(
deviceCode
,
ip
,
&
port
);
search_ccu
(
deviceCode
,
ip
,
&
port
);
char
*
macString
=
kk_get_gw_mac
();
if
(
macString
==
NULL
){
printf
(
"[%s] get mac fail, exit pthread !!!!!!!!!!!!!!!!!
\n
"
,
__FUNCTION__
);
return
;
}
_init_param
(
&
my_server
);
_init_param
(
&
my_server
);
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
==
0
){
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
==
0
){
kk_tcp_client_init
(
ip
,
port
,
_cb
);
kk_tcp_client_init
(
ip
,
port
,
_cb
);
}
else
{
}
else
{
kk_ipc_init
(
IPC_PLAT2MID
,
_cb
,
macString
/*GW_DEVICE_CODE*/
,
ip
);
kk_ipc_init
(
IPC_PLAT2MID
,
_cb
,
GW_DEVICE_CODE
,
ip
);
}
}
emberAfAppPrint
(
"sizeof(rpc_table)=%d,sizeof(rpc_table_s)=%d,%d
\n
"
,
sizeof
(
rpc_table
),
sizeof
(
rpc_table_s
),
sizeof
(
rpc_table
)
/
sizeof
(
rpc_table_s
));
emberAfAppPrint
(
"sizeof(rpc_table)=%d,sizeof(rpc_table_s)=%d,%d
\n
"
,
sizeof
(
rpc_table
),
sizeof
(
rpc_table_s
),
sizeof
(
rpc_table
)
/
sizeof
(
rpc_table_s
));
...
@@ -515,11 +479,6 @@ void ipcHandle(void)
...
@@ -515,11 +479,6 @@ void ipcHandle(void)
//send add gw to ccu
//send add gw to ccu
char
*
outbuf
=
_msg_topo_add
();
char
*
outbuf
=
_msg_topo_add
();
if
(
outbuf
==
NULL
){
printf
(
"[%s] topo add msg failed, exit
\n
"
,
__FUNCTION__
);
return
;
}
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
!=
0
){
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
!=
0
){
printf
(
"check nanomsg is connect(%d)
\n
"
,
kk_ipc_isconnect
(
IPC_PLAT2MID
));
printf
(
"check nanomsg is connect(%d)
\n
"
,
kk_ipc_isconnect
(
IPC_PLAT2MID
));
}
}
...
@@ -534,14 +493,7 @@ void ipcHandle(void)
...
@@ -534,14 +493,7 @@ void ipcHandle(void)
cnt
++
;
cnt
++
;
if
(
cnt
==
2
){
if
(
cnt
==
2
){
sleep
(
1
);
sleep
(
1
);
char
gwIp
[
17
]
=
{
0
};
char
*
postmsg
=
_msg_event_property_post
(
ip
,
port
);
HAL_Get_IP
(
gwIp
,
NULL
);
char
*
postmsg
=
_msg_event_property_post
(
gwIp
,
port
);
if
(
outbuf
==
NULL
){
printf
(
"[%s] property_post msg failed
\n
"
,
__FUNCTION__
);
continue
;
}
kk_sendData2CCU
(
postmsg
,
strlen
(
postmsg
));
kk_sendData2CCU
(
postmsg
,
strlen
(
postmsg
));
free
(
postmsg
);
free
(
postmsg
);
}
}
...
@@ -701,6 +653,7 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
...
@@ -701,6 +653,7 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
uint8_t
*
bufferTemp
;
uint8_t
*
bufferTemp
;
uint8_t
*
bufferPtr
=
buffer
;
uint8_t
*
bufferPtr
=
buffer
;
uint8_t
i
,
bufferSize
,
typeSize
;
uint8_t
i
,
bufferSize
,
typeSize
;
EmberAfAttributeId
attributeId
;
uint8_t
cnt
=
1
;
uint8_t
cnt
=
1
;
uint8_t
Status
;
uint8_t
Status
;
kk_print_debug
(
"
\n
********************read attributes response callback**********************
\n
"
);
kk_print_debug
(
"
\n
********************read attributes response callback**********************
\n
"
);
...
@@ -735,6 +688,7 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
...
@@ -735,6 +688,7 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
for
(
i
=
0
;
i
<
bufLen
;
)
{
for
(
i
=
0
;
i
<
bufLen
;
)
{
Status
=
bufferPtr
[
2
];
Status
=
bufferPtr
[
2
];
if
(
Status
==
EMBER_ZCL_STATUS_SUCCESS
){
if
(
Status
==
EMBER_ZCL_STATUS_SUCCESS
){
if
(
emberAfIsStringAttributeType
(
bufferPtr
[
3
])){
if
(
emberAfIsStringAttributeType
(
bufferPtr
[
3
])){
bufferSize
=
bufferPtr
[
4
];
bufferSize
=
bufferPtr
[
4
];
...
@@ -760,10 +714,11 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
...
@@ -760,10 +714,11 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
bufferTemp
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_LOW_BITS
],
bufferTemp
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_LOW_BITS
],
bufferTemp
[
ATTRIBUTE_BUFFER_REPORT_DATA_TYPE
]);
bufferTemp
[
ATTRIBUTE_BUFFER_REPORT_DATA_TYPE
]);
attributeId
=
HIGH_LOW_TO_INT
(
bufferTemp
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_HIGH_BITS
],
bufferTemp
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_LOW_BITS
]);
rpc_cJSON_AddStatusToObject
(
item_attr
,
Status
);
rpc_cJSON_AddStatusToObject
(
item_attr
,
Status
);
EmberAfAttributeId
attributeId
=
HIGH_LOW_TO_INT
(
bufferTemp
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_HIGH_BITS
],
bufferTemp
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_LOW_BITS
]);
rpc_cJSON_AddAttributeToObject
(
item_attr
,
attributeId
);
rpc_cJSON_AddAttributeToObject
(
item_attr
,
attributeId
);
rpc_cJSON_AddDataTypeToObject
(
item_attr
,
bufferTemp
[
3
]);
rpc_cJSON_AddDataTypeToObject
(
item_attr
,
bufferTemp
[
3
]);
...
@@ -773,13 +728,28 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
...
@@ -773,13 +728,28 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
uint8_t
*
dataPtr
=
&
bufferTemp
[
ATTRIBUTE_BUFFER_REPORT_DATA_TYPE
+
1
+
1
+
typeSize
];
uint8_t
*
dataPtr
=
&
bufferTemp
[
ATTRIBUTE_BUFFER_REPORT_DATA_TYPE
+
1
+
1
+
typeSize
];
rpc_cJSON_AddDataToObject
(
item_attr
,
dataPtr
,
dataLen
);
rpc_cJSON_AddDataToObject
(
item_attr
,
dataPtr
,
dataLen
);
//rpc_read_response_process_callback(nodeId,ep,clusterId,attributeId,bufferPtr[3],dataLen,dataPtr);
kk_read_attr_response
(
nodeId
,
ep
,
clusterId
,
attributeId
,
EMBER_ZCL_STATUS_SUCCESS
,
bufferPtr
[
3
],
dataLen
,
dataPtr
);
free
(
bufferTemp
);
free
(
bufferTemp
);
}
else
{
}
else
{
rpc_cJSON_AddStatusToObject
(
item_attr
,
Status
);
rpc_cJSON_AddStatusToObject
(
item_attr
,
Status
);
bufferSize
+=
2
;
bufferSize
+=
2
;
emberAfAppPrintln
(
"Status=%d
\n
"
,
Status
);
emberAfAppPrintln
(
"Status=%d
\n
"
,
Status
);
attributeId
=
HIGH_LOW_TO_INT
(
bufferPtr
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_HIGH_BITS
],
bufferPtr
[
ATTRIBUTE_BUFFER_ATTRIBUTEID_LOW_BITS
]);
kk_read_attr_response
(
nodeId
,
ep
,
clusterId
,
attributeId
,
Status
,
0
,
0
,
NULL
);
}
}
i
=
i
+
bufferSize
;
i
=
i
+
bufferSize
;
}
}
...
@@ -791,7 +761,7 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
...
@@ -791,7 +761,7 @@ bool rpc_ReadAttributesResponseCallback(EmberAfClusterId clusterId,
static
cJSON
*
rpc_reportDeviceState
(
char
*
state
,
EmberEUI64
eui64
)
cJSON
*
rpc_reportDeviceState
(
char
*
state
,
EmberEUI64
eui64
)
{
{
char
euiString
[
RPC_EUI64_STRING_LENGTH
]
=
{
0
};
char
euiString
[
RPC_EUI64_STRING_LENGTH
]
=
{
0
};
cJSON
*
stateJSON
;
cJSON
*
stateJSON
;
...
@@ -826,20 +796,7 @@ void emberAfPluginDeviceTableStateChangeCallback(EmberNodeId nodeId,
...
@@ -826,20 +796,7 @@ void emberAfPluginDeviceTableStateChangeCallback(EmberNodeId nodeId,
}
}
void
emberAfPluginDeviceTableRejoinDeviceCallback
(
EmberEUI64
nodeEui64
)
{
uint16_t
deviceTableIndex
=
emberAfDeviceTableGetFirstIndexFromEui64
(
nodeEui64
);
if
(
deviceTableIndex
==
EMBER_AF_PLUGIN_DEVICE_TABLE_NULL_INDEX
){
return
;
}
EmberAfPluginDeviceTableEntry
*
deviceTable
=
emberAfDeviceTablePointer
();
cJSON
*
nodeJson
=
rpc_reportDeviceState
(
"rejoin"
,
deviceTable
[
deviceTableIndex
].
eui64
);
rpc_printfJSON
(
"rejoin"
,
nodeJson
);
//rpc_send_message(nodeJson,"device rejoin");
kk_rpc_reportDevices
(
deviceTable
[
deviceTableIndex
].
eui64
);
}
void
emberAfPluginDeviceTableDeviceLeftCallback
(
EmberEUI64
nodeEui64
)
void
emberAfPluginDeviceTableDeviceLeftCallback
(
EmberEUI64
nodeEui64
)
{
{
...
...
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_onoff.c
View file @
64166551
...
@@ -2,120 +2,6 @@
...
@@ -2,120 +2,6 @@
#include "rpc_onoff.h"
#include "rpc_onoff.h"
EmberStatus
WindowCover_UpOpen
(
uint16_t
node
,
uint8_t
ep
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_WINDOW_COVERING_UP_OPEN_COMMAND_ID
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[Up/Open]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
WindowCover_DownClose
(
uint16_t
node
,
uint8_t
ep
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_WINDOW_COVERING_DOWN_CLOSE_COMMAND_ID
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[Down/Close]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
WindowCover_Stop
(
uint16_t
node
,
uint8_t
ep
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_WINDOW_COVERING_STOP_COMMAND_ID
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[Stop]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
WindowCover_GotoLiftPercentage
(
uint16_t
node
,
uint8_t
ep
,
uint8_t
position
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_WINDOW_COVERING_CLUSTER_ID
,
ZCL_WINDOW_COVERING_GO_TO_LIFT_PERCENTAGE_COMMAND_ID
);
zclBufferAddByte
(
position
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[GotoLiftPercentage]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
zclOnOff_On
(
uint16_t
node
,
uint8_t
ep
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_ON_COMMAND_ID
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[On]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
zclOnOff_Off
(
uint16_t
node
,
uint8_t
ep
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_OFF_COMMAND_ID
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[Off]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
zclOnOff_Toggle
(
uint16_t
node
,
uint8_t
ep
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_TOGGLE_COMMAND_ID
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[Toggle]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
zclOnOff_OffWithEffect
(
uint16_t
node
,
uint8_t
ep
,
uint8_t
id
,
uint8_t
var
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_OFF_WITH_EFFECT_COMMAND_ID
);
zclBufferAddByte
(
id
);
zclBufferAddByte
(
var
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[off with effect]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
zclOnOff_OnWithRecallGlobalScene
(
uint16_t
node
,
uint8_t
ep
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_ON_WITH_RECALL_GLOBAL_SCENE_COMMAND_ID
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[On with recall global scene]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
EmberStatus
zclOnOff_OnWithTimedOff
(
uint16_t
node
,
uint8_t
ep
,
uint8_t
Control
,
uint16_t
OnTime
,
uint16_t
OffWaitTime
)
{
EmberStatus
status
;
zcl_clu_client_cmd_buffer_setup
(
ZCL_ON_OFF_CLUSTER_ID
,
ZCL_ON_WITH_TIMED_OFF_COMMAND_ID
);
zclBufferAddByte
(
Control
);
zclBufferAddWord
(
OnTime
);
zclBufferAddWord
(
OffWaitTime
);
status
=
rpcSendCommand
(
node
,
1
,
ep
,
false
);
kk_print_debug
(
"[on with timed off]node=0x%02X,ep=%d,status=0x%02X
\n
"
,
node
,
ep
,
status
);
return
status
;
}
cJSON
*
rpc_zclOnOff_On
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
)
cJSON
*
rpc_zclOnOff_On
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
)
...
...
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
View file @
64166551
...
@@ -87,7 +87,7 @@ void kk_read_ncp_configuration_without_memory_allocation(void)
...
@@ -87,7 +87,7 @@ void kk_read_ncp_configuration_without_memory_allocation(void)
extern
void
kk_print_device_table
(
void
);
extern
void
kk_print_device_table
(
void
);
extern
void
kk_device_table_add
(
EmberEUI64
mac
,
uint8_t
epNum
,
uint8_t
*
epVal
,
char
*
productCode
);
//
extern void kk_device_table_add(EmberEUI64 mac,uint8_t epNum,uint8_t* epVal,char *productCode);
extern
void
kk_device_table_delete
(
EmberEUI64
mac
);
extern
void
kk_device_table_delete
(
EmberEUI64
mac
);
extern
bool
kk_device_find_by_mac11111
(
EmberEUI64
mac
);
extern
bool
kk_device_find_by_mac11111
(
EmberEUI64
mac
);
...
@@ -109,7 +109,7 @@ void kk_message_process(char *messageString)
...
@@ -109,7 +109,7 @@ void kk_message_process(char *messageString)
static
uint8_t
aaa
=
0x00
;
static
uint8_t
aaa
=
0x00
;
EmberEUI64
mac
=
{
0x00
,
0x11
,
0x22
,
0x33
,
0x44
,
0x55
,
0x66
,
0x77
};
EmberEUI64
mac
=
{
0x00
,
0x11
,
0x22
,
0x33
,
0x44
,
0x55
,
0x66
,
0x77
};
mac
[
0
]
=++
aaa
;
mac
[
0
]
=++
aaa
;
kk_device_table_add
(
mac
,
2
,
ep
,
"24"
);
//
kk_device_table_add(mac,2,ep,"24");
}
}
if
(
MEMCOMPARE
(
messageString
,
"AT+456
\r\n
"
,
len
)
==
0
){
if
(
MEMCOMPARE
(
messageString
,
"AT+456
\r\n
"
,
len
)
==
0
){
uint8_t
ep
[
2
]
=
{
1
,
242
};
uint8_t
ep
[
2
]
=
{
1
,
242
};
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ias-zone-client/ias-zone-client.c
View file @
64166551
...
@@ -425,6 +425,9 @@ static void checkForIasZoneServer(EmberNodeId emberNodeId, uint8_t* ieeeAddress)
...
@@ -425,6 +425,9 @@ static void checkForIasZoneServer(EmberNodeId emberNodeId, uint8_t* ieeeAddress)
}
}
}
}
extern
void
kk_device_joined
(
EmberNodeId
node
);
void
emberAfPluginIasZoneClientZdoMessageReceivedCallback
(
EmberNodeId
emberNodeId
,
void
emberAfPluginIasZoneClientZdoMessageReceivedCallback
(
EmberNodeId
emberNodeId
,
EmberApsFrame
*
apsFrame
,
EmberApsFrame
*
apsFrame
,
uint8_t
*
message
,
uint8_t
*
message
,
...
...
platform/zigbee/protocol/zigbee/app/framework/util/af-main-host.c
View file @
64166551
...
@@ -542,7 +542,7 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
...
@@ -542,7 +542,7 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
emberAfGetEui64
(
eui64
);
emberAfGetEui64
(
eui64
);
emberAfCorePrintln
(
"~~~~~~~~~~~~~~~~~~~~~NCP MAC:"
);
emberAfCorePrintln
(
"~~~~~~~~~~~~~~~~~~~~~NCP MAC:"
);
emberAfPrintBigEndianEui64
(
eui64
);
emberAfPrintBigEndianEui64
(
eui64
);
//kk_network_check();
pthread_t
tid
;
pthread_t
tid
;
...
@@ -551,22 +551,16 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
...
@@ -551,22 +551,16 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
// initialize the ZCL framework ,(plug in) ,mqtt init is here
// initialize the ZCL framework ,(plug in) ,mqtt init is here
emAfInit
();
emAfInit
();
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
COMMAND_READER_INIT
();
COMMAND_READER_INIT
();
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
EmberNetworkStatus
Status
=
ezspNetworkState
();
EmberNetworkStatus
Status
=
ezspNetworkState
();
kk_print
(
"ezspNetworkState()~~~~~~[%d]
\r\n
"
,
Status
);
kk_print
(
"ezspNetworkState()~~~~~~[%d]
\r\n
"
,
Status
);
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
// main loop
// main loop
while
(
true
)
{
while
(
true
)
{
halResetWatchdog
();
// Periodically reset the watchdog.
halResetWatchdog
();
// Periodically reset the watchdog.
printf
(
"[%s][%d]
\n
"
,
__FUNCTION__
,
__LINE__
);
// see if the NCP has anything waiting to send us
// see if the NCP has anything waiting to send us
ezspTick
();
ezspTick
();
...
...
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