wireless.h

Go to the documentation of this file.
00001 
00035 #ifndef WIRELESS_H
00036 #define WIRELESS_H
00037 
00038 //Note: If this is raised above 16, we will need to do
00039 //something about frame numbers for TX Status packets.
00043 //TODO: a PacketGroupHandler is at least 10 bytes (I don't know if function pointers are 2 bytes
00044 // or 4 bytes).  That means that in the c file, your array of packet groups is at least 160 bytes.
00045 // Normally that might be fine (the robot's avr chips have 4k SRAM), but austin's chip only has
00046 // 1k SRAM, so if this number can be reduced or if the size of the struct could be reduced, that would be a plus.
00047 #define WL_MAX_PACKET_GROUPS 16
00048 
00079 //TODO: the order of member variables in this struct should be changed in case the compile packs the struct
00080 // In order to achieve the best packing, the variables should be listed in order of decreasing memory size.
00081 // Thus, pointers should be first, followed by int, followed by char.
00082 typedef struct
00083 {
00089   //TODO: if this number must be less than or equal to WL_MAX_PACKET_GROUPS, don't you only need
00090   // one byte for it and it can be made an unsigned char?
00091         unsigned int groupCode;
00092 
00097         void (*timeout_handler) (void);
00098 
00108         void (*handle_response) (int frame, int received);
00109 
00119         void (*handle_receive) (char type, int source, unsigned char* packet, int length);
00120 
00124         void (*unregister) (void);
00125 
00126 } PacketGroupHandler;
00127 
00129 int wl_init(void);
00131 void wl_terminate(void);
00133 void wl_do(void);
00135 void wl_register_packet_group(PacketGroupHandler* h);
00137 void wl_unregister_packet_group(PacketGroupHandler* h);
00138 
00140 int wl_send_robot_to_robot_global_packet(char group, char type, char* data, int len, int dest, char frame);
00142 int wl_send_robot_to_robot_packet(char group, char type, char* data, int len, int dest, char frame);
00144 int wl_send_global_packet(char group, char type, char* data, int len, char frame);
00146 void wl_send_pan_packet(char group, char type, char* data, int len, char frame);
00147 
00149 int wl_set_pan(int pan);
00151 int wl_get_pan(void);
00153 int wl_set_channel(int channel);
00155 int wl_get_channel(void);
00157 int wl_get_xbee_id(void);
00159 void wl_set_com_port(char* port);
00160  // end defgroup
00162 
00163 #endif
00164 

Generated on Mon Apr 28 17:49:53 2008 for libwireless by  doxygen 1.5.3