Main Page | Directories | File List | Globals | Examples

bsRouterDevice.h File Reference

interface to the router device BM7502. More...

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

Defines

#define BLUESENSE_WUSBRTR_MAX_CHANNEL   255

Typedefs

typedef _bsRouterDevice_specificsStruct * bsRouterDevice_specifics_t

Functions

DECLSPEC bsRouterDevice_specifics_t bsRouterDevice_getDeviceSpecifics (bsDeviceTable_deviceInfo_t deviceInstancePtr)
DECLSPEC uint8_t bsRouterDevice_requestSetChannel (bsRouterDevice_specifics_t rtr, uint8_t channel)
DECLSPEC uint8_t bsRouterDevice_requestGetConfiguration (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_getRequestSetConfigDone (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_getRequestGetConfigDone (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_configPending (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_getCurrentChannel (bsRouterDevice_specifics_t rtr)
DECLSPEC void bsRouterDevice_setTimeOutUs (bsRouterDevice_specifics_t rtr, uint32_t timeOutUs)
DECLSPEC uint32_t bsRouterDevice_getTimeOutUs (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_requestSetSerialConfig (bsRouterDevice_specifics_t rtr, uint32_t baudrate, uint8_t stopbits, uint8_t parity, uint8_t databits)
DECLSPEC void bsRouterDevice_reset (bsRouterDevice_specifics_t rtr)
DECLSPEC uint32_t bsRouterDevice_getCurrentSerialBaudRate (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_getCurrentSerialDataBits (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_getCurrentSerialStopBits (bsRouterDevice_specifics_t rtr)
DECLSPEC uint8_t bsRouterDevice_getCurrentSerialParity (bsRouterDevice_specifics_t rtr)
DECLSPEC void bsRouterDevice_setSerialReceiveBuffer (bsRouterDevice_specifics_t rtr, uint8_t *ptr, uint16_t size)
DECLSPEC void bsRouterDevice_setSerialWriteBuffer (bsRouterDevice_specifics_t rtr, uint8_t *ptr, uint16_t size)
DECLSPEC void bsRouterDevice_popReceivedSerialData (bsRouterDevice_specifics_t rtr, uint8_t *ptr, uint16_t *size)
DECLSPEC void bsRouterDevice_writeSerialData (bsRouterDevice_specifics_t rtr, uint8_t *ptr, uint16_t *size)
DECLSPEC uint16_t bsRouterDevice_getSerialWriteBufferPendingData (bsRouterDevice_specifics_t rtr)
DECLSPEC void bsRouterDevice_setSerialReceiveAsciiMode (bsRouterDevice_specifics_t rtr, uint8_t asciiMode)
DECLSPEC uint8_t bsRouterDevice_getSerialReceiveAsciiMode (bsRouterDevice_specifics_t rtr)
DECLSPEC uint32_t bsRouterDevice_getTotalReceivedSerialBytes (bsRouterDevice_specifics_t rtr)


Detailed Description

interface to the router device BM7502.

The BM7502 acts as a portal between the PC and the BlueSense network. The BM7502 is connected with the PC via an USB cable. The sensor and actuator modules can either be connected through a cable with the BM7502 or you can connect the modules to a BM7503 receiver which is wirelessly connected with the BM7502.


Define Documentation

#define BLUESENSE_WUSBRTR_MAX_CHANNEL   255
 

The resolution can be set between 1 and 255


Typedef Documentation

typedef struct _bsRouterDevice_specificsStruct* bsRouterDevice_specifics_t
 

This (opaque) structure represents the device specific data of a wireless usb router


Function Documentation

DECLSPEC uint8_t bsRouterDevice_configPending bsRouterDevice_specifics_t  rtr  ) 
 

Checks if a configuration is being currently being set or being retrieved

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
1 if busy, 0 if done

DECLSPEC uint8_t bsRouterDevice_getCurrentChannel bsRouterDevice_specifics_t  rtr  ) 
 

Obtain the last retrieved channel setting.

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
the last wireless channel setting

DECLSPEC uint32_t bsRouterDevice_getCurrentSerialBaudRate bsRouterDevice_specifics_t  rtr  ) 
 

Returns the configured baudrate for serial communication (when using the serial extension board)

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
the baudrate

DECLSPEC uint8_t bsRouterDevice_getCurrentSerialDataBits bsRouterDevice_specifics_t  rtr  ) 
 

Returns the configured number of databits for serial communication (when using the serial extension board)

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
the number of databits

DECLSPEC uint8_t bsRouterDevice_getCurrentSerialParity bsRouterDevice_specifics_t  rtr  ) 
 

Returns the configured parity mode 4 = even, 3 = odd, 2 = mark, 1 = space, 0 = none, for serial communication (when using the serial extension board).

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
the parity mode

DECLSPEC uint8_t bsRouterDevice_getCurrentSerialStopBits bsRouterDevice_specifics_t  rtr  ) 
 

Returns the configured number of stopbits for serial communication (when using the serial extenstion board)

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
the number of stop bits

DECLSPEC bsRouterDevice_specifics_t bsRouterDevice_getDeviceSpecifics bsDeviceTable_deviceInfo_t  deviceInstancePtr  ) 
 

Returns a adc instance from a device info pointer (obtained from the device table).

Returns:
the instance of an router Interface. Or null if the device is inaccessible (eg. wrong type, not found).

DECLSPEC uint8_t bsRouterDevice_getRequestGetConfigDone bsRouterDevice_specifics_t  rtr  ) 
 

Checks if the configuration request is finished

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
1 if configuration was retrieved, 0 if still busy

DECLSPEC uint8_t bsRouterDevice_getRequestSetConfigDone bsRouterDevice_specifics_t  rtr  ) 
 

Checks if the configuration set request is finished

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
1 if request finished, 0 if request still busy

DECLSPEC uint8_t bsRouterDevice_getSerialReceiveAsciiMode bsRouterDevice_specifics_t  rtr  ) 
 

Returns the serial receive mode. '1' depicts line oriented ASCII mode, '0' binary mode.

Parameters:
rtr a pointer to the router device's instance specific data

DECLSPEC uint16_t bsRouterDevice_getSerialWriteBufferPendingData bsRouterDevice_specifics_t  rtr  ) 
 

Returns the number of bytes waiting to be send in the serial write buffer

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
the number of bytes waiting, or zero if the buffer is empty

DECLSPEC uint32_t bsRouterDevice_getTimeOutUs bsRouterDevice_specifics_t  rtr  ) 
 

Returns the current set time out delay. The time out delay is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
rtr a pointer to the router device's instance specific data
Returns:
the time out value in microseconds.

DECLSPEC uint32_t bsRouterDevice_getTotalReceivedSerialBytes bsRouterDevice_specifics_t  rtr  ) 
 

Returns the total number of received bytes via the serial extension. Is reset to 0 after calling bsRouterDevice_reset()

Returns:
total number of bytes received via the serial extension

DECLSPEC void bsRouterDevice_popReceivedSerialData bsRouterDevice_specifics_t  rtr,
uint8_t *  ptr,
uint16_t *  size
 

Retrieves received buffered data from the serial extension board. Data is received into a receive buffer in each bsmaster yield call. If serial communication is in ascii mode the data will be returned delimited by ascii code 13, otherwise all pending data is returned.

Parameters:
rtr a pointer to the router device's instance specific data
ptr a pointer to a buffer for the received data (should be as large as the receive buffer size)
size input: the maximum number of bytes to return, output: a value indicating the number of bytes put into the buffer

DECLSPEC uint8_t bsRouterDevice_requestGetConfiguration bsRouterDevice_specifics_t  rtr  ) 
 

Request to obtain the configuration settings from a wireless usb router Device.

Parameters:
rtr a pointer to the router device's instance specific data

DECLSPEC uint8_t bsRouterDevice_requestSetChannel bsRouterDevice_specifics_t  rtr,
uint8_t  channel
 

Request the router device to set a new channel for wireless communication. Only applicable for wireless routers.

Parameters:
rtr a pointer to the router device's instance specific data
channel the channel should lie between 0 and BLUESENSE_WUSBRTR_MAX_CHANNEL.
See also:
BLUESENSE_WUSBRTR_MAX_CHANNEL

DECLSPEC uint8_t bsRouterDevice_requestSetSerialConfig bsRouterDevice_specifics_t  rtr,
uint32_t  baudrate,
uint8_t  stopbits,
uint8_t  parity,
uint8_t  databits
 

Sets the configuration parameters for the serial extension board. Note that not all options are available on all devices.

Parameters:
rtr a pointer to the router device's instance specific data
baudrate the speed of serial communication default is 38400
stopbits number of stopbits, choose 2 or 1
parity parity bits: 4 = even, 3 = odd, 2 = mark, 1 = space, 0 = none
databits number of databits: 5,6,7 or 8

DECLSPEC void bsRouterDevice_reset bsRouterDevice_specifics_t  rtr  ) 
 

Resets the software state. The timeout value is set to the default value. The configuration is requested from the device

Parameters:
rtr a pointer to the router device's instance specific data

DECLSPEC void bsRouterDevice_setSerialReceiveAsciiMode bsRouterDevice_specifics_t  rtr,
uint8_t  asciiMode
 

Set serial receive mode. When set to '1' data will be received line oriented (delimited by character 13). When set to '0' no interpretation is done of the data.

Parameters:
rtr a pointer to the router device's instance specific data
asciiMode '1' to set line oriented mode, '0' for no interpretation.

DECLSPEC void bsRouterDevice_setSerialReceiveBuffer bsRouterDevice_specifics_t  rtr,
uint8_t *  ptr,
uint16_t  size
 

Sets a buffer to be used for receiving data from the serial extension board

Parameters:
rtr a pointer to the router device's instance specific data

DECLSPEC void bsRouterDevice_setSerialWriteBuffer bsRouterDevice_specifics_t  rtr,
uint8_t *  ptr,
uint16_t  size
 

Sets a buffer to be used for writing data to the serial extension board

Parameters:
rtr a pointer to the router device's instance specific data

DECLSPEC void bsRouterDevice_setTimeOutUs bsRouterDevice_specifics_t  rtr,
uint32_t  timeOutUs
 

Sets the time out value which is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
rtr a pointer to the router device's instance specific data
timeOutUs the value in microseconds which is the maximum duraion between a request and its answer.

DECLSPEC void bsRouterDevice_writeSerialData bsRouterDevice_specifics_t  rtr,
uint8_t *  ptr,
uint16_t *  size
 

Writes serial data into the writebuffer which will be copied to the serial extension board. Data is written at each bsmaster yield call.

Parameters:
rtr a pointer to the router device's instance specific data
ptr a pointer to the buffer containing the data to be written.
size the number of bytes to be written. In size the number of bytes will be returned which have actually been put into the writebuffer.


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