Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Telin_Zigbee_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
Merge Requests
0
Merge Requests
0
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
limm
Telin_Zigbee_SDK
Commits
e31877dc
Commit
e31877dc
authored
Jan 11, 2022
by
limm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V1.1
parent
4f207db8
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
716 additions
and
516 deletions
+716
-516
tl_zigbee_sdk/apps/3LightPanelDemo/app_cfg.h
tl_zigbee_sdk/apps/3LightPanelDemo/app_cfg.h
+1
-1
tl_zigbee_sdk/apps/3LightPanelDemo/user.c
tl_zigbee_sdk/apps/3LightPanelDemo/user.c
+309
-72
tl_zigbee_sdk/apps/common/00ikonke_app/driver/ikk-led.c
tl_zigbee_sdk/apps/common/00ikonke_app/driver/ikk-led.c
+5
-1
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-cluster.c
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-cluster.c
+0
-5
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-cluster.h
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-cluster.h
+0
-1
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-command.c
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-command.c
+6
-63
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-command.h
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-command.h
+0
-1
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-factory-test.c
...e_sdk/apps/common/00ikonke_app/general/ikk-factory-test.c
+299
-59
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-factory-test.h
...e_sdk/apps/common/00ikonke_app/general/ikk-factory-test.h
+17
-6
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-interpan.c
...igbee_sdk/apps/common/00ikonke_app/general/ikk-interpan.c
+10
-26
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-interpan.h
...igbee_sdk/apps/common/00ikonke_app/general/ikk-interpan.h
+2
-1
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-module-def.h
...bee_sdk/apps/common/00ikonke_app/general/ikk-module-def.h
+3
-0
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-network.c
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-network.c
+3
-2
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-opt-tunnel.c
...bee_sdk/apps/common/00ikonke_app/general/ikk-opt-tunnel.c
+28
-50
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-ota.c
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-ota.c
+0
-101
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-ota.h
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-ota.h
+0
-42
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-token.c
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-token.c
+15
-3
tl_zigbee_sdk/build/tlsr_tc32/.cproject
tl_zigbee_sdk/build/tlsr_tc32/.cproject
+18
-82
No files found.
tl_zigbee_sdk/apps/3LightPanelDemo/app_cfg.h
View file @
e31877dc
...
...
@@ -101,7 +101,7 @@ extern "C" {
#endif
#define ZCL_GROUP_SUPPORT 1
#define ZCL_SCENE_SUPPORT 1
#define ZCL_OTA_SUPPORT
1
#define ZCL_OTA_SUPPORT
0
#define ZCL_PRIVATE_CLUSTER_FCC0_SUPPORT 1
#if TOUCHLINK_SUPPORT
#define ZCL_ZLL_COMMISSIONING_SUPPORT 1
...
...
tl_zigbee_sdk/apps/3LightPanelDemo/user.c
View file @
e31877dc
This diff is collapsed.
Click to expand it.
tl_zigbee_sdk/apps/common/00ikonke_app/driver/ikk-led.c
View file @
e31877dc
...
...
@@ -305,7 +305,11 @@ void kLedOptTrigger(uint8_t id, uint32_t duration_on_ms, uint32_t duration_off_m
g_stLedCtrller
[
led_index
].
offDuration
=
duration_off_ms
/
TICK_LOOP_NMS
;
g_stLedCtrller
[
led_index
].
start
=
start
;
g_stLedCtrller
[
led_index
].
end
=
end
;
if
(
end
==
LED_IGNORE
)
g_stLedCtrller
[
led_index
].
end
=
LED_OFF
;
else
g_stLedCtrller
[
led_index
].
end
=
end
;
if
(
g_stLedCtrller
[
led_index
].
start
==
LED_ON
)
{
kLedDriverhandler
(
led_index
,
LED_ON
);
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-cluster.c
View file @
e31877dc
...
...
@@ -202,11 +202,6 @@ void Update_Local_Attribute_Info(void)
Rewrite_ManufactureName
();
}
typedef
struct
{
zcl_basicAttr_t
basicAttrs_temp
;
zcl_identifyAttr_t
identifyAttrs_temp
;
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-cluster.h
View file @
e31877dc
...
...
@@ -19,7 +19,6 @@ typedef enum{ EOOC_OFF = 0, EOOC_ON, EOOC_TOGGLE, EOOC_UNKNOW }OnOffCtrlEnum;
#define ZCL_ONOFF_STATUS_OFF 0x00
#define ZCL_ONOFF_STATUS_ON 0x01
typedef
struct
tag_zcl_report_table
{
uint8_t
endpoint
;
uint16_t
cluster
;
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-command.c
View file @
e31877dc
...
...
@@ -56,7 +56,7 @@ uint16_t kCmdGetMsgCrc16Value( uint8_t* msg, uint8_t len)
/* DESP: remap opcode, arg direction 0: FCC0->AA55 1:AA55->FCC0
* Auth:
* */
uint16_t
kCmdOpcodeRemap
(
uint16_t
Opcode
,
uint8_t
direction
)
static
uint16_t
kCmdOpcodeRemap
(
uint16_t
Opcode
,
uint8_t
direction
)
{
for
(
uint8_t
i
=
0
;
i
<
(
sizeof
(
opcodeReampTable
)
/
(
2
*
sizeof
(
uint16_t
)));
i
++
)
{
if
(
opcodeReampTable
[
i
][
0
]
==
Opcode
)
{
...
...
@@ -66,7 +66,6 @@ uint16_t kCmdOpcodeRemap(uint16_t Opcode, uint8_t direction)
return
0xFFFF
;
}
kk_err_t
kCmdGeneralMsgPaser
(
UMsgNodeSt
*
pMsgNode
,
ComPortEm
port
,
DataField_st
*
pDataOut
)
{
//UMsgNodeSt uMsgNode = {0};
...
...
@@ -144,7 +143,7 @@ kk_err_t kCmdGeneralMsgPaser(UMsgNodeSt *pMsgNode, ComPortEm port, DataField_st
//check install code length 20200725
uint8_t
length
=
data
.
u8ARG
[
0
];
if
(
length
!=
16
)
{
if
(
length
!=
16
)
{
//如果不是16位的数据就不做任何改变,只回复
send_buf
.
u8ARG
[
0
]
=
ERR_FORMAT
;
send_buf
.
u8ARG
[
1
]
=
data
.
u8ARG
[
0
];
memcpy
(
&
send_buf
.
u8ARG
[
2
],
&
data
.
u8ARG
[
1
],
length
);
...
...
@@ -247,9 +246,9 @@ kk_err_t kCmdGeneralMsgPaser(UMsgNodeSt *pMsgNode, ComPortEm port, DataField_st
memset
(
buffer
,
0
,
33
);
uint8_t
*
data
=
ISN_TOKEN_GET
();
iKonkeAfSelfPrint
(
"len %x
\r\n
"
,
data
[
0
]);
iKonkeAfSelfPrintBuffer
(
data
+
1
,
32
);
length
=
data
[
0
];
iKonkeAfSelfPrint
(
"read ISN len %x
\r\n
"
,
data
[
0
]);
iKonkeAfSelfPrintBuffer
(
data
+
1
,
32
);
memcpy
(
buffer
,
data
,
length
+
1
);
if
(
length
>
32
)
{
...
...
@@ -268,7 +267,7 @@ kk_err_t kCmdGeneralMsgPaser(UMsgNodeSt *pMsgNode, ComPortEm port, DataField_st
{
uint8_t
mac_length
=
0x00
;
addrExt_t
addr
,
local_addr
;
flash_read
(
CFG_MAC_ADDRESS
,
8
,(
uint8_t
*
)
local_addr
);
zb_getLocalExtAddr
(
local_addr
);
mac_length
=
data
.
u8ARG
[
0
];
if
(
mac_length
!=
8
)
{
...
...
@@ -293,8 +292,7 @@ kk_err_t kCmdGeneralMsgPaser(UMsgNodeSt *pMsgNode, ComPortEm port, DataField_st
case
(
UART_MSG_READ_MAC_CODE_OPCODE
):
//ok
{
addrExt_t
addr
;
flash_read
(
CFG_MAC_ADDRESS
,
8
,(
uint8_t
*
)
addr
);
// zb_getLocalExtAddr(addr);
zb_getLocalExtAddr
(
addr
);
send_buf
.
u8ARG
[
0
]
=
0x00
;
send_buf
.
u8ARG
[
1
]
=
0x08
;
...
...
@@ -424,61 +422,6 @@ kk_err_t kCmdGeneralMsgPaser(UMsgNodeSt *pMsgNode, ComPortEm port, DataField_st
reply_control_field
=
Z_TO_H_NO_ACK
;
break
;
}
// case (UART_MSG_READ_DEVICE_SNAP_OPCODE):
// {
// uint8_t tmp_value = 0;
// uint8_t send_length = 0;
//
// send_buf.u8ARG[send_length++] = ERR_OK;
// emberAfReadAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_STACK_VERSION_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
// &tmp_value, 1, NULL);
// send_buf.u8ARG[send_length++] = tmp_value;
//
// EmberEUI64 localEui64;
// EmberNodeType nodeTypeResult = 0xFF;
// EmberNetworkParameters networkParams;
// emberAfGetEui64(localEui64);
// SWAP_EUI64((uint8_t *)&localEui64);
//
// if(emberAfNetworkState() == EMBER_JOINED_NETWORK) {
// emberAfGetNetworkParameters(&nodeTypeResult, &networkParams);
// send_buf.u8ARG[send_length++] = HI_UINT16(networkParams.panId);
// send_buf.u8ARG[send_length++] = LO_UINT16(networkParams.panId);
// send_buf.u8ARG[send_length++] = HI_UINT16(emberAfGetNodeId());
// send_buf.u8ARG[send_length++] = LO_UINT16(emberAfGetNodeId());
// memcpy(&send_buf.u8ARG[send_length], localEui64, 8);
// send_length = send_length + 8;
// send_buf.u8ARG[send_length++] = networkParams.radioChannel;
// send_buf.u8ARG[send_length++] = networkParams.radioTxPower;
// } else {
// emberAfGetNetworkParameters(&nodeTypeResult, &networkParams);
// send_buf.u8ARG[send_length++] = 0xff;
// send_buf.u8ARG[send_length++] = 0xff;
// send_buf.u8ARG[send_length++] = 0xff;
// send_buf.u8ARG[send_length++] = 0xff;
// memcpy(&send_buf.u8ARG[send_length], localEui64, 8);
// send_length = send_length + 8;
// send_buf.u8ARG[send_length++] = 0xff;
// send_buf.u8ARG[send_length++] = 0xff;
// }
// //SV
// emberAfReadAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_APPLICATION_VERSION_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
// &tmp_value, 1, NULL);
// send_buf.u8ARG[send_length++] = tmp_value;
// //HV
// emberAfReadAttribute(1, ZCL_BASIC_CLUSTER_ID, ZCL_HW_VERSION_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
// &tmp_value, 1, NULL);
// send_buf.u8ARG[send_length++] = tmp_value;
// memset(&send_buf.u8ARG[send_length], 0xff, 4);
// send_length = send_length + 4;
// send_buf.u8ARG[send_length++] = emberAfNetworkState();
//
// send_buf.u8ArgLen = send_length;
// //send_buf.u8Datalen = send_length + 3;
// reply_control_field = Z_TO_H_NO_ACK;
//
// break;
// }
//nwk operation request
case
(
UART_MSG_QUERY_NWK_STATUS_REQUEST_OPCODE
):
//ok
{
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-command.h
View file @
e31877dc
...
...
@@ -34,7 +34,6 @@ typedef struct{
}
MsgFrameworkFormat_st
;
kk_err_t
kCmdGeneralMsgPaser
(
UMsgNodeSt
*
pMsgNode
,
ComPortEm
port
,
DataField_st
*
pDataOut
);
uint16_t
kCmdOpcodeRemap
(
uint16_t
Opcode
,
uint8_t
direction
);
uint16_t
kCmdGetMsgCrc16Value
(
uint8_t
*
msg
,
uint8_t
len
);
uint8_t
kCmdMsgDataSentByPort
(
uint8_t
u8Control_Field
,
DataField_st
data
,
bool
isGetResult
,
ComPortEm
port
);
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-factory-test.c
View file @
e31877dc
This diff is collapsed.
Click to expand it.
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-factory-test.h
View file @
e31877dc
...
...
@@ -42,11 +42,15 @@ typedef enum{
FTS_AGING_4HOU_START
,
FTS_AGING_4HOU
,
FTS_AGING_DONE
,
FTS_AGING_FORCE_EXIT
,
FTS_AGING_WAITING
,
FTS_AGING_FORCE_REBOOT
,
FTS_AGING_FIRST_LONG_PRESSED
,
FTS_AGING_WAITING_SECOND_PRESS
FTS_FORCE_EXIT
,
FTS_WAITING_RELEASED
,
//waiting key released
FTS_FORCE_REBOOT
,
FTS_FIRST_LONG_PRESSED
,
FTS_WAITING_SECOND_PRESS
,
FTS_SINGLE_BOARD_TEST
,
FTS_FULL_DEVICE_TEST
,
FTS_SINGLE_BOARD_TEST_DONE
,
FTS_FULL_DEVICE_TEST_DONE
,
}
FactoryTestStatusEnum
;
typedef
struct
{
...
...
@@ -74,7 +78,14 @@ void kSetAgingMaxTime(uint16_t value);
//获取当前产测状态
FactoryTestStatusEnum
kGetFactoryTestStatus
(
void
);
//void kGetFactoryTestBtnAction(uint8_t btn_id, BtnActionEnum action);
void
kFactoryTestInit
(
pFactoryTestPollCallback
callback
,
FactoryTestConfSt
conf_list
[],
uint8_t
btn_num
);
void
kFactoryTestInit
(
pFactoryTestPollCallback
callback
,
FactoryTestConfSt
conf_list
[],
uint8_t
btn_num
,
uint8_t
led_id
);
void
kSetNetworkSteeringInfo
(
uint8_t
channel
,
uint16_t
PanId
);
bool
kCmdNetworkSteeringinfoCheck
(
uint8_t
channel
,
uint16_t
panid
);
//Auth: han_frc.20220105.
void
kSetAgingTestDone
(
void
);
kk_err_t
kkFactoryMsgInComingPaser
(
UMsgNodeSt
*
pMsgNode
,
ComPortEm
port
,
DataField_st
*
pDataOut
);
#endif
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-interpan.c
View file @
e31877dc
...
...
@@ -8,7 +8,7 @@
#include "ikk-debug.h"
#include "ikk-token.h"
#include "ikk-network.h"
#include "ikk-factory-test.h"
static
bool
gInterPanEnabled
;
// 1:enable
static
uint16_t
gInterPanID
=
0x1111
;
// 1:enable
...
...
@@ -16,12 +16,10 @@ static uint8_t g_interpanChannel = 20;
pInterPanMsgIncomingCallback
gInterPanMsgIncomingCallback
;
static
ev_timer_event_t
*
Interpan_timerEvt
=
NULL
;
static
ev_timer_event_t
*
Interpan_DelaySendEvt
=
NULL
;
static
INCOM_MESSAGE_INFO
sIncomingMessageInfo
=
{
0
};
static
s32
kInterPanEventHandler
(
void
);
static
s32
kInterPanDelaySendTestDataEventHandler
(
void
);
/**
* @brief Definition for Incoming cluster / Sever Cluster
...
...
@@ -104,8 +102,7 @@ void kInterPanEnable(uint8_t channel)
{
rf_setChannel
(
channel
);
printf
(
"kInterPanEnable enable,Regesiter Interpan Func,network = %d
\r\n
!!
\r\n
"
,
kNwkGetCurrentStatus
());
if
(
kNwkGetCurrentStatus
()
==
ENS_LEAVED
)
{
if
(
!
zb_isDeviceJoinedNwk
())
{
af_endpointRegister
(
INTERPAN_ENDPOINT
,
(
af_simple_descriptor_t
*
)
&
kInterpanSimpleDesc
,
afInterpan_rx_handler
,
afInterpan_dataSendConfirm
);
}
else
{
...
...
@@ -128,19 +125,17 @@ void kInterpanDisable(void)
void
kInterPanMoudleInit
(
pInterPanMsgIncomingCallback
pfunc_incoming
)
{
bool
interPanEnabledFlg
=
kGetInterpanEnableFlg
()
;
if
(
interPanEnabledFlg
)
{
gInterPanEnabled
=
true
;
if
(
kGetFactoryTestStatus
()
==
FTS_NORMAL
)
{
gInterPanEnabled
=
false
;
af_endpointUnregister
(
INTERPAN_ENDPOINT
);
printf
(
"kInterPanEnable disable
\r\n
!!
\r\n
"
)
;
}
if
(
gInterPanEnabled
==
true
)
{
else
{
gInterPanEnabled
=
true
;
printf
(
"kInterPanEnable enable
\r\n
!!
\r\n
"
);
kInterPanEnable
(
INTERPAN_CHANNEL
);
if
(
Interpan_timerEvt
){
TL_ZB_TIMER_CANCEL
(
&
Interpan_timerEvt
);
}
Interpan_timerEvt
=
TL_ZB_TIMER_SCHEDULE
(
kInterPanEventHandler
,
NULL
,
INTERPAN_AUTO_OFF_TIME
);
if
(
kNwkGetCurrentStatus
()
==
ENS_LEAVED
)
{
if
(
!
zb_isDeviceJoinedNwk
())
{
if
(
Interpan_DelaySendEvt
)
TL_ZB_TIMER_CANCEL
(
&
Interpan_DelaySendEvt
);
...
...
@@ -211,17 +206,6 @@ static s32 kInterPanDelaySendTestDataEventHandler(void )
sSend_Count
=
0
;
return
-
1
;
}
static
s32
kInterPanEventHandler
(
void
)
{
iKonkeAfSelfPrint
(
"kInterPanEventHandler
\r\n
"
);
if
(
gInterPanEnabled
==
true
)
{
af_endpointUnregister
(
INTERPAN_ENDPOINT
);
kInterPanSetEnableStatus
(
false
);
}
return
-
1
;
}
kk_err_t
kInterPanSend
(
UMsgNodeSt
*
pMsgNode
)
{
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-interpan.h
View file @
e31877dc
...
...
@@ -12,7 +12,6 @@ extern const af_simple_descriptor_t kInterpanSimpleDesc;
#define INTERPAN_EVENT_INIT 0x00 // interPan Event
#define INTERPAN_EVENT_OFF 0x01 //
#define INTERPAN_AUTO_OFF_TIME (10 * 60 * 1000)
#define INTERPAN_DELAY_SEND_INTERVAL (3 * 1000)
#define INTERPAN_DELAY_SEND_TIMES (2)
#define INTERPAN_CHANNEL 20
...
...
@@ -38,5 +37,7 @@ kk_err_t kInterPanSend(UMsgNodeSt *pMsgNode);
void
kInterpan_Init
(
void
);
bool
kInterPanSetEnableStatus
(
uint8_t
enable
);
bool
kInterPanGetEnableStatus
(
void
);
void
kInterPanMoudleInit
(
pInterPanMsgIncomingCallback
pfunc_incoming
);
#endif
/* _SAMPLE_LIGHT_H_ */
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-module-def.h
View file @
e31877dc
...
...
@@ -86,6 +86,8 @@
#define UART_MSG_QUERY_SWITCH_ONOFF_OPCODE 0xED06
#define UART_MSG_ENTER_FACTORY_TEST_OPCODE 0xED14
#define UART_MSG_ONOFF_SWITCH_OPCODE 0xED15
#define UART_MSG_QUERY_FACTORY_STATE_OPCODE 0xED16
#define UART_MSG_LED_GROUP_CONTROL_OPCODE 0xED17
#define UART_MSG_GPIO_TEST_OPCODE 0xED10
#define UART_MSG_READ_RSSI_REQUEST_OPCODE 0xED12
...
...
@@ -172,6 +174,7 @@ typedef enum {
ERR_WRITE_FAILED
=
0x04
,
ERR_READ_WRITE_TIMEOUT
=
0x05
,
ERR_NOT_EXIST
=
0x06
,
ERR_EXEC_FAILED
=
0xe0
,
ERR_UNKNOW
=
0xFF
,
}
ERR_RET_E
;
typedef
enum
{
Z3D_COORDINATOR
=
0
,
Z3D_ROUTER
,
Z3D_ENDDEVICE
}
Z3DevTypeEm
;
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-network.c
View file @
e31877dc
...
...
@@ -400,7 +400,8 @@ void kNwkFactoryReset(bool is_nwk_indicator)
//led can blink when network leaved
if
(
is_nwk_indicator
==
true
){
zb_factoryReset
();
if
(
zb_isDeviceJoinedNwk
())
zb_factoryReset
();
g_KeyPressCauasLeave
=
true
;
//add by maozj 20200407 for reset count down after network leaved
g_u32NwkExitCountDownCounter
=
MS2COUNT
(
LED_FAST_BLINK_CONTINUE_TIME_MS
);
...
...
@@ -444,7 +445,7 @@ void NetworkLeaveHandler(nlme_leave_cnf_t *pLeaveCnf)
NwkStatusEnum
kNwkGetCurrentStatus
(
void
)
{
NwkStatusEnum
status
;
if
(
zb_isDeviceJoinedNwk
()){
if
(
zb_isDeviceJoinedNwk
()
||
(
kInterPanGetEnableStatus
())
){
status
=
ENS_ONLINE
;
g_bIsNwkJoiningFlg
=
false
;
}
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-opt-tunnel.c
View file @
e31877dc
...
...
@@ -6,6 +6,10 @@
#include "ikk-config.h"
#include "ikk-token.h"
#include "../../../../zigbee/zcl/zcl_include.h"
#include "ikk-command.h"
#include "../driver/ikk-uart.h"
#include "ikk-factory-test.h"
// FCC0-0000
#pragma pack(1)
typedef
struct
tag_private_clsFCC0_attr0000_frame_st
{
...
...
@@ -27,55 +31,7 @@ pFUNC_OPTDATA_MESSAGE_CALLBACK g_pOptDataIncomingMessageCallback = NULL;
extern
bool
Get_Model_ID
(
uint8_t
*
ModeID
);
extern
_CODE_ZCL_
zclReadCmd_t
*
zcl_parseInReadCmd
(
zclIncoming_t
*
pCmd
);
extern
_CODE_ZCL_
status_t
zcl_readRsp
(
u8
srcEp
,
epInfo_t
*
pDstEpInfo
,
u16
clusterId
,
u16
manuCode
,
u8
disableDefaultRsp
,
u8
direction
,
u8
seqNo
,
zclReadRspCmd_t
*
readRspCmd
);
//_CODE_ZCL_ static status_t zcl_Private_cmdHandler(zclIncoming_t *pInMsg);
//
//
//
//
//_CODE_ZCL_ status_t zcl_private_fcc0_register(u8 endpoint, u16 manuCode, u8 attrNum, const zclAttrInfo_t attrTbl[], cluster_forAppCb_t cb)
//{
// return zcl_registerCluster(endpoint, ZCL_CLUSTER_PRIVATE_FCC0, manuCode, attrNum, attrTbl, zcl_Private_cmdHandler, cb);
//}
//
//_CODE_ZCL_ static status_t zcl_private_clientCmdHandler(zclIncoming_t *pInMsg)
//{
// u8 status = ZCL_STA_SUCCESS;
// apsdeDataInd_t *pApsdeInd = (apsdeDataInd_t*)pInMsg->msg;
// iKonkeAfSelfPrint("#############zcl_private_clientCmdHandler ,command id =%x!!!!!!!\r\n",pInMsg->hdr.cmd);
//// switch(pInMsg->hdr.cmd)
//// {
//// case ZCL_CMD_BASIC_RESET_FAC_DEFAULT:
//// if(pInMsg->clusterAppCb){
//// zclIncomingAddrInfo_t addrInfo;
//// addrInfo.dirCluster = pInMsg->hdr.frmCtrl.bf.dir;
//// addrInfo.profileId = pApsdeInd->indInfo.profile_id;
//// addrInfo.srcAddr = pApsdeInd->indInfo.src_short_addr;
//// addrInfo.dstAddr = pApsdeInd->indInfo.dst_addr;
//// addrInfo.srcEp = pApsdeInd->indInfo.src_ep;
//// addrInfo.dstEp = pApsdeInd->indInfo.dst_ep;
////
//// status = pInMsg->clusterAppCb(&addrInfo, ZCL_CMD_BASIC_RESET_FAC_DEFAULT, NULL);
//// }else{
//// status = ZCL_STA_FAILURE;
//// }
//// break;
//// default:
//// status = ZCL_STA_UNSUP_CLUSTER_COMMAND;
//// break;
//// }
//
// return status;
//}
//
//_CODE_ZCL_ static status_t zcl_Private_cmdHandler(zclIncoming_t *pInMsg)
//{
// if(pInMsg->hdr.frmCtrl.bf.dir == ZCL_FRAME_CLIENT_SERVER_DIR){
// return zcl_private_clientCmdHandler(pInMsg);
// }else{
// return ZCL_STA_UNSUP_CLUSTER_COMMAND;
// }
//}
//
uint8_t
kOptTunnelChunkRead
(
uint8_t
endpoint
,
uint16_t
clusterId
,
uint16_t
attributeId
,
...
...
@@ -271,7 +227,29 @@ kk_err_t kOptTunnelMessageIncoming(OptMethodEm method,zclIncoming_t *pCmd)
// {
if
(
length
>=
7
)
{
iKonkeAfSelfPrint
(
"
\r\n
########################OPTDATA WRITE,g_tmp_length = %d
\r\n
"
,
g_tmp_length
);
if
(
g_pOptDataIncomingMessageCallback
)
{
extern
kk_err_t
kCmdGeneralMsgPaser
(
UMsgNodeSt
*
pMsgNode
,
ComPortEm
port
,
DataField_st
*
pDataOut
);
UMsgNodeSt
msgNode
;
DataField_st
dataOut
;
// length pid ch opcode arg
memcpy
(
msgNode
.
buffer
,
&
g_tmp_buffer
[
0
],
g_tmp_length
);
msgNode
.
length
=
g_tmp_length
;
if
(
kCmdGeneralMsgPaser
(
&
msgNode
,
ECOM_PORT_FCC0
,
&
dataOut
)
==
KET_OK
)
{
iKonkeAfSelfPrint
(
"length(%d)
\r\n
"
,
dataOut
.
u8Datalen
);
iKonkeAfSelfPrintBuffer
(
dataOut
.
u8ARG
,
dataOut
.
u8Datalen
);
g_tmp_length
=
dataOut
.
u8Datalen
+
7
;
g_tmp_buffer
[
0
]
=
g_tmp_length
-
1
;
memcpy
(
&
g_tmp_buffer
[
7
],
dataOut
.
u8ARG
,
dataOut
.
u8Datalen
);
kOptTunnelMessageWriteResponse
(
pCmd
,
g_tmp_buffer
);
}
else
if
(
kkFactoryMsgInComingPaser
(
&
msgNode
,
ECOM_PORT_FCC0
,
&
dataOut
)
==
KET_OK
)
{
iKonkeAfSelfPrint
(
"length(%d)
\r\n
"
,
dataOut
.
u8Datalen
);
iKonkeAfSelfPrintBuffer
(
dataOut
.
u8ARG
,
dataOut
.
u8Datalen
);
g_tmp_length
=
dataOut
.
u8Datalen
+
7
;
g_tmp_buffer
[
0
]
=
g_tmp_length
-
1
;
memcpy
(
&
g_tmp_buffer
[
7
],
dataOut
.
u8ARG
,
dataOut
.
u8Datalen
);
kOptTunnelMessageWriteResponse
(
pCmd
,
g_tmp_buffer
);
}
else
if
(
g_pOptDataIncomingMessageCallback
)
{
g_tmp_length
=
g_tmp_length
-
6
;
if
(
KET_NO_RESPONSE
==
g_pOptDataIncomingMessageCallback
(
g_tmp_buffer
[
5
],
g_tmp_buffer
[
6
],
g_tmp_buffer
+
7
,
&
g_tmp_length
)){
return
KET_NO_RESPONSE
;
...
...
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-ota.c
deleted
100644 → 0
View file @
4f207db8
//#include "app/framework/plugin/network-steering/network-steering.h"
//#include "app/framework/plugin/network-steering/network-steering-internal.h"
#include "ikk-ota.h"
#include "ikk-debug.h"
#include "../driver/ikk-led.h"
#define LED_SLOW_BLINK_ON_TIME_MS 800
#define LED_SLOW_BLINK_OFF_TIME_MS 800
#define LED_FAST_BLINK_ON_TIME_MS 200
#define LED_FAST_BLINK_OFF_TIME_MS 200
#define LED_SLOW_BLINK_CONTINUE_TIME_MS (60 * 1000)
#define LED_FAST_BLINK_CONTINUE_TIME_MS (5 * 1000)
static
OTAStatusEnum
g_eOTAStatus
=
OTA_NORMAL
;
static
uint8_t
g_u8OtaLedId
=
LED_UNKNOW_ID
;
pOTACallback
g_pOTACallback
=
NULL
;
static
void
kOTAMoudleOptCallback
(
OTAStatusEnum
status
);
//__no_init OTAGpioStatusST g_stOTAGpioStatus @ 0x2000FFF0;
static
OTAGpioStatusST
g_stOTAGpioStatus
;
OTAStatusEnum
kGetOTAStatus
(
void
)
{
return
g_eOTAStatus
;
}
void
kSetOTAStatus
(
OTAStatusEnum
status
)
{
g_eOTAStatus
=
status
;
}
void
kOTAMoudleInit
(
pOTACallback
callback
,
uint8_t
led_id
)
{
g_pOTACallback
=
callback
;
g_u8OtaLedId
=
led_id
;
}
void
kOTAMoudleCallback
(
OTAStatusEnum
status
)
{
//校验成功或失败保存gpio状态,待bootloader中恢复
if
(
status
==
OTA_VERITY_SUCCEED
||
status
==
OTA_FAILED
){
iKonkeAfSelfPrint
(
"OTA GPIO KEEP status(%d)
\r\n
"
,
g_eOTAStatus
);
}
if
(
g_pOTACallback
){
g_pOTACallback
(
status
);
}
else
{
if
(
g_u8OtaLedId
!=
LED_UNKNOW_ID
){
kOTAMoudleOptCallback
(
status
);
}
}
}
static
void
kOTAMoudleOptCallback
(
OTAStatusEnum
status
)
{
iKonkeAfSelfPrint
(
"##############kOTAMoudleUserCallback status(%d)##################
\r\n
"
,
status
);
static
bool
flg
=
false
;
//防止网关断电后,ota失败后会间隔快闪
switch
(
status
)
{
case
OTA_NORMAL
:
break
;
case
OTA_START
:
kLedOptTrigger
(
g_u8OtaLedId
,
2
*
LED_FAST_BLINK_ON_TIME_MS
,
14
*
LED_FAST_BLINK_ON_TIME_MS
,
\
OTA_UPGRADE__CONTINUE_MAX_TIME_MS
/
(
2
*
LED_FAST_BLINK_ON_TIME_MS
+
14
*
LED_FAST_BLINK_ON_TIME_MS
),
LED_ON
,
LED_ON
);
g_eOTAStatus
=
OTA_START
;
flg
=
false
;
break
;
case
OTA_DOWNLOAD_DONE
:
{
g_eOTAStatus
=
OTA_DOWNLOAD_DONE
;
break
;
}
case
OTA_VERITY_SUCCEED
:
//校验成功,记录继电器状态
//常亮5S
kLedOptTrigger
(
g_u8OtaLedId
,
25
*
LED_FAST_BLINK_ON_TIME_MS
,
LED_FAST_BLINK_ON_TIME_MS
,
1
,
LED_ON
,
LED_ON
);
g_eOTAStatus
=
OTA_NORMAL
;
break
;
case
OTA_FAILED
:
if
(
flg
!=
true
){
kLedOptTrigger
(
g_u8OtaLedId
,
LED_FAST_BLINK_ON_TIME_MS
,
LED_FAST_BLINK_ON_TIME_MS
,
\
LED_FAST_BLINK_CONTINUE_TIME_MS
/
(
LED_FAST_BLINK_ON_TIME_MS
+
LED_FAST_BLINK_ON_TIME_MS
),
LED_ON
,
LED_ON
);
g_eOTAStatus
=
OTA_NORMAL
;
}
flg
=
true
;
break
;
default:
iKonkeAfSelfPrint
(
"##############Err: OTA status is not exist
\r\n
"
);
break
;
}
}
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-ota.h
deleted
100644 → 0
View file @
4f207db8
#ifndef __IKONKE_MODULE_OTA_H_______________________
#define __IKONKE_MODULE_OTA_H_______________________
#include "tl_common.h"
#define OTA_UPGRADE__CONTINUE_MAX_TIME_MS (16*60*1000)
#define OTA_GPIO_RESTORE_MAXN 8
typedef
enum
{
OTA_NORMAL
=
0
,
OTA_START
,
OTA_DOWNLOAD_DONE
,
OTA_VERITY_SUCCEED
,
OTA_FAILED
}
OTAStatusEnum
;
typedef
enum
{
OTA_GPIO_OFF
=
0
,
OAT_GPIO_ON
}
OTAGpioEnum
;
#pragma pack(1) //按1字节对齐
typedef
struct
{
uint32_t
pin
;
bool
bStatus
;
// on/off
}
OTAGpioListSt
;
#pragma pack() //取消自定义字节对齐方式
#pragma pack(1) //按1字节对齐
typedef
struct
{
bool
bIsValid
;
uint8_t
gpioNum
;
OTAGpioListSt
gpio
[
OTA_GPIO_RESTORE_MAXN
];
}
OTAGpioStatusST
;
#pragma pack() //取消自定义字节对齐方式
//OTA操作函数,一般操作用来操作led
typedef
void
(
*
pOTACallback
)(
OTAStatusEnum
status
);
//获取当前产测状态
OTAStatusEnum
kGetOTAStatus
(
void
);
void
kSetOTAStatus
(
OTAStatusEnum
status
);
void
kOTAMoudleInit
(
pOTACallback
callback
,
uint8_t
led_id
);
void
kOTAMoudleCallback
(
OTAStatusEnum
status
);
#endif
tl_zigbee_sdk/apps/common/00ikonke_app/general/ikk-token.c
View file @
e31877dc
...
...
@@ -288,7 +288,11 @@ uint8_t General_Custom_Token_Save(uint8_t item,uint8_t *buff,uint8_t len)
//same data ,not need rewrite!
return
0
;
}
else
if
(
All_Same_Data
((
uint8_t
*
)
&
sOptunnel_Token_temp
.
modeid
,
0xff
,
32
)){
flash_write
(
TOKEN_USER_LOCATION
+
MODEL_ID_LOC_OFFSET
,
len
,
buff
);
//Auth: han_frc.20220105.
u8
modelid_buff
[
35
]
=
{
0
};
modelid_buff
[
0
]
=
len
;
memcpy
(
modelid_buff
+
1
,
buff
,
len
);
flash_write
(
TOKEN_USER_LOCATION
+
MODEL_ID_LOC_OFFSET
,
len
+
1
,
modelid_buff
);
return
0
;
}
else
{
sOptunnel_Token_temp
.
modeid
.
modeid_len
=
len
;
...
...
@@ -309,7 +313,11 @@ uint8_t General_Custom_Token_Save(uint8_t item,uint8_t *buff,uint8_t len)
//same data ,not need rewrite!
return
0
;
}
else
if
(
All_Same_Data
((
uint8_t
*
)
&
sOptunnel_Token_temp
.
cmei
,
0xff
,
32
)){
flash_write
(
TOKEN_USER_LOCATION
+
CMEI_LOC_OFFSET
,
len
,
buff
);
//Auth: han_frc.20220105.
u8
cmei_buff
[
35
]
=
{
0
};
cmei_buff
[
0
]
=
len
;
memcpy
(
cmei_buff
+
1
,
buff
,
len
);
flash_write
(
TOKEN_USER_LOCATION
+
CMEI_LOC_OFFSET
,
len
+
1
,
cmei_buff
);
return
0
;
}
else
{
sOptunnel_Token_temp
.
cmei
.
cmei_len
=
len
;
...
...
@@ -330,7 +338,11 @@ uint8_t General_Custom_Token_Save(uint8_t item,uint8_t *buff,uint8_t len)
//same data ,not need rewrite!
return
0
;
}
else
if
(
All_Same_Data
((
uint8_t
*
)
&
sOptunnel_Token_temp
.
isn
,
0xff
,
32
)){
flash_write
(
TOKEN_USER_LOCATION
+
ISN_LOC_OFFSET
,
len
,
buff
);
//Auth: han_frc.20220105.
u8
isn_buff
[
35
]
=
{
0
};
isn_buff
[
0
]
=
len
;
memcpy
(
isn_buff
+
1
,
buff
,
len
);
flash_write
(
TOKEN_USER_LOCATION
+
ISN_LOC_OFFSET
,
len
+
1
,
isn_buff
);
return
0
;
}
else
{
sOptunnel_Token_temp
.
isn
.
isn_len
=
len
;
...
...
tl_zigbee_sdk/build/tlsr_tc32/.cproject
View file @
e31877dc
This diff is collapsed.
Click to expand it.
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