|
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
using Bodk.Device.Storage;
|
|
|
|
using Bodk.Device.Storage.EventArgs;
|
|
|
|
using Bodk.Device.Storage.Summary;
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
namespace Admin.Bodk.Device.Services;
|
|
|
|
|
|
|
|
[ApiDescriptionSettings(Order = 2)]
|
|
|
|
public class StorageService(IStorage storage) : IDynamicApiController, ISingleton
|
|
|
|
{
|
|
|
|
[DisplayName("获取存储设备摘要")]
|
|
|
|
public StorageSummary GetSummary()
|
|
|
|
{
|
|
|
|
return storage.GetSummary();
|
|
|
|
}
|
|
|
|
|
|
|
|
[DisplayName("获取指定模块的摘要")]
|
|
|
|
public TypeDescription GetModuleSummary(int moduleId)
|
|
|
|
{
|
|
|
|
return storage.GetModuleSummary(moduleId);
|
|
|
|
}
|
|
|
|
|
|
|
|
[DisplayName("获取属性值")]
|
|
|
|
public object GetGetPropertyValue(int moduleId, string propertyName)
|
|
|
|
{
|
|
|
|
return storage.GetPropertyValue(moduleId, propertyName);
|
|
|
|
}
|
|
|
|
|
|
|
|
[DisplayName("设置属性值")]
|
|
|
|
public void SetPropertyValue(int moduleId, string propertyName, object value)
|
|
|
|
{
|
|
|
|
storage.SetPropertyValue(moduleId, propertyName, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
[DisplayName("开始监控")]
|
|
|
|
public void Start()
|
|
|
|
{
|
|
|
|
storage.Start();
|
|
|
|
}
|
|
|
|
|
|
|
|
[DisplayName("执行方法")]
|
|
|
|
public void InvokeMethod(int moduleId, string methodName, object?[]? parameters)
|
|
|
|
{
|
|
|
|
storage.InvokeMethod(moduleId, methodName, parameters).Wait();
|
|
|
|
}
|
|
|
|
}
|