Cayenne MQTT API¶
- group LWESP_APP_CAYENNE_API
MQTT client API for Cayenne.
Defines
-
LWESP_CAYENNE_API_VERSION¶
Cayenne API version in string.
-
LWESP_CAYENNE_HOST¶
Cayenne host server.
-
LWESP_CAYENNE_PORT¶
Cayenne port number.
-
LWESP_CAYENNE_NO_CHANNEL¶
No channel macro
-
LWESP_CAYENNE_ALL_CHANNELS¶
All channels macro
Typedefs
-
typedef lwespr_t (*lwesp_cayenne_evt_fn)(struct lwesp_cayenne *c, lwesp_cayenne_evt_t *evt)¶
Cayenne event callback function.
Enums
-
enum lwesp_cayenne_topic_t¶
List of possible cayenne topics.
Values:
-
enumerator LWESP_CAYENNE_TOPIC_DATA¶
Data topic
-
enumerator LWESP_CAYENNE_TOPIC_COMMAND¶
Command topic
-
enumerator LWESP_CAYENNE_TOPIC_CONFIG¶
-
enumerator LWESP_CAYENNE_TOPIC_RESPONSE¶
-
enumerator LWESP_CAYENNE_TOPIC_SYS_MODEL¶
-
enumerator LWESP_CAYENNE_TOPIC_SYS_VERSION¶
-
enumerator LWESP_CAYENNE_TOPIC_SYS_CPU_MODEL¶
-
enumerator LWESP_CAYENNE_TOPIC_SYS_CPU_SPEED¶
-
enumerator LWESP_CAYENNE_TOPIC_DIGITAL¶
-
enumerator LWESP_CAYENNE_TOPIC_DIGITAL_COMMAND¶
-
enumerator LWESP_CAYENNE_TOPIC_DIGITAL_CONFIG¶
-
enumerator LWESP_CAYENNE_TOPIC_ANALOG¶
-
enumerator LWESP_CAYENNE_TOPIC_ANALOG_COMMAND¶
-
enumerator LWESP_CAYENNE_TOPIC_ANALOG_CONFIG¶
-
enumerator LWESP_CAYENNE_TOPIC_END¶
Last entry
-
enumerator LWESP_CAYENNE_TOPIC_DATA¶
Functions
-
lwespr_t lwesp_cayenne_create(lwesp_cayenne_t *c, const lwesp_mqtt_client_info_t *client_info, lwesp_cayenne_evt_fn evt_fn)¶
Create new instance of cayenne MQTT connection.
Note
Each call to this functions starts new thread for async receive processing. Function will block until thread is created and successfully started
-
lwespr_t lwesp_cayenne_subscribe(lwesp_cayenne_t *c, lwesp_cayenne_topic_t topic, uint16_t channel)¶
Subscribe to cayenne based topics and channels.
- Parameters
c – [in] Cayenne handle
topic – [in] Cayenne topic
channel – [in] Optional channel number. Use LWESP_CAYENNE_NO_CHANNEL when channel is not needed or LWESP_CAYENNE_ALL_CHANNELS to subscribe to all channels
- Returns
-
lwespr_t lwesp_cayenne_publish_data(lwesp_cayenne_t *c, lwesp_cayenne_topic_t topic, uint16_t channel, const char *type, const char *unit, const char *data)¶
Publish data to cayenne cloud.
- Parameters
c – [in] Cayenne handle
topic – [in] Cayenne specific topic to publish on
channel – [in] Device channel to publish on
type – [in] Data type, string format, for example
temp
for temperature. Set toNULL
if not usedunit – [in] Data unit, string format, for example
c
for celcius. Set toNULL
if not useddata – [in] Actual data, for example
127
for127
degrees
- Returns
-
lwespr_t lwesp_cayenne_publish_float(lwesp_cayenne_t *c, lwesp_cayenne_topic_t topic, uint16_t channel, const char *type, const char *unit, float f)¶
-
lwespr_t lwesp_cayenne_publish_response(lwesp_cayenne_t *c, lwesp_cayenne_msg_t *msg, lwesp_cayenne_rlwesp_t resp, const char *message)¶
Publish response message to command.
-
struct lwesp_cayenne_key_value_t¶
- #include <lwesp_cayenne.h>
Key/Value pair structure.
-
struct lwesp_cayenne_msg_t¶
- #include <lwesp_cayenne.h>
Cayenne message.
Public Members
-
lwesp_cayenne_topic_t topic¶
Message topic
-
uint16_t channel¶
Message channel, optional, based on topic type
-
const char *seq¶
Sequence string on command
-
lwesp_cayenne_key_value_t values[2]¶
Key/Value pair of values
-
size_t values_count¶
Count of valid pairs in values member
-
lwesp_cayenne_topic_t topic¶
-
struct lwesp_cayenne_evt_t¶
- #include <lwesp_cayenne.h>
Cayenne event.
Public Members
-
lwesp_cayenne_evt_type_t type¶
Event type
-
lwesp_cayenne_msg_t *msg¶
Pointer to data message
-
struct lwesp_cayenne_evt_t::[anonymous]::[anonymous] data¶
Data event, used with LWESP_CAYENNE_EVT_DATA event
-
union lwesp_cayenne_evt_t::[anonymous] evt¶
Event union
-
lwesp_cayenne_evt_type_t type¶
-
struct lwesp_cayenne_t¶
- #include <lwesp_cayenne.h>
Cayenne handle.
Public Members
-
lwesp_mqtt_client_api_p api_c¶
MQTT API client
-
const lwesp_mqtt_client_info_t *info_c¶
MQTT Client info structure
-
lwesp_cayenne_msg_t msg¶
Received data message
-
lwesp_cayenne_evt_t evt¶
Event handle
-
lwesp_cayenne_evt_fn evt_fn¶
Event callback function
-
lwesp_sys_thread_t thread¶
Cayenne thread handle
-
lwesp_sys_sem_t sem¶
Sync semaphore handle
-
lwesp_mqtt_client_api_p api_c¶
-
LWESP_CAYENNE_API_VERSION¶