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_buffer(void *buffer, size_t length)
Publish buffer.
bool twr_radio_pub_uint32(const char *subtopic, uint32_t *value)
Publish uint32 value in custom topic.
bool twr_radio_pub_humidity(uint8_t channel, float *percentage)
Publish humidity.
Definition: twr_radio_pub.c:53
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_int(const char *subtopic, int *value)
Publish int value in custom topic.
bool twr_radio_pub_float(const char *subtopic, float *value)
Publish float value in custom topic.
bool twr_radio_pub_barometer(uint8_t channel, float *pascal, float *meter)
Publish barometer.
Definition: twr_radio_pub.c:77
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_battery(float *voltage)
Publish battery.
bool twr_radio_pub_string(const char *subtopic, const char *value)
Publish string value in custom topic.
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_luminosity(uint8_t channel, float *lux)
Publish luminosity.
Definition: twr_radio_pub.c:65
bool twr_radio_pub_co2(float *concentration)
Publish co2.
Definition: twr_radio_pub.c:90
bool twr_radio_pub_bool(const char *subtopic, bool *value)
Publish bool 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_acceleration(float *x_axis, float *y_axis, float *z_axis)
Publish acceleration.
void twr_radio_pub_decode(uint64_t *id, uint8_t *buffer, size_t length)
Internal decode function for twr_radio.c.