gxPL  1.0
Tools, Application and Framework for xPL
gxPL.h
1 
9 #ifndef _GXPL_HEADER_
10 #define _GXPL_HEADER_
11 
12 #include <gxPL/defs.h>
13 #include <gxPL/message.h>
14 #include <gxPL/util.h>
15 #include <gxPL/device.h>
16 #ifndef __AVR__
17 #include <gxPL/hub.h>
18 #include <gxPL/bridge.h>
19 #endif
20 
21 __BEGIN_C_DECLS
22 /* ========================================================================== */
23 
24 /* api functions ============================================================ */
40 gxPLSetting * gxPLSettingNew (const char * iface, const char * iolayer, gxPLConnectType type);
41 
62 gxPLSetting * gxPLSettingFromCommandArgs (int argc, char * argv[], gxPLConnectType type);
63 
82 gxPLApplication * gxPLAppOpen (gxPLSetting * setting);
83 
92 int gxPLAppDisableAllDevices (gxPLApplication * app);
93 
99 int gxPLAppClose (gxPLApplication * app);
100 
107 int gxPLAppPoll (gxPLApplication * app, int timeout_ms);
108 
115 gxPLConnectType gxPLAppConnectionType (const gxPLApplication * app);
116 
123 gxPLSetting * gxPLAppSetting (gxPLApplication * app);
124 
141 int gxPLAppBroadcastMessage (gxPLApplication * app, const gxPLMessage * message);
142 
151 int gxPLAppSendMessage (gxPLApplication * app, const gxPLMessage * message,
152  const gxPLIoAddr * target);
162 int gxPLAppIsHubEchoMessage (const gxPLApplication * app,
163  const gxPLMessage * message, const gxPLId * my_id);
164 
183 gxPLDevice * gxPLAppAddDevice (gxPLApplication * app, const char * vendor_id,
184  const char * device_id, const char * instance_id);
185 
189 int gxPLAppDeviceCount (gxPLApplication * app);
190 
198 gxPLDevice * gxPLAppDeviceAt (gxPLApplication * app, int index);
199 
207 int gxPLAppDeviceIndex (gxPLApplication * app, const gxPLDevice * device);
208 
215 int gxPLAppRemoveDevice (gxPLApplication * app, gxPLDevice * device);
216 
231 gxPLDevice * gxPLAppAddConfigurableDevice (gxPLApplication * app,
232  const char * vendor_id, const char * device_id,
233  const char * filename);
256 int gxPLGenerateUniqueId (const gxPLApplication * app, char * id, int len);
257 
270 /* types ==================================================================== */
274 typedef void (* gxPLMessageListener) (gxPLApplication * app, gxPLMessage *, void *);
275 
276 /* internal public functions ================================================ */
277 
286 int gxPLMessageListenerAdd (gxPLApplication * app, gxPLMessageListener listener, void * udata);
287 
294 int gxPLMessageListenerRemove (gxPLApplication * app, gxPLMessageListener listener);
295 
310 const char * gxPLVersion (void);
311 
315 int gxPLVersionMajor (void);
316 
320 int gxPLVersionMinor (void);
321 
325 int gxPLVersionPatch (void);
326 
330 unsigned long gxPLVersionSha1 (void);
331 
341 /* internal public functions ================================================ */
351 xVector * gxPLIoLayerList (void);
352 
359 const char * gxPLIoLocalAddrGet (const gxPLApplication * app);
360 
367 const xVector * gxPLIoLocalAddrList (const gxPLApplication * app);
368 
375 const char * gxPLIoBcastAddrGet (const gxPLApplication * app);
376 
383 const gxPLIoAddr * gxPLIoInfoGet (const gxPLApplication * app);
384 
391 const char * gxPLIoInterfaceGet (const gxPLApplication * app);
392 
399 const char * gxPLIoLayerGet (const gxPLApplication * app);
400 
439 int gxPLIoCtl (gxPLApplication * app, int req, ...);
440 
445 /* ========================================================================== */
446 __END_C_DECLS
447 #endif /* _GXPL_HEADER_ defined */
unsigned long gxPLVersionSha1(void)
SHA1 signature of the current version.
int gxPLAppClose(gxPLApplication *app)
Close a gxPLApplication object and release all ressources.
gxPLSetting * gxPLAppSetting(gxPLApplication *app)
Returns application setting.
const xVector * gxPLIoLocalAddrList(const gxPLApplication *app)
Local network address list as a vector of strings.
gxPLDevice * gxPLAppAddDevice(gxPLApplication *app, const char *vendor_id, const char *device_id, const char *instance_id)
Adds a new device to an application.
int gxPLAppSendMessage(gxPLApplication *app, const gxPLMessage *message, const gxPLIoAddr *target)
Send a targeted xPL message.
Describe a source or destination xPL identifier.
Definition: defs.h:279
int gxPLGenerateUniqueId(const gxPLApplication *app, char *id, int len)
Generates a fairly unique identifier.
gxPLDevice * gxPLAppAddConfigurableDevice(gxPLApplication *app, const char *vendor_id, const char *device_id, const char *filename)
Adds a new configurable device.
gxPLSetting * gxPLSettingFromCommandArgs(int argc, char *argv[], gxPLConnectType type)
Returns a new gxPLApplication setting from command line parameters.
int gxPLAppPoll(gxPLApplication *app, int timeout_ms)
Polling event of an application.
gxPLConnectType
xPL Connection mode
Definition: defs.h:126
Describe a gxPLApplication configuration.
Definition: defs.h:238
void(* gxPLMessageListener)(gxPLApplication *app, gxPLMessage *, void *)
Function that will be called each valid message reception.
Definition: gxPL.h:274
int gxPLVersionPatch(void)
Patch number of the current version.
int gxPLAppIsHubEchoMessage(const gxPLApplication *app, const gxPLMessage *message, const gxPLId *my_id)
Check if a message is an echo hub.
int gxPLAppDisableAllDevices(gxPLApplication *app)
Stop all devices.
const char * gxPLIoBcastAddrGet(const gxPLApplication *app)
Broadcast network address as a string.
Describe a network address.
Definition: defs.h:263
int gxPLAppDeviceIndex(gxPLApplication *app, const gxPLDevice *device)
Return index for a given device.
gxPLSetting * gxPLSettingNew(const char *iface, const char *iolayer, gxPLConnectType type)
Returns a new gxPLApplication setting from parameters.
gxPLConnectType gxPLAppConnectionType(const gxPLApplication *app)
Connection type.
const char * gxPLIoLayerGet(const gxPLApplication *app)
Name of the underlying layer of the network.
xVector * gxPLIoLayerList(void)
Returns a list of io layers available on the system.
const char * gxPLIoInterfaceGet(const gxPLApplication *app)
Name of the network interface on the system.
int gxPLVersionMajor(void)
Major number of the current version.
const gxPLIoAddr * gxPLIoInfoGet(const gxPLApplication *app)
Local Network informations.
gxPLApplication * gxPLAppOpen(gxPLSetting *setting)
Opens a new gxPLApplication object.
int gxPLAppDeviceCount(gxPLApplication *app)
Return number of devices.
int gxPLAppBroadcastMessage(gxPLApplication *app, const gxPLMessage *message)
Broadcast a message.
const char * gxPLVersion(void)
Current version as a static string buffer.
int gxPLMessageListenerRemove(gxPLApplication *app, gxPLMessageListener listener)
Remove a message listener.
int gxPLMessageListenerAdd(gxPLApplication *app, gxPLMessageListener listener, void *udata)
Add a message listener.
int gxPLAppRemoveDevice(gxPLApplication *app, gxPLDevice *device)
Removes a device.
const char * gxPLIoLocalAddrGet(const gxPLApplication *app)
Local network address as a string.
gxPLDevice * gxPLAppDeviceAt(gxPLApplication *app, int index)
Return a device at a given index.
int gxPLVersionMinor(void)
Minor number of the current version.