
#ifndef __XBEE_ESCAPING_H_
#define __XBEE_ESCAPING_H_


//0x10帧格式
typedef struct frameForMat {

    unsigned char frameHead;//帧头
    unsigned int frameLen;//数据长度Number of bytes between length and checksum fields.
    unsigned char frameType;//帧类型，Transmit Request
    unsigned char frameID;//
    unsigned char des64DeviceAdd[8];//器件ID
    unsigned int des16NetAdd;//网络ID
    unsigned char broadcastRadius;//广播半径
    unsigned char transmitOptions;//发送选项
} fRameFORMAT_t;

//RX,frameType 0x90帧格式
typedef struct frameForMat0x90 {

    unsigned char frameHead;//帧头
    unsigned int frameLen;//数据长度Number of bytes between length and checksum fields.
    unsigned char frameType;//帧类型，Transmit Request
    unsigned char frameID;//
    unsigned char source64DeviceAdd[8];//器件ID
    unsigned int source16NetAdd;//网络ID
    unsigned char receiveOptions;//接收选项
} fRAME_0x90_RECEIVE_FORMAT_t;

//RX,frameType 0x91帧格式
typedef struct frameForMat0x91 {

    unsigned char frameHead;//帧头
    unsigned int frameLen;//数据长度Number of bytes between length and checksum fields.
    unsigned char frameType;//帧类型，Transmit Request
    unsigned char source64DeviceAdd[8];//器件ID
    unsigned int source16NetAdd;//网络ID
    unsigned char sourceEndpoint;
    unsigned char destinationEndpoint;
    unsigned int clusterID;
    unsigned int proFileID;
    unsigned char receiveOptions;//接收选项
} fRAME_0x91_RECEIVE_FORMAT_t;

//remote AT command 0x17帧格式
typedef struct frameForMat0x17 {

    unsigned char frameHead;//帧头
    unsigned int frameLen;//数据长度Number of bytes between length and checksum fields.
    unsigned char frameType;//帧类型，Transmit Request
    unsigned char frameID;//
    unsigned char des64DeviceAdd[8];//器件ID
    unsigned int des16NetAdd;//网络ID
    unsigned char remoteCommandOptions;
    unsigned int ATCommand;
    unsigned char commandParameter;
} fRAME_0x17_REMOTE_FORMAT_t;

//***********************************************************************************
//***********************************************************************************
extern fRameFORMAT_t userSendFrame_t;//发送时候帧格式初始化
extern fRAME_0x90_RECEIVE_FORMAT_t comeFromWhom0x90Frame_t;//接收0x90时候帧格式
extern fRAME_0x91_RECEIVE_FORMAT_t comeFromWhom0x91Frame_t;//接收0x91时候帧格式
extern fRAME_0x17_REMOTE_FORMAT_t atRemoteCommand0x17Frame_t;//远程命令帧

extern unsigned char* xBeeApp2MakeFrame(fRameFORMAT_t *sendFrameFormat,unsigned char* buf);//返回一个处理完成后的数组的首地址
extern unsigned char* xBeeApp2UnEscaping0x90Mode(unsigned char* buf);//返回一个处理完成后的数组的首地址
extern unsigned char* xBeeApp2UnEscaping0x91Mode(unsigned char* buf);//返回一个处理完成后的数组的首地址
extern unsigned char* xBeeApp2RemoteFrame(void);//远程命令付值，返回赋值后的数组

#endif
