Queuing a series of commands and sending those in bulk improves the overall performance and operation of the library and Signalyzer. The USB 2.0 bus provides relatively high throughput, but when it comes to sending small amounts of information at regular rate it can quickly become a bottleneck of the system.
The queue is designed to store a series of commands in the memory first and when queue is ready, the queue engine serializes data in larger blocks and sends it as quickly as possible resulting in substantial speed improvement. In addition, queues can be reused once built, allowing for some additional time saving by building queue once and reusing it over and over as long as connection with Signalyzer is open.
Current library implementation supports up-to 100 independent queues. Queue with Id 0 denotes non-queued mode of operation, Ids in 1 to 99 range are separate user accessible queues.
The Queue, as any other library functions is accessed using Attribute writes and reads. Names for queue related attribute start with SIGNALYZER_ATTRIBUTE_QUEUE_* or “QUEUE_*”.
Detailed list of Queue attributes: QUEUE attribute
The typical use case scenario for queue usage would consist of steps similar to ones described below:
- Switch to specific queue by writing a queue id value to QUEUE_ACTIVE attribute.
- From this point, any operations on the library will be directed to the selected queue. Note: not every attribute supports queue, for example majority of CORE_* and PORT_* attributes do not support queues.
- Start writing and reading attributes as you would normally do in non-queued mode of operation. On read commands, library will not return valid data though.
- Once a series of commands is ready, execute the queue to process it.
- The commands will be sent and read from Signalyzer but in a lot more efficient buffered way.
- After queue execution read data will be returned in read data pointer supplied variables or it can be read from the internal queue read buffer.
- Queue can be re-run again several times, saved for later use by switching to a different queue, or simply cleared.