← Back to Docs

DrvRestGateway Driver (Custom)

DrvRestGateway communicator driver documentation.

Custom Communicator DriversVersion6.0.0Updated2026-04-29OwnerScadaV6CommExt

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

  1. Deploy driver binaries to Communicator folders.
  2. Activate driver in Administrator → Communicator → Drivers.
  3. Upload configuration and restart Communicator.

Line and Device Configuration

  1. Create a communication line with the proper channel type.
  2. Add device and set address/timeouts.
  3. 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)

KeyDefaultNote
未在源码中匹配到明显的 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 keyText
SendOnCommand.CategoryDevice Parameters
DeviceMode.DisplayNameDevice Mode
DeviceMode.CategoryDevice Parameters
DeviceMode.DescriptionDevice mode (Send/Receive)
RequestInterval.CategoryDevice Parameters
SendOnCommand.DisplayNameSend On Command
SendOnCommand.DescriptionSend HTTP request when command is received
SendPeriodically.CategoryDevice Parameters
FormTitleDevice {0} Properties - REST Gateway
RestUrl.DisplayNameREST URL
RestUrl.CategoryMain Parameters
RestUrl.DescriptionThe URL for REST API
RestMethod.DisplayNameREST Method
RestMethod.CategoryMain Parameters
RestMethod.DescriptionHTTP method (GET/POST)
ContentType.DisplayNameContent Type
ContentType.CategoryMain Parameters
ContentType.DescriptionHTTP request Content-Type
RequestInterval.DisplayNameRequest Interval
RequestInterval.DescriptionInterval for periodic requests (ms)
SendPeriodically.DisplayNameSend Periodically
SendPeriodically.DescriptionSend HTTP request periodically
JsEnabled.DisplayNameEnable Request JS
JsEnabled.CategoryJavaScript Engine
JsEnabled.DescriptionEnable JavaScript engine for building request
JsFileName.DisplayNameRequest JS File
JsFileName.CategoryJavaScript Engine
JsFileName.DescriptionJavaScript file name for building request
ResponseJsEnabled.DisplayNameEnable Response JS
ResponseJsEnabled.CategoryJavaScript 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

PropertyNote
GetFileName源码中对 DeviceConfig 的引用

Line CustomOptions

KeyDefault
未在 Logic 中检测到 CustomOptions.GetValueAs*(可能全部从设备模板 XML 读取)。

XML keys (Common)

NodeNote
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).