DrvRestGateway Communicator Driver (Custom)
Functional Description
DrvRestGateway is a custom Communicator driver in ScadaV6CommExt for field device connectivity. Protocol details follow the source implementation.
Scope and Version
- Source:
ScadaV6CommExt/DrvRestGateway.Logic - TFM:
net8.0 - Version:
6.0.0
Install and Enable
- Deploy driver binaries to Communicator folders.
- Activate driver in Administrator → Communicator → Drivers.
- Upload configuration and restart Communicator.
Line and Device Configuration
- Create a communication line with the proper channel type.
- Add device and set address/timeouts.
- Set polling options and CmdLine as required by this driver; see Functional notes and configuration (template and source) below for file names, address format, and line keys.
CustomOptions (extracted)
| Key | Default | Note |
|---|---|---|
未在源码中匹配到明显的 GetValueAs* 调用,请在 Administrator 中打开该驱动的设备/线路配置界面逐项确认。 | ||
Code hints
37: private const int DefaultHttpTimeoutMs = 30000; // 默认 HTTP 超时时间 30 秒
38: private const int MinHttpTimeoutMs = 1000; // 最小超时时间 1 秒
39: private const int MaxHttpTimeoutMs = 300000; // 最大超时时间 5 分钟
65: ConnectionRequired = false;
85: ScadaClient = new ScadaClient(CommContext.AppConfig.ConnectionOptions),
119: int timeoutMs = Math.Max(MinHttpTimeoutMs, Math.Min(MaxHttpTimeoutMs,
120: deviceOpt.RequestInterval > 0 ? deviceOpt.RequestInterval * 2 : DefaultHttpTimeoutMs));
126: Timeout = TimeSpan.FromMilliseconds(timeoutMs)
Administrator UI (DrvRestGateway.View)
Configure in Administrator → Communicator. Labels below come from the View language pack.
- View source:
ScadaV6CommExt/DrvRestGateway.View - Main forms:
- (无独立 Forms 目录或仅有控件)
| Phrase key | Text |
|---|---|
SendOnCommand.Category | Device Parameters |
DeviceMode.DisplayName | Device Mode |
DeviceMode.Category | Device Parameters |
DeviceMode.Description | Device mode (Send/Receive) |
RequestInterval.Category | Device Parameters |
SendOnCommand.DisplayName | Send On Command |
SendOnCommand.Description | Send HTTP request when command is received |
SendPeriodically.Category | Device Parameters |
FormTitle | Device {0} Properties - REST Gateway |
RestUrl.DisplayName | REST URL |
RestUrl.Category | Main Parameters |
RestUrl.Description | The URL for REST API |
RestMethod.DisplayName | REST Method |
RestMethod.Category | Main Parameters |
RestMethod.Description | HTTP method (GET/POST) |
ContentType.DisplayName | Content Type |
ContentType.Category | Main Parameters |
ContentType.Description | HTTP request Content-Type |
RequestInterval.DisplayName | Request Interval |
RequestInterval.Description | Interval for periodic requests (ms) |
SendPeriodically.DisplayName | Send Periodically |
SendPeriodically.Description | Send HTTP request periodically |
JsEnabled.DisplayName | Enable Request JS |
JsEnabled.Category | JavaScript Engine |
JsEnabled.Description | Enable JavaScript engine for building request |
JsFileName.DisplayName | Request JS File |
JsFileName.Category | JavaScript Engine |
JsFileName.Description | JavaScript file name for building request |
ResponseJsEnabled.DisplayName | Enable Response JS |
ResponseJsEnabled.Category | JavaScript Engine |
Functional notes and configuration (template and source)
Derived from Logic/Common and device template XML: driver behavior and the Administrator/Communicator fields to set (address, CmdLine, line CustomOptions, template nodes).
Logic location
ScadaV6CommExt/DrvRestGateway.Logic- Common:
DrvRestGateway.Common
Overrides
OnCommLineStart(), OnCommLineTerminate(), InitDeviceTags(), Session(), SendCommand()
CmdLine / template
未匹配到 PollingOptions.CmdLine 单行片段。
DeviceConfig properties referenced
| Property | Note |
|---|---|
GetFileName | 源码中对 DeviceConfig 的引用 |
Line CustomOptions
| Key | Default |
|---|---|
| 未在 Logic 中检测到 CustomOptions.GetValueAs*(可能全部从设备模板 XML 读取)。 | |
XML keys (Common)
| Node | Note |
|---|---|
DeviceOptions | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Items | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Item | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
RestUrl | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
RequestInterval | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
PublishPeriod | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
SendOnCommand | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
SendPeriodically | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
JsEnabled | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
JsFileName | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ResponseJsEnabled | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ResponseJsFileName | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
RestMethod | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
ContentType | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
DeviceMode | 来自 Common 配置加载/保存相关源码中的 XML 节点名 |
Code excerpt
575: ///
576: public override void InitDeviceTags()
577: {
578: TagGroup tagGroup = new();
602: ///
603: public override void Session()
604: {
605: base.Session();
604: {
605: base.Session();
606:
607: // check fatal error
654:
655: FinishSession();
656: }
657:
Troubleshooting
- No data: line, address, template, connectivity.
- Template load errors: check logs.
- Options ignored: verify option scope (line vs device).