#ifndef _IKONKE_OPT_TUNNEL_H_
#define _IKONKE_OPT_TUNNEL_H_


#include "tl_common.h"
#include "ikk-module-def.h"

#define ZCL_FCC0_MAX_LENGTH								128


#define PRIV_CLUSTER_FCC0				0XFCC0


// Server attributes
#define ZCL_OPT_DATA_ATTRIBUTE_ID           0x0000 // Ver.: always
#define ZCL_TTS_ATTRIBUTE_ID                0x0001 // Ver.: always
#define ZCL_MTO_RR_RspRandom_ATTRIBUTE_ID   0x0002 // Ver.: always
#define ZCL_AssociatedAnnounce_ATTRIBUTE_ID 0x0003 // Ver.: always
#define ZCL_CMEI_ATTRIBUTE_ID               0x0010 // Ver.: always
#define ZCL_ISN_ATTRIBUTE_ID                0x0011 // Ver.: always
#define ZCL_InstallCode_ATTRIBUTE_ID        0x0012 // Ver.: always
#define ZCL_CHUNK_N1_ATTRIBUTE_ID           0x0013 // Ver.: always


#define OPTTUNNEL_OPTDATA_ID			0x0000	// FCC0 Cluster Attribute 0x0000
#define OPTTUNNEL_OPTDATA_MAXLEN		128

#define OPTTUNNEL_CHUNK_MAXLEN			32


#define OPTTUNNEL_UNKNOW				0xFFFF

enum {
	ECA_OPTDATA  			= 0X0000,
	ECA_TTS		 			= 0X0001,
	ECA_MTORR_RR 			= 0X0002,
	ECA_ASSOCIATED_AOUNCE	= 0X0003,
	ECA_CMEI	 			= 0X0010,
	ECA_ISN		 			= 0X0011,
	ECA_INSTALL_CODE 		= 0X0012,
	ECA_CHUNK_N1 			= 0X0013,
	ECA_UNKNOW	 			= 0XFFFF,
};

enum OOD_GLOBAL_ERRNO {
	ERR_NO_NONE				= 0X00,
	ERR_NO_COMMAND_FORMAT 	= 0X80,
	ERR_NO_ENDPOINT 		= 0X81,
	ERR_NO_OPCODE 			= 0X82,
	ERR_NO_UNKNOW 			= 0XFF,
};
typedef struct
{              		 //!< number of attribute status in the list
	uint8_t  status;                //!< should be ZCL_STATUS_SUCCESS or error
	uint16_t attrID;                //!< attribute ID
	uint8_t  *data;
} zclOptWriteRspCmd_t;

typedef enum { EOM_READ = 0, EOM_WRITE }OptMethodEm;
/** @} end of group zcl_onoff_attrId */

typedef kk_err_t (*pFUNC_OPTDATA_MESSAGE_CALLBACK)(uint8_t channel, uint8_t opcode, uint8_t args_in_out[], uint8_t *length_in_out );


void Set2NwkJoiningCountdownCounter(u32 time_ms);


/*	DESP: private clsuter protocol module init interface.
 * 	PARAM[pOptdataIncomingCallback]: private protocol optdata message incoming process callback.
 * 	Auth: mengmengli_frc.20210527.
 * */
kk_err_t kOptTunnelModuleInit(pFUNC_OPTDATA_MESSAGE_CALLBACK pOptdataIncomingCallback );




kk_err_t kOptTunnelOODReport(uint8_t channel, uint8_t opcode, uint8_t *arg, uint8_t length );




#endif /* _SAMPLE_LIGHT_H_ */
