COSA
An Object-Oriented Platform for Arduino Programming
|
#include <VWI.hh>
Classes | |
class | Codec |
struct | header_t |
class | Receiver |
class | Transmitter |
Public Member Functions | |
VWI (int16_t net, uint8_t dev, uint16_t speed, Receiver *rx) | |
VWI (int16_t net, uint8_t dev, uint16_t speed, Transmitter *tx) | |
VWI (int16_t net, uint8_t dev, uint16_t speed, Receiver *rx, Transmitter *tx) | |
virtual bool | begin (const void *config=NULL) |
virtual bool | end () |
virtual void | powerup () |
virtual void | powerdown () |
virtual bool | available () |
virtual int | send (uint8_t dest, uint8_t port, const iovec_t *vec) |
virtual int | send (uint8_t dest, uint8_t port, const void *buf, size_t len) |
virtual int | recv (uint8_t &src, uint8_t &port, void *buf, size_t len, uint32_t ms=0L) |
virtual int | link_quality_indicator () |
uint8_t | channel () const |
void | channel (uint8_t channel) |
int16_t | network_address () const |
uint8_t | device_address () const |
void | address (int16_t net, uint8_t dev) |
virtual void | wakeup_on_radio () |
virtual bool | room () |
virtual int | broadcast (uint8_t port, const iovec_t *vec) |
virtual int | broadcast (uint8_t port, const void *buf, size_t len) |
virtual bool | is_broadcast () |
virtual void | output_power_level (int8_t dBm) |
virtual int | input_power_level () |
Static Public Attributes | |
static const uint8_t | PAYLOAD_MAX = 30 + sizeof(header_t) |
static const uint8_t | BROADCAST = 0x00 |
Protected Attributes | |
uint8_t | m_channel |
Current channel (device dependent. More... | |
addr_t | m_addr |
Current network and device address. More... | |
volatile bool | m_avail |
Message available. May be set by ISR. More... | |
uint8_t | m_dest |
Latest message destination device address. More... | |
Static Protected Attributes | |
static const uint8_t | MESSAGE_MAX = PAYLOAD_MAX + 3 |
static const uint8_t | MESSAGE_MIN = sizeof(header_t) |
static const uint8_t | SAMPLES_PER_BIT = 8 |
Friends | |
void | TIMER1_COMPA_vect (void) |
VWI is an Cosa library that provides features to send short messages using inexpensive radio transmitters and receivers (VWI). This library is an object-oriented refactoring and extension of the Virtual Wire library (vers. 1.19).
Cannot be used together with other classes that use Timer#1.
|
inline |
|
inline |
|
inline |
|
inlineinherited |
Set network and device address. Do not use the broadcast address(0). Should be used before calling begin().
[in] | net | network address. |
[in] | dev | device address. |
Definition at line 106 of file Wireless.hh.
|
inlinevirtual |
Return true(1) if a message is available otherwise false(0).
Reimplemented from Wireless::Driver.
|
virtual |
Start the Wireless device driver. Return true(1) if successful otherwise false(0).
[in] | config | configuration vector (default NULL) |
Implements Wireless::Driver.
|
inlinevirtualinherited |
Broadcast message in given null terminated io vector. Returns number of bytes sent if successful otherwise a negative error code.
[in] | port | device port (or message type). |
[in] | vec | null termianted io vector. |
Definition at line 220 of file Wireless.hh.
|
inlinevirtualinherited |
Boardcast message in given buffer, with given number of bytes. Returns number of bytes sent if successful otherwise a negative error code.
[in] | port | device port (or message type). |
[in] | buf | buffer to transmit. |
[in] | len | number of bytes in buffer. |
Definition at line 235 of file Wireless.hh.
|
inlineinherited |
|
inlineinherited |
Set device transmission channel. Should be used before calling begin().
[in] | channel. |
Definition at line 117 of file Wireless.hh.
|
inlineinherited |
|
virtual |
Shut down the device driver. Return true(1) if successful otherwise false(0).
Reimplemented from Wireless::Driver.
|
inlinevirtualinherited |
Return estimated input power level (dBm). Default zero(0).
Reimplemented in CC1101, and RFM69.
Definition at line 282 of file Wireless.hh.
|
inlinevirtualinherited |
Return true(1) if the latest received message was a broadcast otherwise false(0).
Definition at line 262 of file Wireless.hh.
|
inlinevirtual |
Return link quality indicator.
Reimplemented from Wireless::Driver.
|
inlineinherited |
|
inlinevirtualinherited |
Set output power level in dBm.
[in] | dBm. |
Reimplemented in NRF24L01P, CC1101, and RFM69.
Definition at line 272 of file Wireless.hh.
|
virtual |
Set device in power down mode.
Reimplemented from Wireless::Driver.
|
virtual |
Set device in power up mode.
Reimplemented from Wireless::Driver.
|
inlinevirtual |
Receive message and store into given buffer with given maximum length. The source network address is returned in the parameter src. Returns error code(ETIME) if no message is available and/or a timeout occured. Returns error code(EMSGSIZE) if the buffer size if to small for incoming message or if the receiver fifo has overflowed. Otherwise the actual number of received bytes is returned
[out] | src | source network address. |
[out] | port | device port (or message type). |
[in] | buf | buffer to store incoming message. |
[in] | len | maximum number of bytes to receive. |
[in] | ms | maximum time out period. |
Implements Wireless::Driver.
|
inlinevirtualinherited |
Return true(1) if there is room to send on the device otherwise false(0).
Definition at line 176 of file Wireless.hh.
|
inlinevirtual |
Send message in given null terminated io vector. Returns number of bytes sent. Returns error code(-1) if number of bytes is greater than PAYLOAD_MAX. Return error code(-2) if fails to set transmit mode.
[in] | dest | destination network address. |
[in] | port | device port (or message type). |
[in] | vec | null termianted io vector. |
Implements Wireless::Driver.
|
inlinevirtual |
Send message in given buffer, with given number of bytes. Returns number of bytes sent. Returns error code(-1) if number of bytes is greater than PAYLOAD_MAX. Return error code(-2) if fails to set transmit mode.
[in] | dest | destination network address. |
[in] | port | device port (or message type). |
[in] | buf | buffer to transmit. |
[in] | len | number of bytes in buffer. |
Reimplemented from Wireless::Driver.
|
inlinevirtualinherited |
Set device in wakeup on radio mode.
Reimplemented in CC1101, and RFM69.
Definition at line 158 of file Wireless.hh.
|
staticinherited |
Broadcast device address.
Definition at line 58 of file Wireless.hh.
|
protectedinherited |
Current network and device address.
Definition at line 299 of file Wireless.hh.
|
protectedinherited |
Message available. May be set by ISR.
Definition at line 300 of file Wireless.hh.
|
protectedinherited |
Current channel (device dependent.
Definition at line 298 of file Wireless.hh.
|
protectedinherited |
Latest message destination device address.
Definition at line 301 of file Wireless.hh.
|
staticprotected |
|
staticprotected |
|
static |
|
staticprotected |