24 #define HAVE_STDINT_H 1
33 #include <sys/types.h>
41 #define canMSG_STD 0x0002
55 memset(msg,0,
sizeof(msg));
61 uint16_t GetSlot(
int s)
const
63 return (uint16_t) ((msg[s*2] << 8) | (msg[s*2+1]));
66 void PutSlot(
const int slot,
const uint16_t val)
68 msg[slot*2] = (val >> 8) & 0xFF;
69 msg[slot*2+1] = val & 0xFF;
72 void PutByte(
const int byte,
const uint16_t val)
74 msg[byte] = val & 0xFF;
80 sprintf(buf,
"id:%04lX %02X %02X %02X %02X %02X %02X %02X %02X",
81 id, msg[0], msg[1], msg[2], msg[3], msg[4], msg[5],
88 #define DUALCAN_NR_CHANNELS 2
111 virtual int Init(
long channel_freq) = 0;
112 virtual int ReadPacket(
CanPacket *pkt,
int channel) = 0;
113 virtual int WritePacket(
CanPacket &pkt) = 0;
114 virtual int Shutdown() = 0;
#define PLAYER_WARN1(msg, a)
Definition: error.h:90
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:159
double ReadFloat(int section, const char *name, double value)
Read a floating point (double) value.
int AddInterface(player_devaddr_t addr)
Add an interface.
Generic message header.
Definition: player.h:162
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:658
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:664
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:75
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
virtual void Main(void)=0
Main method for driver thread.
int ReadInt(int section, const char *name, int value)
Read an integer value.
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
#define PLAYER_ERROR2(msg, a, b)
Definition: error.h:83
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:112
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
static bool MatchDeviceAddress(player_devaddr_t addr1, player_devaddr_t addr2)
Compare two addresses.
Definition: device.h:201
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:106
#define PLAYER_MSGTYPE_RESP_NACK
A negative response message.
Definition: player.h:125
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
int GetTupleCount(int section, const char *name)
Get the number of values in a tuple.
Class for loading configuration file information.
Definition: configfile.h:197
int ReadTupleInt(int section, const char *name, int index, int value)
Read an integer from a tuple field.
A device address.
Definition: player.h:146
An autopointer for the message queue.
Definition: message.h:74
Definition: v4lcapture.h:100
Definition: v4lframe.h:64
void SetError(int code)
Set/reset error code.
Definition: driver.h:145
#define PLAYER_ERROR1(msg, a)
Definition: error.h:82
#define PLAYER_ERROR(msg)
Definition: error.h:81
Base class for drivers which oeprate with a thread.
Definition: driver.h:553
double timestamp
Time associated with message contents (seconds since epoch)
Definition: player.h:170
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:89
Base class for all drivers.
Definition: driver.h:109
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:76
T max(T a, T b)
Return the maximum of a, b.
Definition: utility.h:104