/**************************************************************************************************
  Filename:       easenlock.h
  Revised:        $Date: 2017-11-28 16:09:46 -0700 (Tue, 28 Nov 2018) $


  Description:    Zigbee Cluster Library - EasenLock device application.


*************************************************************************************************/

#ifndef ZCL_EASENLOCK_H
#define ZCL_EASENLOCK_H

#ifdef __cplusplus
extern "C"
{
#endif

/*********************************************************************
 * INCLUDES
 */
#include "zcl.h"


// Added to include ZLL Target functionality
#if defined ( BDB_TL_INITIATOR ) || defined ( BDB_TL_TARGET )
  #include "zcl_general.h"
  #include "bdb_tlCommissioning.h"
#endif

/*********************************************************************
 * CONSTANTS
 */
   
#define RET_SUCCESS         0
#define RET_FAILED          1   
   
   
   
#define EasenLock_ENDPOINT            8
// Added to include ZLL Target functionality
#define EASENLOCK_NUM_GRPS            2

#define EasenLock_PROFID             0x0F08     // 0x0F09 // 0x0F08
#define EasenLock_DEVICEID           0x0001
#define EasenLock_DEVICE_VERSION     0
#define EasenLock_FLAGS              0

#define EasenLock_MAX_CLUSTERS       2
#define EasenLock_PERIODIC_CLUSTERID 0x1234
#define EasenLock_FLASH_CLUSTERID    2
#define EasenLock_COM_CLUSTERID      3
#define EasenLock_P2P_CLUSTERID      4  


// Application Events
#define EASENLOCK_MAIN_SCREEN_EVT          0x0001
#define EASENLOCK_LEVEL_CTRL_EVT           0x0002
#define EASENLOCK_END_DEVICE_REJOIN_EVT    0x0004  
  
/* EASENLOCK_TODO: define app events here */
  
#define EASENLOCK_EVT_1                    0x0008
/*
#define EASENLOCK_EVT_2                    0x0010
#define EASENLOCK_EVT_3                    0x0020
*/
  
#define EASENLOCK_START_BDB_COMMISSIONING  0x0040

// Application Display Modes
#define GENERIC_MAINMODE      0x00
#define GENERIC_HELPMODE      0x01
  
#define EASENLOCK_END_DEVICE_REJOIN_DELAY 10000

/*********************************************************************
 * MACROS
 */
/*********************************************************************
 * TYPEDEFS
 */

/*********************************************************************
 * VARIABLES
 */

// Added to include ZLL Target functionality
#if defined ( BDB_TL_INITIATOR ) || defined ( BDB_TL_TARGET )
  extern bdbTLDeviceInfo_t tlEasenLock_DeviceInfo;
#endif

extern SimpleDescriptionFormat_t zclEasenLock_SimpleDesc;

extern CONST zclCommandRec_t zclEasenLock_Cmds[];

extern CONST uint8 zclCmdsArraySize;

// attribute list
extern CONST zclAttrRec_t zclEasenLock_Attrs[];
extern CONST uint8 zclEasenLock_NumAttributes;

// Identify attributes
extern uint16 zclEasenLock_IdentifyTime;
extern uint8  zclEasenLock_IdentifyCommissionState;

// EASENLOCK_TODO: Declare application specific attributes here


/*********************************************************************
 * FUNCTIONS
 */

 /*
  * Initialization for the task
  */
extern void EasenLock_Init( byte task_id );

/*
 *  Event Process for the task
 */
extern UINT16 EasenLock_event_loop( byte task_id, UINT16 events );

/*
 *  Reset all writable attributes to their default values.
 */
extern void EasenLock_ResetAttributesToDefaultValues(void);


/*********************************************************************
*********************************************************************/

#ifdef __cplusplus
}
#endif

#endif /* ZCL_EASENLOCK_H */
