DrvSocket Communicator Driver (Custom)
Functional Description
DrvSocket is a custom Communicator driver in ScadaV6CommExt for field device connectivity. Protocol details follow the source implementation.
Scope and Version
- Source:
ScadaV6CommExt/DrvSocket.Logic - TFM:
net8.0 - Version:
6.0.0.1
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
27: private DeviceTemplate deviceTemplate = new DeviceTemplate();
32: ConnectionRequired = false; //不使用默认连接池
94: int.TryParse(deviceTemplate.config.Port, out var port);
95: this.serverSocket.Port = port;
96: int.TryParse(deviceTemplate.config.Timeout, out var tIME_OUT);
105: string fileName = PollingOptions.CmdLine.Trim();
114: Log.WriteLine($"监听端口:{deviceTemplate.config.Port},超时时间: {deviceTemplate.config.Timeout}");
Administrator UI (DrvSocket.View)
Configure in Administrator → Communicator. Labels below come from the View language pack.
- View source:
ScadaV6CommExt/DrvSocket.View - Main forms:
FrmConfig.csFrmDeviceProps.cs
| Phrase key | Text |
|---|
gbCmd | Command Parameters |
lblCmdCode | Command code |
lblCmdNum | Command number |
lblCmdAddress | Element address |
lblTemplateFileName | Device template |
ConfigDirRequired | The device template file must be located inside {0} |
TemplateNotExists | The device template file does not exist. |
btnAddCmd.ToolTip | Add Command |
gbTemplate | Device Template |
TemplateTitle | {0} - MODBUS. Device Template Editor |
DuplicatedCmdNums | Duplicated command numbers: |
EmptyCmdCodes | Empty command codes found. |
AddressHint | {0}, starting from {1} |
lblCmdName | Name |
lblCmdCodeWarn | Fill out code |
lblCmdDataBlock | Data block |
chkCmdMultiple | Multiple |
lblCmdFuncCode | Function code |
lblCmdFuncCodeHex | Hexadecimal |
lblCmdElemType | Element type |
cbCmdElemType.Items[0] | Undefined |
cbCmdElemType.Items[1] | ushort (2 bytes) |
cbCmdElemType.Items[2] | short (2 bytes) |
cbCmdElemType.Items[3] | uint (4 bytes) |
cbCmdElemType.Items[4] | int (4 bytes) |
cbCmdElemType.Items[5] | ulong (8 bytes) |
cbCmdElemType.Items[6] | long (8 bytes) |
cbCmdElemType.Items[7] | float (4 bytes) |
cbCmdElemType.Items[8] | double (8 bytes) |
cbCmdElemType.Items[9] | bool (1 bit) |
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/DrvSocket.Logic- Common:
DrvSocket.Common
Overrides
Session(), SendCommand(), OnCommLineStart(), OnCommLineTerminate()
CmdLine / template
PollingOptions.CmdLine.Trim();
DeviceConfig properties referenced
| Property | Note |
|---|
| 未检测到 DeviceConfig.* 引用(可能使用基类封装)。 |
Line CustomOptions
| Key | Default |
|---|
| 未在 Logic 中检测到 CustomOptions.GetValueAs*(可能全部从设备模板 XML 读取)。 |
XML keys (Common)
| Node | Note |
|---|
| 未在 Common 中解析到 GetChildAs*/AppendElem 节点(或无 Common 工程)。 |
Code excerpt
42:
43: public override void Session()
44: {
45: base.Session();
44: {
45: base.Session();
46: if (this.serverSocket.socketList.Count > 0)
47: {
67: FinishRequest();
68: FinishSession();
69: }
70:
102:
103: string fileName = PollingOptions.CmdLine.Trim();
104: Log.WriteLine($"Device template name is {fileName}, Storage: {CommContext.Storage.GetType().FullName}");
105: if (string.IsNullOrEmpty(fileName))
Troubleshooting
- No data: line, address, template, connectivity.
- Template load errors: check logs.
- Options ignored: verify option scope (line vs device).