2dda2029bdd578f4a484cf9681be234c23afb412
- 修改 CreateDeviceWithDetailsAsync 方法,在数据库创建成功后自动添加到内存
- 修改 UpdateDeviceAsync 方法,在数据库更新成功后自动更新内存
- 修改 DeleteDeviceByIdAsync 方法,在数据库删除成功后自动从内存移除
- 修改 ToggleDeviceActiveStateAsync 方法,在数据库切换激活状态后更新内存
2. 更新 DeviceDataService 类:
- 移除了在 AddDevice 方法中的独立 AddDeviceToMemory 调用
- 移除了在 DeleteDevice 方法中的独立 RemoveDeviceFromMemory 调用
- 为 UpdateDevice 方法添加了注释,说明内存自动更新
3. 更新 DeviceMonitoringService 类:
- 在 OnDeviceActiveChanged 方法中使用 Task 运行异步的 UpdateDeviceAsync 调用
4. 更新接口文档:
- 在 IDeviceManagementService 接口中更新了内存操作方法的注释,说明通常由其他操作自动调用
PMSWPF
OPC UA Service
This project includes an OPC UA service implementation that provides the following functionalities:
Features
- Connect to OPC UA servers
- Browse nodes in the OPC UA address space
- Read and write values from/to OPC UA nodes
- Add subscriptions for monitoring node changes
Usage
// Create an instance of the OPC UA service
var opcUaService = new OpcUaService();
// Connect to an OPC UA server
await opcUaService.CreateSession("opc.tcp://localhost:4840");
// Check connection status
if (opcUaService.IsConnected())
{
// Browse nodes
var rootNodeId = ObjectIds.RootFolder;
var references = opcUaService.BrowseNodes(rootNodeId);
// Read a value
var value = opcUaService.ReadValue(someNodeId);
// Write a value
opcUaService.WriteValue(someNodeId, newValue);
// Add a subscription
var subscription = opcUaService.AddSubscription("MySubscription");
}
// Disconnect when done
opcUaService.Disconnect();
Testing
Unit tests for the OPC UA service are included in the DMS.Infrastructure.UnitTests project. Run them using your preferred test runner.
Trigger System
The trigger system has been updated to support associating triggers with multiple variables instead of just one. This allows for more flexible trigger configurations where a single trigger can monitor multiple variables.
Key Changes
- Modified
TriggerDefinitionto use a list of variable IDs instead of a single variable ID - Added a new
TriggerVariablestable to maintain the many-to-many relationship between triggers and variables - Updated the UI to support selecting multiple variables when creating or editing triggers
- Updated all related services and repositories to handle the new many-to-many relationship
Description