www.pudn.com > Usb_Project.rar > relay.h


 
#ifndef _RELAY_H_ 
#define _RELAY_H_ 
 
 
 
/**command**/ 
 
/*  
*  rf_cfg_hdr (bytes) 
*/ 
struct relay_cfg_hdr 
{ 
    //data 
    unsigned char data[32]; 
     
    // id  
    unsigned char id[6]; 
 
    //protocol version 
    unsigned char proto_ver; 
    //relay cmd 
    unsigned char relay_cmd; 
}; 
 
/* 
*   RFD <-> FFD 
* 
*   Note: An auto report frame from RFD use dst/relay/cmd/src/grp 0 
*   Group == 0 is anycast 
 
*/ 
#define FRM_CMD_RFD_FFD   0x00 
 
/* 
*   trigger report 
*/ 
#define FRM_CMD_TRIGGER_REPORT  0x10 
 
/* 
*   Relay config 
*/ 
#define FRM_CMD_RELAY_CFG   0x18 
 
/* transfer file to/from relay 
*/ 
#define FRM_CMD_RELAY_FTP   0x19 
#define FRM_CMD_RELAY_FTP_XFER   0x1A 
 
 
/* 
*   tracing 
*/ 
#define FRM_CMD_GROUP_TRACE   0x1B 
 
#define FRM_CMD_GROUP_TRACE_ASK   0x1C 
 
 
#define FRM_CMD_ROUTE_TRACE   0x1D 
 
 
/* 
*   broadcast on every channel 
*/ 
//#define FRM_CMD_CHANNELCAST  0x1F 
 
/*  
*  top of defined protocol 
*  we ignore cmd beyond the top 
*/ 
#define FRM_CMD_CAT1_TOP    0x1F 
 
/*  
*  relay_cfg_local (bytes) 
*/ 
struct relay_cfg_local 
{ 
    //version 
    unsigned short version; 
 
    //group address 
    unsigned short  group_address; 
 
    //next and prev hop 
    unsigned short  next_prev_hop; 
 
    //channel number 
    unsigned char  chan_num; 
    //baud 
    unsigned char  baud_rate; 
     
    unsigned long  live_time; 
    //data 
    unsigned char data[24];     
}; 
 
/* In the future, we may design a session protocol 
*/ 
 
 
/* functions 
*/ 
extern int relay_comm(void); 
 
 
#endif