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
66466c28
Commit
66466c28
authored
Sep 16, 2020
by
尹佳钦
Browse files
Options
Browse Files
Download
Plain Diff
本地合并
parents
2b6abaf8
09d6f4ff
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
1267 additions
and
863 deletions
+1267
-863
platform/zigbee/app/builder/Z3GatewayHost/Makefile
platform/zigbee/app/builder/Z3GatewayHost/Makefile
+5
-4
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3001.json
...uilder/Z3GatewayHost/ZB/dev_config_table/device_3001.json
+21
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3002.json
...uilder/Z3GatewayHost/ZB/dev_config_table/device_3002.json
+21
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3003.json
...uilder/Z3GatewayHost/ZB/dev_config_table/device_3003.json
+28
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
+564
-323
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
...m/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
+7
-14
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_table_db.c
.../zigbee/app/builder/Z3GatewayHost/ZB/kk_device_table_db.c
+0
-16
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_table_db.h
.../zigbee/app/builder/Z3GatewayHost/ZB/kk_device_table_db.h
+57
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.c
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.c
+114
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.h
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.h
+49
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_palt_ota.c
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_palt_ota.c
+15
-4
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
+156
-94
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.h
...bee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.h
+12
-4
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
+46
-341
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
...zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
+5
-10
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zb_com.h
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zb_com.h
+56
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.c
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.c
+21
-0
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
+35
-0
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
+1
-7
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
+5
-11
platform/zigbee/app/builder/Z3GatewayHost/libsqlite_ubuntu.a
platform/zigbee/app/builder/Z3GatewayHost/libsqlite_ubuntu.a
+0
-0
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
...p/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
+2
-1
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
+1
-33
platform/zigbee/makefile
platform/zigbee/makefile
+6
-0
platform/zigbee/protocol/zigbee/app/framework/plugin/device-table/device-table.c
...l/zigbee/app/framework/plugin/device-table/device-table.c
+1
-1
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server.c
...tocol/zigbee/app/framework/plugin/ota-server/ota-server.c
+39
-0
testgit.txt
testgit.txt
+0
-0
No files found.
platform/zigbee/app/builder/Z3GatewayHost/Makefile
View file @
66466c28
...
@@ -87,7 +87,7 @@ INCLUDES= \
...
@@ -87,7 +87,7 @@ INCLUDES= \
-I
./../../../platform/base/hal/micro/unix/host
\
-I
./../../../platform/base/hal/micro/unix/host
\
-I
../../../platform/base/hal/micro/unix/host/board
\
-I
../../../platform/base/hal/micro/unix/host/board
\
-I
./rpc_api/inc
\
-I
./rpc_api/inc
\
-I
../../../../../common/
curl/include
\
-I
../../../../../common/
sqlite/
\
-I
./ZB
-I
./ZB
\
\
...
@@ -285,7 +285,8 @@ APPLICATION_FILES= \
...
@@ -285,7 +285,8 @@ APPLICATION_FILES= \
./ZB/kk_zigbee_api.c
\
./ZB/kk_zigbee_api.c
\
./ZB/kk_tsl_property_report.c
\
./ZB/kk_tsl_property_report.c
\
./ZB/kk_tsl_property_set.c
\
./ZB/kk_tsl_property_set.c
\
./ZB/kk_palt_ota.c
\
./ZB/kk_device_table_db.c
\
./ZB/kk_msg_report.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
\
...
@@ -375,10 +376,10 @@ $(TARGET_FILE): $(APPLICATION_OBJECTS) $(LIBRARIES)
...
@@ -375,10 +376,10 @@ $(TARGET_FILE): $(APPLICATION_OBJECTS) $(LIBRARIES)
else
else
$(TARGET_FILE)
:
$(APPLICATION_OBJECTS) $(LIBRARIES)
$(TARGET_FILE)
:
$(APPLICATION_OBJECTS) $(LIBRARIES)
ifeq
($(CONFIG_VENDOR),ubuntu)
ifeq
($(CONFIG_VENDOR),ubuntu)
$(LD)
$^
$(LINKER_FLAGS)
-lm
-L
.
-lapi_com_ubuntu
-lnanomsg_ubuntu
-lanl
-pthread
-lev_ubuntu
-lkk_hal_ubuntu
-
L
../../../../../common/curl
-lcurl_ubuntu
-o
$(TARGET_FILE)
$(LD)
$^
$(LINKER_FLAGS)
-lm
-L
.
-lapi_com_ubuntu
-lnanomsg_ubuntu
-lanl
-pthread
-lev_ubuntu
-lkk_hal_ubuntu
-
lsqlite_ubuntu
-ldl
-o
$(TARGET_FILE)
@
echo
-e
'\n$@ build success'
@
echo
-e
'\n$@ build success'
else
else
$(LD)
$^
$(LINKER_FLAGS)
-lm
-L
.
-lapi_com
-lnanomsg
-lanl
-pthread
-lev
-lkk_hal
-
L
../../../../../common/curl
-lcurl
-o
$(TARGET_FILE)
$(LD)
$^
$(LINKER_FLAGS)
-lm
-L
.
-lapi_com
-lnanomsg
-lanl
-pthread
-lev
-lkk_hal
-
lsqlite
-o
$(TARGET_FILE)
@
echo
-e
'\n$@ build success'
@
echo
-e
'\n$@ build success'
endif
endif
endif
endif
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3001.json
0 → 100644
View file @
66466c28
{
"productCode"
:
"3001"
,
"config"
:[
{
"identity"
:
"PowerSwitch_1"
,
"endpoint"
:
18
,
"cluster"
:
"0x0011"
,
"attribute"
:
"0x0022"
,
"reportFunc"
:
"A"
,
"controlFunc"
:
"B"
},{
"identity"
:
"PowerSwitch_2"
,
"endpoint"
:
19
,
"cluster"
:
"0x0033"
,
"attribute"
:
"0x0044"
,
"reportFunc"
:
"C"
,
"controlFunc"
:
"D"
}
]
}
\ No newline at end of file
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3002.json
0 → 100644
View file @
66466c28
{
"productCode"
:
"3002"
,
"config"
:[
{
"identity"
:
"AAA"
,
"endpoint"
:
11
,
"cluster"
:
"0x1111"
,
"attribute"
:
"0x2222"
,
"reportFunc"
:
"zclOnOff_On"
,
"controlFunc"
:
"zclOnOff_On"
},{
"identity"
:
"BBB"
,
"endpoint"
:
22
,
"cluster"
:
"0x3333"
,
"attribute"
:
"0x4444"
,
"reportFunc"
:
"zclOnOff_Off"
,
"controlFunc"
:
"zclOnOff_Off"
}
]
}
\ No newline at end of file
platform/zigbee/app/builder/Z3GatewayHost/ZB/dev_config_table/device_3003.json
0 → 100644
View file @
66466c28
{
"productCode"
:
"3003"
,
"config"
:[
{
"identity"
:
"AAA"
,
"endpoint"
:
11
,
"cluster"
:
"0x1111"
,
"attribute"
:
"0x2222"
,
"reportFunc"
:
"zclOnOff_On"
,
"controlFunc"
:
"zclOnOff_On"
},{
"identity"
:
"BBB"
,
"endpoint"
:
22
,
"cluster"
:
"0x3333"
,
"attribute"
:
"0x4444"
,
"reportFunc"
:
"zclOnOff_Off"
,
"controlFunc"
:
"zclOnOff_Off"
},{
"identity"
:
"CCCC"
,
"endpoint"
:
33
,
"cluster"
:
"0x5555"
,
"attribute"
:
"0x6666"
,
"reportFunc"
:
"zclOnOff_Off"
,
"controlFunc"
:
"zclOnOff_Off"
}
]
}
\ No newline at end of file
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.c
View file @
66466c28
This diff is collapsed.
Click to expand it.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_manager.h
View file @
66466c28
...
@@ -4,33 +4,22 @@
...
@@ -4,33 +4,22 @@
#include "kk_sub_tsl.h"
#include "kk_sub_tsl.h"
#include "kk_tsl_zigbee_map.h"
#include "kk_tsl_zigbee_map.h"
#include "kk_product_code.h"
#include "kk_product_code.h"
#include "kk_zb_com.h"
/****************** ******************************************************************
/****************** ******************************************************************
* File Name : kk_device_manager.h
* File Name : kk_device_manager.h
* Author : yjq
* Author : yjq
* data : 2020/09/01
* data : 2020/09/01
*************************************************************************************/
*************************************************************************************/
typedef
struct
kk_device_table_s
{
EmberEUI64
mac
;
EmberNodeId
nodeId
;
uint16_t
deviceId
;
uint16_t
identifyCnt
;
char
productCode
[
33
];
struct
kk_device_table_s
*
next
;
}
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
#define KK_MAX_READ_MODLE_ID_COUNT 30
#define KK_NETWORK_PARAMETER_TX_POWER 10
#define KK_NETWORK_PARAMETER_TX_POWER 10
#define KK_NETWORK_PARAMETER_CHANNEL 0x0B
#define KK_NETWORK_PARAMETER_CHANNEL 0x0B
void
kk_print_device_table
(
void
);
kk_device_table_s
*
kk_device_find_by_mac
(
EmberEUI64
mac
);
void
kk_device_table_add
(
EmberEUI64
mac
,
EmberNodeId
nodeId
,
const
char
*
productCode
,
uint16_t
deviceId
);
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_productCode_tick
();
void
kk_read_attr_response
(
EmberNodeId
nodeId
,
void
kk_read_attr_response
(
EmberNodeId
nodeId
,
...
@@ -47,8 +36,12 @@ int kk_permit_join(jrpc_context * ctx,EmberNodeId node,unsigned char ep,void* da
...
@@ -47,8 +36,12 @@ int kk_permit_join(jrpc_context * ctx,EmberNodeId node,unsigned char ep,void* da
void
kk_load_dev_map_table
(
void
);
void
kk_add_dev_map_table_to_list
(
cJSON
*
root
);
char
*
kk_match_productCode
(
const
char
*
modelId
);
bool
kk_device_config_map_add
(
const
char
*
productCode
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_table_db.c
View file @
66466c28
...
@@ -529,19 +529,3 @@ void kk_device_config_load_from_db(void)
...
@@ -529,19 +529,3 @@ void kk_device_config_load_from_db(void)
}
}
void
emberAfPluginDeviceTableInitialized
(
void
)
{
kk_device_db_load
();
kk_print_device_table
();
kk_load_dev_map_table
();
kk_device_map_print
();
kk_device_config_load_from_db
();
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_device_table_db.h
0 → 100644
View file @
66466c28
#ifndef __KK_DEVICE_TABLE_DB_H
#define __KK_DEVICE_TABLE_DB_H
#include "kk_zb_com.h"
#include "kk_test.h"
#define KK_MAX_PRODUCT_CODE_SIZE 33
#define KK_DEVICE_DB_TABLE "kk_device"
#define KK_DEVICE_DB_FILE "kk_device.db"
void
kk_device_db_init
(
void
);
void
kk_device_db_insert
(
EmberEUI64
mac
,
EmberNodeId
nodeId
,
uint16_t
deviceId
,
char
*
productCode
);
void
kk_device_db_delete
(
EmberEUI64
mac
);
void
kk_device_db_update
(
EmberEUI64
mac
,
EmberNodeId
nodeId
,
uint16_t
deviceId
,
char
*
productCode
);
bool
kk_device_db_check
(
EmberEUI64
mac
);
int
kk_device_db_get_num
();
kk_device_table_s
*
kk_get_device_table_pointer
(
void
);
void
kk_print_device_table
(
void
);
char
*
kk_device_find_productCode
(
EmberEUI64
mac
);
kk_device_table_s
*
kk_device_find_by_mac
(
EmberEUI64
mac
);
void
kk_device_table_add
(
EmberEUI64
mac
,
EmberNodeId
nodeId
,
const
char
*
productCode
,
uint16_t
deviceId
);
void
kk_device_table_delete
(
EmberEUI64
mac
);
void
kk_add_device_to_table
(
EmberEUI64
mac
,
EmberNodeId
nodeId
,
uint16_t
deviceId
);
#endif
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.c
0 → 100644
View file @
66466c28
#include "kk_msg_report.h"
static
void
kk_msg_report
(
cJSON
*
data
,
char
*
msgtype
,
char
*
method
,
EmberEUI64
mac
)
{
static
uint16_t
msgid
;
char
msgIdString
[
10
]
=
{
0
};
char
macString
[
19
]
=
{
0
};
sub_dev_node_t
*
node
=
NULL
;
int
res
=
0
;
rpc_eui64ToString
(
mac
,
macString
);
res
=
kk_sub_tsl_get_device_by_mac
(
macString
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
printf
(
"[%s][%d]kk_rpc_send_message error!!!
\n
"
,
__FUNCTION__
,
__LINE__
);
return
;
}
cJSON
*
info
=
rpc_cJSON_CreateObject
();
if
(
info
!=
NULL
){
rpc_cJSON_AddStringToObject
(
info
,
"msgType"
,
msgtype
);
rpc_cJSON_AddStringToObject
(
info
,
"productCode"
,
node
->
productCode
);
rpc_cJSON_AddStringToObject
(
info
,
"deviceCode"
,
macString
);
}
cJSON
*
payload
=
rpc_cJSON_CreateObject
();
if
(
payload
!=
NULL
){
sprintf
(
msgIdString
,
"%d"
,
++
msgid
);
rpc_cJSON_AddStringToObject
(
payload
,
"msgId"
,
msgIdString
);
rpc_cJSON_AddStringToObject
(
payload
,
"version"
,
KK_IPC_VERSION
);
rpc_cJSON_AddStringToObject
(
payload
,
"method"
,
method
);
rpc_cJSON_AddItemToObject
(
payload
,
"params"
,
data
);
}
cJSON
*
root
=
rpc_cJSON_CreateObject
();
if
(
root
!=
NULL
){
rpc_cJSON_AddItemToObject
(
root
,
"info"
,
info
);
rpc_cJSON_AddItemToObject
(
root
,
"payload"
,
payload
);
}
char
*
p
=
rpc_cJSON_Print
(
root
);
emberAfAppPrintln
(
"send json:
\n
%s
\n
"
,
p
);
free
(
p
);
jrpc_send_msg
(
root
);
rpc_cJSON_Delete
(
root
);
}
static
void
kk_msg_report_joined
(
cJSON
*
data
,
EmberEUI64
mac
)
{
kk_msg_report
(
data
,
KK_REPORT_DEVICE_JOINED_TYPE
,
KK_REPORT_DEVICE_JOINED_METHOD
,
mac
);
}
static
void
kk_msg_report_leave
(
cJSON
*
data
,
EmberEUI64
mac
)
{
kk_msg_report
(
data
,
KK_REPORT_DEVICE_LEFT_TYPE
,
KK_REPORT_DEVICE_LEAVE_METHOD
,
mac
);
}
void
kk_msg_report_property
(
cJSON
*
data
,
EmberEUI64
mac
)
{
kk_msg_report
(
data
,
KK_REPORT_ATTRIBUTE_TYPE
,
KK_REPORT_ATTRIBUTE_METHOD
,
mac
);
}
void
kk_msg_report_dev_joined
(
EmberEUI64
mac
,
const
char
*
productCode
)
{
cJSON
*
devicesJson
;
EmberEUI64
localEui64
=
{
0
};
char
macString
[
KK_EUI64_STRING_LENGTH
]
=
{
0
};
UTIL_LOG_WARNING
(
"report tsl product code:%s
\n
"
,
productCode
);
emberAfDebugPrint
(
"mac:"
);
emberAfPrintBigEndianEui64
(
mac
);
emberAfDebugPrintln
(
""
);
devicesJson
=
rpc_cJSON_CreateObject
();
rpc_eui64ToString
(
mac
,
macString
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productCode"
,
productCode
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceCode"
,
macString
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"mac"
,
macString
);
kk_sub_tsl_add
(
mac
,
productCode
);
emberAfGetEui64
(
localEui64
);
kk_msg_report_joined
(
devicesJson
,
localEui64
);
}
void
kk_msg_report_dev_leave
(
EmberEUI64
mac
)
{
int
res
=
0
;
cJSON
*
devicesJson
;
sub_dev_node_t
*
node
=
NULL
;
EmberEUI64
localEui64
=
{
0
};
char
macString
[
KK_EUI64_STRING_LENGTH
];
rpc_eui64ToString
(
mac
,
macString
);
res
=
kk_sub_tsl_get_device_by_mac
(
macString
,
&
node
);
if
(
res
!=
SUCCESS_RETURN
)
{
emberAfDebugPrintln
(
"[%s][%d]kk msg send error!!!
\n
"
,
__FUNCTION__
,
__LINE__
);
return
;
}
devicesJson
=
rpc_cJSON_CreateObject
();
rpc_cJSON_AddStringToObject
(
devicesJson
,
"productCode"
,
node
->
productCode
);
rpc_cJSON_AddStringToObject
(
devicesJson
,
"deviceCode"
,
macString
);
emberAfGetEui64
(
localEui64
);
kk_msg_report_leave
(
devicesJson
,
localEui64
);
kk_sub_tsl_delete
(
mac
);
kk_device_table_delete
(
mac
);
kk_device_db_delete
(
mac
);
}
int
kk_sendData2CCU
(
char
*
data
,
int
len
)
{
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
==
0
){
kk_tcp_client_send
(
data
,
len
);
}
else
{
kk_ipc_send
(
IPC_PLAT2MID
,
data
,
len
);
}
}
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_msg_report.h
0 → 100644
View file @
66466c28
#ifndef __KK_MSG_REPORT_H
#define __KK_MSG_REPORT_H
#include <stdio.h>
#include "app/framework/include/af.h"
#include ".././jsonrpc/jsonrpc-c.h"
#include ".././jsonrpc/rpccJSON.h"
#include "com_api.h"
#include "kk_zb_com.h"
#include "kk_sub_tsl.h"
#define KK_IPC_VERSION "1.0"
#define KK_REPORT_DEVICE_JOINED_METHOD "thing.topo.add"
#define KK_REPORT_DEVICE_LEAVE_METHOD "thing.topo.delete"
#define KK_REPORT_ATTRIBUTE_METHOD "thing.event.property.post"
#define KK_READ_ATTRIBUTE_METHOD "thing.service.property.get"
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
#define GW2CCU_PROTOCOL "tcp"
int
kk_sendData2CCU
(
char
*
data
,
int
len
);
void
kk_msg_report_dev_leave
(
EmberEUI64
mac
);
void
kk_msg_report_dev_joined
(
EmberEUI64
mac
,
const
char
*
productCode
);
void
kk_msg_report_property
(
cJSON
*
data
,
EmberEUI64
mac
);
#endif
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_palt_ota.c
View file @
66466c28
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "curl.h"
#include "curl.h"
#include "./jsonrpc/rpccJSON.h"
#include "./jsonrpc/rpccJSON.h"
static
int
s_ota_server_init
=
0
;
size_t
kk_write_func
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
)
size_t
kk_write_func
(
void
*
ptr
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
)
{
{
...
@@ -57,6 +58,8 @@ int kk_http_download(char* url, char* filename)
...
@@ -57,6 +58,8 @@ int kk_http_download(char* url, char* filename)
}
}
static
const
char
oatStorageDirectory
[]
=
"ota-files"
;
int
kk_ota_process
(
cJSON
*
root
){
int
kk_ota_process
(
cJSON
*
root
){
cJSON
*
params
;
cJSON
*
params
;
cJSON
*
id
;
cJSON
*
id
;
...
@@ -70,7 +73,9 @@ int kk_ota_process(cJSON* root){
...
@@ -70,7 +73,9 @@ int kk_ota_process(cJSON* root){
int
ret
=
0
;
int
ret
=
0
;
struct
stat
st
;
struct
stat
st
;
int
iFileSize
;
int
iFileSize
;
printf
(
"===============kk_ota_process
\n
"
);
char
fileName
[
100
]
=
{
0
};
info
=
rpc_cJSON_GetObjectItem
(
root
,
"info"
);
info
=
rpc_cJSON_GetObjectItem
(
root
,
"info"
);
if
(
info
!=
NULL
){
if
(
info
!=
NULL
){
...
@@ -79,14 +84,15 @@ int kk_ota_process(cJSON* root){
...
@@ -79,14 +84,15 @@ int kk_ota_process(cJSON* root){
}
}
payload
=
rpc_cJSON_GetObjectItem
(
root
,
"payload"
);
payload
=
rpc_cJSON_GetObjectItem
(
root
,
"payload"
);
if
(
payload
!=
NULL
){
if
(
payload
!=
NULL
){
printf
(
"===============kk_ota_process ===========11111111
\n
"
);
params
=
rpc_cJSON_GetObjectItem
(
payload
,
"data"
);
params
=
rpc_cJSON_GetObjectItem
(
payload
,
"data"
);
//id = rpc_cJSON_GetObjectItem(payload, "msgId");
//id = rpc_cJSON_GetObjectItem(payload, "msgId");
url
=
rpc_cJSON_GetObjectItem
(
params
,
"url"
);
url
=
rpc_cJSON_GetObjectItem
(
params
,
"url"
);
md5
=
rpc_cJSON_GetObjectItem
(
params
,
"md5"
);
md5
=
rpc_cJSON_GetObjectItem
(
params
,
"md5"
);
size
=
rpc_cJSON_GetObjectItem
(
params
,
"size"
);
size
=
rpc_cJSON_GetObjectItem
(
params
,
"size"
);
printf
(
"===============kk_ota_process ===========[%s][%s][%s]
\n
"
,
url
->
valuestring
,
mac
->
valuestring
,
size
->
valuestring
);
printf
(
"===============kk_ota_process ===========[%s][%s][%s]
\n
"
,
url
->
valuestring
,
mac
->
valuestring
,
size
->
valuestring
);
kk_http_download
(
url
->
valuestring
,
mac
->
valuestring
);
sprintf
(
fileName
,
"%s/%s.%s"
,
oatStorageDirectory
,
mac
->
valuestring
,
"ota"
);
kk_http_download
(
url
->
valuestring
,
fileName
);
if
(
stat
(
mac
->
valuestring
,
&
st
))
if
(
stat
(
mac
->
valuestring
,
&
st
))
printf
(
"读取出错!
\n
"
);
printf
(
"读取出错!
\n
"
);
...
@@ -101,7 +107,7 @@ int kk_ota_process(cJSON* root){
...
@@ -101,7 +107,7 @@ int kk_ota_process(cJSON* root){
char
md5str
[
34
]
=
{
0
};
char
md5str
[
34
]
=
{
0
};
FILE
*
fp
;
FILE
*
fp
;
sprintf
(
md5File
,
"%s.md5"
,
mac
->
valuestring
);
sprintf
(
md5File
,
"%s.md5"
,
mac
->
valuestring
);
sprintf
(
cmd
,
"md5sum %s|cut -d
\"
\"
-f1 > %s"
,
mac
->
valuestring
,
md5File
);
sprintf
(
cmd
,
"md5sum %s|cut -d
\"
\"
-f1 > %s"
,
fileName
,
md5File
);
system
(
cmd
);
system
(
cmd
);
...
@@ -124,6 +130,11 @@ int kk_ota_process(cJSON* root){
...
@@ -124,6 +130,11 @@ int kk_ota_process(cJSON* root){
}
}
fclose
(
fp
);
fclose
(
fp
);
remove
(
md5File
);
kk_ota_notify
(
fileName
);
return
ret
;
return
ret
;
}
}
return
-
1
;
return
-
1
;
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.c
View file @
66466c28
This diff is collapsed.
Click to expand it.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_report.h
View file @
66466c28
#ifndef __KK_TSL_PROPERTY_REPORT_H
#ifndef __KK_TSL_PROPERTY_REPORT_H
#define __KK_TSL_PROPERTY_REPORT_H
#define __KK_TSL_PROPERTY_REPORT_H
#include "kk_test.h"
#include "kk_zb_com.h"
#include "kk_msg_report.h"
typedef
enum
{
typedef
enum
{
...
@@ -23,15 +24,22 @@ void kk_tsl_report_attribute(EmberEUI64 eui64,
...
@@ -23,15 +24,22 @@ void kk_tsl_report_attribute(EmberEUI64 eui64,
int
kk_tsl_report_global_onoff
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_global_onoff
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_windowCovering_mode
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_windowCovering_mode
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_windowCovering_position
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_windowCovering_position
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_global_Brightness
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_global_RGB
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_ias_zoneStatus
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_metering_summationDelivered
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_global_Level
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_temperature_measure
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_illuminance_measure
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_local_temperature
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_OccupiedHeatingSetpoint
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_Formaldehyde
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_PM2_5
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
int
kk_tsl_report_CO2
(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.c
View file @
66466c28
This diff is collapsed.
Click to expand it.
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_tsl_property_set.h
View file @
66466c28
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
#define __KK_TSL_PROPERTY_SET_H
#define __KK_TSL_PROPERTY_SET_H
#include "kk_test.h"
#include "kk_test.h"
cJSON
*
kk_topo_change_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
kk_tsl_property_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
cJSON
*
kk_tsl_property_operation
(
jrpc_context
*
ctx
,
cJSON
*
params
,
cJSON
*
id
,
cJSON
*
mac
);
...
@@ -13,14 +11,11 @@ int kk_tsl_set_windowCovering_OperationMode(jrpc_context * ctx,EmberNodeId node,
...
@@ -13,14 +11,11 @@ int kk_tsl_set_windowCovering_OperationMode(jrpc_context * ctx,EmberNodeId node,
int
kk_tsl_set_windowCovering_mode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_mode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_position
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_windowCovering_position
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_colorlight_OnOff
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_colorlight_ModeType
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
#define RPC_KK_TEST_FUNCTION_TABLE \
int
kk_tsl_set_colorlight_Mode
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
{(
rpc_function
*
)
kk_tsl_property_operation
,
"/thing/service/property/set"
}
\
int
kk_tsl_set_colorlight_Brightness
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_colorlight_WhiteBrightness
(
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
);
int
kk_tsl_set_colorlight_RGB_green
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
int
kk_tsl_set_colorlight_RGB_blue
(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zb_com.h
0 → 100644
View file @
66466c28
#ifndef __KK_ZB_COM_H
#define __KK_ZB_COM_H
#include "app/framework/include/af.h"
typedef
struct
kk_device_table_s
{
EmberEUI64
mac
;
EmberNodeId
nodeId
;
uint16_t
deviceId
;
uint16_t
identifyCnt
;
char
productCode
[
33
];
struct
kk_device_table_s
*
next
;
}
kk_device_table_s
;
#define RPC_APPVERSION_STRING_LENGTH 3 //
#define RPC_ENDPOINT_STRING_LENGTH 4 //0-255 + NULL
#define RPC_EUI64_STRING_LENGTH 19 //"0x" + 16 characters + NULL
#define RPC_NODEID_STRING_LENGTH 7 //"0x" + 4 characters + NULL
#define RPC_CLUSTERID_STRING_LENGTH 7 // "0x" + 4 chars + NULL
#define RPC_ATTRIBUTE_STRING_LENGTH 7 // "0x" + 4 chars + NULL
#define RPC_DATATYPE_STRING_LENGTH 4 //0-255 + NULL
#define RPC_LENGTH_STRING_LENGTH 4 //0-255 + NULL
#define RPC_STATUS_STRING_LENGTH 4 //0-255 + NULL
enum
{
WC_normal_dir
=
0
,
//"正转"
WC_reversed_dir
=
1
,
//"反转"
WC_calibration_mode
=
2
,
//"校验"
}
windowCoveringMode
;
#define KK_EUI64_STRING_LENGTH 17 //16 characters + NULL
#define KK_GET_U16( x ) (int16u)( (x[1]<<8)+x[0] )
#define KK_GET_U24( x ) (int32u)( (x[2]<<16)+(x[1]<<8)+x[0] )
#define KK_GET_U32( x ) (int32u)( (x[3]<<24)+(x[2]<<16)+(x[1]<<8)+x[0] )
#define KK_GET_U48( x ) (int64u)( ((int64u)(x[4])<<32)+(x[3]<<24)+(x[2]<<16)+(x[1]<<8)+x[0] )
#endif
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.c
View file @
66466c28
#include "kk_zigbee_api.h"
#include "kk_zigbee_api.h"
kk_rpc_set_api_s
kk_rpc_set_api
[]
=
KK_RPC_SET_FUNCTION_TABLE
;
kk_rpc_report_api_s
kk_rpc_report_api
[]
=
KK_RPC_REPORT_FUNCTION_TABLE
;
void
kk_rpc_test
(
void
)
{
emberAfAppPrintln
(
"!!!!!!!!!!!kk_rpc_test!!!!!!!!!!!!!!"
);
}
uint8_t
kk_get_rpc_set_api_size
(
void
)
{
return
sizeof
(
kk_rpc_set_api
)
/
sizeof
(
kk_rpc_set_api_s
);
}
uint8_t
kk_get_rpc_report_api_size
(
void
)
{
return
sizeof
(
kk_rpc_report_api
)
/
sizeof
(
kk_rpc_report_api_s
);
}
// network leave
// network leave
EmberStatus
kk_network_leave
(
void
)
EmberStatus
kk_network_leave
(
void
)
{
{
...
...
platform/zigbee/app/builder/Z3GatewayHost/ZB/kk_zigbee_api.h
View file @
66466c28
...
@@ -2,6 +2,41 @@
...
@@ -2,6 +2,41 @@
#define __KK_ZIGBEE_API_H
#define __KK_ZIGBEE_API_H
#include "kk_test.h"
#include "kk_test.h"
typedef
int
(
*
kk_rpc_set
)(
jrpc_context
*
ctx
,
EmberNodeId
node
,
unsigned
char
ep
,
void
*
data
);
typedef
int
(
*
kk_rpc_report
)(
EmberEUI64
eui64
,
uint8_t
EP
,
EmberAfClusterId
clusterId
,
EmberAfAttributeId
attributeId
,
uint8_t
dataType
,
uint8_t
len
,
uint8_t
*
data
);
typedef
struct
{
const
char
*
name
;
kk_rpc_set
set
;
}
kk_rpc_set_api_s
;
typedef
struct
{
const
char
*
name
;
kk_rpc_report
report
;
}
kk_rpc_report_api_s
;
void
kk_rpc_test
(
void
);
#define KK_RPC_SET_FUNCTION_TABLE {\
{
"zclOnOff_On"
,
zclOnOff_On
},
\
{
"zclOnOff_Off"
,
zclOnOff_Off
}
\
}
#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_rpc_set_api_s
kk_rpc_set_api
[];
kk_rpc_report_api_s
kk_rpc_report_api
[];
uint8_t
kk_get_rpc_set_api_size
(
void
);
uint8_t
kk_get_rpc_report_api_size
(
void
);
EmberStatus
kk_network_leave
(
void
);
EmberStatus
kk_network_leave
(
void
);
EmberStatus
kk_network_form
(
bool
centralized
,
EmberPanId
panId
,
int8_t
radioTxPower
,
uint8_t
channel
);
EmberStatus
kk_network_form
(
bool
centralized
,
EmberPanId
panId
,
int8_t
radioTxPower
,
uint8_t
channel
);
void
kk_print_network_info
(
void
);
void
kk_print_network_info
(
void
);
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.c
View file @
66466c28
...
@@ -95,13 +95,7 @@ void kk_rpc_reportLeftDevices(EmberEUI64 mac)
...
@@ -95,13 +95,7 @@ void kk_rpc_reportLeftDevices(EmberEUI64 mac)
}
}
int
kk_sendData2CCU
(
char
*
data
,
int
len
){
if
(
strcmp
(
GW2CCU_PROTOCOL
,
"tcp"
)
==
0
){
kk_tcp_client_send
(
data
,
len
);
}
else
{
kk_ipc_send
(
IPC_PLAT2MID
,
data
,
len
);
}
}
void
kk_rpc_reportDevices
(
EmberEUI64
mac
,
const
char
*
productCode
)
void
kk_rpc_reportDevices
(
EmberEUI64
mac
,
const
char
*
productCode
)
{
{
...
...
platform/zigbee/app/builder/Z3GatewayHost/kk_test.h
View file @
66466c28
...
@@ -10,11 +10,13 @@
...
@@ -10,11 +10,13 @@
#include "kk_zigbee_api.h"
#include "kk_zigbee_api.h"
#include "kk_tsl_property_report.h"
#include "kk_tsl_property_report.h"
#include "kk_tsl_property_set.h"
#include "kk_tsl_property_set.h"
#include "kk_msg_report.h"
#include "kk_device_table_db.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"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
#define KK_DEVICE_TOPO_CHANGE_TYPE "/thing/topo/change"
#define KK_IPC_VERSION "1.0"
#define KK_IPC_VERSION "1.0"
#define KK_REPORT_DEVICE_JOINED_METHOD "thing.topo.add"
#define KK_REPORT_DEVICE_JOINED_METHOD "thing.topo.add"
...
@@ -27,8 +29,6 @@
...
@@ -27,8 +29,6 @@
#define TEST_PRODUCT_CODE "24"
#define TEST_PRODUCT_CODE "24"
#define GW2CCU_PROTOCOL "tcp"
#define GW2CCU_PROTOCOL "tcp"
#define MSG_TOPO_CHANGE_TYPE_STR "changeType"
#define MSG_TOPO_CHANGE_DEVICES_STR "devices"
...
@@ -47,8 +47,7 @@ int kk_sendData2CCU(char* data, int len);
...
@@ -47,8 +47,7 @@ int kk_sendData2CCU(char* data, int len);
#define RPC_KK_TEST_FUNCTION_TABLE \
#define RPC_KK_TEST_FUNCTION_TABLE \
{(
rpc_function
*
)
kk_tsl_property_operation
,
"/thing/service/property/set"
},
\
{(
rpc_function
*
)
kk_tsl_property_operation
,
"/thing/service/property/set"
},
\
{(
rpc_function
*
)
kk_tsl_property_operation
,
KK_READ_ATTRIBUTE_METHOD
},
\
{(
rpc_function
*
)
kk_tsl_property_operation
,
KK_READ_ATTRIBUTE_METHOD
}
{(
rpc_function
*
)
kk_topo_change_operation
,
KK_DEVICE_TOPO_CHANGE_TYPE
}
...
@@ -56,11 +55,6 @@ int kk_sendData2CCU(char* data, int len);
...
@@ -56,11 +55,6 @@ int kk_sendData2CCU(char* data, int len);
enum
{
WC_normal_dir
=
0
,
//"正转"
WC_reversed_dir
=
1
,
//"反转"
WC_calibration_mode
=
2
,
//"校验"
}
windowCoveringMode
;
...
...
platform/zigbee/app/builder/Z3GatewayHost/libsqlite_ubuntu.a
0 → 100644
View file @
66466c28
File added
platform/zigbee/app/builder/Z3GatewayHost/rpc_api/src/rpc_interface_parse.c
View file @
66466c28
...
@@ -224,6 +224,7 @@ static int eval_request(struct jrpc_server *server, cJSON *root) {
...
@@ -224,6 +224,7 @@ static int eval_request(struct jrpc_server *server, cJSON *root) {
#define KK_THING_OTA_DEVICE_UPGRADE "/ota/device/upgrade"
#define KK_THING_OTA_DEVICE_UPGRADE "/ota/device/upgrade"
void
_cb
(
void
*
data
,
int
len
,
char
*
chlmark
){
void
_cb
(
void
*
data
,
int
len
,
char
*
chlmark
){
if
(
data
!=
NULL
){
if
(
data
!=
NULL
){
printf
(
"plat_cb: %s RECEIVED
\r\n
"
,
data
);
printf
(
"plat_cb: %s RECEIVED
\r\n
"
,
data
);
...
@@ -237,7 +238,7 @@ void _cb(void* data, int len, char* chlmark){
...
@@ -237,7 +238,7 @@ void _cb(void* data, int len, char* chlmark){
if
(
info
!=
NULL
&&
strstr
(
rpc_cJSON_GetObjectItem
(
info
,
"msgType"
)
->
valuestring
,
KK_THING_OTA_DEVICE_UPGRADE
)
!=
NULL
){
if
(
info
!=
NULL
&&
strstr
(
rpc_cJSON_GetObjectItem
(
info
,
"msgType"
)
->
valuestring
,
KK_THING_OTA_DEVICE_UPGRADE
)
!=
NULL
){
kk_ota_process
(
root
);
//
kk_ota_process(root);
}
else
{
}
else
{
eval_request
(
&
my_server
,
root
);
eval_request
(
&
my_server
,
root
);
}
}
...
...
platform/zigbee/app/builder/Z3GatewayHost/yjq_ezsp.c
View file @
66466c28
...
@@ -86,10 +86,7 @@ void kk_read_ncp_configuration_without_memory_allocation(void)
...
@@ -86,10 +86,7 @@ void kk_read_ncp_configuration_without_memory_allocation(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_delete
(
EmberEUI64
mac
);
extern
bool
kk_device_find_by_mac11111
(
EmberEUI64
mac
);
extern
void
kk_print_network_info
(
void
);
extern
void
kk_print_network_info
(
void
);
void
kk_message_process
(
char
*
messageString
)
void
kk_message_process
(
char
*
messageString
)
...
@@ -102,35 +99,6 @@ void kk_message_process(char *messageString)
...
@@ -102,35 +99,6 @@ void kk_message_process(char *messageString)
emberAfAppPrint
(
"set txpower = 10
\r\n
"
);
emberAfAppPrint
(
"set txpower = 10
\r\n
"
);
setTxPower
(
10
);
setTxPower
(
10
);
}
}
if
(
MEMCOMPARE
(
messageString
,
"AT+123
\r\n
"
,
len
)
==
0
){
kk_print_device_table
();
}
if
(
MEMCOMPARE
(
messageString
,
"AT+KKTEST1
\r\n
"
,
len
)
==
0
){
uint8_t
ep
[
2
]
=
{
1
,
242
};
static
uint8_t
aaa
=
0x00
;
EmberEUI64
mac
=
{
0x00
,
0x11
,
0x22
,
0x33
,
0x44
,
0x55
,
0x66
,
0x77
};
mac
[
0
]
=++
aaa
;
//kk_device_table_add(mac,2,ep,"24");
}
if
(
MEMCOMPARE
(
messageString
,
"AT+456
\r\n
"
,
len
)
==
0
){
uint8_t
ep
[
2
]
=
{
1
,
242
};
static
uint8_t
aaa
=
0x01
;
EmberEUI64
mac
=
{
0x00
,
0x11
,
0x22
,
0x33
,
0x44
,
0x55
,
0x66
,
0x77
};
mac
[
0
]
=
aaa
++%
5
;
kk_device_table_delete
(
mac
);
}
if
(
MEMCOMPARE
(
messageString
,
"AT+678
\r\n
"
,
len
)
==
0
){
uint8_t
ep
[
2
]
=
{
1
,
242
};
EmberEUI64
mac
=
{
0x01
,
0x11
,
0x22
,
0x33
,
0x44
,
0x55
,
0x66
,
0x77
};
if
(
kk_device_find_by_mac11111
(
mac
)
==
true
){
emberAfAppPrint
(
" Exist!!!
\r\n
"
);
}
else
{
emberAfAppPrint
(
" not Exist!!!
\r\n
"
);
}
}
if
(
MEMCOMPARE
(
messageString
,
"AT+GETINFO
\r\n
"
,
len
)
==
0
){
if
(
MEMCOMPARE
(
messageString
,
"AT+GETINFO
\r\n
"
,
len
)
==
0
){
kk_print_network_info
();
kk_print_network_info
();
...
...
platform/zigbee/makefile
View file @
66466c28
CONFIG_TPL
:=
$(CURDIR)
/../../../.config
CONFIG_VENDOR
:=
$(
shell
grep
-m
1
"VENDOR *:"
$(CONFIG_TPL)
2>/dev/null|awk
'{ print $$NF
}
'
)
export
CONFIG_VENDOR
TOP_DIR_ZIGBEE
?=
$(CURDIR)
TOP_DIR_ZIGBEE
?=
$(CURDIR)
ZIGBEE_MAKEFILE_PATH
?=
$(TOP_DIR_ZIGBEE)
/app/builder/Z3GatewayHost/
ZIGBEE_MAKEFILE_PATH
?=
$(TOP_DIR_ZIGBEE)
/app/builder/Z3GatewayHost/
all
:
all
:
@
cd
$(ZIGBEE_MAKEFILE_PATH)
&&
$(MAKE)
;
@
cd
$(ZIGBEE_MAKEFILE_PATH)
&&
$(MAKE)
;
\ No newline at end of file
platform/zigbee/protocol/zigbee/app/framework/plugin/device-table/device-table.c
View file @
66466c28
...
@@ -407,7 +407,7 @@ void emberAfPluginDeviceTableStackStatusCallback(EmberStatus status)
...
@@ -407,7 +407,7 @@ void emberAfPluginDeviceTableStackStatusCallback(EmberStatus status)
emberAfCorePrintln
(
"DeviceTable: Clear State"
);
emberAfCorePrintln
(
"DeviceTable: Clear State"
);
emberAfDeviceTableClear
();
emberAfDeviceTableClear
();
kk_device_table_clear
();
//
kk_device_table_clear();
}
}
}
}
...
...
platform/zigbee/protocol/zigbee/app/framework/plugin/ota-server/ota-server.c
View file @
66466c28
...
@@ -570,3 +570,42 @@ void emberAfOtaServerSendUpgradeCommandCallback(EmberNodeId dest,
...
@@ -570,3 +570,42 @@ void emberAfOtaServerSendUpgradeCommandCallback(EmberNodeId dest,
"error 0x%x"
,
status
);
"error 0x%x"
,
status
);
}
}
}
}
static
int
s_ota_server_init
=
0
;
EmberAfOtaImageId
kk_get_imageId
(
char
*
filename
){
char
*
oatfile
=
NULL
;
EmberAfOtaImageId
id
=
emberAfOtaStorageIteratorFirstCallback
();
do
{
oatfile
=
emAfOtaStorageGetFilepath
(
&
id
);
if
(
oatfile
!=
NULL
&&
strcmp
(
oatfile
,
filename
)
==
0
){
return
id
;
}
id
=
emberAfOtaStorageIteratorNextCallback
();
}
while
(
emberAfIsOtaImageIdValid
(
&
id
));
return
emberAfInvalidImageId
;
}
void
kk_ota_notify
(
char
*
filepath
){
if
(
s_ota_server_init
==
0
){
s_ota_server_init
=
1
;
emberAfOtaBootloadClusterServerInitCallback
(
0x00
);
}
//add file
emAfOtaReloadStorageDevice
();
//TODO:开启通知, 通过mac地址获取dest,endpoint
EmberNodeId
dest
;
uint8_t
endpoint
;
EmberAfOtaImageId
id
;
id
=
kk_get_imageId
(
filepath
);
emberAfOtaServerSendUpgradeCommandCallback
(
dest
,
endpoint
,
&
id
);
}
testgit.txt
0 → 100644
View file @
66466c28
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