Firmware SDK
twr_radio

Radio implementation. More...

Data Structures

struct  twr_radio_sub_t
 
struct  twr_radio_peer_t
 

Macros

#define TWR_RADIO_MAX_DEVICES   4
 
#define TWR_RADIO_PUB_QUEUE_BUFFER_SIZE   512
 
#define TWR_RADIO_RX_QUEUE_BUFFER_SIZE   128
 
#define TWR_RADIO_ID_SIZE   6
 
#define TWR_RADIO_HEAD_SIZE   (TWR_RADIO_ID_SIZE + 2)
 
#define TWR_RADIO_MAX_BUFFER_SIZE   (TWR_SPIRIT1_MAX_PACKET_SIZE - TWR_RADIO_HEAD_SIZE)
 
#define TWR_RADIO_MAX_TOPIC_LEN   (TWR_RADIO_MAX_BUFFER_SIZE - 1 - 4 - 1)
 
#define TWR_RADIO_NULL_BOOL   0xff
 
#define TWR_RADIO_NULL_INT   INT32_MIN
 
#define TWR_RADIO_NULL_FLOAT   NAN
 
#define TWR_RADIO_NULL_UINT32   UINT32_MAX
 
#define TWR_RADIO_NULL_UINT16   UINT16_MAX
 
#define TWR_RADIO_NODE_HEAD_SIZE   (TWR_RADIO_HEAD_SIZE + 1 + TWR_RADIO_ID_SIZE)
 
#define TWR_RADIO_NODE_MAX_BUFFER_SIZE   (TWR_RADIO_MAX_BUFFER_SIZE - TWR_RADIO_ID_SIZE - 1)
 
#define TWR_RADIO_NODE_MAX_COMPOUND_PART   (TWR_RADIO_NODE_MAX_BUFFER_SIZE / 5)
 
#define TWR_RADIO_NODE_MAX_COMPOUND_BUFFER_SIZE   (TWR_RADIO_NODE_MAX_COMPOUND_PART * 5)
 

Typedefs

typedef struct twr_radio_sub_t twr_radio_sub_t
 

Enumerations

enum  twr_radio_mode_t {
  TWR_RADIO_MODE_UNKNOWN = 0 ,
  TWR_RADIO_MODE_GATEWAY = 1 ,
  TWR_RADIO_MODE_NODE_LISTENING = 2 ,
  TWR_RADIO_MODE_NODE_SLEEPING = 3
}
 Radio mode. More...
 
enum  twr_radio_event_t {
  TWR_RADIO_EVENT_INIT_FAILURE = 0 ,
  TWR_RADIO_EVENT_INIT_DONE = 1 ,
  TWR_RADIO_EVENT_ATTACH = 2 ,
  TWR_RADIO_EVENT_ATTACH_FAILURE = 3 ,
  TWR_RADIO_EVENT_DETACH = 4 ,
  TWR_RADIO_EVENT_SCAN_FIND_DEVICE = 5 ,
  TWR_RADIO_EVENT_PAIRED = 6 ,
  TWR_RADIO_EVENT_UNPAIRED = 7 ,
  TWR_RADIO_EVENT_TX_DONE = 8 ,
  TWR_RADIO_EVENT_TX_ERROR = 9
}
 
enum  twr_radio_header_t {
  TWR_RADIO_HEADER_PAIRING = 0x00 ,
  TWR_RADIO_HEADER_PUB_PUSH_BUTTON = 0x01 ,
  TWR_RADIO_HEADER_PUB_TEMPERATURE = 0x02 ,
  TWR_RADIO_HEADER_PUB_HUMIDITY = 0x03 ,
  TWR_RADIO_HEADER_PUB_LUX_METER = 0x04 ,
  TWR_RADIO_HEADER_PUB_BAROMETER = 0x05 ,
  TWR_RADIO_HEADER_PUB_CO2 = 0x06 ,
  TWR_RADIO_HEADER_PUB_BUFFER = 0x07 ,
  TWR_RADIO_HEADER_NODE_ATTACH = 0x08 ,
  TWR_RADIO_HEADER_NODE_DETACH = 0x09 ,
  TWR_RADIO_HEADER_PUB_BATTERY = 0x0a ,
  TWR_RADIO_HEADER_PUB_INFO = 0x0b ,
  TWR_RADIO_HEADER_PUB_ACCELERATION = 0x0d ,
  TWR_RADIO_HEADER_PUB_TOPIC_STRING = 0x0e ,
  TWR_RADIO_HEADER_PUB_TOPIC_UINT32 = 0x0f ,
  TWR_RADIO_HEADER_PUB_TOPIC_BOOL = 0x10 ,
  TWR_RADIO_HEADER_PUB_TOPIC_INT = 0x11 ,
  TWR_RADIO_HEADER_PUB_TOPIC_FLOAT = 0x12 ,
  TWR_RADIO_HEADER_PUB_EVENT_COUNT = 0x13 ,
  TWR_RADIO_HEADER_PUB_STATE = 0x14 ,
  TWR_RADIO_HEADER_NODE_STATE_SET = 0x15 ,
  TWR_RADIO_HEADER_NODE_STATE_GET = 0x16 ,
  TWR_RADIO_HEADER_NODE_BUFFER = 0x17 ,
  TWR_RADIO_HEADER_NODE_LED_STRIP_COLOR_SET = 0x18 ,
  TWR_RADIO_HEADER_NODE_LED_STRIP_BRIGHTNESS_SET = 0x19 ,
  TWR_RADIO_HEADER_NODE_LED_STRIP_COMPOUND_SET = 0x1a ,
  TWR_RADIO_HEADER_NODE_LED_STRIP_EFFECT_SET = 0x1b ,
  TWR_RADIO_HEADER_NODE_LED_STRIP_THERMOMETER_SET = 0x1c ,
  TWR_RADIO_HEADER_SUB_DATA = 0x1d ,
  TWR_RADIO_HEADER_PUB_VALUE_INT = 0x1e ,
  TWR_RADIO_HEADER_SUB_REG = 0x20 ,
  TWR_RADIO_HEADER_ACK = 0xaa
}
 
enum  twr_radio_sub_pt_t {
  TWR_RADIO_SUB_PT_BOOL = 0 ,
  TWR_RADIO_SUB_PT_INT = 1 ,
  TWR_RADIO_SUB_PT_FLOAT = 2 ,
  TWR_RADIO_SUB_PT_STRING = 3 ,
  TWR_RADIO_SUB_PT_NULL = 4
}
 Subscribe payload type.
 
enum  {
  TWR_RADIO_NODE_STATE_LED = TWR_RADIO_PUB_STATE_LED ,
  TWR_RADIO_NODE_STATE_RELAY_MODULE_0 = TWR_RADIO_PUB_STATE_RELAY_MODULE_0 ,
  TWR_RADIO_NODE_STATE_RELAY_MODULE_1 = TWR_RADIO_PUB_STATE_RELAY_MODULE_1 ,
  TWR_RADIO_NODE_STATE_POWER_MODULE_RELAY = TWR_RADIO_PUB_STATE_POWER_MODULE_RELAY
}
 
enum  twr_radio_node_led_strip_effect_t {
  TWR_RADIO_NODE_LED_STRIP_EFFECT_TEST = 0 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_RAINBOW = 1 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_RAINBOW_CYCLE = 2 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_THEATER_CHASE_RAINBOW = 3 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_COLOR_WIPE = 4 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_THEATER_CHASE = 5 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_STROBOSCOPE = 6 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_ICICLE = 7 ,
  TWR_RADIO_NODE_LED_STRIP_EFFECT_PULSE_COLOR = 8
}
 
enum  {
  TWR_RADIO_PUB_CHANNEL_R1_I2C0_ADDRESS_DEFAULT = 0x00 ,
  TWR_RADIO_PUB_CHANNEL_R1_I2C0_ADDRESS_ALTERNATE = 0x01 ,
  TWR_RADIO_PUB_CHANNEL_R1_I2C1_ADDRESS_DEFAULT = 0x80 ,
  TWR_RADIO_PUB_CHANNEL_R1_I2C1_ADDRESS_ALTERNATE = 0x81 ,
  TWR_RADIO_PUB_CHANNEL_R2_I2C0_ADDRESS_DEFAULT = 0x02 ,
  TWR_RADIO_PUB_CHANNEL_R2_I2C0_ADDRESS_ALTERNATE = 0x03 ,
  TWR_RADIO_PUB_CHANNEL_R2_I2C1_ADDRESS_DEFAULT = 0x82 ,
  TWR_RADIO_PUB_CHANNEL_R2_I2C1_ADDRESS_ALTERNATE = 0x83 ,
  TWR_RADIO_PUB_CHANNEL_R3_I2C0_ADDRESS_DEFAULT = 0x04 ,
  TWR_RADIO_PUB_CHANNEL_R3_I2C0_ADDRESS_ALTERNATE = 0x05 ,
  TWR_RADIO_PUB_CHANNEL_R3_I2C1_ADDRESS_DEFAULT = 0x84 ,
  TWR_RADIO_PUB_CHANNEL_R3_I2C1_ADDRESS_ALTERNATE = 0x85 ,
  TWR_RADIO_PUB_CHANNEL_R4_I2C0_ADDRESS_DEFAULT = 0x06 ,
  TWR_RADIO_PUB_CHANNEL_R4_I2C0_ADDRESS_ALTERNATE = 0x07 ,
  TWR_RADIO_PUB_CHANNEL_R4_I2C1_ADDRESS_DEFAULT = 0x86 ,
  TWR_RADIO_PUB_CHANNEL_R4_I2C1_ADDRESS_ALTERNATE = 0x87 ,
  TWR_RADIO_PUB_CHANNEL_A = 0xf0 ,
  TWR_RADIO_PUB_CHANNEL_B = 0xf1 ,
  TWR_RADIO_PUB_CHANNEL_SET_POINT = 0xf2 ,
  TWR_RADIO_PUB_CHANNEL_NONE = 0xff
}
 
enum  {
  TWR_RADIO_PUB_EVENT_PUSH_BUTTON = 0 ,
  TWR_RADIO_PUB_EVENT_PIR_MOTION = 1 ,
  TWR_RADIO_PUB_EVENT_LCD_BUTTON_LEFT = 2 ,
  TWR_RADIO_PUB_EVENT_LCD_BUTTON_RIGHT = 3 ,
  TWR_RADIO_PUB_EVENT_ACCELEROMETER_ALERT = 4 ,
  TWR_RADIO_PUB_EVENT_HOLD_BUTTON = 5
}
 
enum  {
  TWR_RADIO_PUB_STATE_LED = 0 ,
  TWR_RADIO_PUB_STATE_RELAY_MODULE_0 = 1 ,
  TWR_RADIO_PUB_STATE_RELAY_MODULE_1 = 2 ,
  TWR_RADIO_PUB_STATE_POWER_MODULE_RELAY = 3
}
 
enum  { TWR_RADIO_PUB_VALUE_HOLD_DURATION_BUTTON = 0 }
 

Functions

void twr_radio_init (twr_radio_mode_t mode)
 Initialize radio. More...
 
void twr_radio_set_event_handler (void(*event_handler)(twr_radio_event_t, void *), void *event_param)
 
void twr_radio_listen (twr_tick_t timeout)
 
void twr_radio_pairing_request (const char *firmware, const char *version)
 
void twr_radio_pairing_mode_start (void)
 
void twr_radio_pairing_mode_stop (void)
 
bool twr_radio_peer_device_add (uint64_t id)
 
bool twr_radio_peer_device_remove (uint64_t id)
 
bool twr_radio_peer_device_purge_all (void)
 
void twr_radio_get_peer_id (uint64_t *id, int length)
 
void twr_radio_scan_start (void)
 
void twr_radio_scan_stop (void)
 
void twr_radio_automatic_pairing_start (void)
 
void twr_radio_automatic_pairing_stop (void)
 
uint64_t twr_radio_get_my_id (void)
 
uint64_t twr_radio_get_event_id (void)
 
bool twr_radio_is_peer_device (uint64_t id)
 
bool twr_radio_pub_queue_put (const void *buffer, size_t length)
 
void twr_radio_pub_queue_clear ()
 Clear the publish message queue.
 
void twr_radio_set_subs (twr_radio_sub_t *subs, int length)
 
bool twr_radio_send_sub_data (uint64_t *id, uint8_t order, void *payload, size_t size)
 
void twr_radio_set_rx_timeout_for_sleeping_node (twr_tick_t timeout)
 
twr_radio_peer_ttwr_radio_get_peer_device (uint64_t id)
 
uint8_t * twr_radio_id_to_buffer (uint64_t *id, uint8_t *buffer)
 
uint8_t * twr_radio_bool_to_buffer (bool *value, uint8_t *buffer)
 
uint8_t * twr_radio_int_to_buffer (int *value, uint8_t *buffer)
 
uint8_t * twr_radio_uint16_to_buffer (uint16_t *value, uint8_t *buffer)
 
uint8_t * twr_radio_uint32_to_buffer (uint32_t *value, uint8_t *buffer)
 
uint8_t * twr_radio_float_to_buffer (float *value, uint8_t *buffer)
 
uint8_t * twr_radio_data_to_buffer (void *data, size_t length, uint8_t *buffer)
 
uint8_t * twr_radio_id_from_buffer (uint8_t *buffer, uint64_t *id)
 
uint8_t * twr_radio_bool_from_buffer (uint8_t *buffer, bool *value, bool **pointer)
 
uint8_t * twr_radio_int_from_buffer (uint8_t *buffer, int *value, int **pointer)
 
uint8_t * twr_radio_uint16_from_buffer (uint8_t *buffer, uint16_t *value, uint16_t **pointer)
 
uint8_t * twr_radio_uint32_from_buffer (uint8_t *buffer, uint32_t *value, uint32_t **pointer)
 
uint8_t * twr_radio_float_from_buffer (uint8_t *buffer, float *value, float **pointer)
 
uint8_t * twr_radio_data_from_buffer (uint8_t *buffer, void *data, size_t length)
 
void twr_radio_init_pairing_button ()
 
bool twr_radio_node_state_set (uint64_t *id, uint8_t state_id, bool *state)
 Send request for set new state. More...
 
bool twr_radio_node_state_get (uint64_t *id, uint8_t state_id)
 Send request for get actual state. More...
 
bool twr_radio_node_buffer (uint64_t *id, void *buffer, size_t length)
 Send data to node. More...
 
bool twr_radio_node_led_strip_color_set (uint64_t *id, uint32_t color)
 Send data to node. More...
 
bool twr_radio_node_led_strip_brightness_set (uint64_t *id, uint8_t brightness)
 Send data to node. More...
 
bool twr_radio_node_led_strip_compound_set (uint64_t *id, uint8_t *compound, size_t length)
 Send data to node. More...
 
bool twr_radio_node_led_strip_effect_set (uint64_t *id, twr_radio_node_led_strip_effect_t type, uint16_t wait, uint32_t color)
 Send data to node. More...
 
bool twr_radio_node_led_strip_thermometer_set (uint64_t *id, float temperature, int8_t min, int8_t max, uint8_t white_dots, float *set_point, uint32_t set_point_color)
 Send data to node. More...
 
void twr_radio_node_decode (uint64_t *id, uint8_t *buffer, size_t length)
 Internal decode function for twr_radio.c. More...
 
bool twr_radio_pub_event_count (uint8_t event_id, uint16_t *event_count)
 Publish event count. More...
 
bool twr_radio_pub_push_button (uint16_t *event_count)
 Publish push button event count, same as use twr_radio_pub_event_count with TWR_RADIO_PUB_EVENT_PUSH_BUTTON. More...
 
bool twr_radio_pub_temperature (uint8_t channel, float *celsius)
 Publish temperature. More...
 
bool twr_radio_pub_humidity (uint8_t channel, float *percentage)
 Publish humidity. More...
 
bool twr_radio_pub_luminosity (uint8_t channel, float *lux)
 Publish luminosity. More...
 
bool twr_radio_pub_barometer (uint8_t channel, float *pascal, float *meter)
 Publish barometer. More...
 
bool twr_radio_pub_co2 (float *concentration)
 Publish co2. More...
 
bool twr_radio_pub_battery (float *voltage)
 Publish battery. More...
 
bool twr_radio_pub_acceleration (float *x_axis, float *y_axis, float *z_axis)
 Publish acceleration. More...
 
bool twr_radio_pub_buffer (void *buffer, size_t length)
 Publish buffer. More...
 
bool twr_radio_pub_state (uint8_t state_id, bool *state)
 Publish battery. More...
 
bool twr_radio_pub_value_int (uint8_t value_id, int *value)
 Publish int value. More...
 
bool twr_radio_pub_bool (const char *subtopic, bool *value)
 Publish bool value in custom topic. More...
 
bool twr_radio_pub_int (const char *subtopic, int *value)
 Publish int value in custom topic. More...
 
bool twr_radio_pub_uint32 (const char *subtopic, uint32_t *value)
 Publish uint32 value in custom topic. More...
 
bool twr_radio_pub_float (const char *subtopic, float *value)
 Publish float value in custom topic. More...
 
bool twr_radio_pub_string (const char *subtopic, const char *value)
 Publish string value in custom topic. More...
 
void twr_radio_pub_decode (uint64_t *id, uint8_t *buffer, size_t length)
 Internal decode function for twr_radio.c. More...
 

Detailed Description

Radio implementation.

Radio implementation send to gateway.

Radio implementation send to node.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TWR_RADIO_PUB_CHANNEL_R1_I2C0_ADDRESS_DEFAULT 

channel 0:0

TWR_RADIO_PUB_CHANNEL_R1_I2C0_ADDRESS_ALTERNATE 

channel 0:1

TWR_RADIO_PUB_CHANNEL_R1_I2C1_ADDRESS_DEFAULT 

channel 1:0

TWR_RADIO_PUB_CHANNEL_R1_I2C1_ADDRESS_ALTERNATE 

channel 1:1

TWR_RADIO_PUB_CHANNEL_R2_I2C0_ADDRESS_DEFAULT 

channel 0:2

TWR_RADIO_PUB_CHANNEL_R2_I2C0_ADDRESS_ALTERNATE 

channel 0:3

TWR_RADIO_PUB_CHANNEL_R2_I2C1_ADDRESS_DEFAULT 

channel 1:2

TWR_RADIO_PUB_CHANNEL_R2_I2C1_ADDRESS_ALTERNATE 

channel 1:3

TWR_RADIO_PUB_CHANNEL_R3_I2C0_ADDRESS_DEFAULT 

channel 0:4

TWR_RADIO_PUB_CHANNEL_R3_I2C0_ADDRESS_ALTERNATE 

channel 0:5

TWR_RADIO_PUB_CHANNEL_R3_I2C1_ADDRESS_DEFAULT 

channel 1:4

TWR_RADIO_PUB_CHANNEL_R3_I2C1_ADDRESS_ALTERNATE 

channel 1:5

TWR_RADIO_PUB_CHANNEL_R4_I2C0_ADDRESS_DEFAULT 

channel 0:6

TWR_RADIO_PUB_CHANNEL_R4_I2C0_ADDRESS_ALTERNATE 

channel 0:7

TWR_RADIO_PUB_CHANNEL_R4_I2C1_ADDRESS_DEFAULT 

channel 1:6

TWR_RADIO_PUB_CHANNEL_R4_I2C1_ADDRESS_ALTERNATE 

channel 1:7

TWR_RADIO_PUB_CHANNEL_A 

channel a

TWR_RADIO_PUB_CHANNEL_B 

channel b

TWR_RADIO_PUB_CHANNEL_SET_POINT 

channel set-point

TWR_RADIO_PUB_CHANNEL_NONE 

channel -

Definition at line 10 of file twr_radio_pub.h.

◆ twr_radio_mode_t

Radio mode.

Enumerator
TWR_RADIO_MODE_UNKNOWN 

Unknown mode.

TWR_RADIO_MODE_GATEWAY 

Gateway mode.

TWR_RADIO_MODE_NODE_LISTENING 

Node listening mode.

TWR_RADIO_MODE_NODE_SLEEPING 

Node sleeping mode, suitable for battery.

Definition at line 37 of file twr_radio.h.

Function Documentation

◆ twr_radio_init()

void twr_radio_init ( twr_radio_mode_t  mode)

Initialize radio.

Parameters
[in]mode

Definition at line 89 of file twr_radio.c.

Here is the call graph for this function:

◆ twr_radio_node_buffer()

bool twr_radio_node_buffer ( uint64_t *  id,
void *  buffer,
size_t  length 
)

Send data to node.

Parameters
[in]idPointer to node id
[in]bufferPointer to buffer from which data will be send
[in]lengthNumber of bytes to be send, max value is in TWR_RADIO_NODE_MAX_BUFFER_SIZE
Returns
true On success
false On failure

Definition at line 41 of file twr_radio_node.c.

◆ twr_radio_node_decode()

void twr_radio_node_decode ( uint64_t *  id,
uint8_t *  buffer,
size_t  length 
)

Internal decode function for twr_radio.c.

Parameters
[in]idPointer on own id
[in]bufferPointer to RX buffer
[in]lengthRX buffer length

Definition at line 148 of file twr_radio_node.c.

◆ twr_radio_node_led_strip_brightness_set()

bool twr_radio_node_led_strip_brightness_set ( uint64_t *  id,
uint8_t  brightness 
)

Send data to node.

Parameters
[in]idPointer to node id
[in]brightness
Returns
true On success
false On failure

Definition at line 71 of file twr_radio_node.c.

◆ twr_radio_node_led_strip_color_set()

bool twr_radio_node_led_strip_color_set ( uint64_t *  id,
uint32_t  color 
)

Send data to node.

Parameters
[in]idPointer to node id
[in]colorColor in RGBW format
Returns
true On success
false On failure

Definition at line 58 of file twr_radio_node.c.

◆ twr_radio_node_led_strip_compound_set()

bool twr_radio_node_led_strip_compound_set ( uint64_t *  id,
uint8_t *  compound,
size_t  length 
)

Send data to node.

Parameters
[in]idPointer to node id
[in]compoundPointer to compound buffer
[in]lengthNumber of bytes to be send, must be modulo 5, max value is in TWR_RADIO_NODE_MAX_COMPOUND_BUFFER_SIZE
Returns
true On success
false On failure

Definition at line 84 of file twr_radio_node.c.

◆ twr_radio_node_led_strip_effect_set()

bool twr_radio_node_led_strip_effect_set ( uint64_t *  id,
twr_radio_node_led_strip_effect_t  type,
uint16_t  wait,
uint32_t  color 
)

Send data to node.

Parameters
[in]idPointer to node id
[in]typeEffect type
[in]waitInterval between refresh
[in]colorColor in RGBW format
Returns
true On success
false On failure

Definition at line 102 of file twr_radio_node.c.

◆ twr_radio_node_led_strip_thermometer_set()

bool twr_radio_node_led_strip_thermometer_set ( uint64_t *  id,
float  temperature,
int8_t  min,
int8_t  max,
uint8_t  white_dots,
float *  set_point,
uint32_t  set_point_color 
)

Send data to node.

Parameters
[in]idPointer to node id
[in]temperature
[in]minTemperature on thermometer
[in]maxTemperature on thermometer
[in]white_dots
[in]set_pointPointer to set point temperature, if NULL set_point and set_point_color not used
[in]set_point_colorColor in RGBW format
Returns
true On success
false On failure

Definition at line 120 of file twr_radio_node.c.

◆ twr_radio_node_state_get()

bool twr_radio_node_state_get ( uint64_t *  id,
uint8_t  state_id 
)

Send request for get actual state.

Parameters
[in]idPointer to node id
[in]state_idState id from enum
Returns
true On success
false On failure

Definition at line 28 of file twr_radio_node.c.

◆ twr_radio_node_state_set()

bool twr_radio_node_state_set ( uint64_t *  id,
uint8_t  state_id,
bool *  state 
)

Send request for set new state.

Parameters
[in]idPointer to node id
[in]state_idState id from enum
[in]statePointer to state which will be send
Returns
true On success
false On failure

Definition at line 13 of file twr_radio_node.c.

◆ twr_radio_pub_acceleration()

bool twr_radio_pub_acceleration ( float *  x_axis,
float *  y_axis,
float *  z_axis 
)

Publish acceleration.

Parameters
[in]x_axisPointer to value, can be null
[in]y_axisPointer to value, can be null
[in]x_az_axisxisPointer to value, can be null
Returns
true On success
false On failure

Definition at line 112 of file twr_radio_pub.c.

◆ twr_radio_pub_barometer()

bool twr_radio_pub_barometer ( uint8_t  channel,
float *  pascal,
float *  meter 
)

Publish barometer.

Parameters
[in]channelChannel id from enum TWR_RADIO_PUB_CHANNEL_*
[in]pascalPointer to value, can be null
[in]meterPointer to value, can be null
Returns
true On success
false On failure

Definition at line 77 of file twr_radio_pub.c.

◆ twr_radio_pub_battery()

bool twr_radio_pub_battery ( float *  voltage)

Publish battery.

Parameters
[in]voltagePointer to value, can be null
Returns
true On success
false On failure

Definition at line 101 of file twr_radio_pub.c.

◆ twr_radio_pub_bool()

bool twr_radio_pub_bool ( const char *  subtopic,
bool *  value 
)

Publish bool value in custom topic.

Parameters
[in]subtopicSubtopic (example: node/{id}/{subtopic})
[in]valuePointer to value, can be null
Returns
true On success
false On failure

Definition at line 167 of file twr_radio_pub.c.

◆ twr_radio_pub_buffer()

bool twr_radio_pub_buffer ( void *  buffer,
size_t  length 
)

Publish buffer.

Parameters
[in]bufferPointer to buffer from which data will be send
[in]lengthNumber of bytes to be send, max value is in TWR_RADIO_NODE_MAX_BUFFER_SIZE
Returns
true On success
false On failure

Definition at line 127 of file twr_radio_pub.c.

◆ twr_radio_pub_co2()

bool twr_radio_pub_co2 ( float *  concentration)

Publish co2.

Parameters
[in]concentrationPointer to value, can be null
Returns
true On success
false On failure

Definition at line 90 of file twr_radio_pub.c.

◆ twr_radio_pub_decode()

void twr_radio_pub_decode ( uint64_t *  id,
uint8_t *  buffer,
size_t  length 
)

Internal decode function for twr_radio.c.

Parameters
[in]idPointer on sender id
[in]bufferPointer to RX buffer
[in]lengthRX buffer length

Definition at line 267 of file twr_radio_pub.c.

◆ twr_radio_pub_event_count()

bool twr_radio_pub_event_count ( uint8_t  event_id,
uint16_t *  event_count 
)

Publish event count.

Parameters
[in]event_idEvent id is from enum TWR_RADIO_PUB_EVENT_*
[in]event_countPointer to value, can be null
Returns
true On success
false On failure

Definition at line 24 of file twr_radio_pub.c.

Referenced by twr_radio_pub_push_button().

Here is the caller graph for this function:

◆ twr_radio_pub_float()

bool twr_radio_pub_float ( const char *  subtopic,
float *  value 
)

Publish float value in custom topic.

Parameters
[in]subtopicSubtopic (example: node/{id}/{subtopic})
[in]valuePointer to value, can be null
Returns
true On success
false On failure

Definition at line 227 of file twr_radio_pub.c.

◆ twr_radio_pub_humidity()

bool twr_radio_pub_humidity ( uint8_t  channel,
float *  percentage 
)

Publish humidity.

Parameters
[in]channelChannel id from enum TWR_RADIO_PUB_CHANNEL_*
[in]percentagePointer to value, can be null
Returns
true On success
false On failure

Definition at line 53 of file twr_radio_pub.c.

◆ twr_radio_pub_int()

bool twr_radio_pub_int ( const char *  subtopic,
int *  value 
)

Publish int value in custom topic.

Parameters
[in]subtopicSubtopic (example: node/{id}/{subtopic})
[in]valuePointer to value, can be null
Returns
true On success
false On failure

Definition at line 187 of file twr_radio_pub.c.

◆ twr_radio_pub_luminosity()

bool twr_radio_pub_luminosity ( uint8_t  channel,
float *  lux 
)

Publish luminosity.

Parameters
[in]channelChannel id from enum TWR_RADIO_PUB_CHANNEL_*
[in]luxPointer to value, can be null
Returns
true On success
false On failure

Definition at line 65 of file twr_radio_pub.c.

◆ twr_radio_pub_push_button()

bool twr_radio_pub_push_button ( uint16_t *  event_count)

Publish push button event count, same as use twr_radio_pub_event_count with TWR_RADIO_PUB_EVENT_PUSH_BUTTON.

Parameters
[in]event_countPointer to value, can be null
Returns
true On success
false On failure

Definition at line 36 of file twr_radio_pub.c.

Here is the call graph for this function:

◆ twr_radio_pub_state()

bool twr_radio_pub_state ( uint8_t  state_id,
bool *  state 
)

Publish battery.

Parameters
[in]state_idState id from enum TWR_RADIO_PUB_STATE_*
[in]statePointer to value, can be null
Returns
true On success
false On failure

Definition at line 143 of file twr_radio_pub.c.

◆ twr_radio_pub_string()

bool twr_radio_pub_string ( const char *  subtopic,
const char *  value 
)

Publish string value in custom topic.

Parameters
[in]subtopicSubtopic (example: node/{id}/{subtopic})
[in]valuePointer to value, can be null
Returns
true On success
false On failure

Definition at line 247 of file twr_radio_pub.c.

◆ twr_radio_pub_temperature()

bool twr_radio_pub_temperature ( uint8_t  channel,
float *  celsius 
)

Publish temperature.

Parameters
[in]channelChannel id from enum TWR_RADIO_PUB_CHANNEL_*
[in]celsiusPointer to value, can be null
Returns
true On success
false On failure

Definition at line 41 of file twr_radio_pub.c.

◆ twr_radio_pub_uint32()

bool twr_radio_pub_uint32 ( const char *  subtopic,
uint32_t *  value 
)

Publish uint32 value in custom topic.

Parameters
[in]subtopicSubtopic (example: node/{id}/{subtopic})
[in]valuePointer to value, can be null
Returns
true On success
false On failure

Definition at line 207 of file twr_radio_pub.c.

◆ twr_radio_pub_value_int()

bool twr_radio_pub_value_int ( uint8_t  value_id,
int *  value 
)

Publish int value.

Parameters
[in]value_idState id from enum TWR_RADIO_PUB_VALUE_*
[in]valuePointer to value, can be null
Returns
true On success

Definition at line 155 of file twr_radio_pub.c.