|
Nyx Node
|
Data Structures | |
| struct | nyx_node_t |
| Opaque struct describing a Nyx node. More... | |
Typedefs | |
| typedef struct nyx_node_s | nyx_node_t |
| typedef void(* | nyx_node_t::nyx_mqtt_handler_t) (nyx_node_t *node, nyx_event_type_t event_type, size_t topic_size, BUFF_t topic_buff, size_t message_size, BUFF_t message_buff) |
| MQTT event handler. | |
Enumerations | |
| enum | nyx_node_t::nyx_event_type_t |
| TCP or MQTT event type. More... | |
Functions | |
| __NYX_NULLABLE__ nyx_node_t * | nyx_node_t::nyx_node_initialize (STR_t node_id, nyx_dict_t *vectors[], __NYX_NULLABLE__ STR_t indi_url, __NYX_NULLABLE__ STR_t mqtt_url, __NYX_NULLABLE__ STR_t nss_url, __NYX_NULLABLE__ STR_t mqtt_username, __NYX_NULLABLE__ STR_t mqtt_password, __NYX_NULLABLE__ nyx_mqtt_handler_t mqtt_handler, uint32_t retry_ms, bool enable_xml) |
| Allocates and initializes a new Nyx node. | |
| void | nyx_node_t::nyx_node_finalize (nyx_node_t *node, bool free_vectors) |
| Finalizes a Nyx node. | |
| void | nyx_node_t::nyx_node_add_timer (const nyx_node_t *node, uint32_t interval_ms, void(*callback)(void *), void *arg) |
| Add a new timer. | |
| void | nyx_node_t::nyx_node_poll (const nyx_node_t *node, uint32_t timeout_ms) |
| Performs a single poll iteration. | |
| bool | nyx_node_t::nyx_node_notify (__NYX_NULLABLE__ nyx_object_t *object) |
| Notifies the provided Nyx / INDI object to the clients. | |
| void | nyx_node_t::nyx_node_enable (const nyx_node_t *node, STR_t device, __NYX_NULLABLE__ STR_t name, __NYX_NULLABLE__ STR_t message) |
| Enables a device or a vector and notifies clients. | |
| void | nyx_node_t::nyx_node_disable (const nyx_node_t *node, STR_t device, __NYX_NULLABLE__ STR_t name, __NYX_NULLABLE__ STR_t message) |
| Disables a device or a vector and notifies clients. | |
| void | nyx_node_t::nyx_node_send_message (const nyx_node_t *node, STR_t device, __NYX_NULLABLE__ STR_t message) |
| Sends a human-oriented message to the clients. | |
| void | nyx_node_t::nyx_node_send_del_property (const nyx_node_t *node, STR_t device, __NYX_NULLABLE__ STR_t name, __NYX_NULLABLE__ STR_t message) |
Sends a del-property message to the clients. | |
| void | nyx_node_t::nyx_mqtt_sub (const nyx_node_t *node, STR_t topic, int qos) |
| If MQTT is enabled, subscribes to an MQTT topic. | |
| void | nyx_node_t::nyx_mqtt_pub (const nyx_node_t *node, STR_t topic, __NYX_ZEROABLE__ size_t message_size, __NYX_NULLABLE__ BUFF_t message_buff, int qos) |
| If MQTT is enabled, publishes an MQTT message. | |
| void | nyx_node_t::nyx_nss_pub (const nyx_node_t *node, STR_t device, STR_t stream, __NYX_ZEROABLE__ size_t n_fields, const uint32_t field_hashes[], const size_t field_sizes[], const buff_t field_buffs[]) |
| If Nyx-Stream is enabled, publishes an entry to a stream. | |
Nyx node.
| typedef struct nyx_node_s nyx_node_t |
Definition at line 2822 of file nyx_node.h.
| typedef void(* nyx_mqtt_handler_t) (nyx_node_t *node, nyx_event_type_t event_type, size_t topic_size, BUFF_t topic_buff, size_t message_size, BUFF_t message_buff) |
MQTT event handler.
| node | Nyx node. |
| event_type | Event type. |
| topic_size | MQTT topic length. |
| topic_buff | MQTT topic buffer. |
| message_size | MQTT message length. |
| message_buff | MQTT message buffer. |
Definition at line 2851 of file nyx_node.h.
| enum nyx_event_type_t |
TCP or MQTT event type.
Definition at line 2831 of file nyx_node.h.
| __NYX_NULLABLE__ nyx_node_t * nyx_node_initialize | ( | STR_t | node_id, |
| nyx_dict_t * | vectors[], | ||
| __NYX_NULLABLE__ STR_t | indi_url, | ||
| __NYX_NULLABLE__ STR_t | mqtt_url, | ||
| __NYX_NULLABLE__ STR_t | nss_url, | ||
| __NYX_NULLABLE__ STR_t | mqtt_username, | ||
| __NYX_NULLABLE__ STR_t | mqtt_password, | ||
| __NYX_NULLABLE__ nyx_mqtt_handler_t | mqtt_handler, | ||
| uint32_t | retry_ms, | ||
| bool | enable_xml | ||
| ) |
Allocates and initializes a new Nyx node.
| node_id | Unique node identifier. |
| vectors | Array of vectors with ǸULL sentinel. |
| indi_url | Optional INDI URL (e.g. tcp://0.0.0.0:7625). |
| mqtt_url | Optional MQTT URL (e.g. mqtt://localhost:1883). |
| nss_url | Optional Nyx-Stream URL (e.g. tcp://localhost:6379). |
| mqtt_username | Optional MQTT username. |
| mqtt_password | Optional MQTT password. |
| mqtt_handler | Optional MQTT handler. |
| retry_ms | Connect retry time [milliseconds]. |
| enable_xml | Enables the XML messages. |
| void nyx_node_finalize | ( | nyx_node_t * | node, |
| bool | free_vectors | ||
| ) |
| void nyx_node_add_timer | ( | const nyx_node_t * | node, |
| uint32_t | interval_ms, | ||
| void(*)(void *) | callback, | ||
| void * | arg | ||
| ) |
Add a new timer.
| node | Nyx node. |
| interval_ms | Interval [milliseconds]. |
| callback | Callback to be invoked. |
| arg | Callback argument. |
Definition at line 390 of file mongoose.c.
| void nyx_node_poll | ( | const nyx_node_t * | node, |
| uint32_t | timeout_ms | ||
| ) |
Performs a single poll iteration.
| node | Nyx node. |
| timeout_ms | Timeout [milliseconds]. |
Definition at line 397 of file mongoose.c.
| bool nyx_node_notify | ( | __NYX_NULLABLE__ nyx_object_t * | object | ) |
Notifies the provided Nyx / INDI object to the clients.
| object | The provided Nyx / INDI object. |
| void nyx_node_enable | ( | const nyx_node_t * | node, |
| STR_t | device, | ||
| __NYX_NULLABLE__ STR_t | name, | ||
| __NYX_NULLABLE__ STR_t | message | ||
| ) |
Enables a device or a vector and notifies clients.
| node | Nyx node. |
| device | Device name. |
| name | Optional vector name (NULL ≡ whole device). |
| message | Optional human-oriented message. |
| void nyx_node_disable | ( | const nyx_node_t * | node, |
| STR_t | device, | ||
| __NYX_NULLABLE__ STR_t | name, | ||
| __NYX_NULLABLE__ STR_t | message | ||
| ) |
Disables a device or a vector and notifies clients.
| node | Nyx node. |
| device | Device name. |
| name | Optional vector name (NULL ≡ whole device). |
| message | Optional human-oriented message. |
| void nyx_node_send_message | ( | const nyx_node_t * | node, |
| STR_t | device, | ||
| __NYX_NULLABLE__ STR_t | message | ||
| ) |
| void nyx_node_send_del_property | ( | const nyx_node_t * | node, |
| STR_t | device, | ||
| __NYX_NULLABLE__ STR_t | name, | ||
| __NYX_NULLABLE__ STR_t | message | ||
| ) |
| void nyx_mqtt_sub | ( | const nyx_node_t * | node, |
| STR_t | topic, | ||
| int | qos | ||
| ) |
If MQTT is enabled, subscribes to an MQTT topic.
| node | Nyx node. |
| topic | MQTT topic. |
| qos | MQTT Quality Of Service. |
mqtt_handler has to be defined in nyx_node_initialize. | void nyx_mqtt_pub | ( | const nyx_node_t * | node, |
| STR_t | topic, | ||
| __NYX_ZEROABLE__ size_t | message_size, | ||
| __NYX_NULLABLE__ BUFF_t | message_buff, | ||
| int | qos | ||
| ) |
If MQTT is enabled, publishes an MQTT message.
| node | Nyx node. |
| topic | MQTT topic. |
| message_size | MQTT message length. |
| message_buff | MQTT message buffer. |
| qos | MQTT Quality Of Service. |
| void nyx_nss_pub | ( | const nyx_node_t * | node, |
| STR_t | device, | ||
| STR_t | stream, | ||
| __NYX_ZEROABLE__ size_t | n_fields, | ||
| const uint32_t | field_hashes[], | ||
| const size_t | field_sizes[], | ||
| const buff_t | field_buffs[] | ||
| ) |
If Nyx-Stream is enabled, publishes an entry to a stream.
| node | Nyx node. |
| device | Device name. |
| stream | Stream name. |
| n_fields | Number of field triplets (hash, size, buffer). |
| field_hashes | Array of field hashes. |
| field_sizes | Array of field sizes. |
| field_buffs | Array of field buffers. |