NI InsightCM™ SDK Help
»View Product Info
Parent Topic: Communication Methods within Device Code
Qbus is an internal message bus that implements communication among all processes that run in the device software, including routing and storing messages. The Qbus API allows processes to perform the following operations:
- Send a message to other processes.
- Retrieve the oldest message in their specific message queue.
- Continuously poll for new messages when the message queue is empty.
- Override the message queue in the event that the device shuts down, enters an error state, or sets a priority action.
Registering a Process with Qbus
A process must register itself with Qbus to send and receive information from other processes. Register processes before you start them to ensure the processes are able to communicate when they execute for the first time. In the reference code for devices, the NI-developed Initialize subVI registers each NI-developed process by executing an instance of the Create Listener VI.
Implementation of Qbus
Internally, the Qbus API bundles the following elements and provides access to them via a single reference. Each process in the device software must receive a copy of this reference to pass to the members of the Qbus API that it calls.
- Queues is an array of process message queues. Message queues contain messages in the form of a bundled message name and message value. Qbus maintains one message queue per process.
- Subscriptions stores the message-subscription lists that determines which broadcast messages Qbus enqueues for each process.
- States stores the status each process set for itself: configured or unconfigured. If you want a process to require another process to be configured before it executes a particular action, you can check the state of the service of interest in this element.
- MasterQ—The name of the process that is designed to handle ProcessError messages that other processes send when an unhandled error occurs. In NI-developed reference device software, the Controller process is the MasterQ.
Initializing the Application Software