diff --git a/.doc/CSM-TCP-Router 1.svg b/.doc/CSM-TCP-Router 1.svg index bd185c4..bda3681 100644 --- a/.doc/CSM-TCP-Router 1.svg +++ b/.doc/CSM-TCP-Router 1.svg @@ -1,3 +1,3 @@ -Server AppicationasTCP ServerTCP Layer( Reusable)Code Based CSM Framework(Based on the Requirements)TCP ClientTCP ClientTCP ClientTCP Command| Length(4 Bytes) | CSM Command(Text) |All CSM command from your code is supportedSystem command provided by TCP Layer is supportedlist/help/list api ... \ No newline at end of file +Server AppicationServer AppicationTCP Layer( Reusable)TCP Layer( Reusable)Code Based CSM Framework(Based on the Requirements)Code Based CSM Framework...TCP ClientTCP ClientTCP ClientTCP ClientTCP ClientTCP ClientTCP CommandAll CSM command from your code is supportedSystem command provided by TCP Layer is supportedlist/help/list api ...TCP Command... \ No newline at end of file diff --git a/.doc/CSM-TCP-Router Sever BD.png b/.doc/CSM-TCP-Router Sever BD.png index 96ee01c..42d3d9c 100644 Binary files a/.doc/CSM-TCP-Router Sever BD.png and b/.doc/CSM-TCP-Router Sever BD.png differ diff --git a/.doc/CSM-TCP-Router.drawio b/.doc/CSM-TCP-Router.drawio index 28cc0e5..e3fd44f 100644 --- a/.doc/CSM-TCP-Router.drawio +++ b/.doc/CSM-TCP-Router.drawio @@ -1,86 +1,86 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.doc/Protocol.v0.(en).md b/.doc/Protocol.v0.(en).md new file mode 100644 index 0000000..8d3c0e1 --- /dev/null +++ b/.doc/Protocol.v0.(en).md @@ -0,0 +1,104 @@ +# Protocol Definition + +The TCP packet format used in the CSM-TCP-Router is defined as follows: + +``` txt +| Data Length (4B) | Version (1B) | TYPE (1B) | FLAG1 (1B) | FLAG2 (1B) | Text Data | +╰─────────────────────── Header (8B) ──────────────────────────────╯╰─── Data Length Range ──╯ +``` + +## Header Fields + +### Data Length (4 Bytes) + +This field specifies the length of the data section and is represented using 4 bytes. + +### Version (1 Byte) + +This field indicates the version of the data packet. The current version is `0x01`. Different versions can be handled appropriately to ensure forward compatibility. + +### Packet Type (1 Byte) + +This field defines the type of the data packet and is an enumerated value. The supported packet types are: + +- Information Packet (`info`) - `0x00` +- Error Packet (`error`) - `0x01` +- Command Packet (`cmd`) - `0x02` +- Synchronous Response Packet (`resp`) - `0x03` +- Asynchronous Response Packet (`async-resp`) - `0x04` +- Subscription Status Packet (`status`) - `0x05` + +### FLAG1 (1 Byte) + +This field is reserved for future use to describe additional attributes of the data packet. + +### FLAG2 (1 Byte) + +Similar to FLAG1, this field is reserved for future use to describe additional attributes of the data packet. + +## Data Content + +### Information Packet (`info`) + +The content of an information packet is plain text containing informational data. + +### Error Packet (`error`) + +The content of an error packet is plain text describing an error, formatted as per the CSM Error format. + +> [!NOTE] +> The CSM Error format is: `[Error: Error Code] Error Message`. + +### Command Packet (`cmd`) + +The content of a command packet is a command in the CSM local command format. It supports the following types of messages: + +- Synchronous (`-@`) +- Asynchronous (`->`) +- Asynchronous without return (`->|`) +- Register (`register`) +- Unregister (`unregister`) + +> [!NOTE] +> Example: Suppose there is a CSM module named `DAQmx` in the local program with an interface `API: Start Sampling`. You can send the following messages to control data acquisition: +> +> ``` c++ +> API: Start Sampling -@ DAQmx // Synchronous message +> API: Start Sampling -> DAQmx // Asynchronous message +> API: Start Sampling ->| DAQmx // Asynchronous message without return +> ``` +> +> These messages can also be sent over a TCP connection to achieve remote control. + +> [!NOTE] +> Example: Suppose there is a CSM module `A` that continuously sends a monitoring status called `Status`. Another module `B` can subscribe to this status: +> +> ``` c++ +> status@a >> api@b -> // Subscribe to status +> status@a >> api@b -> // Unsubscribe from status +> ``` +> +> Similarly, these messages can be sent over a TCP connection to manage subscriptions remotely. +> +> If the subscriber (`api@b`) is omitted, it indicates that the client connected to the TCP router is subscribing to the status: +> +> ``` c++ +> status@a -> // Client subscribes to module A's status +> status@a >> api@b -> // Client unsubscribes from module A's status +> ``` +> +> When module `A` sends a `Status`, the client will automatically receive a `status` packet. + +### Synchronous Response Packet (`resp`) + +After executing a synchronous command, the TCP router sends a response packet back to the client. + +### Asynchronous Response Packet (`async-resp`) + +After executing an asynchronous command, the TCP router sends a response packet back to the client. The format is: `Response Data <- Original Asynchronous Message`. + +### Subscription Status Packet (`status`) + +When a client subscribes to the status of a CSM module, it will automatically receive this packet whenever the status changes. + +The packet format is: `Status Name >> Status Data <- Sending Module`. diff --git a/.doc/Protocol.v0.(zh-cn).md b/.doc/Protocol.v0.(zh-cn).md new file mode 100644 index 0000000..7ef29b4 --- /dev/null +++ b/.doc/Protocol.v0.(zh-cn).md @@ -0,0 +1,108 @@ +# 传输协议 + +CSM-TCP-Router 中 TCP 数据包格式定义如下: + +``` txt +| 数据长度(4B) | 版本(1B) | TYPE(1B) | FLAG1(1B) | FLAG2(1B) | 文本数据 | +╰─────────────────────────── 包头 ──────────────────────────╯╰──── 数据长度字范围 ────╯ +``` + +## 包头字段 + +### 数据长度(4字节) + +数据长度为4字节,表示数据字段的长度。 + +### 版本信息(1字节) + +版本信息为1字节,表示数据包的版本信息。当前的版本信息为 `0x01`。可以根据版本信息进行不同的处理,实现向前兼容。 + +### 数据包类型(1字节) + +数据包类型用于描述数据包的内容,为枚举类型,目前支持的数据包类型有: + +- 信息数据包(info) - `0x00` +- 错误数据包(error) - `0x01` +- 指令数据包(cmd) - `0x02` +- 同步响应数据包(resp) - `0x03` +- 异步响应数据包(async-resp) - `0x04` +- 订阅返回数据包(status) - `0x05` + +### FLAG1类型(1字节) + +FLAG1用于描述数据包的属性, 保留字段。 + +### FLAG2类型(1字节) + +FLAG2用于描述数据包的属性, 保留字段。 + +## 数据内容 + +### 信息数据包(info) + +info 数据包的数据内容为提示信息内容,纯文本格式。 + +### 错误数据包(error) + +error 数据包的数据内容为错误信息内容,为纯文本格式,文本格式定为 CSM Error 格式。 + +> [!NOTE] +> CSM Error 格式为:"[Error: `错误代码`]`错误字符串`"。 +> + +### 指令数据包(cmd) + +指令数据包的数据内容为指令内容,格式为 CSM 本地指令格式,支持: + +- 同步(-@) +- 异步(->) +- 无返回异步(->|)消息, +- 注册(register) +- 注销(unregister)。 + +> [!NOTE] +> 举例:假设本地程序存在名为DAQmx的CSM模块,具有一个接口为 "API: Start Sampling". +> 本地我们可以发送消息给这个模块,控制采集的启停: +> +> ``` c++ +> API: Start Sampling -@ DAQmx // 同步消息 +> API: Start Sampling -> DAQmx // 异步消息 +> API: Start Sampling ->| DAQmx // 异步无返回消息 +> ``` +> +> 现在只要通过TCP连接,发送同样的文本消息,就可以实现远程消息。 +> + +> [!NOTE] +> 举例:假设本地程序存在名为A的CSM模块,不停的发送一个监控状态为 "Status", 另外一个模块B可以订阅这个状态。 +> +> ``` c++ +> status@a >> api@b -> // 订阅状态 +> status@a >> api@b -> // 取消订阅 +> ``` +> +> 现在只要通过TCP连接,发送同样的文本消息,就可以实现远程控制底层 csm 模块的订阅 +> +> 但是如果发送中缺省了订阅方(api@b), 则表示连接到 tcp-router 的 client订阅状态 +> +> ``` c++ +> status@a -> // client 订阅 A 模块status +> status@a >> api@b -> // 取消 client 订阅 A 模块status +> ``` +> +> 当 A 模块发出 Status 后,client 将自动收到 `status` 数据包 +> + +### 同步响应数据包(resp) + +当执行完毕同步消息指令后,tcp-router 将 response 返回给 client. + +### 异步响应数据包(async-resp) + +当执行完毕同步消息指令后,tcp-router 将 response 返回给 client. 格式为:"`Response数据` <- `异步消息原文`" + +### 订阅返回数据包(status) + +Client 订阅了CSM模块的状态,当状态发生时,client 会自动收到此数据包。 + +数据包格式为 "状态名 >> `状态数据` <- 发送模块" diff --git a/.doc/Protocol.v1.(zh-cn).md b/.doc/Protocol.v1.(zh-cn).md new file mode 100644 index 0000000..c1c018a --- /dev/null +++ b/.doc/Protocol.v1.(zh-cn).md @@ -0,0 +1,138 @@ +# 传输协议 + +CSM-TCP-Router 中 TCP 数据包格式定义如下: + +``` txt + ╭────────────────── CRC校验范围 ────────────────────╮ +| 数据长度(4B) | 版本(1B) | FLAG1(1B) | FLAG2(1B) | TYPE(1B) | 文本长度(4B) | 文本数据 | 二进制长度(4B) | 二进制数据 | CRC(2B) | +╰─────────────────────────── 包头 ──────────────────────────╯╰──────────────────── 数据长度字范围 ──────────────────────────╯ +``` + +## 包头字段 + +### 数据长度(4字节) + +数据长度为4字节,表示数据字段的长度。 + +### 版本信息(1字节) + +版本信息为1字节,表示数据包的版本信息。当前的版本信息为 `0x01`。可以根据版本信息进行不同的处理,实现向前兼容。 + +### FLAG1类型(1字节) + +FLAG1用于描述数据包的属性 + +``` ini +FLAG_TEXT = 0b00000001 # 存在文本数据(置1时需解析文本长度+内容) +FLAG_BIN = 0b00000010 # 存在二进制数据(置1时需解析二进制长度+内容) +FLAG_CRC = 0B00010000 # 存在CRC校验(置1时需解析CRC校验) +``` + +### FLAG2类型(1字节) + +FLAG2用于描述数据包的属性, 保留字段。 + +### 数据包类型(1字节) + +数据包类型用于描述数据包的内容,为枚举类型,目前支持的数据包类型有: + +- 信息数据包(info) - `0x00` +- 错误数据包(error) - `0x01` +- 指令数据包(cmd) - `0x02` +- 同步响应数据包(resp) - `0x03` +- 异步响应数据包(async-resp) - `0x04` +- 订阅返回数据包(status) - `0x05` + +## 数据内容 + +当 FLAG1 的 `FLAG_TEXT` 为1时,数据包中存在文本数据。文本数据的格式为:`文本数据长度(4字节)` | `文本数据内容`。 +当 FLAG1 的 `FLAG_BIN` 为1时,数据包中存在二进制数据。二进制数据的格式为:`二进制数据长度(4字节)` | `二进制数据内容`。 + +> [!NOTE] +> `数据包类型`决定了数据内容的格式, 主要规定了文本数据的内容。 +> + +> [!NOTE] +> +> 目前当文本数据格式中存在`MassData`类型的参数或返回数据时,才会有二进制数据。 +> + +### 文本数据 + +#### 信息数据包(info) + +info 数据包的数据内容为提示信息内容,纯文本格式。 + +#### 错误数据包(error) + +error 数据包的数据内容为错误信息内容,为纯文本格式,文本格式定为 CSM Error 格式。 + +> [!NOTE] +> CSM Error 格式为:"[Error: `错误代码`]`错误字符串`"。 +> + +#### 指令数据包(cmd) + +指令数据包的数据内容为指令内容,格式为 CSM 本地指令格式,支持: + +- 同步(-@) +- 异步(->) +- 无返回异步(->|)消息, +- 注册(register) +- 注销(unregister)。 + +> [!NOTE] +> 举例:假设本地程序存在名为DAQmx的CSM模块,具有一个接口为 "API: Start Sampling". +> 本地我们可以发送消息给这个模块,控制采集的启停: +> +> - API: Start Sampling -@ DAQmx // 同步消息 +> - API: Start Sampling -> DAQmx // 异步消息 +> - API: Start Sampling ->| DAQmx // 异步无返回消息 +> +> 现在只要通过TCP连接,发送同样的文本消息,就可以实现远程消息。 +> + +> [!NOTE] +> 举例:假设本地程序存在名为A的CSM模块,不停的发送一个监控状态为 "Status", 另外一个模块B可以订阅这个状态。 +> +> - status@a >> api@b -> // 订阅状态 +> - status@a >> api@b -> // 取消订阅 +> +> 现在只要通过TCP连接,发送同样的文本消息,就可以实现远程控制底层 csm 模块的订阅 +> +> 但是如果发送中缺省了订阅方(api@b), 则表示连接到 tcp-router 的 client订阅状态 +> +> - status@a -> // client 订阅 A 模块status +> - status@a >> api@b -> // 取消 client 订阅 A 模块status +> +> 当 A 模块发出 Status 后,client 将自动收到 `status` 数据包 +> + +#### 同步响应数据包(resp) + +当执行完毕同步消息指令后,tcp-router 将 response 返回给 client. + +#### 异步响应数据包(async-resp) + +当执行完毕同步消息指令后,tcp-router 将 response 返回给 client. 格式为:"`Response数据` <- `异步消息原文`" + +#### 订阅返回数据包(status) + +Client 订阅了CSM模块的状态,当状态发生时,client 会自动收到此数据包。 + +数据包格式为 "状态名 >> `状态数据` <- 发送模块" + +### 二进制数据 + +当大量数据需要进行传递时,使用二进制格式传输会在不损失精度的前提下节省带宽。目前支持 CSM MassData 数据格式,当文本描述中的参数、返回为 CSM MassData 数据时,MassData 指向的数据区域,将被放置在`二进制数据段` 传输。 + +> [!NOTE] +> 举例,假设本地程序存在名为DAQmx的CSM模块,具有一个接口为 "API: Read Data", 返回的 Response 为 MassData 格式 +> +> 通常返回的纯文本描述为 Start:100;Length:1000 +> +> 此时,MassData 指向的数据区域,将被放置在`二进制数据段` 传输。 + +## CRC校验 + +当 FLAG1 的 `FLAG_CRC` 为1时,数据包中存在CRC校验。CRC校验为2字节,校验范围为数据内容段,不包括包头。 diff --git a/CSM-TCP-Router.vipb b/CSM-TCP-Router.vipb index 025a5af..5bd11a8 100644 --- a/CSM-TCP-Router.vipb +++ b/CSM-TCP-Router.vipb @@ -1,7 +1,7 @@ - + NEVSTOP_lib_CSM_TCP_Router_Example - 2025.2.0.2 + 2025.3.0.2 false src vip @@ -18,11 +18,10 @@ jki_lib_tcp_server >=5.0.0.8 - nevstop_lib_communicable_state_machine >=2025.2.28.95859 - nevstop_lib_csm_api_string_arguments_support >=2025.1.27.145038 - nevstop_lib_csm_ini_static_variable_support >=2025.2.28.100053 + nevstop_lib_communicable_state_machine >=2025.3.24.114002 + nevstop_lib_csm_api_string_arguments_support >=2025.3.14.155345 + nevstop_lib_csm_ini_static_variable_support >=2025.3.23.221959 nevstop_lib_csm_massdata_parameter_support >=2024.12.31.84154 - nevstop_lib_globalstop >=2022.12.12.102654 oglib_error >=4.2.0.23 oglib_time >=4.0.1.3 @@ -75,11 +74,8 @@ NEVSTOP https://github.com/NEVSTOP-LAB/CSM-TCP-Router-App - [add] add IP address/Port input dialog for client. -[update] update connection information -[update] update server/client VI icon -[fix] type "bye", client will exit, as the connection will be closed from server side. -[fix] minor fix. #5 + [add] #4 support async message/register/unregister. +[update] #8 Remove GlobalStop Library, multiple clients instances could work simultaneously diff --git a/README(zh-cn).md b/README(zh-cn).md index ecf88e3..d5ee298 100644 --- a/README(zh-cn).md +++ b/README(zh-cn).md @@ -12,23 +12,27 @@ - 基于JKI-TCP-Server库,支持多个TCP客户端同时连接。 - [client] 提供一个标准的TCP客户端,可以连接到服务器,验证远程连接、消息发送等功能。 -> [!IMPORTANT] -> `TCP数据包格式:` | 数据长度(4字节) | CSM命令字符串(纯文本) | - -> [!NOTE] -> 举例:假设本地程序存在名为DAQmx的CSM模块,具有一个接口为 "API: Start Sampling". -> 本地我们可以发送消息给这个模块,控制采集的启停: -> -> - API: Start Sampling -@ DAQmx // 同步消息 -> - API: Start Sampling -> DAQmx // 异步消息 -> - API: Start Sampling ->| DAQmx // 异步无返回消息 -> -> 现在只要通过TCP连接,发送同样的文本消息,就可以实现远程控制。 - -> [!WARNING] -> 目前CSM-TCP-Router只支持同步消息(-@)和无返回的异步消息(->|),异步消息(->)将被视为无返回的异步消息。 - -## 支持的指令集 +## 通讯协议 + +CSM-TCP-Router 中 TCP 数据包格式定义如下: + +``` +| 数据长度(4B) | 版本(1B) | FLAG1(1B) | FLAG2(1B) | TYPE(1B) | 文本数据 | +╰─────────────────────────── 包头 ──────────────────────────╯╰──── 数据长度字范围 ────╯ +``` + +数据包类型用于描述数据包的内容,为枚举类型,目前支持的数据包类型有: + +- 信息数据包(info) - `0x00` +- 错误数据包(error) - `0x01` +- 指令数据包(cmd) - `0x02` +- 同步响应数据包(resp) - `0x03` +- 异步响应数据包(async-resp) - `0x04` +- 订阅返回数据包(status) - `0x05` + +详细的通讯协议定义, 见 [协议设计](.doc/Protocol.v0.(zh-cn).md) + +## 指令集  diff --git a/README.md b/README.md index 248521e..d7161ef 100644 --- a/README.md +++ b/README.md @@ -12,21 +12,25 @@ This repository demonstrates how to create a reusable TCP communication layer (C - Based on the JKI-TCP-Server library, it supports multiple TCP clients connecting simultaneously. - [client] Provides a standard TCP client that can connect to the server to verify remote connections and message sending. -> [!IMPORTANT] -> `TCP Packet Format:` | Data Length (4 bytes) | CSM Command String (plain text) | - -> [!NOTE] -> Example: Suppose there is a CSM module named DAQmx locally with an interface "API: Start Sampling". -> Locally, we can send messages to this module to control the start and stop of sampling: -> -> - API: Start Sampling -@ DAQmx // Synchronous message -> - API: Start Sampling -> DAQmx // Asynchronous message -> - API: Start Sampling ->| DAQmx // Asynchronous message without return -> -> Now, by sending the same text message via TCP connection, remote control can be achieved. - -> [!WARNING] -> Currently, CSM-TCP-Router only supports synchronous messages (-@) and asynchronous messages without return (->|). Asynchronous messages (->) will be treated as asynchronous messages without return. +## Protocol + +The TCP packet format used in the CSM-TCP-Router is defined as follows: + +``` +| Data Length (4B) | Version (1B) | TYPE (1B) | FLAG1 (1B) | FLAG2 (1B) | Text Data | +╰───────────────────────────────── Header ──────────────────────────────╯╰─── Data Length Range ──╯ +``` + +This field defines the type of the data packet and is an enumerated value. The supported packet types are: + +- Information Packet (`info`) - `0x00` +- Error Packet (`error`) - `0x01` +- Command Packet (`cmd`) - `0x02` +- Synchronous Response Packet (`resp`) - `0x03` +- Asynchronous Response Packet (`async-resp`) - `0x04` +- Subscription Status Packet (`status`) - `0x05` + +For detailed communication protocol definitions, see [Protocol Design](.doc/Protocol.v0.(en).md). ## Supported Command Sets diff --git a/src/CSM-TCP-Router.lvcsm b/src/CSM-TCP-Router.lvcsm index 02c340d..13fdb2d 100644 --- a/src/CSM-TCP-Router.lvcsm +++ b/src/CSM-TCP-Router.lvcsm @@ -1,7 +1,14 @@ [CSMModule.AI] VIName = "HAL-AI.vi" + +[CSMVI.HAL-AI.vi] Path = "/CSM_Modules/HAL-AI.vi" +[CSMAPI.HAL-AI.vi] +Item 0 = "Channels" +Item 1 = "read" +Item 2 = "read all" + [CSMStates.HAL-AI.vi] Item 0 = "Idle" Item 1 = "CSM Documentation" @@ -30,18 +37,19 @@ Item 23 = "read all" Item 24 = "DoSth: DoA" Item 25 = "DoSth: DoB" -[CSMAPI.HAL-AI.vi] -Item 0 = "Channels" -Item 1 = "read" -Item 2 = "read all" - -[CSMDoc.HAL-AI.vi] -doc = "AI Module with 4 Channels.%0AAPI:%0A1. Channels %2F%2F List all Channels %0A2. Read %3E%3E ChannelName%3BNum %2F%2FRead num of points from Channel specified.%0A3.read all %3E%3E Num %2F%2F Read num of points from all channels." - [CSMModule.DIO] VIName = "HAL-DIO.vi" + +[CSMVI.HAL-DIO.vi] Path = "/CSM_Modules/HAL-DIO.vi" +[CSMAPI.HAL-DIO.vi] +Item 0 = "Turn On" +Item 1 = "Turn Off" +Item 2 = "Check" +Item 3 = "Check All" +Item 4 = "Reset All" + [CSMStates.HAL-DIO.vi] Item 0 = "Idle" Item 1 = "CSM Documentation" @@ -72,24 +80,19 @@ Item 25 = "Reset All" Item 26 = "DoSth: DoA" Item 27 = "DoSth: DoB" -[CSMAPI.HAL-DIO.vi] -Item 0 = "Turn On" -Item 1 = "Turn Off" -Item 2 = "Check" -Item 3 = "Check All" -Item 4 = "Reset All" - -[CSMDoc.HAL-DIO.vi] -doc = "DIO Module with 8 Channels.%0AAPI:%0A1. TurnOn %3E%3E ChannelIndex %2F%2FSet Channel to ON.%0A2. TurnOff %3E%3E ChannelIndex %2F%2FSet Channel to OFF.%0A3. Check %3E%3E ChannelIndex %2F%2FCheck current status of Channel.%0A4. CheckAll %2F%2FCheck status of all channels%0A5. ResetAll %2F%2FReset All channels" - [CSMModule.DIO2] VIName = "HAL-DIO.vi" -Path = "/CSM_Modules/HAL-DIO.vi" [CSMModule.Measure] VIName = "MAL-TEST.vi" + +[CSMVI.MAL-TEST.vi] Path = "/CSM_Modules/MAL-TEST.vi" +[CSMAPI.MAL-TEST.vi] +Item 0 = "Sweep" +Item 1 = "Measure" + [CSMStates.MAL-TEST.vi] Item 0 = "Idle" Item 1 = "CSM Documentation" @@ -112,14 +115,104 @@ Item 17 = "Data: Update Indicators" Item 18 = "Data: Cleanup" Item 19 = "Macro: Initialize" Item 20 = "Macro: Exit" -Item 21 = "Sweep" -Item 22 = "Measure" -Item 23 = "DoSth: DoA" -Item 24 = "DoSth: DoB" +Item 21 = "Generate Status" +Item 22 = "start loop" +Item 23 = "stop loop" +Item 24 = "Sweep" +Item 25 = "Measure" +Item 26 = "action: start loop" +Item 27 = "action: loop check" +Item 28 = "action: end loop" -[CSMAPI.MAL-TEST.vi] -Item 0 = "Sweep" -Item 1 = "Measure" +[CSM Debug Console] +Response Timeout(s) = 30 +History Length = 50 + +[CSMModule.CSM TCP Router] +VIName = "CSM-TCP-Router.lvlib:CSM-TCP-Router.vi" + +[CSMVI.CSM-TCP-Router.lvlib:CSM-TCP-Router.vi] +Path = "/Server/_support/Module/CSM-TCP-Router.vi" + +[CSMStates.CSM-TCP-Router.lvlib:CSM-TCP-Router.vi] +Item 0 = "Idle" +Item 1 = "CSM Documentation" +Item 2 = "VI Reference" +Item 3 = "Error Handler" +Item 4 = "Critical Error" +Item 5 = "Target Timeout Error" +Item 6 = "Target Error" +Item 7 = "Async Response" +Item 8 = "Response" +Item 9 = "Async Message Posted" +Item 10 = "Initialize Core Data" +Item 11 = "Exit" +Item 12 = "Data: Initialize" +Item 13 = "Data: Get Configuration" +Item 14 = "Data: Get Internal Data" +Item 15 = "Data: Set Configuration" +Item 16 = "Data: Update Indicators" +Item 17 = "Data: Cleanup" +Item 18 = "Macro: Initialize" +Item 19 = "Macro: Exit" +Item 20 = "API: Start JKI TCP Server" +Item 21 = "API: Disconnect All Client" +Item 22 = "API: Get Time Running" +Item 23 = "API: Get Connection Number" +Item 24 = "API: Get Connection Details" +Item 25 = "API: Stop JKI TCP Server" + +[CSMModule.CSM TCP Router.71000005] +VIName = "CSM-TCP-Router.lvlib:Connection Handler Worker.vi" + +[CSMVI.CSM-TCP-Router.lvlib:Connection Handler Worker.vi] +Path = "/Server/_support/Module/_support/Connection Handler Worker.vi" + +[CSMStates.CSM-TCP-Router.lvlib:Connection Handler Worker.vi] +Item 0 = "Idle" +Item 1 = "CSM Documentation" +Item 2 = "VI Reference" +Item 3 = "Error Handler" +Item 4 = "Critical Error" +Item 5 = "Target Timeout Error" +Item 6 = "Target Error" +Item 7 = "Async Response" +Item 8 = "Response" +Item 9 = "Async Message Posted" +Item 10 = "Initialize Core Data" +Item 11 = "Exit" +Item 12 = "Data: Initialize" +Item 13 = "Data: Get Configuration" +Item 14 = "Data: Get Internal Data" +Item 15 = "Data: Set Configuration" +Item 16 = "Data: Update Indicators" +Item 17 = "Data: Cleanup" +Item 18 = "Macro: Initialize" +Item 19 = "Macro: Exit" +Item 20 = "API: API1" +Item 21 = "API: API2" +Item 22 = "Action: Send Sync Message" + +[CSMModule.CSM TCP Router.F4C00005] +VIName = "CSM-TCP-Router.lvlib:Connection Handler Worker.vi" + +[CSMModule.CSM TCP Router.F5000005] +VIName = "CSM-TCP-Router.lvlib:Connection Handler Worker.vi" + +[CSMModule.CSM TCP Router.F5300005] +VIName = "CSM-TCP-Router.lvlib:Connection Handler Worker.vi" + +[CSMModule.CSM TCP Router.F5700005] +VIName = "CSM-TCP-Router.lvlib:Connection Handler Worker.vi" + +[CSMDoc.HAL-AI.vi] +doc = "AI Module with 4 Channels.%0AAPI:%0A1. Channels %2F%2F List all Channels %0A2. Read %3E%3E ChannelName%3BNum %2F%2FRead num of points from Channel specified.%0A3.read all %3E%3E Num %2F%2F Read num of points from all channels." + +[CSMDoc.HAL-DIO.vi] +doc = "DIO Module with 8 Channels.%0AAPI:%0A1. TurnOn %3E%3E ChannelIndex %2F%2FSet Channel to ON.%0A2. TurnOff %3E%3E ChannelIndex %2F%2FSet Channel to OFF.%0A3. Check %3E%3E ChannelIndex %2F%2FCheck current status of Channel.%0A4. CheckAll %2F%2FCheck status of all channels%0A5. ResetAll %2F%2FReset All channels" [CSMDoc.MAL-TEST.vi] -doc = "Measurement Module.%0AAPI: %0A1. Sweep %3E%3E Start%3BStop%3BStep%3BInterval %2F%2F sweep current with specified parameters.%0A2. Measure %2F%2F Return voltage and current at the same time." \ No newline at end of file +doc = "Measurement Module.%0AAPI: %0A1. Sweep %3E%3E Start%3BStop%3BStep%3BInterval %2F%2F sweep current with specified parameters.%0A2. Measure %2F%2F Return voltage and current at the same time." + +[CSMModule.Measure2] +VIName = "MAL-TEST.vi" \ No newline at end of file diff --git a/src/CSM-TCP-Router.lvproj b/src/CSM-TCP-Router.lvproj index 5f31a0d..fce8321 100644 --- a/src/CSM-TCP-Router.lvproj +++ b/src/CSM-TCP-Router.lvproj @@ -24,13 +24,16 @@ - + + + + @@ -39,7 +42,6 @@ - @@ -64,6 +66,7 @@ + @@ -76,6 +79,7 @@ + @@ -87,6 +91,8 @@ + + @@ -95,6 +101,7 @@ + @@ -110,6 +117,8 @@ + + @@ -321,13 +330,16 @@ AddOutputFilter chunkFilter - + + + + @@ -348,12 +360,19 @@ AddOutputFilter chunkFilter + + + + + + + @@ -361,10 +380,23 @@ AddOutputFilter chunkFilter + + + + + + + + + + + + + @@ -373,6 +405,8 @@ AddOutputFilter chunkFilter + + @@ -384,19 +418,29 @@ AddOutputFilter chunkFilter + + + + + + + + + + diff --git a/src/CSM_Modules/HAL-AI.vi b/src/CSM_Modules/HAL-AI.vi index 7876696..319e1ec 100644 Binary files a/src/CSM_Modules/HAL-AI.vi and b/src/CSM_Modules/HAL-AI.vi differ diff --git a/src/CSM_Modules/HAL-DIO.vi b/src/CSM_Modules/HAL-DIO.vi index 66736d0..c3b4411 100644 Binary files a/src/CSM_Modules/HAL-DIO.vi and b/src/CSM_Modules/HAL-DIO.vi differ diff --git a/src/CSM_Modules/MAL-TEST.vi b/src/CSM_Modules/MAL-TEST.vi index 60bc63c..96de655 100644 Binary files a/src/CSM_Modules/MAL-TEST.vi and b/src/CSM_Modules/MAL-TEST.vi differ diff --git a/src/Client/Client.vi b/src/Client/Client.vi index 52a4ca1..7164621 100644 Binary files a/src/Client/Client.vi and b/src/Client/Client.vi differ diff --git a/src/Client/Mulit-Clients Example.vi b/src/Client/Mulit-Clients Example.vi new file mode 100644 index 0000000..8ee1715 Binary files /dev/null and b/src/Client/Mulit-Clients Example.vi differ diff --git a/src/Client/Support/Connection Input Dialog.vi b/src/Client/Support/Connection Input Dialog.vi index 6a3a9bd..e7f634d 100644 Binary files a/src/Client/Support/Connection Input Dialog.vi and b/src/Client/Support/Connection Input Dialog.vi differ diff --git a/src/Client/Support/Diff Timer.vi b/src/Client/Support/Diff Timer.vi new file mode 100644 index 0000000..9189720 Binary files /dev/null and b/src/Client/Support/Diff Timer.vi differ diff --git a/src/Server/CSM-TCP-Router(Server).vi b/src/Server/CSM-TCP-Router(Server).vi index 7eef1ed..54fa493 100644 Binary files a/src/Server/CSM-TCP-Router(Server).vi and b/src/Server/CSM-TCP-Router(Server).vi differ diff --git a/src/Server/Connection Handler VI.vi b/src/Server/Connection Handler VI.vi deleted file mode 100644 index 8c381a5..0000000 Binary files a/src/Server/Connection Handler VI.vi and /dev/null differ diff --git a/src/Server/_support/CSM Router Module.vi b/src/Server/_support/CSM Router Module.vi deleted file mode 100644 index 4f4aec6..0000000 Binary files a/src/Server/_support/CSM Router Module.vi and /dev/null differ diff --git a/src/Server/_support/Module/CSM-TCP-Router.lvlib b/src/Server/_support/Module/CSM-TCP-Router.lvlib new file mode 100644 index 0000000..8aed318 --- /dev/null +++ b/src/Server/_support/Module/CSM-TCP-Router.lvlib @@ -0,0 +1,15 @@ + + + )!#!!!!!!!)!"1!&!!!-!%!!!@````]!!!!"!!%!!!(^!!!*Q(C=\>8"<2MR%!813:"$A*T51;!7JA7VI";G"6V^6!P4AFJ1#^/#7F!,TN/'-(++=IC2(-TVS+O`80+:3[QDNP9VYEO]0GP@@NM_LD_\`K4&2`NI`\;^0.WE\\ZH0]8D2;2'N3K6]:DK>?1D(`H)2T\SFL?]Z3VP?=N,8P+3F\TE*5^ZSF/?]J3H@$PE)1^ZS*('Z'/C-?A99(2'C@%R0--T0-0D;QT0]!T0]!S0,D%]QT-]QT-]<IPB':\B':\B->1GG?W1]QS0Y;.ZGK>ZGK>Z4"H.UQ"NMD:Q'Q1DWM6WUDT.UTR/IXG;JXG;JXF=DO:JHO:JHO:RS\9KP7E?BZT(-&%]R6-]R6-]BI\C+:\C+:\C-6U54`%52*GQ$)Y1Z;<3I8QJHO,R+YKH?)KH?)L(J?U*V<9S$]XDE0-E4`)E4`)EDS%C?:)H?:)H?1Q<S:-]S:-]S7/K3*\E3:Y%3:/;0N*A[=<5+18*YW@<,<E^J>YEO2U2;`0'WJ3R.FOM422L=]2[[,%?:KS(&'PR9SVKL-7+N1CR`LB9[&C97*0%OPH2-?Y_<_KK,OKM4OKI$GKP>I^<`X,(_`U?N^MNLN>L8#[8/*`0=4K>YHA]RO&QC0V_(\P>\OUV].XR^E,Y_6Z[=@YH^5\`3`_$>W.]DF`(N59`!/<!-PQ!!!!! + 536903680 + 1.0.0.0 + + + + + + + + + + diff --git a/src/Server/_support/Module/CSM-TCP-Router.vi b/src/Server/_support/Module/CSM-TCP-Router.vi new file mode 100644 index 0000000..bd743be Binary files /dev/null and b/src/Server/_support/Module/CSM-TCP-Router.vi differ diff --git a/src/Server/_support/Module/_support/Connection Handler Worker.vi b/src/Server/_support/Module/_support/Connection Handler Worker.vi new file mode 100644 index 0000000..c80cb27 Binary files /dev/null and b/src/Server/_support/Module/_support/Connection Handler Worker.vi differ diff --git a/src/Server/_support/Module/_support/pack tcp packet.vi b/src/Server/_support/Module/_support/pack tcp packet.vi new file mode 100644 index 0000000..a9cf7c9 Binary files /dev/null and b/src/Server/_support/Module/_support/pack tcp packet.vi differ diff --git a/src/Server/_support/Module/_support/unpack tcp packet.vi b/src/Server/_support/Module/_support/unpack tcp packet.vi new file mode 100644 index 0000000..4ef3f0c Binary files /dev/null and b/src/Server/_support/Module/_support/unpack tcp packet.vi differ diff --git a/src/Server/_support/Module/typedef/tcp-msg type.ctl b/src/Server/_support/Module/typedef/tcp-msg type.ctl new file mode 100644 index 0000000..7896f7b Binary files /dev/null and b/src/Server/_support/Module/typedef/tcp-msg type.ctl differ diff --git a/src/Server/_support/Read CSM Doc with lvcsm Support.vi b/src/Server/_support/Read CSM Doc with lvcsm Support.vi index 0321ca9..7fde07b 100644 Binary files a/src/Server/_support/Read CSM Doc with lvcsm Support.vi and b/src/Server/_support/Read CSM Doc with lvcsm Support.vi differ diff --git a/src/Server/_support/TCP Send Receive.vi b/src/Server/_support/TCP Send Receive.vi deleted file mode 100644 index e2c2fff..0000000 Binary files a/src/Server/_support/TCP Send Receive.vi and /dev/null differ diff --git a/src/csm-app.ini b/src/csm-app.ini index 7f76a87..c15ca86 100644 --- a/src/csm-app.ini +++ b/src/csm-app.ini @@ -10,8 +10,8 @@ WebServer.ViAccess="+*" DebugServerEnabled=False DebugServerWaitOnLaunch=False IP Address = "localhost" -Port = "50007" +Port = "30007" [Server] -Port = "50007" +Port = "30007" MaxConnections = "2"