device.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _DEVICE_H
00030 #define _DEVICE_H
00031
00032 #include <libplayercore/player.h>
00033 #include <libplayercore/message.h>
00034
00035
00036 class Driver;
00037
00043 class Device
00044 {
00045 private:
00046 public:
00047
00052 Device(player_devaddr_t addr, Driver *driver);
00053
00055 ~Device();
00056
00060 int Subscribe(MessageQueue* sub_queue);
00061
00065 int Unsubscribe(MessageQueue* sub_queue);
00066
00080 void PutMsg(MessageQueue* resp_queue,
00081 uint8_t type,
00082 uint8_t subtype,
00083 void* src,
00084 size_t len,
00085 double* timestamp);
00086
00095 void PutMsg(MessageQueue* resp_queue,
00096 player_msghdr_t* hdr,
00097 void* src);
00098
00121 Message* Request(MessageQueue* resp_queue,
00122 uint8_t type,
00123 uint8_t subtype,
00124 void* src,
00125 size_t len,
00126 double* timestamp,
00127 bool threaded = true);
00128
00134 static bool MatchDeviceAddress(player_devaddr_t addr1,
00135 player_devaddr_t addr2)
00136 {
00137 return((addr1.host == addr2.host) &&
00138 (addr1.robot == addr2.robot) &&
00139 (addr1.interf == addr2.interf) &&
00140 (addr1.index == addr2.index));
00141 }
00142
00144 Device* next;
00145
00147 player_devaddr_t addr;
00148
00150 char drivername[PLAYER_MAX_DRIVER_STRING_LEN];
00151
00153 Driver* driver;
00154
00156 MessageQueue** queues;
00157
00159 size_t len_queues;
00160 };
00161
00162 #endif
Last updated 12 September 2005 21:38:45
|