Firmware SDK
twr_radio_pub.h
1 #ifndef _TWR_RADIO_PUB_H
2 #define _TWR_RADIO_PUB_H
3 
4 #include <twr_radio.h>
5 
9 
10 enum
11 {
52 };
53 
54 enum
55 {
56  TWR_RADIO_PUB_EVENT_PUSH_BUTTON = 0,
57  TWR_RADIO_PUB_EVENT_PIR_MOTION = 1,
58  TWR_RADIO_PUB_EVENT_LCD_BUTTON_LEFT = 2,
59  TWR_RADIO_PUB_EVENT_LCD_BUTTON_RIGHT = 3,
60  TWR_RADIO_PUB_EVENT_ACCELEROMETER_ALERT = 4,
61  TWR_RADIO_PUB_EVENT_HOLD_BUTTON = 5
62 };
63 
64 enum
65 {
66  TWR_RADIO_PUB_STATE_LED = 0,
67  TWR_RADIO_PUB_STATE_RELAY_MODULE_0 = 1,
68  TWR_RADIO_PUB_STATE_RELAY_MODULE_1 = 2,
69  TWR_RADIO_PUB_STATE_POWER_MODULE_RELAY = 3
70 };
71 
72 enum
73 {
74  TWR_RADIO_PUB_VALUE_HOLD_DURATION_BUTTON = 0
75 };
76 
82 
83 bool twr_radio_pub_event_count(uint8_t event_id, uint16_t *event_count);
84 
89 
90 bool twr_radio_pub_push_button(uint16_t *event_count);
91 
97 
98 bool twr_radio_pub_temperature(uint8_t channel, float *celsius);
99 
105 
106 bool twr_radio_pub_humidity(uint8_t channel, float *percentage);
107 
113 
114 bool twr_radio_pub_luminosity(uint8_t channel, float *lux);
115 
122 
123 bool twr_radio_pub_barometer(uint8_t channel, float *pascal, float *meter);
124 
129 
130 bool twr_radio_pub_co2(float *concentration);
131 
136 
137 bool twr_radio_pub_battery(float *voltage);
138 
145 
146 bool twr_radio_pub_acceleration(float *x_axis, float *y_axis, float *z_axis);
147 
153 
154 bool twr_radio_pub_buffer(void *buffer, size_t length);
155 
161 
162 bool twr_radio_pub_state(uint8_t state_id, bool *state);
163 
168 
169 bool twr_radio_pub_value_int(uint8_t value_id, int *value);
170 
176 
177 bool twr_radio_pub_bool(const char *subtopic, bool *value);
178 
184 
185 bool twr_radio_pub_int(const char *subtopic, int *value);
186 
192 
193 bool twr_radio_pub_uint32(const char *subtopic, uint32_t *value);
194 
200 
201 bool twr_radio_pub_float(const char *subtopic, float *value);
202 
208 
209 bool twr_radio_pub_string(const char *subtopic, const char *value);
210 
215 
216 void twr_radio_pub_decode(uint64_t *id, uint8_t *buffer, size_t length);
217 
219 
220 #endif // _TWR_RADIO_PUB_H
bool twr_radio_pub_float(const char *subtopic, float *value)
Publish float value in custom topic.
bool twr_radio_pub_luminosity(uint8_t channel, float *lux)
Publish luminosity.
Definition: twr_radio_pub.c:65
bool twr_radio_pub_value_int(uint8_t value_id, int *value)
Publish int value.
bool twr_radio_pub_state(uint8_t state_id, bool *state)
Publish battery.
bool twr_radio_pub_event_count(uint8_t event_id, uint16_t *event_count)
Publish event count.
Definition: twr_radio_pub.c:24
bool twr_radio_pub_barometer(uint8_t channel, float *pascal, float *meter)
Publish barometer.
Definition: twr_radio_pub.c:77
bool twr_radio_pub_acceleration(float *x_axis, float *y_axis, float *z_axis)
Publish acceleration.
bool twr_radio_pub_humidity(uint8_t channel, float *percentage)
Publish humidity.
Definition: twr_radio_pub.c:53
bool twr_radio_pub_int(const char *subtopic, int *value)
Publish int value in custom topic.
bool twr_radio_pub_string(const char *subtopic, const char *value)
Publish string value in custom topic.
bool twr_radio_pub_temperature(uint8_t channel, float *celsius)
Publish temperature.
Definition: twr_radio_pub.c:41
bool twr_radio_pub_uint32(const char *subtopic, uint32_t *value)
Publish uint32 value in custom topic.
bool twr_radio_pub_buffer(void *buffer, size_t length)
Publish buffer.
bool twr_radio_pub_battery(float *voltage)
Publish battery.
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_...
Definition: twr_radio_pub.c:36
bool twr_radio_pub_bool(const char *subtopic, bool *value)
Publish bool value in custom topic.
void twr_radio_pub_decode(uint64_t *id, uint8_t *buffer, size_t length)
Internal decode function for twr_radio.c.
bool twr_radio_pub_co2(float *concentration)
Publish co2.
Definition: twr_radio_pub.c:90
@ TWR_RADIO_PUB_CHANNEL_R3_I2C0_ADDRESS_DEFAULT
channel 0:4
Definition: twr_radio_pub.h:29
@ TWR_RADIO_PUB_CHANNEL_R2_I2C1_ADDRESS_ALTERNATE
channel 1:3
Definition: twr_radio_pub.h:27
@ TWR_RADIO_PUB_CHANNEL_NONE
channel -
Definition: twr_radio_pub.h:51
@ TWR_RADIO_PUB_CHANNEL_R2_I2C1_ADDRESS_DEFAULT
channel 1:2
Definition: twr_radio_pub.h:25
@ TWR_RADIO_PUB_CHANNEL_R1_I2C0_ADDRESS_ALTERNATE
channel 0:1
Definition: twr_radio_pub.h:15
@ TWR_RADIO_PUB_CHANNEL_R1_I2C1_ADDRESS_ALTERNATE
channel 1:1
Definition: twr_radio_pub.h:19
@ TWR_RADIO_PUB_CHANNEL_R4_I2C1_ADDRESS_DEFAULT
channel 1:6
Definition: twr_radio_pub.h:41
@ TWR_RADIO_PUB_CHANNEL_R2_I2C0_ADDRESS_DEFAULT
channel 0:2
Definition: twr_radio_pub.h:21
@ TWR_RADIO_PUB_CHANNEL_R2_I2C0_ADDRESS_ALTERNATE
channel 0:3
Definition: twr_radio_pub.h:23
@ TWR_RADIO_PUB_CHANNEL_R1_I2C0_ADDRESS_DEFAULT
channel 0:0
Definition: twr_radio_pub.h:13
@ TWR_RADIO_PUB_CHANNEL_R1_I2C1_ADDRESS_DEFAULT
channel 1:0
Definition: twr_radio_pub.h:17
@ TWR_RADIO_PUB_CHANNEL_R4_I2C0_ADDRESS_DEFAULT
channel 0:6
Definition: twr_radio_pub.h:37
@ TWR_RADIO_PUB_CHANNEL_B
channel b
Definition: twr_radio_pub.h:47
@ TWR_RADIO_PUB_CHANNEL_R4_I2C1_ADDRESS_ALTERNATE
channel 1:7
Definition: twr_radio_pub.h:43
@ TWR_RADIO_PUB_CHANNEL_SET_POINT
channel set-point
Definition: twr_radio_pub.h:49
@ TWR_RADIO_PUB_CHANNEL_R3_I2C1_ADDRESS_DEFAULT
channel 1:4
Definition: twr_radio_pub.h:33
@ TWR_RADIO_PUB_CHANNEL_R4_I2C0_ADDRESS_ALTERNATE
channel 0:7
Definition: twr_radio_pub.h:39
@ TWR_RADIO_PUB_CHANNEL_R3_I2C0_ADDRESS_ALTERNATE
channel 0:5
Definition: twr_radio_pub.h:31
@ TWR_RADIO_PUB_CHANNEL_A
channel a
Definition: twr_radio_pub.h:45
@ TWR_RADIO_PUB_CHANNEL_R3_I2C1_ADDRESS_ALTERNATE
channel 1:5
Definition: twr_radio_pub.h:35