Skip to content

Commit

Permalink
[update] #21 Special Float: e,-e,pi,-pi,inf,+inf,-inf,`…
Browse files Browse the repository at this point in the history
…NaN` support
  • Loading branch information
nevstop committed Jan 6, 2024
1 parent ba017fc commit 8e9ebe5
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 43 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified API-String-Arugments-Support/_Support/String To Float_csm.vi
Binary file not shown.
Binary file not shown.
Binary file modified API-String-Arugments-Support/_Support/String to Boolean_csm.vi
Binary file not shown.
26 changes: 15 additions & 11 deletions CSM API String Arguments Support.vipb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<VI_Package_Builder_Settings Version="2020.1" Created_Date="2023-08-12 17:59:50" Modified_Date="2024-01-03 10:44:53" Creator="yaoli" Comments="" ID="dcf8e05ac7351860500e18ab14fbfba3">
<VI_Package_Builder_Settings Version="2020.1" Created_Date="2023-08-12 17:59:50" Modified_Date="2024-01-06 20:51:13" Creator="yaoli" Comments="" ID="df4c1ba14090b745484f9af56232ed85">
<Library_General_Settings>
<Package_File_Name>NEVSTOP_lib_CSM_API_String_Arguments_Support</Package_File_Name>
<Library_Version>2024.1.0.15</Library_Version>
Expand Down Expand Up @@ -38,18 +38,20 @@
<One_Line_Description_Summary>API string argument support enhancement for CSM</One_Line_Description_Summary>
<Description>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 '&gt;&gt; internal data &gt;&gt;' shift register.

![example](.github/doc.png)

## Supported Data Type

- String/Path
- Boolean
- Integer(I8,I16,I32,I64,U8,U16,U32,U64)
- Float(DBL/SGL)
- Complex(DBL/SGL)
- Enum
- Timestamp
- Array
- Cluster
- Other(use CSM-Hexstr)
- String/Path
- Boolean
- Integer(I8,I16,I32,I64,U8,U16,U32,U64)
- Float(DBL/SGL)
- Complex(DBL/SGL)
- Timestamp
- Enum
- Array
- Cluster
- Other(use CSM-Hexstr)

More information for the supported datatype format, please visit: https://github.com/NEVSTOP-LAB/CSM-API-String-Arugments-Support

Expand All @@ -61,6 +63,7 @@ More information for the supported datatype format, please visit: https://github
<Packager>NEVSTOP</Packager>
<URL>https://github.com/NEVSTOP-LAB/CSM-API-String-Arugments-Support</URL>
<Release_Notes>[add] #18 add SGLComplex and DBL Complex Datatype
[update] #21 Special Float: `e`,`-e`,`pi`,`-pi`,`inf`,`+inf`,`-inf`,`NaN` support
[add] Utility: CSM - Convert HexStr to Data.vim</Release_Notes>
</Description>
<Destinations>
Expand Down Expand Up @@ -256,6 +259,7 @@ More information for the supported datatype format, please visit: https://github
<close_labview_before_install>false</close_labview_before_install>
<restart_labview_after_install>false</restart_labview_after_install>
<skip_mass_compile_after_install>false</skip_mass_compile_after_install>
<install_into_global_environment>false</install_into_global_environment>
</LabVIEW>
<VI_Docs>
<Edit_VI_Description>true</Edit_VI_Description>
Expand Down
65 changes: 33 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CSM-API-String-Arugments-Support
# CSM-API-String-Arguments-Support

[![Image](https://www.vipm.io/package/nevstop_lib_csm_api_string_arguments_support/badge.svg?metric=installs)](https://www.vipm.io/package/nevstop_lib_csm_api_string_arguments_support/)
[![Image](https://www.vipm.io/package/nevstop_lib_csm_api_string_arguments_support/badge.svg?metric=stars)](https://www.vipm.io/package/nevstop_lib_csm_api_string_arguments_support/)
Expand All @@ -11,23 +11,24 @@ The purpose of this library is to enhance the API parameters for Communicable St

## Supported Data Type

- String/Path
- Boolean
- Integer(I8,I16,I32,I64,U8,U16,U32,U64)
- Float(DBL/SGL)
- Complex(DBL/SGL)
- Timestamp
- Enum
- Array
- Cluster
- String/Path
- Boolean
- Integer(I8,I16,I32,I64,U8,U16,U32,U64)
- Float(DBL/SGL)
- Complex(DBL/SGL)
- Timestamp
- Enum
- Array
- Cluster
- Other(use CSM-Hexstr)

### String/Path

It Follows CSM's rule. '->|' '->' '-@' '-&' '>>' ',' ';' should be replaced with %[Hex] String before passing. You can use **CSM AdvanceAPI\CSM Make String Arguments Safe.vi**.

### Boolean

```
``` text
TRUE/FALSE String Pairs:
- T/F
- True/False
Expand All @@ -42,7 +43,7 @@ TRUE/FALSE String Pairs:

### Integer

```
``` text
Supported format:
- 12345
- 0d12345
Expand All @@ -58,7 +59,7 @@ Supported format:

### Float(DBL/SGL)

```
``` text
Supported Format:
- 1.2345
- 1.23E+2
Expand All @@ -67,48 +68,48 @@ Supported Format:
- 1.23k (1.23*10^3)
- 1.23m (1.23*0.001)
- 1.23u (1.23*0.000001)
- Special Float: `e`,`-e`,`pi`,`-pi`,`inf`,`+inf`,`-inf`,`NaN`
```

### Complex(DBL/SGL)

String of `a+bi` or `a-bi` stands of complex data type. `a` and `b` is supporting all Float format.


### Timestamp

**Condition1**
_**Condition1**_

`TimeStamp String(FormatString)`is supported. `FormatString` in "" will be used to parse `TimeStamp String`.

```
``` text
"2023-10-11 22:54:33(%<%Y-%m-%d %H:%M:%S>T)" equal to UTC timestamp string "2023-10-11T14:54:33.000Z".
```

**Condition2**
_**Condition2**_

No time string format included in string, ISO8601 UTC standard is used.

```
``` text
"2023-10-31T14:49:39.597Z" is valid.
"2023-10-31T22:49:39.597+08:00" is valid.
```

### Enum

**Condition1**
_**Condition1**_

Enum = {AAA,BBBB,CCCC}

- String "AAA" will be converted to Enum(AAA), IntegerValue = 0
- String "CCC" will be converted to Enum(CCC), IntegerValue = 2
- String "AAA" will be converted to Enum(AAA), IntegerValue = 0
- String "CCC" will be converted to Enum(CCC), IntegerValue = 2

**Condition2**
_**Condition2**_

Enum = {1- AAA,5 - BBBB, 9 - CCCC}

- String "AAA" will be converted to Enum(1- AAA), IntegerValue = 0
- String "5" will be converted to Enum(5 - BBBB), IntegerValue = 1
- String "9 - CCCC" will be converted to Enum(9 - CCCC), IntegerValue = 2
- String "AAA" will be converted to Enum(1- AAA), IntegerValue = 0
- String "5" will be converted to Enum(5 - BBBB), IntegerValue = 1
- String "9 - CCCC" will be converted to Enum(9 - CCCC), IntegerValue = 2

### Array

Expand All @@ -118,13 +119,13 @@ Enum = {1- AAA,5 - BBBB, 9 - CCCC}

`a,b,c,d,e` and `[a,b,c,d,e]` stands for 5 elements array

```
``` text
a b c d e
```

`a;b;c;d;e` and `[a;b;c;d;e]` stands for 5 elements array

```
``` text
a
b
c
Expand All @@ -134,21 +135,21 @@ 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

```
``` text
a1 b1 c1 d1 e1
a2 b2 c2 d2 e2
```

### Cluster


':' is used for separating name and value, ';' is usd for separating elements. '{' & '}' are used for boundary symbol. If it's not within other array/cluster, boundary symbol is not indispensable. Not all elements should be described but the changing ones.
It's helpful for CSM to reduce configuration setting API numbers. You can defined the configuration within a cluster and one single setting API for the config API.

**Example:**

Suppose a cluster as below:
```

``` text
typedef cluster{
Boolean b;
String str;
Expand All @@ -166,5 +167,5 @@ Other Datatype will be treated as variant and use CSM-HexStr for data transforma

## Know Issue

1. **Cluster in Array is not fully supported. Need to imporve.**
2. **2D array in cluster is not supported now. Need to imporve.**
1. **Cluster in Array is not fully supported. Need to improve.**
2. **2D array in cluster is not supported now. Need to improve.**

0 comments on commit 8e9ebe5

Please sign in to comment.