From b3b9164352b1fc276f0c1388be5e6c44f16906f2 Mon Sep 17 00:00:00 2001 From: Michal Hanus Date: Mon, 2 Jun 2025 09:46:16 +0200 Subject: final1 --- prilohy/nrfdemo_source/src/mqtt_connection.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 prilohy/nrfdemo_source/src/mqtt_connection.h (limited to 'prilohy/nrfdemo_source/src/mqtt_connection.h') diff --git a/prilohy/nrfdemo_source/src/mqtt_connection.h b/prilohy/nrfdemo_source/src/mqtt_connection.h new file mode 100644 index 0000000..d4dc9cb --- /dev/null +++ b/prilohy/nrfdemo_source/src/mqtt_connection.h @@ -0,0 +1,25 @@ +#ifndef _MQTTCONNECTION_H_ +#define _MQTTCONNECTION_H_ +#define LED_CONTROL_OVER_MQTT DK_LED1 /* Stratus LED to control over MQTT */ +#define IMEI_LEN 15 +#define CGSN_RESPONSE_LENGTH (IMEI_LEN + 6 + 1) /* Add 6 for \r\nOK\r\n and 1 for \0 */ +#define CLIENT_ID_LEN sizeof("nrf-") + IMEI_LEN + +/**@brief Initialize the MQTT client structure + */ +int client_init(struct mqtt_client *client); + +/**@brief Initialize the file descriptor structure used by poll. + */ +int fds_init(struct mqtt_client *c, struct pollfd *fds); + +/**@brief Function to publish data on the configured topic + */ +int data_publish(struct mqtt_client *c, enum mqtt_qos qos, + uint8_t *data, size_t len); + +int publish_wrap(struct mqtt_client *c, uint8_t* topic, uint8_t *data, size_t len); +int publish_sensor(struct mqtt_client *c, uint8_t* topic, int32_t val1, int32_t val2); +int publish_int(struct mqtt_client *c, uint8_t* topic, int32_t val); + +#endif /* _CONNECTION_H_ */ -- cgit v1.2.3