|
Z-Wave Protocol Controller Reference
|
#include <zwave_tx_queue.hpp>
Public Member Functions | |
| sl_status_t | enqueue (const zwave_tx_queue_element_t &new_element, zwave_tx_session_id_t *user_session_id) |
| Adds a new element into the queue. More... | |
| sl_status_t | pop (const zwave_tx_session_id_t session_id) |
| Removes an element from the queue. More... | |
| zwave_tx_queue_element_t * | first_in_queue () |
| gets the element which has the highest priority More... | |
| void | clear () |
| clears the tx queue More... | |
| bool | empty () const |
| int | size () const noexcept |
| sl_status_t | get_by_id (zwave_tx_queue_element_t *element, const zwave_tx_session_id_t session_id) const |
| Gets a copy of the data for an element in the queue. More... | |
| bool | contains (const zwave_tx_session_id_t session_id) const |
| Verifies if a session ID is in the queue. More... | |
| sl_status_t | get_highest_priority_child (zwave_tx_queue_element_t *element, const zwave_tx_session_id_t session_id) const |
| Find the child in the queue with the highest priority. More... | |
| sl_status_t | set_transmissions_results (const zwave_tx_session_id_t session_id, uint8_t status, zwapi_tx_report_t *tx_status) |
| Sets Z-Wave API transmission results for an element in the queue. More... | |
| sl_status_t | decrement_expected_responses (const zwave_tx_session_id_t session_id) |
| Decrement the number of expected responses for an element in the queue. More... | |
| uint8_t | get_number_of_responses (const zwave_tx_session_id_t session_id) |
| Finds the total the number of expected responses for an element and its parents in the queue. More... | |
| const uint8_t * | get_frame (const zwave_tx_session_id_t session_id) |
| Returns a pointer to the payload of a frame in the Tx Queue. More... | |
| uint16_t | get_frame_length (const zwave_tx_session_id_t session_id) |
| Returns the length of a frame in the Z-Wave Tx Queue. More... | |
| sl_status_t | set_transmission_timestamp (const zwave_tx_session_id_t session_id) |
| Records a timestamp of the current time for the transmission of an element. More... | |
| sl_status_t | reset_transmission_timestamp (const zwave_tx_session_id_t session_id) |
| Reset the timestamp for the transmission of an element. More... | |
| sl_status_t | disable_fasttack (const zwave_tx_session_id_t session_id) |
| Disables the fasttrack options from the Z-Wave Tx Options. More... | |
| bool | zwave_tx_has_frames_for_node (const zwave_node_id_t node_id) |
| Finds if we have elements to send to a NodeID destination. More... | |
| void | log (bool log_messages_payload) const |
| Logs the content of the queue using sl_log. More... | |
| void | log_element (const zwave_tx_session_id_t session_id, bool log_frame_payload) const |
| Logs the content one element of the queue using sl_log. More... | |
| void | simple_log (zwave_tx_queue_element_t *e) const |
| Short log of one element using sl_log. More... | |
Private Types | |
| using | queue_iterator = priority_queue< zwave_tx_queue_element_t, ZWAVE_TX_QUEUE_BUFFER_SIZE, queue_element_qos_compare >::iterator |
| using | const_queue_iterator = priority_queue< zwave_tx_queue_element_t, ZWAVE_TX_QUEUE_BUFFER_SIZE, queue_element_qos_compare >::const_iterator |
Private Member Functions | |
| queue_iterator | find (const zwave_tx_session_id_t key) |
| const_queue_iterator | find (const zwave_tx_session_id_t key) const |
Private Attributes | |
| uint32_t | zwave_tx_session_id_counter = 0 |
| priority_queue< zwave_tx_queue_element_t, ZWAVE_TX_QUEUE_BUFFER_SIZE, queue_element_qos_compare > | queue |
Z-Wave TX Queue class
This class is a multiset of zwave_tx_queue_element_t objects, that keeps sorted by element qos_priority.
All queue elements are uniquely identified by a zwave_tx_session_id_t that gets assigned to the element when queueing them. It is possible to get a copy of an element providing a zwave_tx_session_id_t, but they cannot be modified directly.
Setters are available for changing elements properties.
|
private |
|
private |
| void zwave_tx_queue::clear | ( | ) |
clears the tx queue
| bool zwave_tx_queue::contains | ( | const zwave_tx_session_id_t | session_id | ) | const |
Verifies if a session ID is in the queue.
| session_id | Used to identify the queue entry to find. |
| sl_status_t zwave_tx_queue::decrement_expected_responses | ( | const zwave_tx_session_id_t | session_id | ) |
Decrement the number of expected responses for an element in the queue.
| session_id | Used to identify the queue entry for which the expected responses must be decremented. |
| sl_status_t zwave_tx_queue::disable_fasttack | ( | const zwave_tx_session_id_t | session_id | ) |
Disables the fasttrack options from the Z-Wave Tx Options.
This should be used when a "fasttracked" transmission attempt failed.
| session_id | Used to identify the queue entry for which the fasttrack flag is to be disabled |
| bool zwave_tx_queue::empty | ( | ) | const |
| sl_status_t zwave_tx_queue::enqueue | ( | const zwave_tx_queue_element_t & | new_element, |
| zwave_tx_session_id_t * | user_session_id | ||
| ) |
Adds a new element into the queue.
A session_id will be allocated to the element and written back at the location of the new_element parameter.
| new_element | Pointer to a variable containing element data to be added into the queue. |
| user_session_id | Pointer to a zwave_tx_session_id_t variable used to return the allocated session_id. |
|
private |
|
private |
| zwave_tx_queue_element_t * zwave_tx_queue::first_in_queue | ( | ) |
gets the element which has the highest priority
| sl_status_t zwave_tx_queue::get_by_id | ( | zwave_tx_queue_element_t * | element, |
| const zwave_tx_session_id_t | session_id | ||
| ) | const |
Gets a copy of the data for an element in the queue.
| element | Variable where to copy the data from the element identified by the session_id |
| session_id | Used to identify the queue entry to copy to element. |
| const uint8_t * zwave_tx_queue::get_frame | ( | const zwave_tx_session_id_t | session_id | ) |
Returns a pointer to the payload of a frame in the Tx Queue.
| session_id | Used to identify the queue entry for which the the frame data poiner must be returned. |
| uint16_t zwave_tx_queue::get_frame_length | ( | const zwave_tx_session_id_t | session_id | ) |
Returns the length of a frame in the Z-Wave Tx Queue.
| session_id | Used to identify the queue entry for which the the frame length poiner must be returned. |
| sl_status_t zwave_tx_queue::get_highest_priority_child | ( | zwave_tx_queue_element_t * | element, |
| const zwave_tx_session_id_t | session_id | ||
| ) | const |
Find the child in the queue with the highest priority.
| element | Variable where to copy the data from the child element identified by the session_id |
| session_id | Used to identify parent of the queue entry to copy to the element pointer. |
| uint8_t zwave_tx_queue::get_number_of_responses | ( | const zwave_tx_session_id_t | session_id | ) |
Finds the total the number of expected responses for an element and its parents in the queue.
| session_id | Used to identify the queue entry for which the total number of responses must be returned. |
| void zwave_tx_queue::log | ( | bool | log_messages_payload | ) | const |
Logs the content of the queue using sl_log.
| log_messages_payload | boolean indicating if the hex payload of each frame must be included in the log. |
| void zwave_tx_queue::log_element | ( | const zwave_tx_session_id_t | session_id, |
| bool | log_frame_payload | ||
| ) | const |
Logs the content one element of the queue using sl_log.
| session_id | boolean indicating if the hex payload of each frame must be included in the log. |
| log_frame_payload | boolean indicating if the hex payload of the frame must be included in the log. |
| sl_status_t zwave_tx_queue::pop | ( | const zwave_tx_session_id_t | session_id | ) |
Removes an element from the queue.
| session_id | Used to identify the queue entry to remove. |
| sl_status_t zwave_tx_queue::reset_transmission_timestamp | ( | const zwave_tx_session_id_t | session_id | ) |
Reset the timestamp for the transmission of an element.
This is unsed in case the element transmission was initiated, but it needs to be requeued and a new transmission will be initiated later on.
| session_id | Used to identify the queue entry for which the timestamp must be reset. |
| sl_status_t zwave_tx_queue::set_transmission_timestamp | ( | const zwave_tx_session_id_t | session_id | ) |
Records a timestamp of the current time for the transmission of an element.
The timestamp will subsequently be used by set_transmissions_results() to calculate how long the transmission took.
| session_id | Used to identify the queue entry for which the timestamp must be marked. |
| sl_status_t zwave_tx_queue::set_transmissions_results | ( | const zwave_tx_session_id_t | session_id, |
| uint8_t | status, | ||
| zwapi_tx_report_t * | tx_status | ||
| ) |
Sets Z-Wave API transmission results for an element in the queue.
| session_id | Used to identify the queue entry for which the transmissions results must be copied to. |
| status | Status returned by the Z-Wave API. |
| tx_status | Pointer to the zwapi_tx_report_t report returned by the Z-Wave API. |
| void zwave_tx_queue::simple_log | ( | zwave_tx_queue_element_t * | e | ) | const |
Short log of one element using sl_log.
| e | Pointer of the element object to log. |
|
noexcept |
| bool zwave_tx_queue::zwave_tx_has_frames_for_node | ( | const zwave_node_id_t | node_id | ) |
Finds if we have elements to send to a NodeID destination.
| node_id | The NodeID to check for in the queue |
|
private |
|
private |