46 #ifndef _INTERFACE_UTIL_H
47 #define _INTERFACE_UTIL_H
50 #if defined (PLAYER_STATIC)
51 #define PLAYERINTERFACE_EXPORT
52 #elif defined (playerinterface_EXPORTS)
53 #define PLAYERINTERFACE_EXPORT __declspec (dllexport)
55 #define PLAYERINTERFACE_EXPORT __declspec (dllimport)
58 #define PLAYERINTERFACE_EXPORT
61 #include <playerconfig.h>
80 PLAYERINTERFACE_EXPORT
int itable_init (
void);
86 PLAYERINTERFACE_EXPORT
int itable_grow (
int newSize);
91 PLAYERINTERFACE_EXPORT
void itable_destroy (
void);
96 PLAYERINTERFACE_EXPORT
int itable_add (
const char *name,
unsigned int code,
int replace);
103 PLAYERINTERFACE_EXPORT
int lookup_interface(
const char* name,
player_interface_t* interf);
110 PLAYERINTERFACE_EXPORT
int
118 PLAYERINTERFACE_EXPORT
const char*
119 lookup_interface_name(
unsigned int startpos,
int code);
125 PLAYERINTERFACE_EXPORT
const char*
126 interf_to_str(uint16_t code);
132 PLAYERINTERFACE_EXPORT uint16_t
133 str_to_interf(
const char *name);
139 PLAYERINTERFACE_EXPORT
const char*
140 msgtype_to_str(uint8_t code);
146 PLAYERINTERFACE_EXPORT uint8_t
147 str_to_msgtype(
const char *name);
#define PLAYER_WARN1(msg, a)
Error message macros.
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.
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
uint8_t type
Message type; must be one of PLAYER_MSGTYPE_*.
Definition: player.h:166
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.
uint8_t subtype
Message subtype; interface specific.
Definition: player.h:168
virtual void Main(void)=0
Main method for driver thread.
int ReadInt(int section, const char *name, int value)
Read an integer value.
Available interfaces are stored in an array of these, defined in interface_util.c.
Definition: interface_util.h:72
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:95
#define PLAYER_ERROR2(msg, a, b)
Error message macros.
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.
Class for loading configuration file information.
Definition: configfile.h:197
virtual int Setup()
Initialize the driver.
Definition: driver.h:386
A device address.
Definition: player.h:146
An autopointer for the message queue.
Definition: message.h:74
#define PLAYER_ERROR(msg)
Error message macros.
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
uint32_t size
Size in bytes of the payload to follow.
Definition: player.h:174
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:89
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:99
virtual int Shutdown()
Finalize the driver.
Definition: driver.h:393
Base class for all drivers.
Definition: driver.h:109
#define PLAYER_MSG0(level, msg)
General messages.
Definition: error.h:105
player_devaddr_t addr
Device to which this message pertains.
Definition: player.h:164
#define PLAYER_MSGQUEUE_DEFAULT_MAXLEN
Default maximum length for a message queue.
Definition: player.h:76