|Download Help (Windows Only)|
Parent Topic: Communication Methods within Device Code
Each Qbus message consists of two parts: its name/type and its value. The Qbus API stores message values as variant data. Because message values can be of many data types, such as strings, scalar numerics, and arrays of various data types, Qbus must handle data of many different types in a generic way. The variant data type, a generic container for all other types of data in LabVIEW, is one solution for these situations.
The Qbus API provides subVIs that allow processes to send two types of messages:
The format of a Qbus message consists of a name of type string and a body of type variant. For broadcast messages, you can use SendBroadcastMessage.vi with any service. For routed messages, use SendRoutedMessage.vi and the name of a specific service to route the message to. Wiring the body of any data type coerces it to the variant data type. For code that consumes the message, write a specific parsing VI to cast the body back to its original type for that message name.
For example, in the NI-developed Data Event Creator process, the DataEventCreator.RegisterTrend case calls RegisterTrendPointsRoutedMessage_Parse.vi, which uses Variant to Data to cast the variant in the message to the expected cluster type for that message. Routed messages follow the same pattern. An example of this pattern is available in the Initialize case of the NI-developed VibrationAnalysis process.