gxPL  1.0
Tools, Application and Framework for xPL
Filters

Detailed Description

Filters provide an incredibly powerful method of addressing devices and applications. Filters are only applied to incoming broadcast messages, and are intended to reduce the number of messages that a device will act upon.
If multiple filters are present, only one of the filters needs to match for the message to be processed.
Message Filters may also be specified via a configuration message.

Collaboration diagram for Filters:

Functions

int gxPLDeviceFilterAdd (gxPLDevice *device, gxPLMessageType type, const gxPLId *source, const gxPLSchema *schema)
 Adds a filter to the device. More...
 
int gxPLDeviceFilterAddFromStr (gxPLDevice *device, char *filter)
 Adds a filter to the device from a string. More...
 
int gxPLDeviceFilterClearAll (gxPLDevice *device)
 Erases all filters. More...
 
int gxPLDeviceFilterCount (const gxPLDevice *device)
 Number of filters. More...
 
const char * gxPLDeviceFilterGet (const gxPLDevice *device, int index)
 Gets a filter. More...
 
int gxPLDeviceFilterHave (const gxPLDevice *device)
 Indicates whether the device has filters. More...
 
const char * gxPLDeviceFilterToString (const gxPLFilter *filter)
 Convert a filter to a string For display purposes. More...
 

Function Documentation

int gxPLDeviceFilterAdd ( gxPLDevice *  device,
gxPLMessageType  type,
const gxPLId source,
const gxPLSchema schema 
)

Adds a filter to the device.

Parameters
devicepointer on the device
filter_namenew filter
Returns
0, -1 if an error occurs
int gxPLDeviceFilterAddFromStr ( gxPLDevice *  device,
char *  filter 
)

Adds a filter to the device from a string.

the format of the string is as follows:

1 filter = [msgtype].[vendor].[device].[instance].[class].[type]

for example:

  • xpl-cmnd.wmute.k400.bedroom.drapes.basic
  • xpl-cmnd.wmute.k400.bedroom.drapes.*
  • xpl-cmnd.wmute.k400.bedroom.*.*
  • xpl-cmnd.wmute.k400.*.drapes.basic
  • .
Parameters
devicepointer on the device
filter_namenew filter as a string, will be modified by the function unusable after the call.
Returns
0, -1 if an error occurs
int gxPLDeviceFilterClearAll ( gxPLDevice *  device)

Erases all filters.

Parameters
devicepointer on the device
Returns
0, -1 if an error occurs
int gxPLDeviceFilterCount ( const gxPLDevice *  device)

Number of filters.

Parameters
devicepointer on the device
Returns
the value, -1 if an error occurs
const char* gxPLDeviceFilterGet ( const gxPLDevice *  device,
int  index 
)

Gets a filter.

Parameters
devicepointer on the device
indexindex of the filter to read
Returns
the filter, NULL if error occurs
int gxPLDeviceFilterHave ( const gxPLDevice *  device)

Indicates whether the device has filters.

Parameters
devicepointer on the device
Returns
0, -1 if an error occurs
const char* gxPLDeviceFilterToString ( const gxPLFilter filter)

Convert a filter to a string For display purposes.

Parameters
filterthe filter
Returns
a string in a static buffer that is overwritten with each call to the function.