Main Page | Directories | File List | Globals | Examples

bsDeviceTable.h File Reference

The device table represents a list of all found BlueSense devices. More...

#include <bluemelon/types.h>
#include <bluesense/external/bsDeviceInterface.h>
#include <bluemelon/identifier.h>
#include <bluemelon/dex/types.h>

Defines

#define BLUESENSE_UNKNOWN_DEVICE_TITLE   "unknown"
#define MAX_TXTCONVERTEDDEVICE_LINELENGTH   80

Typedefs

typedef _bsDeviceTable_deviceInfo * bsDeviceTable_deviceInfo_t
typedef _bsDeviceTable_table * bsDeviceTable_table_t
typedef void(* bsDeviceTable_notifyCallback )(void *x, void *data)

Functions

DECLSPEC int bsDeviceTable_getListedDeviceCount (bsDeviceTable_table_t deviceTablePtr)
DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getDeviceById (bsDeviceTable_table_t deviceTablePtr, identifier_t id)
DECLSPEC void bsDeviceTable_getDeviceTableAsText (bsDeviceInterface_registeredDeviceInterfaces_t devInterfaceTablePtr, bsDeviceTable_table_t deviceTablePtr, char *txt, uint32_t *size)
DECLSPEC uint32_t bsDeviceTable_getDeviceTableAsTextSize (bsDeviceTable_table_t deviceTablePtr)
DECLSPEC void bsDeviceTable_clearDeviceTable (bsDeviceTable_table_t deviceTablePtr)
DECLSPEC uint8_t bsDeviceTable_isProxyAccessible (bsDeviceTable_deviceInfo_t devInfo, bluesense_proxytype_t mustBeOfType)
DECLSPEC dex_devtype_t bsDeviceTable_isDeviceInterfaceFound (bsDeviceTable_deviceInfo_t devInfo)
DECLSPEC dex_devtype_t bsDeviceTable_getDeviceType (bsDeviceTable_deviceInfo_t devInfo)
DECLSPEC identifier_t bsDeviceTable_getDeviceId (bsDeviceTable_deviceInfo_t devInfo)
DECLSPEC uint8_t bsDeviceTable_getDeviceFirmwareVersion (bsDeviceTable_deviceInfo_t devInfo)
DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getFirstDevice (bsDeviceTable_table_t deviceTablePtr)
DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getNextDevice (bsDeviceTable_deviceInfo_t devInfo)
DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getDeviceEvent (bsDeviceTable_table_t deviceTablePtr)
DECLSPEC void bsDeviceTable_resolveInterfaces (bsDeviceInterface_registeredDeviceInterfaces_t interfaceTablePtr, bsDeviceTable_table_t deviceTablePtr)
DECLSPEC bsDeviceTable_table_t bsDeviceTable_allocDeviceTable (void)
DECLSPEC void bsDeviceTable_freeDeviceTable (bsDeviceTable_table_t tablePtr)


Detailed Description

The device table represents a list of all found BlueSense devices.

The device table stores a list of BlueSense Device instances. Each instance is of type bsDeviceTable_deviceInfo_t. To get a specifc interface to a BlueSense device you first obtain a reference to a bsDeviceTable_deviceInfo_t (via the device id, bsDeviceTable_getDeviceById) Then you can obtain a device specific pointer by using eg. bsAdcInputDevice_getDeviceSpecifics(devInfo).


Define Documentation

#define BLUESENSE_UNKNOWN_DEVICE_TITLE   "unknown"
 

The type name of an unknown device

#define MAX_TXTCONVERTEDDEVICE_LINELENGTH   80
 

when device info is converted to a line of text, this is the maximum length


Typedef Documentation

typedef struct _bsDeviceTable_deviceInfo* bsDeviceTable_deviceInfo_t
 

This datastructure represents general device info, which exists for all types of devices

Examples:
analogue_in.c, analogue_out.c, blink_output.c, counter.c, list_devices.c, motor.c, rotary.c, servo.c, set_ocoutput.c, set_ocoutputpwm.c, stepper.c, and switch.c.

typedef void(* bsDeviceTable_notifyCallback)(void *x, void *data)
 

A notify callback for use when detecting devices.

See also:
bsMaster_requestRefreshDeviceTable

typedef struct _bsDeviceTable_table* bsDeviceTable_table_t
 

A table to store references to devices: bsDeviceTable_deviceInfo_t

Examples:
analogue_in.c, analogue_out.c, blink_output.c, counter.c, list_devices.c, motor.c, rotary.c, servo.c, set_ocoutput.c, set_ocoutputpwm.c, stepper.c, and switch.c.


Function Documentation

DECLSPEC bsDeviceTable_table_t bsDeviceTable_allocDeviceTable void   ) 
 

Allocates space for a device table. The table is initalized as well.

Returns:
a pointer to the newly created table instance
Examples:
analogue_in.c, analogue_out.c, blink_output.c, counter.c, list_devices.c, motor.c, rotary.c, servo.c, set_ocoutput.c, set_ocoutputpwm.c, stepper.c, and switch.c.

DECLSPEC void bsDeviceTable_clearDeviceTable bsDeviceTable_table_t  deviceTablePtr  ) 
 

Clears the device table

Parameters:
deviceTablePtr pointer to a device table.

DECLSPEC void bsDeviceTable_freeDeviceTable bsDeviceTable_table_t  tablePtr  ) 
 

Frees and finalizes a device table.

Parameters:
tablePtr the device table to free.
Examples:
analogue_in.c, analogue_out.c, blink_output.c, counter.c, list_devices.c, motor.c, rotary.c, servo.c, set_ocoutput.c, set_ocoutputpwm.c, stepper.c, and switch.c.

DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getDeviceById bsDeviceTable_table_t  deviceTablePtr,
identifier_t  id
 

Returns a pointer to device information, given a devic identifier

Parameters:
deviceTablePtr pointer to a device table
id device identifier
Returns:
general device information

DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getDeviceEvent bsDeviceTable_table_t  deviceTablePtr  ) 
 

Returns a device which has pending events (eg. analog input values changed). The device is removed from the event list.

Parameters:
deviceTablePtr pointer to a device table.
Returns:
pointer to the device, or 0 if there are no found devices

DECLSPEC uint8_t bsDeviceTable_getDeviceFirmwareVersion bsDeviceTable_deviceInfo_t  devInfo  ) 
 

Returns the firmware version of a device.

Parameters:
devInfo pointer to general device information
Returns:
the firmware version
Examples:
list_devices.c, and set_ocoutputpwm.c.

DECLSPEC identifier_t bsDeviceTable_getDeviceId bsDeviceTable_deviceInfo_t  devInfo  ) 
 

Returns the unique identifier of a device.

Parameters:
devInfo pointer to general device information
Returns:
the unique identifier
Examples:
list_devices.c.

DECLSPEC void bsDeviceTable_getDeviceTableAsText bsDeviceInterface_registeredDeviceInterfaces_t  devInterfaceTablePtr,
bsDeviceTable_table_t  deviceTablePtr,
char *  txt,
uint32_t *  size
 

Converts a device table to text format

Parameters:
devInterfaceTablePtr pointer to a device interface table.
deviceTablePtr pointer to a device table.
txt pointer to receiving text buffer. This buffer must atleas have bsDeviceTable_getDeviceTableAsTextSize space.
size returned text size in the buffer

DECLSPEC uint32_t bsDeviceTable_getDeviceTableAsTextSize bsDeviceTable_table_t  deviceTablePtr  ) 
 

When the device table is converted to text, the text size will be returned by this function.

Parameters:
deviceTablePtr pointer to a device table.
Returns:
the text size in bytes

DECLSPEC dex_devtype_t bsDeviceTable_getDeviceType bsDeviceTable_deviceInfo_t  devInfo  ) 
 

Returns the type of a device with a certain identifier.

Parameters:
devInfo pointer to general device information
Returns:
the type of the device or 0 if no device found.
Examples:
list_devices.c.

DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getFirstDevice bsDeviceTable_table_t  deviceTablePtr  ) 
 

Gets the first found device from the table. Use together with bsDeviceTable_getNextDevice to iterate over the found devices.

See also:
bsDeviceTable_getNextDevice
Parameters:
deviceTablePtr pointer to a device table.
Returns:
pointer to the first device, or 0 if there are no found devices
Examples:
list_devices.c.

DECLSPEC int bsDeviceTable_getListedDeviceCount bsDeviceTable_table_t  deviceTablePtr  ) 
 

Returns the number of found devices

Returns:
the number of found devices
Examples:
list_devices.c.

DECLSPEC bsDeviceTable_deviceInfo_t bsDeviceTable_getNextDevice bsDeviceTable_deviceInfo_t  devInfo  ) 
 

Gets the next found device from the table. Use together with bsDeviceTable_getFirstDevice to iterate over the found devices.

See also:
bsDeviceTable_getFirstDevice
Parameters:
devInfo pointer to general device information
Returns:
pointer to the next device, or 0 if there are no found devices
Examples:
list_devices.c.

DECLSPEC dex_devtype_t bsDeviceTable_isDeviceInterfaceFound bsDeviceTable_deviceInfo_t  devInfo  ) 
 

Checks if a device with a certain identifier is found and has a registered device interface.

Parameters:
devInfo pointer to general device information
Returns:
the type of the device or 0 if no device or device interface found.

DECLSPEC uint8_t bsDeviceTable_isProxyAccessible bsDeviceTable_deviceInfo_t  devInfo,
bluesense_proxytype_t  mustBeOfType
 

Checks if a device is of a certain type and that the device specific information is accessible

Parameters:
devInfo pointer to general device information
mustBeOfType check if the devInfo represents a proxy of this type
Returns:
1 if accessible, 0 if inaccessible

DECLSPEC void bsDeviceTable_resolveInterfaces bsDeviceInterface_registeredDeviceInterfaces_t  interfaceTablePtr,
bsDeviceTable_table_t  deviceTablePtr
 

After registering a new device (eg. by bsAdcInputDevice_registerDeviceInterface) type you should call this function to make sure that the interface becomes available for existing devices

Parameters:
interfaceTablePtr pointer to a device interface table
deviceTablePtr pointer to a device table.


Generated on Mon Jan 21 17:51:55 2008 for BlueSense by  doxygen 1.4.4