mirror of
https://github.com/formtapez/ZigUP.git
synced 2025-02-23 09:34:50 +01:00
added sourcecode
This commit is contained in:
2635
src/ZigUP/CC2530DB/ZigUP.ewd
Executable file
2635
src/ZigUP/CC2530DB/ZigUP.ewd
Executable file
File diff suppressed because it is too large
Load Diff
5330
src/ZigUP/CC2530DB/ZigUP.ewp
Executable file
5330
src/ZigUP/CC2530DB/ZigUP.ewp
Executable file
File diff suppressed because it is too large
Load Diff
30
src/ZigUP/CC2530DB/ZigUP.eww
Executable file
30
src/ZigUP/CC2530DB/ZigUP.eww
Executable file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\ZigUP.ewp</path>
|
||||
</project>
|
||||
<batchBuild>
|
||||
<batchDefinition>
|
||||
<name>ALL</name>
|
||||
<member>
|
||||
<project>ZigUP</project>
|
||||
<configuration>CoordinatorEB</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>ZigUP</project>
|
||||
<configuration>RouterEB</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>ZigUP</project>
|
||||
<configuration>EndDeviceEB</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>ZigUP</project>
|
||||
<configuration>RouterZLight</configuration>
|
||||
</member>
|
||||
</batchDefinition>
|
||||
</batchBuild>
|
||||
</workspace>
|
||||
|
||||
|
||||
90
src/ZigUP/Source/OSAL_ZigUP.c
Executable file
90
src/ZigUP/Source/OSAL_ZigUP.c
Executable file
@@ -0,0 +1,90 @@
|
||||
/*********************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
|
||||
#include "ZComDef.h"
|
||||
#include "hal_drivers.h"
|
||||
#include "OSAL.h"
|
||||
#include "OSAL_Tasks.h"
|
||||
|
||||
#if defined ( MT_TASK )
|
||||
#include "MT.h"
|
||||
#include "MT_TASK.h"
|
||||
#endif
|
||||
|
||||
#include "nwk.h"
|
||||
#include "APS.h"
|
||||
#include "ZDApp.h"
|
||||
#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
|
||||
#include "ZDNwkMgr.h"
|
||||
#endif
|
||||
#if defined ( ZIGBEE_FRAGMENTATION )
|
||||
#include "aps_frag.h"
|
||||
#endif
|
||||
|
||||
#include "zcl_zigup.h"
|
||||
|
||||
/*********************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*/
|
||||
|
||||
// The order in this table must be identical to the task initialization calls below in osalInitTask.
|
||||
const pTaskEventHandlerFn tasksArr[] = {
|
||||
macEventLoop,
|
||||
nwk_event_loop,
|
||||
Hal_ProcessEvent,
|
||||
#if defined( MT_TASK )
|
||||
MT_ProcessEvent,
|
||||
#endif
|
||||
APS_event_loop,
|
||||
#if defined ( ZIGBEE_FRAGMENTATION )
|
||||
APSF_ProcessEvent,
|
||||
#endif
|
||||
ZDApp_event_loop,
|
||||
#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
|
||||
ZDNwkMgr_event_loop,
|
||||
#endif
|
||||
zcl_event_loop,
|
||||
zclZigUP_event_loop
|
||||
};
|
||||
|
||||
const uint8 tasksCnt = sizeof( tasksArr ) / sizeof( tasksArr[0] );
|
||||
uint16 *tasksEvents;
|
||||
|
||||
/*********************************************************************
|
||||
* FUNCTIONS
|
||||
*********************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* @fn osalInitTasks
|
||||
*
|
||||
* @brief This function invokes the initialization function for each task.
|
||||
*
|
||||
* @param void
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void osalInitTasks( void )
|
||||
{
|
||||
uint8 taskID = 0;
|
||||
|
||||
tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt);
|
||||
osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt));
|
||||
|
||||
macTaskInit( taskID++ );
|
||||
nwk_init( taskID++ );
|
||||
Hal_Init( taskID++ );
|
||||
#if defined( MT_TASK )
|
||||
MT_TaskInit( taskID++ );
|
||||
#endif
|
||||
APS_Init( taskID++ );
|
||||
#if defined ( ZIGBEE_FRAGMENTATION )
|
||||
APSF_Init( taskID++ );
|
||||
#endif
|
||||
ZDApp_Init( taskID++ );
|
||||
#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
|
||||
ZDNwkMgr_Init( taskID++ );
|
||||
#endif
|
||||
zcl_Init( taskID++ );
|
||||
zclZigUP_Init( taskID );
|
||||
}
|
||||
1300
src/ZigUP/Source/zcl_zigup.c
Executable file
1300
src/ZigUP/Source/zcl_zigup.c
Executable file
File diff suppressed because it is too large
Load Diff
397
src/ZigUP/Source/zcl_zigup.h
Executable file
397
src/ZigUP/Source/zcl_zigup.h
Executable file
@@ -0,0 +1,397 @@
|
||||
#ifndef ZCL_ZIGUP_H
|
||||
#define ZCL_ZIGUP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*********************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
#include "zcl.h"
|
||||
#include "zcl_general.h"
|
||||
|
||||
/*********************************************************************
|
||||
* CONSTANTS
|
||||
*/
|
||||
#define ZIGUP_ENDPOINT 8
|
||||
|
||||
#define LIGHT_OFF 0x00
|
||||
#define LIGHT_ON 0x01
|
||||
|
||||
// Application Events
|
||||
#define ZIGUP_IDENTIFY_TIMEOUT_EVT 0x0001
|
||||
#define ZIGUP_REPORTING_EVT 0x0002
|
||||
|
||||
// Custom attribute IDs
|
||||
#define ATTRID_CPU_TEMP 41361
|
||||
#define ATTRID_EXT_TEMP 41362
|
||||
#define ATTRID_EXT_HUMI 41363
|
||||
#define ATTRID_S0_COUNTS 41364
|
||||
#define ATTRID_ADC_VOLT 41365
|
||||
#define ATTRID_DIG_INPUT 41366
|
||||
|
||||
// Bitmasks
|
||||
#define b00000000 0x00
|
||||
#define b00000001 0x01
|
||||
#define b00000010 0x02
|
||||
#define b00000011 0x03
|
||||
#define b00000100 0x04
|
||||
#define b00000101 0x05
|
||||
#define b00000110 0x06
|
||||
#define b00000111 0x07
|
||||
#define b00001000 0x08
|
||||
#define b00001001 0x09
|
||||
#define b00001010 0x0a
|
||||
#define b00001011 0x0b
|
||||
#define b00001100 0x0c
|
||||
#define b00001101 0x0d
|
||||
#define b00001110 0x0e
|
||||
#define b00001111 0x0f
|
||||
#define b00010000 0x10
|
||||
#define b00010001 0x11
|
||||
#define b00010010 0x12
|
||||
#define b00010011 0x13
|
||||
#define b00010100 0x14
|
||||
#define b00010101 0x15
|
||||
#define b00010110 0x16
|
||||
#define b00010111 0x17
|
||||
#define b00011000 0x18
|
||||
#define b00011001 0x19
|
||||
#define b00011010 0x1a
|
||||
#define b00011011 0x1b
|
||||
#define b00011100 0x1c
|
||||
#define b00011101 0x1d
|
||||
#define b00011110 0x1e
|
||||
#define b00011111 0x1f
|
||||
#define b00100000 0x20
|
||||
#define b00100001 0x21
|
||||
#define b00100010 0x22
|
||||
#define b00100011 0x23
|
||||
#define b00100100 0x24
|
||||
#define b00100101 0x25
|
||||
#define b00100110 0x26
|
||||
#define b00100111 0x27
|
||||
#define b00101000 0x28
|
||||
#define b00101001 0x29
|
||||
#define b00101010 0x2a
|
||||
#define b00101011 0x2b
|
||||
#define b00101100 0x2c
|
||||
#define b00101101 0x2d
|
||||
#define b00101110 0x2e
|
||||
#define b00101111 0x2f
|
||||
#define b00110000 0x30
|
||||
#define b00110001 0x31
|
||||
#define b00110010 0x32
|
||||
#define b00110011 0x33
|
||||
#define b00110100 0x34
|
||||
#define b00110101 0x35
|
||||
#define b00110110 0x36
|
||||
#define b00110111 0x37
|
||||
#define b00111000 0x38
|
||||
#define b00111001 0x39
|
||||
#define b00111010 0x3a
|
||||
#define b00111011 0x3b
|
||||
#define b00111100 0x3c
|
||||
#define b00111101 0x3d
|
||||
#define b00111110 0x3e
|
||||
#define b00111111 0x3f
|
||||
#define b01000000 0x40
|
||||
#define b01000001 0x41
|
||||
#define b01000010 0x42
|
||||
#define b01000011 0x43
|
||||
#define b01000100 0x44
|
||||
#define b01000101 0x45
|
||||
#define b01000110 0x46
|
||||
#define b01000111 0x47
|
||||
#define b01001000 0x48
|
||||
#define b01001001 0x49
|
||||
#define b01001010 0x4a
|
||||
#define b01001011 0x4b
|
||||
#define b01001100 0x4c
|
||||
#define b01001101 0x4d
|
||||
#define b01001110 0x4e
|
||||
#define b01001111 0x4f
|
||||
#define b01010000 0x50
|
||||
#define b01010001 0x51
|
||||
#define b01010010 0x52
|
||||
#define b01010011 0x53
|
||||
#define b01010100 0x54
|
||||
#define b01010101 0x55
|
||||
#define b01010110 0x56
|
||||
#define b01010111 0x57
|
||||
#define b01011000 0x58
|
||||
#define b01011001 0x59
|
||||
#define b01011010 0x5a
|
||||
#define b01011011 0x5b
|
||||
#define b01011100 0x5c
|
||||
#define b01011101 0x5d
|
||||
#define b01011110 0x5e
|
||||
#define b01011111 0x5f
|
||||
#define b01100000 0x60
|
||||
#define b01100001 0x61
|
||||
#define b01100010 0x62
|
||||
#define b01100011 0x63
|
||||
#define b01100100 0x64
|
||||
#define b01100101 0x65
|
||||
#define b01100110 0x66
|
||||
#define b01100111 0x67
|
||||
#define b01101000 0x68
|
||||
#define b01101001 0x69
|
||||
#define b01101010 0x6a
|
||||
#define b01101011 0x6b
|
||||
#define b01101100 0x6c
|
||||
#define b01101101 0x6d
|
||||
#define b01101110 0x6e
|
||||
#define b01101111 0x6f
|
||||
#define b01110000 0x70
|
||||
#define b01110001 0x71
|
||||
#define b01110010 0x72
|
||||
#define b01110011 0x73
|
||||
#define b01110100 0x74
|
||||
#define b01110101 0x75
|
||||
#define b01110110 0x76
|
||||
#define b01110111 0x77
|
||||
#define b01111000 0x78
|
||||
#define b01111001 0x79
|
||||
#define b01111010 0x7a
|
||||
#define b01111011 0x7b
|
||||
#define b01111100 0x7c
|
||||
#define b01111101 0x7d
|
||||
#define b01111110 0x7e
|
||||
#define b01111111 0x7f
|
||||
#define b10000000 0x80
|
||||
#define b10000001 0x81
|
||||
#define b10000010 0x82
|
||||
#define b10000011 0x83
|
||||
#define b10000100 0x84
|
||||
#define b10000101 0x85
|
||||
#define b10000110 0x86
|
||||
#define b10000111 0x87
|
||||
#define b10001000 0x88
|
||||
#define b10001001 0x89
|
||||
#define b10001010 0x8a
|
||||
#define b10001011 0x8b
|
||||
#define b10001100 0x8c
|
||||
#define b10001101 0x8d
|
||||
#define b10001110 0x8e
|
||||
#define b10001111 0x8f
|
||||
#define b10010000 0x90
|
||||
#define b10010001 0x91
|
||||
#define b10010010 0x92
|
||||
#define b10010011 0x93
|
||||
#define b10010100 0x94
|
||||
#define b10010101 0x95
|
||||
#define b10010110 0x96
|
||||
#define b10010111 0x97
|
||||
#define b10011000 0x98
|
||||
#define b10011001 0x99
|
||||
#define b10011010 0x9a
|
||||
#define b10011011 0x9b
|
||||
#define b10011100 0x9c
|
||||
#define b10011101 0x9d
|
||||
#define b10011110 0x9e
|
||||
#define b10011111 0x9f
|
||||
#define b10100000 0xa0
|
||||
#define b10100001 0xa1
|
||||
#define b10100010 0xa2
|
||||
#define b10100011 0xa3
|
||||
#define b10100100 0xa4
|
||||
#define b10100101 0xa5
|
||||
#define b10100110 0xa6
|
||||
#define b10100111 0xa7
|
||||
#define b10101000 0xa8
|
||||
#define b10101001 0xa9
|
||||
#define b10101010 0xaa
|
||||
#define b10101011 0xab
|
||||
#define b10101100 0xac
|
||||
#define b10101101 0xad
|
||||
#define b10101110 0xae
|
||||
#define b10101111 0xaf
|
||||
#define b10110000 0xb0
|
||||
#define b10110001 0xb1
|
||||
#define b10110010 0xb2
|
||||
#define b10110011 0xb3
|
||||
#define b10110100 0xb4
|
||||
#define b10110101 0xb5
|
||||
#define b10110110 0xb6
|
||||
#define b10110111 0xb7
|
||||
#define b10111000 0xb8
|
||||
#define b10111001 0xb9
|
||||
#define b10111010 0xba
|
||||
#define b10111011 0xbb
|
||||
#define b10111100 0xbc
|
||||
#define b10111101 0xbd
|
||||
#define b10111110 0xbe
|
||||
#define b10111111 0xbf
|
||||
#define b11000000 0xc0
|
||||
#define b11000001 0xc1
|
||||
#define b11000010 0xc2
|
||||
#define b11000011 0xc3
|
||||
#define b11000100 0xc4
|
||||
#define b11000101 0xc5
|
||||
#define b11000110 0xc6
|
||||
#define b11000111 0xc7
|
||||
#define b11001000 0xc8
|
||||
#define b11001001 0xc9
|
||||
#define b11001010 0xca
|
||||
#define b11001011 0xcb
|
||||
#define b11001100 0xcc
|
||||
#define b11001101 0xcd
|
||||
#define b11001110 0xce
|
||||
#define b11001111 0xcf
|
||||
#define b11010000 0xd0
|
||||
#define b11010001 0xd1
|
||||
#define b11010010 0xd2
|
||||
#define b11010011 0xd3
|
||||
#define b11010100 0xd4
|
||||
#define b11010101 0xd5
|
||||
#define b11010110 0xd6
|
||||
#define b11010111 0xd7
|
||||
#define b11011000 0xd8
|
||||
#define b11011001 0xd9
|
||||
#define b11011010 0xda
|
||||
#define b11011011 0xdb
|
||||
#define b11011100 0xdc
|
||||
#define b11011101 0xdd
|
||||
#define b11011110 0xde
|
||||
#define b11011111 0xdf
|
||||
#define b11100000 0xe0
|
||||
#define b11100001 0xe1
|
||||
#define b11100010 0xe2
|
||||
#define b11100011 0xe3
|
||||
#define b11100100 0xe4
|
||||
#define b11100101 0xe5
|
||||
#define b11100110 0xe6
|
||||
#define b11100111 0xe7
|
||||
#define b11101000 0xe8
|
||||
#define b11101001 0xe9
|
||||
#define b11101010 0xea
|
||||
#define b11101011 0xeb
|
||||
#define b11101100 0xec
|
||||
#define b11101101 0xed
|
||||
#define b11101110 0xee
|
||||
#define b11101111 0xef
|
||||
#define b11110000 0xf0
|
||||
#define b11110001 0xf1
|
||||
#define b11110010 0xf2
|
||||
#define b11110011 0xf3
|
||||
#define b11110100 0xf4
|
||||
#define b11110101 0xf5
|
||||
#define b11110110 0xf6
|
||||
#define b11110111 0xf7
|
||||
#define b11111000 0xf8
|
||||
#define b11111001 0xf9
|
||||
#define b11111010 0xfa
|
||||
#define b11111011 0xfb
|
||||
#define b11111100 0xfc
|
||||
#define b11111101 0xfd
|
||||
#define b11111110 0xfe
|
||||
#define b11111111 0xff
|
||||
|
||||
/*********************************************************************
|
||||
* MACROS
|
||||
*/
|
||||
/*********************************************************************
|
||||
* TYPEDEFS
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
* VARIABLES
|
||||
*/
|
||||
extern SimpleDescriptionFormat_t zclZigUP_SimpleDesc[];
|
||||
|
||||
extern CONST zclCommandRec_t zclZigUP_Cmds[];
|
||||
|
||||
extern CONST uint8 zclCmdsArraySize;
|
||||
|
||||
// attribute list
|
||||
extern CONST zclAttrRec_t zclZigUP_Attrs[];
|
||||
extern CONST uint8 zclZigUP_NumAttributes;
|
||||
|
||||
// Identify attributes
|
||||
extern uint16 zclZigUP_IdentifyTime;
|
||||
extern uint8 zclZigUP_IdentifyCommissionState;
|
||||
|
||||
// OnOff attributes
|
||||
extern uint8 zclZigUP_OnOff;
|
||||
|
||||
/*********************************************************************
|
||||
* FUNCTIONS
|
||||
*/
|
||||
void _delay_ns_400(void);
|
||||
void _delay_ns_800(void);
|
||||
void _delay_us(uint16 microSecs);
|
||||
void _delay_ms(uint16 milliSecs);
|
||||
void FactoryReset(void);
|
||||
uint16 ADC_Read(void);
|
||||
uint16 ADC_Read_Avg(void);
|
||||
float ADC_GetVoltage(void);
|
||||
uint16 ADC_Temperature(void);
|
||||
uint16 ADC_Temperature_Avg(void);
|
||||
float ADC_GetTemperature(void);
|
||||
void UART0_Init(void);
|
||||
void UART0_Transmit(char data);
|
||||
void UART0_String(const char *s);
|
||||
void Relais(uint8 state);
|
||||
void LED(uint8 state);
|
||||
void WS2812_StoreBit(uint8 bit);
|
||||
void WS2812_SendLED(uint8 red, uint8 green, uint8 blue);
|
||||
uint8 GetRandomNumber(void);
|
||||
__interrupt void IRQ_S0(void);
|
||||
__interrupt void IRQ_KEY(void);
|
||||
__interrupt void IRQ_DIGIN(void);
|
||||
void zclZigUP_Reporting(void);
|
||||
void Measure(void);
|
||||
int DHT22_Measure(void);
|
||||
|
||||
int DS1820_Measure(void);
|
||||
|
||||
void ds18b20_send(uint8 bit);
|
||||
uint8 ds18b20_read(void);
|
||||
void ds18b20_send_byte(int8 data);
|
||||
uint8 ds18b20_read_byte(void);
|
||||
uint8 ds18b20_RST_PULSE(void);
|
||||
uint8 ds18b20_get_temp(void);
|
||||
|
||||
static void zclZigUP_BasicResetCB( void );
|
||||
static void zclZigUP_IdentifyCB( zclIdentify_t *pCmd );
|
||||
static void zclZigUP_IdentifyQueryRspCB( zclIdentifyQueryRsp_t *pRsp );
|
||||
static void zclZigUP_OnOffCB( uint8 cmd );
|
||||
static void zclZigUP_ProcessIdentifyTimeChange( void );
|
||||
|
||||
// Functions to process ZCL Foundation incoming Command/Response messages
|
||||
static void zclZigUP_ProcessIncomingMsg( zclIncomingMsg_t *msg );
|
||||
#ifdef ZCL_READ
|
||||
static uint8 zclZigUP_ProcessInReadRspCmd( zclIncomingMsg_t *pInMsg );
|
||||
#endif
|
||||
#ifdef ZCL_WRITE
|
||||
static uint8 zclZigUP_ProcessInWriteRspCmd( zclIncomingMsg_t *pInMsg );
|
||||
#endif
|
||||
static uint8 zclZigUP_ProcessInDefaultRspCmd( zclIncomingMsg_t *pInMsg );
|
||||
#ifdef ZCL_DISCOVER
|
||||
static uint8 zclZigUP_ProcessInDiscCmdsRspCmd( zclIncomingMsg_t *pInMsg );
|
||||
static uint8 zclZigUP_ProcessInDiscAttrsRspCmd( zclIncomingMsg_t *pInMsg );
|
||||
static uint8 zclZigUP_ProcessInDiscAttrsExtRspCmd( zclIncomingMsg_t *pInMsg );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialization for the task
|
||||
*/
|
||||
extern void zclZigUP_Init( byte task_id );
|
||||
|
||||
/*
|
||||
* Event Process for the task
|
||||
*/
|
||||
extern UINT16 zclZigUP_event_loop( byte task_id, UINT16 events );
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZCL_ZIGUP_H */
|
||||
256
src/ZigUP/Source/zcl_zigup_data.c
Executable file
256
src/ZigUP/Source/zcl_zigup_data.c
Executable file
@@ -0,0 +1,256 @@
|
||||
/*********************************************************************
|
||||
* INCLUDES
|
||||
*/
|
||||
#include "ZComDef.h"
|
||||
#include "OSAL.h"
|
||||
#include "AF.h"
|
||||
#include "ZDConfig.h"
|
||||
|
||||
#include "zcl.h"
|
||||
#include "zcl_general.h"
|
||||
#include "zcl_ha.h"
|
||||
#include "zcl_ezmode.h"
|
||||
#include "zcl_poll_control.h"
|
||||
#include "zcl_electrical_measurement.h"
|
||||
#include "zcl_diagnostic.h"
|
||||
#include "zcl_meter_identification.h"
|
||||
#include "zcl_appliance_identification.h"
|
||||
#include "zcl_appliance_events_alerts.h"
|
||||
#include "zcl_power_profile.h"
|
||||
#include "zcl_appliance_control.h"
|
||||
#include "zcl_appliance_statistics.h"
|
||||
#include "zcl_hvac.h"
|
||||
|
||||
#include "zcl_zigup.h"
|
||||
|
||||
/*********************************************************************
|
||||
* CONSTANTS
|
||||
*/
|
||||
|
||||
#define ZIGUP_DEVICE_VERSION 0
|
||||
#define ZIGUP_FLAGS 0
|
||||
|
||||
#define ZIGUP_HWVERSION 1
|
||||
#define ZIGUP_ZCLVERSION 1
|
||||
|
||||
/*********************************************************************
|
||||
* TYPEDEFS
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
* MACROS
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
* GLOBAL VARIABLES
|
||||
*/
|
||||
|
||||
// Basic Cluster
|
||||
const uint8 zclZigUP_HWRevision = ZIGUP_HWVERSION;
|
||||
const uint8 zclZigUP_ZCLVersion = ZIGUP_ZCLVERSION;
|
||||
const uint8 zclZigUP_ManufacturerName[] = { 9, 'f','o','r','m','t','a','p','e','z' };
|
||||
const uint8 zclZigUP_ModelId[] = { 9, 'Z','i','g','B','e','e',' ','U','P' };
|
||||
const uint8 zclZigUP_DateCode[] = { 16, '2','0','1','9','0','4','0','6',' ',' ',' ',' ',' ',' ',' ',' ' };
|
||||
const uint8 zclZigUP_PowerSource = POWER_SOURCE_MAINS_1_PHASE;
|
||||
|
||||
uint8 zclZigUP_LocationDescription[17] = { 16, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
|
||||
uint8 zclZigUP_PhysicalEnvironment = 0;
|
||||
uint8 zclZigUP_DeviceEnable = DEVICE_ENABLED;
|
||||
|
||||
// Identify Cluster
|
||||
uint16 zclZigUP_IdentifyTime = 0;
|
||||
|
||||
// On/Off Cluster
|
||||
uint8 zclZigUP_OnOff = LIGHT_OFF;
|
||||
|
||||
#if ZCL_DISCOVER
|
||||
CONST zclCommandRec_t zclZigUP_Cmds[] =
|
||||
{
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
COMMAND_BASIC_RESET_FACT_DEFAULT,
|
||||
CMD_DIR_SERVER_RECEIVED
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_ON_OFF,
|
||||
COMMAND_OFF,
|
||||
CMD_DIR_SERVER_RECEIVED
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_ON_OFF,
|
||||
COMMAND_ON,
|
||||
CMD_DIR_SERVER_RECEIVED
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_ON_OFF,
|
||||
COMMAND_TOGGLE,
|
||||
CMD_DIR_SERVER_RECEIVED
|
||||
}
|
||||
};
|
||||
|
||||
CONST uint8 zclCmdsArraySize = ( sizeof(zclZigUP_Cmds) / sizeof(zclZigUP_Cmds[0]) );
|
||||
#endif // ZCL_DISCOVER
|
||||
|
||||
/*********************************************************************
|
||||
* ATTRIBUTE DEFINITIONS - Uses REAL cluster IDs
|
||||
*/
|
||||
CONST zclAttrRec_t zclZigUP_Attrs[] =
|
||||
{
|
||||
// *** General Basic Cluster Attributes ***
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC, // Cluster IDs - defined in the foundation (ie. zcl.h)
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_HW_VERSION, // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)
|
||||
ZCL_DATATYPE_UINT8, // Data Type - found in zcl.h
|
||||
ACCESS_CONTROL_READ, // Variable access control - found in zcl.h
|
||||
(void *)&zclZigUP_HWRevision // Pointer to attribute variable
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_ZCL_VERSION,
|
||||
ZCL_DATATYPE_UINT8,
|
||||
ACCESS_CONTROL_READ,
|
||||
(void *)&zclZigUP_ZCLVersion
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_MANUFACTURER_NAME,
|
||||
ZCL_DATATYPE_CHAR_STR,
|
||||
ACCESS_CONTROL_READ,
|
||||
(void *)zclZigUP_ManufacturerName
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_MODEL_ID,
|
||||
ZCL_DATATYPE_CHAR_STR,
|
||||
ACCESS_CONTROL_READ,
|
||||
(void *)zclZigUP_ModelId
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_DATE_CODE,
|
||||
ZCL_DATATYPE_CHAR_STR,
|
||||
ACCESS_CONTROL_READ,
|
||||
(void *)zclZigUP_DateCode
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_POWER_SOURCE,
|
||||
ZCL_DATATYPE_UINT8,
|
||||
ACCESS_CONTROL_READ,
|
||||
(void *)&zclZigUP_PowerSource
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_LOCATION_DESC,
|
||||
ZCL_DATATYPE_CHAR_STR,
|
||||
(ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
|
||||
(void *)zclZigUP_LocationDescription
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_PHYSICAL_ENV,
|
||||
ZCL_DATATYPE_UINT8,
|
||||
(ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
|
||||
(void *)&zclZigUP_PhysicalEnvironment
|
||||
}
|
||||
},
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
{ // Attribute record
|
||||
ATTRID_BASIC_DEVICE_ENABLED,
|
||||
ZCL_DATATYPE_BOOLEAN,
|
||||
(ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
|
||||
(void *)&zclZigUP_DeviceEnable
|
||||
}
|
||||
},
|
||||
|
||||
#ifdef ZCL_IDENTIFY
|
||||
// *** Identify Cluster Attribute ***
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_IDENTIFY,
|
||||
{ // Attribute record
|
||||
ATTRID_IDENTIFY_TIME,
|
||||
ZCL_DATATYPE_UINT16,
|
||||
(ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
|
||||
(void *)&zclZigUP_IdentifyTime
|
||||
}
|
||||
},
|
||||
#endif
|
||||
|
||||
// *** On/Off Cluster Attributes ***
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_ON_OFF,
|
||||
{ // Attribute record
|
||||
ATTRID_ON_OFF,
|
||||
ZCL_DATATYPE_BOOLEAN,
|
||||
ACCESS_CONTROL_READ,
|
||||
(void *)&zclZigUP_OnOff
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
uint8 CONST zclZigUP_NumAttributes = ( sizeof(zclZigUP_Attrs) / sizeof(zclZigUP_Attrs[0]) );
|
||||
|
||||
/*********************************************************************
|
||||
* SIMPLE DESCRIPTOR
|
||||
*/
|
||||
// This is the Cluster ID List and should be filled with Application
|
||||
// specific cluster IDs.
|
||||
const cId_t zclZigUP_InClusterList[] =
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC,
|
||||
ZCL_CLUSTER_ID_GEN_IDENTIFY,
|
||||
ZCL_CLUSTER_ID_GEN_GROUPS,
|
||||
ZCL_CLUSTER_ID_GEN_SCENES,
|
||||
ZCL_CLUSTER_ID_GEN_ON_OFF
|
||||
};
|
||||
// work-around for compiler bug... IAR can't calculate size of array with #if options.
|
||||
#define ZCLZIGUP_MAX_INCLUSTERS 5
|
||||
|
||||
const cId_t zclZigUP_OutClusterList[] =
|
||||
{
|
||||
ZCL_CLUSTER_ID_GEN_BASIC
|
||||
};
|
||||
#define ZCLZIGUP_MAX_OUTCLUSTERS (sizeof(zclZigUP_OutClusterList) / sizeof(zclZigUP_OutClusterList[0]))
|
||||
|
||||
SimpleDescriptionFormat_t zclZigUP_SimpleDesc[1] = {
|
||||
{
|
||||
ZIGUP_ENDPOINT, // int Endpoint;
|
||||
ZCL_HA_PROFILE_ID, // uint16 AppProfId;
|
||||
ZCL_HA_DEVICEID_ON_OFF_LIGHT, // uint16 AppDeviceId;
|
||||
ZIGUP_DEVICE_VERSION, // int AppDevVer:4;
|
||||
ZIGUP_FLAGS, // int AppFlags:4;
|
||||
ZCLZIGUP_MAX_INCLUSTERS, // byte AppNumInClusters;
|
||||
(cId_t *)zclZigUP_InClusterList, // byte *pAppInClusterList;
|
||||
ZCLZIGUP_MAX_OUTCLUSTERS, // byte AppNumInClusters;
|
||||
(cId_t *)zclZigUP_OutClusterList // byte *pAppInClusterList;
|
||||
}
|
||||
};
|
||||
|
||||
/*********************************************************************
|
||||
* GLOBAL FUNCTIONS
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
* LOCAL FUNCTIONS
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user