The purpose of this library is to enhance the API parameters for Communicable State Machine (CSM). It allows for the inclusion of various data types in plain text format.
Two more templates which include "Data: Get Configuration", "Data: Set Configuration" and "Data: Get Internal Data" states, are provided in the library. These templates can serve as a starting point for building your CSM module with the ability to access data stored in the '>> internal data >>' shift register.
For String/Path datatype, CSM Key words '->|' '->' '-@' '-&' '>>' ',' ';' will be replaced with %[Hex] String before passing, which is as same as using CSM AdvanceAPI\CSM Make String Arguments Safe.vi.
Predefined TRUE/FALSE String Pairs:
TRUE/FALSE String Pairs:
- T/F
- True/False
- On/Off
- Enable/Disable
- Active/Inactive
- valid/Invalid
- 1/0
- Open/Close
- Non-null/null
[!NOTE] For Boolean, empty string will be converted to the input prototype value
[!NOTE] Use
API String - Add Boolean Strings.vi
orAPI String - Remove Boolean Strings.vi
to set your own boolean string to be used.
[!NOTE] Tag-value pair(Tag:Value) could be parsed correctly. Tag is used for readability and will be ignored during conversion.
Supported format: Normal, Hex, Binary, Octal, Hex with suffix H, Octal with suffix O, Binary with suffix B, Decimal with suffix D. Example:
- 12345
- 0d12345
- 0x1234
- 0b10101010
- 0o777
- 1234H
- 10101010H
- 7777O
- 10k
- 1M
[!NOTE] For Integer, empty string will be converted to the input prototype value
[!NOTE] Tag-value pair(Tag:Value) could be parsed correctly. Tag is used for readability and will be ignored during conversion.
Supported format: Normal Float, Scientific Notation, Special Float. Example:
- 1.2345
- 1.23E+2
- 1.23E-2
- 1.23Y (1.23*10^24)
- 1.23Z (1.23*10^21)
- 1.23E (1.23*10^18)
- 1.23P (1.23*10^15)
- 1.23T (1.23*10^12)
- 1.23G (1.23*10^9)
- 1.23M (1.23*10^6)
- 1.23k (1.23*10^3)
- 1.23m (1.23*0.001)
- 1.23u (1.23*0.000001)
- 1.23n (1.23*10^-9)
- 1.23p (1.23*10^-12)
- 1.23f (1.23*10^-15)
- 1.23a (1.23*10^-18)
- 1.23z (1.23*10^-21)
- 1.23y (1.23*10^-24)
- Special Float: `e`,`-e`,`pi`,`-pi`,`inf`,`+inf`,`-inf`,`NaN`
[!NOTE] For float datatype, empty string will be converted to the input prototype value.
[!NOTE] Default precision is 6. You can change it by
API String - Set Float Precision.vi
[!NOTE] Tag-value pair could be parsed correctly. Tag is used for readability and will be ignored during conversion.
[!NOTE] Float String with Unit is also supported.
special case:
space
between float string and unit string, all strings include notation behind float string is recognized as unit string.1.23mA : Float: 1.23m; Unit: A 1.23 mA : Float: 1.23; Unit: mA
1.23E+5mA: Float: 1.23E+5; Unit: mA 1.23E+5 mA: Float: 1.23E+5; Unit: mA
[!NOTE] Unit is not supported for
e
,-e
,pi
,-pi
,inf
,+inf
,-inf
,NaN
a+bi
or a-bi
stands of complex data type. a
and b
is supporting all Float format.
[!NOTE] For Complex, empty string will be converted to the input prototype value
[!NOTE] Tag-value pair could be parsed correctly. Tag is used for readability and will be ignored during conversion.
Timestamp's string format is TimeStamp_String(Format_String)
. Format_String
will be used to parse the TimeStamp_String
.
"2023-10-11 22:54:33(%<%Y-%m-%d %H:%M:%S>T)" equal to UTC timestamp string "2023-10-11T14:54:33.000Z".
special case:
If no time string format included in string, ISO8601 UTC standard is used.
"2023-10-31T14:49:39.597Z" is valid.
"2023-10-31T22:49:39.597+08:00" is valid.
TimeStamp String(FormatString)
is supported. FormatString
in "" will be used to parse TimeStamp String
.
[!NOTE] For Timestamp, empty string will be converted to current time.
Indexed Enum is defined as Enum Strings composed with [number] [separator] [enum String]. The following are supported expressions:
hex Number, -- as separator
- 0x01 -- boolean
- 0x02 -- string
- 0x04 -- dbl
- 0x08 -- number
binary Number, -- as separator
- 0b0001 __ boolean
- 0b0010 __ string
- 0b0100 __ dbl
- 0b1000 __ number
Decided Number, == as separator
- 1 == boolean
- 2 == string
- 4 == dbl
- 8 == number
[!NOTE] Index Number supports all integer expression.
Rule1: When Index is not Specified, the string will be converted to Enum by matching the string.
Enum = {AAA,BBBB,CCCC}
Rule2: When Index is Specified, the string will be converted to Enum by matching the string or Index.
Enum = {1- AAA,5 - BBBB, 9 - CCCC}
',' is used for element separator, ';' is usd for row separator. '[' & ']' are used for boundary symbol. If it's not a complex mixed data type, '[' & ']' can be omitted.
Example:
a,b,c,d,e
and [a,b,c,d,e]
stands for 5 elements array
a b c d e
a;b;c;d;e
and [a;b;c;d;e]
stands for 5 elements array
a
b
c
d
e
a1, b1, c1, d1, e1; a2, b2, c2, d2, e2
and [a1, b1, c1, d1, e1; a2, b2, c2, d2, e2]
stands for 2*5 2D array
a1 b1 c1 d1 e1
a2 b2 c2 d2 e2
[!NOTE] Empty String will be ignored and the prototype input will be used as output.
Tag:Value Mode
In this mode, the input string is a list of tag:value pairs. The tag is the name of the element in the cluster, and the value is the value to be set. The tag and value are separated by a colon('
Example:
Suppose a cluster as below:
typedef cluster{
Boolean b;
String str;
U32 integer
Cluster subCluster
{
Boolean b2;
}
}
b:On
and{b:On}
stands for change the input cluster's boolean b to TRUE. Other elements will keep as before.
b:On;str:abcdef
and{b:On;str:abcdef}
stands for change the input cluster's boolean b to TRUE and String str to "abcdef". Other elements will keep as before.
{subCluster.b2:On}
stands for change the input cluster's subCluster's boolean b2 to TRUE. Other elements will keep as before. Since b2 is unique, the parent cluster's tag can be omitted.b2:On
also stands for the same conversion.
Not Tag Mode
For Cluster, only input data string is supported. These value strings are separated by semicolons(
on;abcdef;13
和{on;abcdef;13}
stands for change the input cluster's boolean b to TRUE, string str to "abcdef", and U32 integer to 13. If the cluster has more elements, they will remain unchanged.
on;abcdef
and{on;abcdef}
stands for change the input cluster's boolean b to TRUE and string str to "abcdef". Other elements will keep as before.
[!NOTE] Empty String will be converted to the input prototype value.
Other Datatype will be treated as variant and use CSM-HexStr for data transformation.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。