Basic Usages
Step1. Create a reusable module
Creating a reusable module typically does not require message interaction with other modules; it only needs to provide an external interface and publish the state of the module. Therefore, as long as these two aspects are clearly described, one can call the reusable module without understanding its internal implementation details. In CSM modules, all cases can be considered as messages for invocation, but it is recommended to use API category as external interfaces. When sending status updates, notify external entities of changes by sending either Status or Interrupt Status.
Go to /Example/1. Create a reusable module to learn how to create a CSM module.
Step2. Caller is CSM Scenario
In this scenario, inter-module communication solely relies on message string queue operations. You can generate a Message string using the “Build Message with Arguments++.vi” function. Alternatively, if you are familiar with the rules, you can directly utilize message description strings.
#CSM State Syntax
// Local Message Example
DoSth: DoA >> Arguments
// Sync Call Example
API: xxxx >> Arguments -@ TargetModule
// Async Call Example
API: xxxx >> Arguments -> TargetModule
// Async Call without Reply Example
API: xxxx >> Arguments ->\| TargetModule
// Broadcast normal status:
Status >> StatusArguments -><status>
// Broadcast Interrupt status:
Interrupt >> StatusArguments -><interrupt>
// Register Source Module's status to Handler Module
Status@Source Module >> Handler Module@Handler Module -><register>
// Unregister Source Module's status
Status@Source Module >> Handler Module -><unregister>
#CSM Commenting
To add a comment use "//" and all text to the right will be ignored
UI: Initialize // This initializes the UI
// Another comment line
Go to /Example/2. Caller is CSM Scenario to find an example for this scenario.
Step3. Caller is not CSM Scenario
In this scenario, inter-module communication solely relies on Post/Send Message API and module status change user event.
Go to /Example/3. Caller is Other Framework Scenario to find an example for this scenario.
Step4. CSM Arguments
CSM only supports the STRING TYPE as a parameter, but there is a wide variety of data that needs to be transmitted. Therefore, support for parameters is crucial. The table below lists some of the current ways in which different data types are supported, with some being built-in within CSM and others requiring additional installation through addons.
Arguments | Type | Description |
---|---|---|
Safe String | Build-in | ”->| -> -@ & <- , ; []{}`” wil be replaced with %[HEXCODE] |
HexStr | Build-in | Data will be converted as variant and changed to Hex String as parameter |
ArrayData | Addons | Pass the StartPos with array-length of a circle buffer for numeric array data |
MassData | Addons | Data will be converted to memory and saved in a circle buffer. Pass the StartPos with length as parameter. |
API String Arguments | Addons | Support plain string as CSM API parameter |
INI Static Variable Support | Addons | offering ${variable} support for CSM |