#ifndef __IKONKE_COMMAND_H____________________________
#define __IKONKE_COMMAND_H____________________________
#include "ikk-module-def.h"
#include "../driver/ikk-uart.h"


#define CMD_CONTROL_FIELD_HOST_TO_ZIGBEE_NEED_ACK		0x10
#define CMD_CONTROL_FIELD_HOST_TO_ZIGBEE_NO_ACK			0x00
#define CMD_CONTROL_FIELD_ZIGBEE_TO_HOST_NEED_ACK		0x30
#define CMD_CONTROL_FIELD_ZIGBEE_TO_HOST_NO_ACK			0x20

typedef enum {
	H_TO_Z_WITH_ACK	= CMD_CONTROL_FIELD_HOST_TO_ZIGBEE_NEED_ACK,
	H_TO_Z_NO_ACK	= CMD_CONTROL_FIELD_HOST_TO_ZIGBEE_NO_ACK,
	Z_TO_H_WITH_ACK	= CMD_CONTROL_FIELD_ZIGBEE_TO_HOST_NEED_ACK,
	Z_TO_H_NO_ACK	= CMD_CONTROL_FIELD_ZIGBEE_TO_HOST_NO_ACK,
}CMD_CONTROL_FIELD_E;

typedef struct{
	uint16_t seq;
	uint8_t u8Datalen;
	uint8_t u8ChannelID;
	uint16_t u16Opcode;
	uint8_t u8ArgLen;
	uint8_t u8ARG[128];
}DataField_st;

typedef struct{
	uint8_t u8SOFHeaderBuf[2];
	uint16_t u16DataLength;
	uint8_t u8ControlFied;
	//uint16_t u16Seq;
	DataField_st stDataField;
}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);

















































#endif
