├── .appveyor.yml ├── .gitattributes ├── .gitignore ├── 3rd-party-licenses.md ├── Directory.Build.props ├── Directory.Build.targets ├── LICENSE.md ├── NuGet.config ├── OneDas.Core.sln ├── README.md ├── build ├── build.props └── build.targets ├── doc └── dependencies.md ├── extensions ├── OneDas.Extension.Can │ ├── BusCoupling.cs │ ├── CanDeviceType.cs │ ├── CanFrameFormat.cs │ ├── CanGateway.cs │ ├── CanModule.cs │ ├── CanSettings.cs │ ├── CanSupporter.cs │ ├── CiaBitRate.cs │ ├── Devices │ │ ├── CanLoopbackDevice │ │ │ └── CanLoopbackDevice.cs │ │ └── IxxatUsbToCanV2Compact │ │ │ ├── Ixxat.QuickStart.cs │ │ │ ├── IxxatUsbToCanV2Compact.cs │ │ │ └── IxxatUtils.cs │ ├── ICanDevice.cs │ ├── OneDas.Extension.Can.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ └── WebClient │ │ ├── BusCouplingEnum.ts │ │ ├── Can.js │ │ ├── CanDeviceTypeEnum.ts │ │ ├── CanFrameFormatEnum.ts │ │ ├── CanModuleModel.ts │ │ ├── CanModuleSelectorViewModel.ts │ │ ├── CanModuleViewModel.ts │ │ ├── CanView.html │ │ ├── CanViewModel.ts │ │ ├── CiaBitRateEnum.ts │ │ ├── DeviceDescription.ts │ │ └── tsconfig.json ├── OneDas.Extension.Csv │ ├── CsvRowIndexFormat.cs │ ├── CsvSettings.cs │ ├── CsvWriter.cs │ ├── OneDas.Extension.Csv.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ └── WebClient │ │ ├── Csv.js │ │ ├── CsvView.html │ │ ├── CsvViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.Ethercat │ ├── EthercatGateway.cs │ ├── EthercatSettings.cs │ ├── EthercatSupporter.cs │ ├── OneDas.Extension.Ethercat.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ └── WebClient │ │ ├── Ethercat.js │ │ ├── EthercatView.html │ │ ├── EthercatViewModel.ts │ │ ├── Export │ │ ├── OneDas.Extension.Ethercat.Types.d.ts │ │ ├── OneDas.Extension.Ethercat.Types.js │ │ └── tsconfig.json │ │ ├── NetworkInterfaceDescription.ts │ │ ├── OneDas.Ethercat │ │ ├── SlaveChannelViewModel.ts │ │ ├── SlaveExtensionViewModelBase.ts │ │ ├── SlaveInfoDynamicDataViewModel.ts │ │ ├── SlaveInfoViewModel.ts │ │ └── SlavePdoViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.Famos │ ├── FamosSettings.cs │ ├── FamosWriter.cs │ ├── OneDas.Extension.Famos.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ └── WebClient │ │ ├── Famos.js │ │ ├── FamosView.html │ │ ├── FamosViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.Hdf │ ├── Hdf │ │ ├── DataContainerType.cs │ │ ├── GeneralHelper.cs │ │ ├── IOHelper.cs │ │ └── TypeConversionHelper.cs │ ├── HdfSettings.cs │ ├── HdfWriter.cs │ ├── OneDas.Extension.Hdf.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ └── WebClient │ │ ├── Hdf.js │ │ ├── HdfView.html │ │ ├── HdfViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.Mat73 │ ├── Mat73Settings.cs │ ├── Mat73Utilities.cs │ ├── Mat73Writer.cs │ ├── OneDas.Extension.Mat73.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ ├── TextEntry.cs │ └── WebClient │ │ ├── Mat73.js │ │ ├── Mat73View.html │ │ ├── Mat73ViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.Modbus │ ├── Client │ │ ├── ModbusClientGateway.cs │ │ ├── ModbusClientSettings.cs │ │ ├── ModbusRtuClientGateway.cs │ │ ├── ModbusRtuClientSettings.cs │ │ ├── ModbusTcpClientGateway.cs │ │ └── ModbusTcpClientSettings.cs │ ├── ModbusModule.cs │ ├── ModbusObjectType.cs │ ├── OneDas.Extension.Modbus.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ ├── Server │ │ ├── ModbusRtuServerGateway.cs │ │ ├── ModbusRtuServerSettings.cs │ │ ├── ModbusServerGateway.cs │ │ ├── ModbusServerSettings.cs │ │ ├── ModbusTcpServerGateway.cs │ │ └── ModbusTcpServerSettings.cs │ └── WebClient │ │ ├── Client │ │ ├── ModbusClientModuleSelectorViewModel.ts │ │ ├── ModbusClientModuleViewModel.ts │ │ └── ModbusClientViewModel.ts │ │ ├── HandshakeEnum.ts │ │ ├── ModbusModuleModel.ts │ │ ├── ModbusModuleViewModel.ts │ │ ├── ModbusObjectTypeEnum.ts │ │ ├── ParityEnum.ts │ │ ├── RtuClient │ │ ├── ModbusRtuClient.js │ │ ├── ModbusRtuClientView.html │ │ ├── ModbusRtuClientViewModel.ts │ │ └── tsconfig.json │ │ ├── RtuServer │ │ ├── ModbusRtuServer.js │ │ ├── ModbusRtuServerView.html │ │ ├── ModbusRtuServerViewModel.ts │ │ └── tsconfig.json │ │ ├── Server │ │ ├── ModbusServerModuleSelectorViewModel.ts │ │ ├── ModbusServerModuleViewModel.ts │ │ └── ModbusServerViewModel.ts │ │ ├── StopBitsEnum.ts │ │ ├── TcpClient │ │ ├── ModbusTcpClient.js │ │ ├── ModbusTcpClientView.html │ │ ├── ModbusTcpClientViewModel.ts │ │ └── tsconfig.json │ │ └── TcpServer │ │ ├── ModbusTcpServer.js │ │ ├── ModbusTcpServerView.html │ │ ├── ModbusTcpServerViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.OpcUa │ ├── CertificateManager.cs │ ├── OneDas.Extension.OpcUa.csproj │ ├── OpcUaUtilities.cs │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ ├── Server │ │ ├── OpcUaNodeManager.cs │ │ ├── OpcUaServer.cs │ │ ├── OpcUaServerGateway.cs │ │ ├── OpcUaServerSettings.cs │ │ └── configuration.xml │ └── WebClient │ │ └── Server │ │ ├── OpcUaServer.js │ │ ├── OpcUaServerView.html │ │ ├── OpcUaServerViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.RaspberryPi │ ├── OneDas.Extension.RaspberryPi.csproj │ ├── RaspberryPiGateway.cs │ ├── RaspberryPiSettings.cs │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ └── WebClient │ │ ├── RaspberryPi.js │ │ ├── RaspberryPiView.html │ │ ├── RaspberryPiViewModel.ts │ │ └── tsconfig.json ├── OneDas.Extension.Udp │ ├── OneDas.Extension.Udp.csproj │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ ├── UdpGateway.cs │ ├── UdpSettings.cs │ └── WebClient │ │ ├── Udp.js │ │ ├── UdpView.html │ │ ├── UdpViewModel.ts │ │ └── tsconfig.json └── tsconfig.base.json ├── init_solution.ps1 ├── samples ├── DataGatewaySample │ ├── DataGatewaySample.csproj │ ├── DataGatewaySampleGateway.cs │ ├── DataGatewaySampleNumberGenerator.cs │ ├── DataGatewaySampleNumberGeneratorBase.cs │ ├── DataGatewaySampleSettings.cs │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ └── WebClient │ │ ├── DataGatewaySample.js │ │ ├── DataGatewaySampleView.html │ │ ├── DataGatewaySampleViewModel.ts │ │ └── tsconfig.json ├── EngineSample │ ├── EngineSample.csproj │ └── Program.cs ├── ExtensionSample │ ├── ExtensionSample.csproj │ └── Program.cs └── PackageManagementSample │ ├── PackageManagementSample.csproj │ └── Program.cs ├── src ├── OneDas.Core.Deployment │ ├── OneDas.Core.Deployment.wixproj │ ├── Product.wxs │ ├── RemoveExe.xslt │ └── license.rtf ├── OneDas.Core.WebClient │ ├── Core │ │ ├── ActionRequest.ts │ │ ├── ActionResponse.ts │ │ ├── ChartContext.ts │ │ ├── EventDispatcher.ts │ │ ├── IEvent.ts │ │ ├── LiveViewPeriodEnum.ts │ │ ├── OneDasModuleSelectorModeEnum.ts │ │ └── WorkspaceBase.ts │ ├── Export │ │ ├── OneDas.Types.d.ts │ │ ├── OneDas.Types.js │ │ └── tsconfig.json │ ├── Models │ │ ├── BufferRequestModel.ts │ │ ├── ChannelHubModel.ts │ │ ├── OneDasModuleModel.ts │ │ └── TransferFunctionModel.ts │ ├── OneDas.Core.WebClient.csproj │ ├── OneDas.Types │ │ ├── DataDirectionEnum.ts │ │ ├── EndiannessEnum.ts │ │ ├── FileGranularityEnum.ts │ │ ├── OneDasDataTypeEnum.ts │ │ ├── OneDasStateEnum.ts │ │ └── SampleRateEnum.ts │ ├── Properties │ │ └── launchSettings.json │ ├── Static │ │ ├── ConnectionManager.ts │ │ ├── EnumerationHelper.ts │ │ ├── ErrorMessage.ts │ │ ├── ExtensionFactory.ts │ │ ├── ExtensionHive.ts │ │ └── Helper.ts │ ├── ViewModels │ │ ├── AppViewModel.ts │ │ ├── Core │ │ │ ├── ChannelHubViewModel.ts │ │ │ ├── MessageLogEntryViewModel.ts │ │ │ ├── MultiMappingEditorViewModel.ts │ │ │ ├── OneDasModuleSelectorViewModel.ts │ │ │ ├── OneDasModuleViewModel.ts │ │ │ ├── OneDasPackageSourceViewModel.ts │ │ │ ├── OneDasPerformanceInformationViewModel.ts │ │ │ ├── OneDasProjectDescriptionViewModel.ts │ │ │ ├── OneDasProjectViewModel.ts │ │ │ ├── PackageMetadataViewModel.ts │ │ │ ├── TransferFunctionViewModel.ts │ │ │ └── WebServerOptionsLightViewModel.ts │ │ ├── Extension │ │ │ ├── BufferRequestSelectorViewModel.ts │ │ │ ├── BufferRequestViewModel.ts │ │ │ ├── DataGatewayViewModelBase.ts │ │ │ ├── DataPortViewModel.ts │ │ │ ├── DataWriterViewModelBase.ts │ │ │ ├── ExtendedDataGatewayViewModelBase.ts │ │ │ ├── ExtensionDescriptionViewModel.ts │ │ │ ├── ExtensionIdentificationViewModel.ts │ │ │ └── ExtensionViewModelBase.ts │ │ └── Navigation │ │ │ ├── ControlViewModel.ts │ │ │ ├── EditorViewModel.ts │ │ │ ├── ExtensionViewModel.ts │ │ │ ├── LiveViewViewModel.ts │ │ │ └── StartViewModel.ts │ ├── package-lock.json │ ├── site.ts │ └── tsconfig.json ├── OneDas.Core.WebServer │ ├── AdvancedBootloader.cs │ ├── BasicBootloader.cs │ ├── Core │ │ ├── AuthorizationType.cs │ │ ├── BroadcasterException.cs │ │ ├── ClientPushService.cs │ │ ├── ExtensionLoader.cs │ │ └── LiveViewSubscription.cs │ ├── Logging │ │ ├── WebClientLogger.cs │ │ └── WebClientLoggerProvider.cs │ ├── OneDas.Core.WebServer.csproj │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── ErrorMessage.Designer.cs │ │ ├── ErrorMessage.resx │ │ └── NetworkIcon.ico │ ├── Shell │ │ └── OneDasConsole.cs │ ├── Web │ │ ├── Hubs │ │ │ ├── ConsoleHub.cs │ │ │ ├── IWebClientHub.cs │ │ │ └── WebClientHub.cs │ │ ├── Models │ │ │ ├── AppModel.cs │ │ │ └── WebServerOptionsLight.cs │ │ ├── Pages │ │ │ ├── Index.cshtml │ │ │ ├── Index.cshtml.cs │ │ │ ├── _Layout.cshtml │ │ │ ├── _ValidationScriptsPartial.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ │ └── Startup.cs │ ├── WebServerOptions.cs │ ├── WebServerUtilities.cs │ ├── bundleconfig.json │ └── wwwroot │ │ ├── css │ │ ├── site.css │ │ └── site.min.css │ │ ├── favicon.ico │ │ ├── images │ │ ├── activity_monitor.png │ │ ├── air_port.png │ │ ├── chart.png │ │ ├── console_stripes.png │ │ ├── loading.gif │ │ ├── network_icon.png │ │ └── terminal.png │ │ └── views │ │ ├── control.html │ │ ├── editor.html │ │ ├── extension.html │ │ ├── liveview.html │ │ └── start.html ├── OneDas.Core │ ├── Engine │ │ ├── BufferFlags.cs │ │ ├── OneDasEngine.cs │ │ ├── OneDasPerformanceInformation.cs │ │ ├── OneDasStateChangedEventArgs.cs │ │ ├── RtTimer.cs │ │ └── StorageContext.cs │ ├── EngineUtilities.cs │ ├── GcNotification.cs │ ├── OneDas.Core.csproj │ ├── OneDasDependencyInjectionExtensions.cs │ ├── ProjectManagement │ │ ├── ChannelHub.cs │ │ ├── ChannelHubBase.cs │ │ └── OneDasProject.cs │ ├── Ressources │ │ ├── ErrorMessage.Designer.cs │ │ └── ErrorMessage.resx │ ├── SafeNativeMethods.cs │ └── Serialization │ │ ├── ConstructorlessContractResolver.cs │ │ ├── IOneDasProjectSerializer.cs │ │ ├── KnownTypesBinder.cs │ │ ├── OneDasConverter.cs │ │ ├── OneDasProjectSerializer.cs │ │ ├── OneDasSerializer.cs │ │ └── SerializationHelper.cs ├── OneDas.PackageManagement │ ├── OneDas.PackageManagement.csproj │ ├── OneDasDeleteOnRestartManager.cs │ ├── OneDasNuGetProjectContext.cs │ ├── OneDasNugetProject.cs │ ├── OneDasPackageManager.cs │ └── OneDasSolutionManager.cs └── OneDas.Types │ ├── Assembly.cs │ ├── AssemblyInfo.cs │ ├── Buffers │ ├── BufferRequest.cs │ ├── BufferType.cs │ ├── BufferUtilities.cs │ ├── ExtendedBuffer.cs │ ├── ExtendedBufferBase.cs │ ├── GenericsUtilities.cs │ ├── IBuffer.cs │ ├── IExtendedBuffer.cs │ ├── ISimpleBuffer.cs │ └── SimpleBuffer.cs │ ├── DateTimeExtensions.cs │ ├── ExceptionExtensions.cs │ ├── Extensibility │ ├── ActionRequest.cs │ ├── ActionResponse.cs │ ├── DataGateway │ │ ├── DataGatewayContext.cs │ │ ├── DataGatewayExtensionLogicBase.cs │ │ ├── DataGatewayExtensionSettingsBase.cs │ │ ├── DataPort.cs │ │ ├── ExtendedDataGatewayExtensionLogicBase.cs │ │ ├── ExtendedDataGatewayExtensionSettingsBase.cs │ │ ├── IReferenceClock.cs │ │ └── OneDasModule.cs │ ├── DataWriter │ │ ├── ChannelContext.cs │ │ ├── ChannelContextGroup.cs │ │ ├── ChannelDescription.cs │ │ ├── CustomMetadataEntry.cs │ │ ├── CustomMetadataEntryLevel.cs │ │ ├── DataWriterContext.cs │ │ ├── DataWriterExtensionLogicBase.cs │ │ ├── DataWriterExtensionSettingsBase.cs │ │ └── DataWriterFormatVersionAttribute.cs │ ├── ExtensionContextAttribute.cs │ ├── ExtensionDescription.cs │ ├── ExtensionFactory.cs │ ├── ExtensionIdentificationAttribute.cs │ ├── ExtensionLogicBase.cs │ ├── ExtensionSettingsBase.cs │ ├── ExtensionSupporterAttribute.cs │ ├── IExtensionFactory.cs │ └── IExtensionSupporter.cs │ ├── Infrastructure │ ├── DataDirection.cs │ ├── Endianness.cs │ ├── FileGranularity.cs │ ├── IOneDasSerializer.cs │ ├── OneDasDataType.cs │ ├── OneDasProjectDescription.cs │ ├── SampleRate.cs │ ├── SampleRateContainer.cs │ └── TransferFunction.cs │ ├── OneDas.Types.csproj │ ├── OneDasConstants.cs │ ├── OneDasOptions.cs │ ├── OneDasState.cs │ ├── OneDasUtilities.cs │ ├── PackageManagement │ ├── OneDasPackageMetadata.cs │ └── OneDasPackageSource.cs │ ├── ProjectManagement │ ├── ChannelHubSettings.cs │ └── OneDasProjectSettings.cs │ └── Resources │ ├── ErrorMessage.Designer.cs │ └── ErrorMessage.resx ├── tests └── OneDas.Core.Tests │ ├── DataWriterFamosTests.cs │ ├── DummyTests.cs │ └── OneDas.Core.Tests.csproj ├── tsconfig.base.json └── web ├── package-lock.json └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # Declare files that will always have LF line endings on checkout. 5 | package.json text eol=lf 6 | package-lock.json text eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | artifacts/ 3 | 4 | __pycache__ 5 | 6 | **/node_modules 7 | **/OneDas.Core.WebServer/wwwroot/js/ 8 | **/wwwroot/lib/ 9 | 10 | *.suo 11 | *.user -------------------------------------------------------------------------------- /3rd-party-licenses.md: -------------------------------------------------------------------------------- 1 | # License overview of included 3rd party libraries 2 | 3 | OneDAS includes third-party open-source libraries, which are licensed under their own respective open-source licenses. 4 | 5 | ### [HDF.PInvoke](https://github.com/HDFGroup/HDF.PInvoke). 6 | 7 | License: [Link](https://github.com/HDFGroup/HDF.PInvoke/blob/master/COPYING) -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | LGPL-3.0-only 7 | https://github.com/OneDAS-Group/OneDAS-Core 8 | 9 | 10 | -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/LICENSE.md -------------------------------------------------------------------------------- /NuGet.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OneDAS-Core 2 | 3 | [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/onedas-group/onedas-core?svg=true&branch=master)](https://ci.appveyor.com/project/Apollo3zehn/onedas-core) 4 | 5 | Contains the main executables and type definitions of OneDAS. 6 | 7 | ### Prerequisites 8 | 9 | * Visual Studio 2017 Community 10 | * Git for Windows (https://git-scm.com/download/win) 11 | * node.js (https://nodejs.org/en/) 12 | * **optional**: WiX Toolset (to open .wixproj and to build .msi packages) 13 | * WiX Toolset build tools v3.11 (http://wixtoolset.org/releases/) 14 | * WiX Toolset Visual Studio 2017 Extension (http://wixtoolset.org/releases/)" -------------------------------------------------------------------------------- /build/build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | embedded 7 | true 8 | latest 9 | net5.0 10 | true 11 | $(NoWarn);CS7035 12 | 13 | 14 | 15 | 1 16 | 0 17 | 0 18 | alpha.3 19 | 20 | 21 | 22 | $([MSBuild]::NormalizePath($(MSBuildThisFileDirectory)../artifacts)) 23 | $(ArtifactsPath)/obj/$(MSBuildProjectName) 24 | $(BaseIntermediateOutputPath)/$(Configuration) 25 | $(ArtifactsPath)/bin/$(MSBuildProjectName)/$(Configuration) 26 | $(ArtifactsPath)/packages 27 | 28 | 29 | 30 | $(GetPackageVersionDependsOn);CreateMetaData 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /build/build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | https://github.com/OneDAS-Group 18 | https://github.com/OneDAS-Group 19 | OneDAS Group 20 | final 21 | 22 | 23 | $(Major).0.0.0 24 | $(Major).$(Minor).$(Revision).0 25 | OneDAS 26 | $(PackageProjectUrl) 27 | $(Major).$(Minor).$(Revision) 28 | 29 | 30 | 31 | 32 | 33 | $(Version)-$(VersionSuffix) 34 | $(Version).$(Build) 35 | 36 | 37 | 38 | 39 | $(Version) 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /doc/dependencies.md: -------------------------------------------------------------------------------- 1 | ```mermaid 2 | graph LR 3 | OneDas.PackageManagement --> OneDas.Types 4 | OneDas.Hdf.Interface --> OneDas.Types 5 | OneDas.Core --> OneDas.PackageManagement 6 | OneDas.Hdf.VdsTool --> OneDas.Types 7 | %%OneDas.Hdf.VdsTool --> OneDas.Hdf.Types 8 | OneDas.Hdf.Explorer --> OneDas.PackageManagement 9 | %%OneDas.Hdf.Explorer --> OneDas.Hdf.Types 10 | OneDas.Core.WebServer --> OneDas.Core 11 | OneDas.Core.WebServer --> OneDas.Core.WebClient 12 | OneDas.Core.WebClient --> OneDas.Types 13 | DataGatewaySample --> OneDas.Types 14 | ``` 15 | 16 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/BusCoupling.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Can 2 | { 3 | public enum BusCoupling 4 | { 5 | Lowspeed = 1, 6 | Highspeed = 2 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/CanDeviceType.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Can 2 | { 3 | public enum CanDeviceType 4 | { 5 | IxxatUsbToCanV2Compact = 1, 6 | CanLoopbackDevice = 999, 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/CanFrameFormat.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Can 2 | { 3 | public enum CanFrameFormat 4 | { 5 | Standard = 1, 6 | Extended = 2 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/CanModule.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using OneDas.Infrastructure; 3 | using System.Runtime.Serialization; 4 | 5 | namespace OneDas.Extension.Can 6 | { 7 | public class CanModule : OneDasModule 8 | { 9 | #region "Constructors" 10 | 11 | public CanModule(uint identifier, CanFrameFormat frameFormat, OneDasDataType dataType, DataDirection dataDirection, Endianness endianness, int size) 12 | : base(dataType, dataDirection, endianness, size) 13 | { 14 | this.Identifier = identifier; 15 | this.FrameFormat = frameFormat; 16 | } 17 | 18 | #endregion 19 | 20 | #region "Properties" 21 | 22 | [DataMember] 23 | public uint Identifier { get; set; } 24 | 25 | [DataMember] 26 | public CanFrameFormat FrameFormat { get; set; } 27 | 28 | public int ByteOffset { get; set; } 29 | 30 | #endregion 31 | 32 | #warning Validation? 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/CanSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extension.Can 5 | { 6 | [DataContract] 7 | [ExtensionContext(typeof(CanGateway))] 8 | [ExtensionSupporter(typeof(CanSupporter))] 9 | [ExtensionIdentification("CAN_2_0a_b", "CAN 2.0a/b", "Send and receive CAN 2.0a and 2.0b messages.", @"WebClient.CanView.html", @"WebClient.Can.js")] 10 | public class CanSettings : ExtendedDataGatewayExtensionSettingsBase 11 | { 12 | #region "Constructors" 13 | 14 | public CanSettings() 15 | { 16 | this.CanDeviceType = CanDeviceType.IxxatUsbToCanV2Compact; 17 | this.HardwareId = string.Empty; 18 | this.BitRate = CiaBitRate.Cia125KBit; 19 | this.BusCoupling = BusCoupling.Highspeed; 20 | } 21 | 22 | #endregion 23 | 24 | #region "Properties" 25 | 26 | [DataMember] 27 | public CanDeviceType CanDeviceType { get; set; } 28 | 29 | [DataMember] 30 | public string HardwareId { get; set; } 31 | 32 | [DataMember] 33 | public CiaBitRate BitRate { get; set; } 34 | 35 | [DataMember] 36 | public BusCoupling BusCoupling { get; set; } 37 | 38 | [DataMember] 39 | public int FrameRateDivider { get; set; } 40 | 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/CiaBitRate.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Can 2 | { 3 | public enum CiaBitRate 4 | { 5 | Cia10KBit = 1, 6 | Cia20KBit = 2, 7 | Cia50KBit = 3, 8 | Cia125KBit = 4, 9 | Cia500KBit = 5, 10 | Cia800KBit = 6, 11 | Cia1000KBit = 7 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/Devices/CanLoopbackDevice/CanLoopbackDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | 4 | namespace OneDas.Extension.Can 5 | { 6 | public class CanLoopbackDevice : ICanDevice 7 | { 8 | #region Fields 9 | 10 | ConcurrentQueue<(uint Identifier, byte[] Data)> _messageQueue; 11 | 12 | #endregion 13 | 14 | #region Constructors 15 | 16 | public CanLoopbackDevice() 17 | { 18 | _messageQueue = new ConcurrentQueue<(uint identifier, byte[] data)>(); 19 | } 20 | 21 | #endregion 22 | 23 | #region Properties 24 | 25 | public int AvailableMessagesCount => _messageQueue.Count; 26 | 27 | #endregion 28 | 29 | #region Methods 30 | 31 | public void Send(uint identifier, CanFrameFormat frameFormat, Span data) 32 | { 33 | if (data.Length > 8) 34 | throw new FormatException(ErrorMessage.MessageSizeExceeded); 35 | 36 | _messageQueue.Enqueue((identifier, data.ToArray())); 37 | } 38 | 39 | public bool Receive(out uint identifier, out byte[] data) 40 | { 41 | identifier = default; 42 | data = default; 43 | 44 | if (_messageQueue.TryDequeue(out var message)) 45 | { 46 | identifier = message.Identifier; 47 | data = message.Data; 48 | 49 | return true; 50 | } 51 | else 52 | { 53 | return false; 54 | } 55 | } 56 | 57 | public void Dispose() 58 | { 59 | // 60 | } 61 | 62 | #endregion 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/Devices/IxxatUsbToCanV2Compact/IxxatUtils.cs: -------------------------------------------------------------------------------- 1 | using Ixxat.Vci4.Bal.Can; 2 | using System; 3 | 4 | namespace OneDas.Extension.Can 5 | { 6 | static class IxxatUtils 7 | { 8 | #region Properties 9 | 10 | public static Guid AcceptedDeviceClass { get; } = new Guid("2219f6a0-732a-4750-b66f-0ae731fb40e1"); 11 | 12 | #endregion 13 | 14 | #region Methods 15 | 16 | public static CanBitrate CiaBitRateToCanBitrate(CiaBitRate bitRate) 17 | { 18 | return bitRate switch 19 | { 20 | CiaBitRate.Cia10KBit => CanBitrate.Cia10KBit, 21 | CiaBitRate.Cia20KBit => CanBitrate.Cia20KBit, 22 | CiaBitRate.Cia50KBit => CanBitrate.Cia50KBit, 23 | CiaBitRate.Cia125KBit => CanBitrate.Cia125KBit, 24 | CiaBitRate.Cia500KBit => CanBitrate.Cia500KBit, 25 | CiaBitRate.Cia800KBit => CanBitrate.Cia800KBit, 26 | CiaBitRate.Cia1000KBit => CanBitrate.Cia1000KBit, 27 | _ => throw new NotSupportedException() 28 | }; 29 | } 30 | 31 | public static string TrimHardwareId(string hardwareId) 32 | { 33 | return hardwareId.Replace("\0", string.Empty); 34 | } 35 | 36 | #endregion 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/ICanDevice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Extension.Can 4 | { 5 | interface ICanDevice 6 | { 7 | #region Properties 8 | 9 | int AvailableMessagesCount { get; } 10 | 11 | #endregion 12 | 13 | #region Methods 14 | 15 | void Send(uint identifier, CanFrameFormat frameFormat, Span data); 16 | 17 | bool Receive(out uint identifier, out byte[] data); 18 | 19 | void Dispose(); 20 | 21 | #endregion 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/OneDas.Extension.Can.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Send and received CAN 2.0a and 2.0b messages. 5 | OneDAS data aquisition measurement extension CAN 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | false 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | True 31 | True 32 | ErrorMessage.resx 33 | 34 | 35 | 36 | 37 | 38 | ResXFileCodeGenerator 39 | ErrorMessage.Designer.cs 40 | OneDas.Extension.Can 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/BusCouplingEnum.ts: -------------------------------------------------------------------------------- 1 | enum BusCouplingEnum { 2 | Lowspeed = 1, 3 | Highspeed = 2 4 | } 5 | 6 | window["BusCouplingEnum"] = BusCouplingEnum -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/CanDeviceTypeEnum.ts: -------------------------------------------------------------------------------- 1 | enum CanDeviceTypeEnum { 2 | IxxatUsbToCanV2Compact = 1, 3 | CanLoopbackDevice = 999 4 | } 5 | 6 | window["CanDeviceTypeEnum"] = CanDeviceTypeEnum 7 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/CanFrameFormatEnum.ts: -------------------------------------------------------------------------------- 1 | enum CanFrameFormatEnum { 2 | Standard = 1, 3 | Extended = 2 4 | } 5 | 6 | window["CanFrameFormatEnum"] = CanFrameFormatEnum -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/CanModuleModel.ts: -------------------------------------------------------------------------------- 1 | class CanModuleModel extends OneDasModuleModel 2 | { 3 | public Identifier: number 4 | public FrameFormat: CanFrameFormatEnum 5 | 6 | constructor(identifier: number, frameFormat: CanFrameFormatEnum, dataType: OneDasDataTypeEnum, dataDirection: DataDirectionEnum, endianness: EndiannessEnum, size: number) 7 | { 8 | super(dataType, dataDirection, endianness, size) 9 | 10 | this.Identifier = identifier 11 | this.FrameFormat = frameFormat 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/CanModuleSelectorViewModel.ts: -------------------------------------------------------------------------------- 1 | class CanModuleSelectorViewModel extends OneDasModuleSelectorViewModel 2 | { 3 | constructor(oneDasModuleSelectorMode: OneDasModuleSelectorModeEnum, moduleSet: CanModuleViewModel[]) 4 | { 5 | super(oneDasModuleSelectorMode, moduleSet) 6 | 7 | this.SettingsTemplateName = ko.observable("Can_CanModuleSettingsTemplate") 8 | } 9 | 10 | protected CreateNewModule() 11 | { 12 | return new CanModuleViewModel(new CanModuleModel(0, CanFrameFormatEnum.Standard, OneDasDataTypeEnum.INT32, DataDirectionEnum.Input, EndiannessEnum.LittleEndian, 2)) 13 | } 14 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/CiaBitRateEnum.ts: -------------------------------------------------------------------------------- 1 | enum CiaBitRateEnum { 2 | Cia10KBit = 1, 3 | Cia20KBit = 2, 4 | Cia50KBit = 3, 5 | Cia125KBit = 4, 6 | Cia500KBit = 5, 7 | Cia800KBit = 6, 8 | Cia1000KBit = 7 9 | } 10 | 11 | window["CiaBitRateEnum"] = CiaBitRateEnum -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/DeviceDescription.ts: -------------------------------------------------------------------------------- 1 | class DeviceDescription 2 | { 3 | public Name: string 4 | public HardwareId: string 5 | 6 | constructor(name: string, hardwareId: string) 7 | { 8 | this.Name = name 9 | this.HardwareId = hardwareId 10 | } 11 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Can/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "Can.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Csv/CsvRowIndexFormat.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Csv 2 | { 3 | public enum CsvRowIndexFormat 4 | { 5 | Index = 0, 6 | Unix = 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Csv/CsvSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extension.Csv 5 | { 6 | [DataContract] 7 | [ExtensionContext(typeof(CsvWriter))] 8 | [ExtensionIdentification("CSV", "Comma-separated values", "Store data in comma-separated values files.", @"WebClient.CsvView.html", @"WebClient.Csv.js")] 9 | public class CsvSettings : DataWriterExtensionSettingsBase 10 | { 11 | #region "Constructors" 12 | 13 | public CsvSettings() 14 | { 15 | this.SignificantFigures = 4; 16 | } 17 | 18 | #endregion 19 | 20 | #region Properties 21 | 22 | public CsvRowIndexFormat RowIndexFormat { get; set; } 23 | public uint SignificantFigures { get; set; } 24 | 25 | #endregion 26 | 27 | #region "Methods" 28 | 29 | public override void Validate() 30 | { 31 | base.Validate(); 32 | } 33 | 34 | #endregion 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Csv/OneDas.Extension.Csv.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Store data in comma-separated values format. 5 | $(PackageTags) OneDAS data aquisition measurement extension CSV 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | false 18 | 19 | 20 | 21 | 22 | 23 | True 24 | True 25 | ErrorMessage.resx 26 | 27 | 28 | 29 | 30 | 31 | ResXFileCodeGenerator 32 | ErrorMessage.Designer.cs 33 | OneDas.Extension.Csv 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Csv/WebClient/Csv.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | let ViewModelConstructor = (model, identification) => new CsvViewModel(model, identification); 11 | class CsvViewModel extends DataWriterViewModelBase { 12 | constructor(model, identification) { 13 | super(model, identification); 14 | } 15 | // methods 16 | InitializeAsync() { 17 | return __awaiter(this, void 0, void 0, function* () { 18 | // 19 | }); 20 | } 21 | ExtendModel(model) { 22 | super.ExtendModel(model); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Csv/WebClient/CsvView.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
- nothing to display -
6 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Csv/WebClient/CsvViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new CsvViewModel(model, identification) 2 | 3 | class CsvViewModel extends DataWriterViewModelBase 4 | { 5 | constructor(model, identification: ExtensionIdentificationViewModel) 6 | { 7 | super(model, identification) 8 | } 9 | 10 | // methods 11 | public async InitializeAsync() 12 | { 13 | // 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | } 20 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Csv/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "Csv.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/EthercatSettings.cs: -------------------------------------------------------------------------------- 1 | using EtherCAT.NET.Infrastructure; 2 | using OneDas.Extensibility; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Runtime.Serialization; 7 | 8 | namespace OneDas.Extension.Ethercat 9 | { 10 | [DataContract] 11 | [ExtensionContext(typeof(EthercatGateway))] 12 | [ExtensionSupporter(typeof(EthercatSupporter))] 13 | [ExtensionIdentification("EtherCAT", "EtherCAT", "Access EtherCAT networks to read and write data periodically.", @"WebClient.EthercatView.html", @"WebClient.Ethercat.js")] 14 | public class EthercatSettings : DataGatewayExtensionSettingsBase 15 | { 16 | #region "Constructors" 17 | 18 | public EthercatSettings() 19 | { 20 | // 21 | } 22 | 23 | #endregion 24 | 25 | #region "Properties" 26 | 27 | [DataMember(IsRequired = true)] 28 | public string NicHardwareAddress { get; set; } 29 | 30 | [DataMember(IsRequired = true)] 31 | public SlaveInfo RootSlaveInfo { get; set; } 32 | 33 | #endregion 34 | 35 | #region "Methods" 36 | 37 | public override void Validate() 38 | { 39 | List slaveInfoSet; 40 | IEnumerable csaSet; 41 | 42 | base.Validate(); 43 | 44 | slaveInfoSet = this.RootSlaveInfo != null ? this.RootSlaveInfo.Descendants().ToList() : new List(); 45 | csaSet = slaveInfoSet.Select(x => x.Csa); 46 | 47 | if (csaSet.Count() > csaSet.Distinct().Count()) 48 | { 49 | throw new Exception(ErrorMessage.EthercatSettings_SlaveInfoIdNotUnique); 50 | } 51 | 52 | slaveInfoSet.ForEach(slaveInfo => slaveInfo.Validate()); 53 | } 54 | 55 | #endregion 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/OneDas.Extension.Ethercat.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Access EtherCAT networks to read and write data periodically. 5 | true 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | false 21 | 22 | 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | True 32 | True 33 | ErrorMessage.resx 34 | 35 | 36 | 37 | 38 | 39 | ResXFileCodeGenerator 40 | ErrorMessage.Designer.cs 41 | OneDas.Extension.Ethercat 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/WebClient/Export/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "outFile": "./OneDas.Extension.Ethercat.Types.js" 6 | }, 7 | "include": [ 8 | "./../OneDas.Ethercat/**/*.ts" 9 | ] 10 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/WebClient/NetworkInterfaceDescription.ts: -------------------------------------------------------------------------------- 1 | class NetworkInterfaceDescription 2 | { 3 | public Name: string 4 | public Address: string 5 | 6 | constructor(name: string, address: string) 7 | { 8 | this.Name = name 9 | this.Address = address 10 | } 11 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/WebClient/OneDas.Ethercat/SlaveChannelViewModel.ts: -------------------------------------------------------------------------------- 1 | class SlaveChannelViewModel extends DataPortViewModel 2 | { 3 | public readonly Parent: SlavePdoViewModel 4 | public readonly Index: number 5 | public readonly SubIndex: number 6 | 7 | constructor(slaveChannelModel: any, parent: SlavePdoViewModel, dataGateway: DataGatewayViewModelBase) 8 | { 9 | super(slaveChannelModel, dataGateway) 10 | 11 | this.Parent = parent 12 | this.Index = slaveChannelModel.Index 13 | this.SubIndex = slaveChannelModel.SubIndex 14 | } 15 | 16 | public GetId(): string 17 | { 18 | return this.Parent.Parent.Csa + " / " + this.Parent.Name + " / " + this.Name() 19 | } 20 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/WebClient/OneDas.Ethercat/SlaveExtensionViewModelBase.ts: -------------------------------------------------------------------------------- 1 | abstract class SlaveExtensionViewModelBase extends ExtensionViewModelBase 2 | { 3 | public SlaveInfo: SlaveInfoViewModel 4 | } 5 | 6 | window[SlaveExtensionViewModelBase.name] = SlaveExtensionViewModelBase -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/WebClient/OneDas.Ethercat/SlaveInfoDynamicDataViewModel.ts: -------------------------------------------------------------------------------- 1 | class SlaveInfoDynamicDataViewModel 2 | { 3 | public readonly Name: string 4 | public readonly Description: string 5 | public readonly Base64ImageData: ByteString 6 | public readonly PdoSet: SlavePdoViewModel[] 7 | 8 | constructor(slaveInfoDynamicDataModel: any, parent: SlaveInfoViewModel, dataGateway: DataGatewayViewModelBase) 9 | { 10 | this.Name = slaveInfoDynamicDataModel.Name 11 | this.Description = slaveInfoDynamicDataModel.Description 12 | this.Base64ImageData = slaveInfoDynamicDataModel.Base64ImageData 13 | this.PdoSet = slaveInfoDynamicDataModel.PdoSet.filter(slavePdoModel => slavePdoModel.SyncManager >= 0).map(slavePdoModel => new SlavePdoViewModel(slavePdoModel, parent, dataGateway)) 14 | } 15 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/WebClient/OneDas.Ethercat/SlavePdoViewModel.ts: -------------------------------------------------------------------------------- 1 | class SlavePdoViewModel 2 | { 3 | public readonly Parent: SlaveInfoViewModel 4 | public readonly Name: string 5 | public readonly Index: number 6 | public readonly SyncManager: number 7 | public readonly ChannelSet: SlaveChannelViewModel[] 8 | public readonly CompactView: KnockoutObservable 9 | 10 | constructor(slavePdoModel: any, parent: SlaveInfoViewModel, dataGateway: DataGatewayViewModelBase) 11 | { 12 | this.Parent = parent 13 | this.Name = slavePdoModel.Name 14 | this.Index = slavePdoModel.Index 15 | this.SyncManager = slavePdoModel.SyncManager 16 | this.ChannelSet = slavePdoModel.ChannelSet.map(x => new SlaveChannelViewModel(x, this, dataGateway)) 17 | this.CompactView = ko.observable(this.ChannelSet.length === 1) 18 | } 19 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Ethercat/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "Ethercat.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ], 9 | "exclude": [ 10 | "./**/*.d.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Famos/FamosSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extension.Famos 5 | { 6 | [DataContract] 7 | [ExtensionContext(typeof(FamosWriter))] 8 | [ExtensionIdentification("FamosImc2", "FAMOS (imc2)", "Store data in FAMOS v2 .dat files (imc2).", @"WebClient.FamosView.html", @"WebClient.Famos.js")] 9 | public class FamosSettings : DataWriterExtensionSettingsBase 10 | { 11 | #region "Constructors" 12 | 13 | public FamosSettings() 14 | { 15 | // 16 | } 17 | 18 | #endregion 19 | 20 | #region "Methods" 21 | 22 | public override void Validate() 23 | { 24 | base.Validate(); 25 | } 26 | 27 | #endregion 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Famos/OneDas.Extension.Famos.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Store data in FAMOS v2 .dat files (imc2). 5 | $(PackageTags) OneDAS data aquisition measurement extension imc FAMOS 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | false 22 | 23 | 24 | 25 | 26 | 27 | True 28 | True 29 | ErrorMessage.resx 30 | 31 | 32 | 33 | 34 | 35 | ResXFileCodeGenerator 36 | ErrorMessage.Designer.cs 37 | OneDas.Extension.Famos 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Famos/WebClient/Famos.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | let ViewModelConstructor = (model, identification) => new FamosViewModel(model, identification); 11 | class FamosViewModel extends DataWriterViewModelBase { 12 | constructor(model, identification) { 13 | super(model, identification); 14 | } 15 | // methods 16 | InitializeAsync() { 17 | return __awaiter(this, void 0, void 0, function* () { 18 | // 19 | }); 20 | } 21 | ExtendModel(model) { 22 | super.ExtendModel(model); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Famos/WebClient/FamosView.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
- nothing to display -
6 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Famos/WebClient/FamosViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new FamosViewModel(model, identification) 2 | 3 | class FamosViewModel extends DataWriterViewModelBase 4 | { 5 | constructor(model, identification: ExtensionIdentificationViewModel) 6 | { 7 | super(model, identification) 8 | } 9 | 10 | // methods 11 | public async InitializeAsync() 12 | { 13 | // 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | } 20 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Famos/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "Famos.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/Hdf/DataContainerType.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Hdf 2 | { 3 | public enum DataContainerType 4 | { 5 | Dataset = 0, 6 | Attribute = 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/Hdf/IOHelper.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/extensions/OneDas.Extension.Hdf/Hdf/IOHelper.cs -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/HdfSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace OneDas.Extension.Hdf 6 | { 7 | [DataContract] 8 | [ExtensionContext(typeof(HdfWriter))] 9 | [ExtensionIdentification("HDF", "HDF files", "Store data in hierachical data format files.", "WebClient.HdfView.html", "WebClient.Hdf.js")] 10 | public class HdfSettings : DataWriterExtensionSettingsBase 11 | { 12 | #region "Constructors" 13 | 14 | public HdfSettings() 15 | { 16 | this.FilePeriod = TimeSpan.FromDays(1); 17 | } 18 | 19 | #endregion 20 | 21 | #region "Methods" 22 | 23 | public override void Validate() 24 | { 25 | base.Validate(); 26 | } 27 | 28 | #endregion 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/OneDas.Extension.Hdf.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Store data in hierachical data format files. 5 | $(PackageTags) OneDAS data aquisition measurement extension HDF 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | false 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | True 28 | True 29 | ErrorMessage.resx 30 | 31 | 32 | 33 | 34 | 35 | ResXFileCodeGenerator 36 | ErrorMessage.Designer.cs 37 | OneDas.Extension.Hdf 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/WebClient/Hdf.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | let ViewModelConstructor = (model, identification) => new HdfViewModel(model, identification); 11 | class HdfViewModel extends DataWriterViewModelBase { 12 | constructor(model, identification) { 13 | super(model, identification); 14 | } 15 | // methods 16 | InitializeAsync() { 17 | return __awaiter(this, void 0, void 0, function* () { 18 | // 19 | }); 20 | } 21 | ExtendModel(model) { 22 | super.ExtendModel(model); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/WebClient/HdfView.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
- nothing to display -
6 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/WebClient/HdfViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new HdfViewModel(model, identification) 2 | 3 | class HdfViewModel extends DataWriterViewModelBase 4 | { 5 | constructor(model, identification: ExtensionIdentificationViewModel) 6 | { 7 | super(model, identification) 8 | } 9 | 10 | // methods 11 | public async InitializeAsync() 12 | { 13 | // 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | } 20 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Hdf/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "Hdf.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/Mat73Settings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extension.Mat73 5 | { 6 | [DataContract] 7 | [ExtensionContext(typeof(Mat73Writer))] 8 | [ExtensionIdentification("MAT73", "Matlab files (v7.3)", "Store data in Matlab's hierachical data format (v7.3).", @"WebClient.Mat73View.html", @"WebClient.Mat73.js")] 9 | public class Mat73Settings : DataWriterExtensionSettingsBase 10 | { 11 | #region "Constructors" 12 | 13 | public Mat73Settings() 14 | { 15 | // 16 | } 17 | 18 | #endregion 19 | 20 | #region "Methods" 21 | 22 | public override void Validate() 23 | { 24 | base.Validate(); 25 | } 26 | 27 | #endregion 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/Mat73Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace OneDas.Extension.Mat73 5 | { 6 | public static class Mat73Utilities 7 | { 8 | public static int[] ToCodePoints(this string value) 9 | { 10 | List codePoints; 11 | 12 | if (value == null) 13 | { 14 | throw new ArgumentNullException("str"); 15 | } 16 | 17 | codePoints = new List(value.Length); 18 | 19 | for (int i = 0; i < value.Length; i++) 20 | { 21 | codePoints.Add(Char.ConvertToUtf32(value, i)); 22 | 23 | if (Char.IsHighSurrogate(value[i])) 24 | { 25 | i += 1; 26 | } 27 | } 28 | 29 | return codePoints.ToArray(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/OneDas.Extension.Mat73.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Store data in Matlab's hierachical data format (v7.3). 5 | $(PackageTags) OneDAS data aquisition measurement extension MATLAB HDF 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | false 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | True 24 | True 25 | ErrorMessage.resx 26 | 27 | 28 | 29 | 30 | 31 | ResXFileCodeGenerator 32 | ErrorMessage.Designer.cs 33 | OneDas.Extension.Mat73 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/TextEntry.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Mat73 2 | { 3 | public class TextEntry 4 | { 5 | public TextEntry(string path, string name, string content) 6 | { 7 | this.Path = path; 8 | this.Name = name; 9 | this.Content = content; 10 | } 11 | 12 | public string Path { get; private set; } 13 | public string Name { get; private set; } 14 | public string Content { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/WebClient/Mat73.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 3 | return new (P || (P = Promise))(function (resolve, reject) { 4 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 5 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 6 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 7 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 8 | }); 9 | }; 10 | let ViewModelConstructor = (model, identification) => new Mat73ViewModel(model, identification); 11 | class Mat73ViewModel extends DataWriterViewModelBase { 12 | constructor(model, identification) { 13 | super(model, identification); 14 | } 15 | // methods 16 | InitializeAsync() { 17 | return __awaiter(this, void 0, void 0, function* () { 18 | // 19 | }); 20 | } 21 | ExtendModel(model) { 22 | super.ExtendModel(model); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/WebClient/Mat73View.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
- nothing to display -
6 | 7 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/WebClient/Mat73ViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new Mat73ViewModel(model, identification) 2 | 3 | class Mat73ViewModel extends DataWriterViewModelBase 4 | { 5 | constructor(model, identification: ExtensionIdentificationViewModel) 6 | { 7 | super(model, identification) 8 | } 9 | 10 | // methods 11 | public async InitializeAsync() 12 | { 13 | // 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | } 20 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Mat73/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "Mat73.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/Client/ModbusClientSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extension.Modbus 5 | { 6 | public abstract class ModbusClientSettings : ExtendedDataGatewayExtensionSettingsBase 7 | { 8 | #region "Constructors" 9 | 10 | public ModbusClientSettings() 11 | { 12 | // unit identifier must be initialized in derived classes due to different rules 13 | } 14 | 15 | #endregion 16 | 17 | #region "Properties" 18 | 19 | [DataMember] 20 | public byte UnitIdentifier { get; set; } 21 | 22 | [DataMember] 23 | public int FrameRateDivider { get; set; } 24 | 25 | #endregion 26 | 27 | #region "Methods" 28 | 29 | public override void Validate() 30 | { 31 | base.Validate(); 32 | 33 | // unit identifier must be validated in derived classes due to different rules 34 | } 35 | 36 | #endregion 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/Client/ModbusTcpClientSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System; 3 | using System.Net; 4 | using System.Runtime.Serialization; 5 | 6 | namespace OneDas.Extension.Modbus 7 | { 8 | [DataContract] 9 | [ExtensionContext(typeof(ModbusTcpClientGateway))] 10 | [ExtensionIdentification("ModbusTcpClient", "Modbus TCP Client", "Exchange data with a Modbus TCP server.", @"WebClient.TcpClient.ModbusTcpClientView.html", @"WebClient.TcpClient.ModbusTcpClient.js")] 11 | public class ModbusTcpClientSettings : ModbusClientSettings 12 | { 13 | #region "Constructors" 14 | 15 | public ModbusTcpClientSettings() 16 | { 17 | this.Port = 502; 18 | this.UnitIdentifier = 0xFF; 19 | } 20 | 21 | #endregion 22 | 23 | #region "Properties" 24 | 25 | [DataMember] 26 | public string RemoteIpAddress { get; set; } 27 | 28 | [DataMember] 29 | public UInt16 Port { get; set; } 30 | 31 | #endregion 32 | 33 | #region "Methods" 34 | 35 | public override void Validate() 36 | { 37 | IPAddress remoteIpAddress; 38 | 39 | base.Validate(); 40 | 41 | if (!OneDasUtilities.ValidateIPv4(this.RemoteIpAddress, out remoteIpAddress)) 42 | throw new Exception(ErrorMessage.ModbusTcpClientSettings_RemoteIpAddressInvalid); 43 | 44 | if (this.Port == 0) 45 | throw new Exception(ErrorMessage.ModbusTcpClientSettings_PortInvalid); 46 | } 47 | 48 | #endregion 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/ModbusModule.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using OneDas.Infrastructure; 3 | using System; 4 | using System.Runtime.Serialization; 5 | 6 | namespace OneDas.Extension.Modbus 7 | { 8 | public class ModbusModule : OneDasModule 9 | { 10 | #region "Constructors" 11 | 12 | public ModbusModule(ushort startingAddress, ModbusObjectTypeEnum objectType, OneDasDataType dataType, DataDirection dataDirection, Endianness endianness, int size) : base(dataType, dataDirection, endianness, size) 13 | { 14 | this.StartingAddress = startingAddress; 15 | this.ObjectType = objectType; 16 | 17 | this.Initialize(); 18 | } 19 | 20 | #endregion 21 | 22 | #region "Properties" 23 | 24 | [DataMember] 25 | public ushort StartingAddress { get; set; } 26 | 27 | [DataMember] 28 | public ModbusObjectTypeEnum ObjectType { get; set; } 29 | 30 | public int ByteOffset { get; set; } 31 | 32 | public ushort Quantity { get; private set; } 33 | public int ByteCount { get; private set; } 34 | 35 | #endregion 36 | 37 | #region "Methods" 38 | 39 | private void Initialize() 40 | { 41 | this.ByteCount = this.GetByteCount(); 42 | this.Quantity = (ushort)Math.Ceiling(this.ByteCount / (double)2); 43 | } 44 | 45 | #endregion 46 | 47 | #region "Serialization" 48 | 49 | [OnDeserialized] 50 | private void OnDeserialized(StreamingContext streamingContext) 51 | { 52 | this.Initialize(); 53 | } 54 | 55 | #endregion 56 | 57 | #warning Validation? 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/ModbusObjectType.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extension.Modbus 2 | { 3 | public enum ModbusObjectTypeEnum 4 | { 5 | DiscreteInput = 1, 6 | Coil = 2, 7 | InputRegister = 3, 8 | HoldingRegister = 4 9 | } 10 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/Server/ModbusRtuServerGateway.cs: -------------------------------------------------------------------------------- 1 | using FluentModbus; 2 | using Microsoft.Extensions.Logging; 3 | 4 | namespace OneDas.Extension.Modbus 5 | { 6 | public class ModbusRtuServerGateway : ModbusServerGateway 7 | { 8 | #region Constructors 9 | 10 | public ModbusRtuServerGateway(ModbusRtuServerSettings settings, ILogger logger) 11 | : base(new ModbusRtuServer(settings.UnitIdentifier, isAsynchronous: false), settings, logger) 12 | { 13 | var modbusServer = (ModbusRtuServer)this.ModbusServer; 14 | 15 | modbusServer.BaudRate = settings.BaudRate; 16 | modbusServer.Handshake = settings.Handshake; 17 | modbusServer.Parity = settings.Parity; 18 | modbusServer.StopBits = settings.StopBits; 19 | } 20 | 21 | #endregion 22 | 23 | #region Methods 24 | 25 | protected override void OnConfigure() 26 | { 27 | base.OnConfigure(); 28 | 29 | var settings = (ModbusRtuServerSettings)this.Settings; 30 | var server = (ModbusRtuServer)this.ModbusServer; 31 | 32 | server.Start(settings.Port); 33 | this.Logger.LogInformation($"COM port '{settings.Port}' opened"); 34 | } 35 | 36 | #endregion 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/Server/ModbusServerSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extension.Modbus 5 | { 6 | public abstract class ModbusServerSettings : ExtendedDataGatewayExtensionSettingsBase 7 | { 8 | #region Properties 9 | 10 | [DataMember] 11 | public int FrameRateDivider { get; set; } 12 | 13 | #endregion 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/Server/ModbusTcpServerGateway.cs: -------------------------------------------------------------------------------- 1 | using FluentModbus; 2 | using Microsoft.Extensions.Logging; 3 | using System.Net; 4 | 5 | namespace OneDas.Extension.Modbus 6 | { 7 | public class ModbusTcpServerGateway : ModbusServerGateway 8 | { 9 | #region "Fields" 10 | 11 | private IPEndPoint _localEndpoint; 12 | 13 | #endregion 14 | 15 | #region "Constructors" 16 | 17 | public ModbusTcpServerGateway(ModbusTcpServerSettings settings, ILogger logger) 18 | : base(new ModbusTcpServer(isAsynchronous: false), settings, logger) 19 | { 20 | _localEndpoint = new IPEndPoint(IPAddress.Parse(settings.LocalIpAddress), (int)settings.Port); 21 | } 22 | 23 | #endregion 24 | 25 | #region "Methods" 26 | 27 | protected override void OnConfigure() 28 | { 29 | base.OnConfigure(); 30 | 31 | var settings = (ModbusTcpServerSettings)this.Settings; 32 | var modbusServer = (ModbusTcpServer)this.ModbusServer; 33 | 34 | modbusServer.Start(_localEndpoint); 35 | this.Logger.LogInformation($"Listening on TCP end point '{settings.LocalIpAddress}:{settings.Port}'."); 36 | } 37 | 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/Server/ModbusTcpServerSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace OneDas.Extension.Modbus 6 | { 7 | [DataContract] 8 | [ExtensionContext(typeof(ModbusTcpServerGateway))] 9 | [ExtensionIdentification("ModbusTcpServer", "Modbus TCP Server", "Provide data to Modbus TCP clients.", @"WebClient.TcpServer.ModbusTcpServerView.html", @"WebClient.TcpServer.ModbusTcpServer.js")] 10 | public class ModbusTcpServerSettings : ModbusServerSettings 11 | { 12 | #region "Constructors" 13 | 14 | public ModbusTcpServerSettings() 15 | { 16 | this.Port = 502; 17 | } 18 | 19 | #endregion 20 | 21 | #region "Properties" 22 | 23 | [DataMember] 24 | public string LocalIpAddress { get; set; } 25 | 26 | [DataMember] 27 | public UInt16 Port { get; set; } 28 | 29 | #endregion 30 | 31 | #region "Methods" 32 | 33 | public override void Validate() 34 | { 35 | base.Validate(); 36 | 37 | if (!OneDasUtilities.ValidateIPv4(this.LocalIpAddress, out var _)) 38 | throw new Exception(ErrorMessage.ModbusTcpServerSettings_LocalIpAddressInvalid); 39 | 40 | if (this.Port == 0) 41 | throw new Exception(ErrorMessage.ModbusTcpServerSettings_PortInvalid); 42 | } 43 | 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/Client/ModbusClientModuleSelectorViewModel.ts: -------------------------------------------------------------------------------- 1 | class ModbusClientModuleSelectorViewModel extends OneDasModuleSelectorViewModel 2 | { 3 | constructor(oneDasModuleSelectorMode: OneDasModuleSelectorModeEnum, moduleSet: OneDasModuleViewModel[]) 4 | { 5 | super(oneDasModuleSelectorMode, moduleSet) 6 | 7 | this.SettingsTemplateName = ko.observable("Modbus_OneDasModuleSettingsTemplate") 8 | } 9 | 10 | protected CreateNewModule() 11 | { 12 | return new ModbusClientModuleViewModel(new ModbusModuleModel(0, ModbusObjectTypeEnum.HoldingRegister, OneDasDataTypeEnum.UINT16, DataDirectionEnum.Input, EndiannessEnum.BigEndian, 1)) 13 | } 14 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/Client/ModbusClientModuleViewModel.ts: -------------------------------------------------------------------------------- 1 | class ModbusClientModuleViewModel extends ModbusModuleViewModel 2 | { 3 | public Validate() 4 | { 5 | super.Validate() 6 | 7 | if (this.DataDirection() === DataDirectionEnum.Output && this.ObjectType() !== ModbusObjectTypeEnum.HoldingRegister) 8 | { 9 | this.ErrorMessage("Only object type 'holding register' is allowed for output modules.") 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/Client/ModbusClientViewModel.ts: -------------------------------------------------------------------------------- 1 | class ModbusClientViewModel extends ExtendedDataGatewayViewModelBase 2 | { 3 | public UnitIdentifier: KnockoutObservable 4 | public FrameRateDivider: KnockoutObservable 5 | 6 | constructor(model, identification: ExtensionIdentificationViewModel) 7 | { 8 | super(model, identification, new ModbusClientModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(modbusModuleModel => new ModbusClientModuleViewModel(modbusModuleModel)))) 9 | 10 | EnumerationHelper.Description["ModbusObjectTypeEnum_DiscreteInput"] = "Discrete Input (R)" 11 | EnumerationHelper.Description["ModbusObjectTypeEnum_Coil"] = "Coil (RW)" 12 | EnumerationHelper.Description["ModbusObjectTypeEnum_InputRegister"] = "Input Register (R)" 13 | EnumerationHelper.Description["ModbusObjectTypeEnum_HoldingRegister"] = "Holding Register (RW)" 14 | 15 | this.UnitIdentifier = ko.observable(model.UnitIdentifier) 16 | this.FrameRateDivider = ko.observable(model.FrameRateDivider) 17 | } 18 | 19 | public ExtendModel(model: any) 20 | { 21 | super.ExtendModel(model) 22 | 23 | model.UnitIdentifier = this.UnitIdentifier() 24 | model.FrameRateDivider = this.FrameRateDivider() 25 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()) 26 | } 27 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/HandshakeEnum.ts: -------------------------------------------------------------------------------- 1 | enum HandshakeEnum { 2 | None = 0, 3 | XOnXOff = 1, 4 | RequestToSend = 2, 5 | RequestToSendXOnXOff = 3 6 | } 7 | 8 | window["HandshakeEnum"] = HandshakeEnum -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/ModbusModuleModel.ts: -------------------------------------------------------------------------------- 1 | class ModbusModuleModel extends OneDasModuleModel 2 | { 3 | public StartingAddress: number 4 | public ObjectType: ModbusObjectTypeEnum 5 | 6 | constructor(startingAddress: number, objectType: ModbusObjectTypeEnum, dataType: OneDasDataTypeEnum, dataDirection: DataDirectionEnum, endianness: EndiannessEnum, size: number) 7 | { 8 | super(dataType, dataDirection, endianness, size) 9 | 10 | this.StartingAddress = startingAddress 11 | this.ObjectType = objectType 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/ModbusObjectTypeEnum.ts: -------------------------------------------------------------------------------- 1 | enum ModbusObjectTypeEnum 2 | { 3 | DiscreteInput = 1, 4 | Coil = 2, 5 | InputRegister = 3, 6 | HoldingRegister = 4 7 | } 8 | 9 | window["ModbusObjectTypeEnum"] = ModbusObjectTypeEnum -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/ParityEnum.ts: -------------------------------------------------------------------------------- 1 | enum ParityEnum { 2 | None = 0, 3 | Odd = 1, 4 | Even = 2 5 | } 6 | 7 | window["ParityEnum"] = ParityEnum -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/RtuClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "ModbusRtuClient.js" 5 | }, 6 | "include": [ 7 | "./../*.ts", 8 | "./../Client/*.ts", 9 | "./**/*.ts" 10 | ] 11 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/RtuServer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "ModbusRtuServer.js" 5 | }, 6 | "include": [ 7 | "./../*.ts", 8 | "./../Server/*.ts", 9 | "./**/*.ts" 10 | ] 11 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/Server/ModbusServerModuleSelectorViewModel.ts: -------------------------------------------------------------------------------- 1 | class ModbusServerModuleSelectorViewModel extends OneDasModuleSelectorViewModel 2 | { 3 | constructor(oneDasModuleSelectorMode: OneDasModuleSelectorModeEnum, moduleSet: OneDasModuleViewModel[]) 4 | { 5 | super(oneDasModuleSelectorMode, moduleSet) 6 | 7 | this.SettingsTemplateName = ko.observable("Modbus_OneDasModuleSettingsTemplate") 8 | } 9 | 10 | protected CreateNewModule() 11 | { 12 | return new ModbusServerModuleViewModel(new ModbusModuleModel(0, ModbusObjectTypeEnum.HoldingRegister, OneDasDataTypeEnum.UINT16, DataDirectionEnum.Input, EndiannessEnum.BigEndian, 1)) 13 | } 14 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/Server/ModbusServerModuleViewModel.ts: -------------------------------------------------------------------------------- 1 | class ModbusServerModuleViewModel extends ModbusModuleViewModel 2 | { 3 | public Validate() 4 | { 5 | super.Validate() 6 | 7 | // because INPUT register values do not change (they are readonly for clients) it is useless to allow server side read 8 | if (this.DataDirection() === DataDirectionEnum.Input && this.ObjectType() !== ModbusObjectTypeEnum.HoldingRegister) { 9 | this.ErrorMessage("Only object type 'holding register' is allowed for input modules.") 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/Server/ModbusServerViewModel.ts: -------------------------------------------------------------------------------- 1 | abstract class ModbusServerViewModel extends ExtendedDataGatewayViewModelBase 2 | { 3 | public FrameRateDivider: KnockoutObservable 4 | 5 | constructor(model, identification: ExtensionIdentificationViewModel) 6 | { 7 | super(model, identification, new ModbusServerModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(modbusModuleModel => new ModbusServerModuleViewModel(modbusModuleModel)))) 8 | 9 | EnumerationHelper.Description["ModbusObjectTypeEnum_DiscreteInput"] = "Discrete Input (R)" 10 | EnumerationHelper.Description["ModbusObjectTypeEnum_Coil"] = "Coil (RW)" 11 | EnumerationHelper.Description["ModbusObjectTypeEnum_InputRegister"] = "Input Register (R)" 12 | EnumerationHelper.Description["ModbusObjectTypeEnum_HoldingRegister"] = "Holding Register (RW)" 13 | 14 | this.FrameRateDivider = ko.observable(model.FrameRateDivider) 15 | } 16 | 17 | public ExtendModel(model: any) 18 | { 19 | super.ExtendModel(model) 20 | 21 | model.FrameRateDivider = this.FrameRateDivider() 22 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()) 23 | } 24 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/StopBitsEnum.ts: -------------------------------------------------------------------------------- 1 | enum StopBitsEnum { 2 | None = 0, 3 | One = 1, 4 | Two = 2, 5 | OnePointFive = 3 6 | } 7 | 8 | window["StopBitsEnum"] = StopBitsEnum -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/TcpClient/ModbusTcpClientViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new ModbusTcpClientViewModel(model, identification) 2 | 3 | class ModbusTcpClientViewModel extends ModbusClientViewModel 4 | { 5 | public RemoteIpAddress: KnockoutObservable 6 | public Port: KnockoutObservable 7 | 8 | constructor(model, identification: ExtensionIdentificationViewModel) 9 | { 10 | super(model, identification) 11 | 12 | this.RemoteIpAddress = ko.observable(model.RemoteIpAddress) 13 | this.Port = ko.observable(model.Port) 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | 20 | model.RemoteIpAddress = this.RemoteIpAddress() 21 | model.Port = this.Port() 22 | } 23 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/TcpClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "ModbusTcpClient.js" 5 | }, 6 | "include": [ 7 | "./../*.ts", 8 | "./../Client/*.ts", 9 | "./**/*.ts" 10 | ] 11 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/TcpServer/ModbusTcpServerViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new ModbusTcpServerViewModel(model, identification) 2 | 3 | class ModbusTcpServerViewModel extends ModbusServerViewModel 4 | { 5 | public LocalIpAddress: KnockoutObservable 6 | public Port: KnockoutObservable 7 | 8 | constructor(model, identification: ExtensionIdentificationViewModel) 9 | { 10 | super(model, identification) 11 | 12 | this.LocalIpAddress = ko.observable(model.LocalIpAddress) 13 | this.Port = ko.observable(model.Port) 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | 20 | model.LocalIpAddress = this.LocalIpAddress() 21 | model.Port = this.Port() 22 | } 23 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Modbus/WebClient/TcpServer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "ModbusTcpServer.js" 5 | }, 6 | "include": [ 7 | "./../*.ts", 8 | "./../Server/*.ts", 9 | "./**/*.ts" 10 | ] 11 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.OpcUa/OneDas.Extension.OpcUa.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Communicate via OPC-UA. 5 | $(PackageTags) OneDAS data aquisition measurement extension OPC-UA 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | false 22 | 23 | 24 | 25 | 26 | 27 | ErrorMessage.resx 28 | True 29 | True 30 | 31 | 32 | 33 | 34 | 35 | OneDas.Extension.OpcUa 36 | ErrorMessage.Designer.cs 37 | ResXFileCodeGenerator 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.OpcUa/OpcUaUtilities.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using Opc.Ua; 3 | using System; 4 | 5 | namespace OneDas.Extension.OpcUa 6 | { 7 | public class OpcUaUtilities 8 | { 9 | public static BuiltInType GetOpcUaDataTypeFromOneDasDataType(OneDasDataType oneDasDataType) 10 | { 11 | switch (oneDasDataType) 12 | { 13 | case OneDasDataType.BOOLEAN: 14 | return BuiltInType.Boolean; 15 | case OneDasDataType.UINT8: 16 | return BuiltInType.Byte; 17 | case OneDasDataType.INT8: 18 | return BuiltInType.SByte; 19 | case OneDasDataType.UINT16: 20 | return BuiltInType.UInt16; 21 | case OneDasDataType.INT16: 22 | return BuiltInType.Int16; 23 | case OneDasDataType.UINT32: 24 | return BuiltInType.UInt32; 25 | case OneDasDataType.INT32: 26 | return BuiltInType.Int32; 27 | case OneDasDataType.UINT64: 28 | return BuiltInType.UInt64; 29 | case OneDasDataType.INT64: 30 | return BuiltInType.Int32; 31 | case OneDasDataType.FLOAT32: 32 | return BuiltInType.Float; 33 | case OneDasDataType.FLOAT64: 34 | return BuiltInType.Double; 35 | default: 36 | throw new ArgumentException(nameof(oneDasDataType)); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.OpcUa/Server/OpcUaServerSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System; 3 | using System.Net; 4 | using System.Runtime.Serialization; 5 | 6 | namespace OneDas.Extension.OpcUa 7 | { 8 | [DataContract] 9 | [ExtensionContext(typeof(OpcUaServerGateway))] 10 | [ExtensionIdentification("OpcUaServer", "OPC-UA Server", "Provide data to OPC-UA clients.", @"WebClient.Server.OpcUaServerView.html", @"WebClient.Server.OpcUaServer.js")] 11 | public class OpcUaServerSettings : ExtendedDataGatewayExtensionSettingsBase 12 | { 13 | #region "Constructors" 14 | 15 | public OpcUaServerSettings() 16 | { 17 | // 18 | } 19 | 20 | #endregion 21 | 22 | #region "Properties" 23 | 24 | [DataMember] 25 | public string LocalIpAddress { get; set; } 26 | 27 | [DataMember] 28 | public int FrameRateDivider { get; set; } 29 | 30 | #endregion 31 | 32 | #region "Methods" 33 | 34 | public override void Validate() 35 | { 36 | IPAddress localIpAddress; 37 | 38 | base.Validate(); 39 | 40 | if (!OneDasUtilities.ValidateIPv4(this.LocalIpAddress, out localIpAddress)) 41 | throw new Exception(ErrorMessage.OpcUaServerSettings_LocalIpAddressInvalid); 42 | } 43 | 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.OpcUa/WebClient/Server/OpcUaServer.js: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model, identification) => new OpcUaServerViewModel(model, identification); 2 | class OpcUaServerViewModel extends ExtendedDataGatewayViewModelBase { 3 | constructor(model, identification) { 4 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(module => new OneDasModuleViewModel(module)))); 5 | this.LocalIpAddress = ko.observable(model.LocalIpAddress); 6 | this.FrameRateDivider = ko.observable(model.FrameRateDivider); 7 | } 8 | ExtendModel(model) { 9 | super.ExtendModel(model); 10 | model.LocalIpAddress = this.LocalIpAddress(); 11 | model.FrameRateDivider = this.FrameRateDivider(); 12 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.OpcUa/WebClient/Server/OpcUaServerView.html: -------------------------------------------------------------------------------- 1 |  2 |
3 |
4 |
5 |
6 | 7 | 11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 20 | 23 |
24 |
25 |
26 |
27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.OpcUa/WebClient/Server/OpcUaServerViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new OpcUaServerViewModel(model, identification) 2 | 3 | class OpcUaServerViewModel extends ExtendedDataGatewayViewModelBase 4 | { 5 | public LocalIpAddress: KnockoutObservable 6 | public FrameRateDivider: KnockoutObservable 7 | 8 | constructor(model, identification: ExtensionIdentificationViewModel) 9 | { 10 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(module => new OneDasModuleViewModel(module)))) 11 | 12 | this.LocalIpAddress = ko.observable(model.LocalIpAddress) 13 | this.FrameRateDivider = ko.observable(model.FrameRateDivider) 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | 20 | model.LocalIpAddress = this.LocalIpAddress() 21 | model.FrameRateDivider = this.FrameRateDivider() 22 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()) 23 | } 24 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.OpcUa/WebClient/Server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "OpcUaServer.js" 5 | }, 6 | "include": [ 7 | "./../*.ts", 8 | "./**/*.ts" 9 | ] 10 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.RaspberryPi/OneDas.Extension.RaspberryPi.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Communicate via CAN Bus. 5 | OneDAS data aquisition measurement extension CAN 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | false 18 | 19 | 20 | 21 | 22 | 23 | True 24 | True 25 | ErrorMessage.resx 26 | 27 | 28 | 29 | 30 | 31 | ResXFileCodeGenerator 32 | ErrorMessage.Designer.cs 33 | OneDas.Extension.RaspberryPi 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.RaspberryPi/RaspberryPiGateway.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using OneDas.Extensibility; 3 | using System; 4 | 5 | namespace OneDas.Extension.RaspberryPi 6 | { 7 | public class RaspberryPiGateway : ExtendedDataGatewayExtensionLogicBase 8 | { 9 | private RaspberryPiSettings _settings; 10 | private Random _random; 11 | 12 | public RaspberryPiGateway(RaspberryPiSettings settings, ILogger logger) : base(settings, logger) 13 | { 14 | _settings = settings; 15 | _random = new Random(); 16 | } 17 | 18 | protected override void OnUpdateIo(DateTime referenceDateTime) 19 | { 20 | this.LastSuccessfulUpdate.Restart(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.RaspberryPi/RaspberryPiSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extension.RaspberryPi 5 | { 6 | [DataContract] 7 | [ExtensionContext(typeof(RaspberryPiGateway))] 8 | [ExtensionIdentification("RaspberryPi", "RaspberryPi", "Send and receive data via CAN bus", @"WebClient.RaspberryPiView.html", @"WebClient.RaspberryPi.js")] 9 | public class RaspberryPiSettings : ExtendedDataGatewayExtensionSettingsBase 10 | { 11 | // 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.RaspberryPi/WebClient/RaspberryPi.js: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model, identification) => new RaspberryPiViewModel(model, identification); 2 | class RaspberryPiViewModel extends ExtendedDataGatewayViewModelBase { 3 | constructor(model, identification) { 4 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(oneDasModuleModel => new OneDasModuleViewModel(oneDasModuleModel)))); 5 | this.OneDasModuleSelector.SetMaxBytes(128); 6 | } 7 | // methods 8 | ExtendModel(model) { 9 | super.ExtendModel(model); 10 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.RaspberryPi/WebClient/RaspberryPiView.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.RaspberryPi/WebClient/RaspberryPiViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new RaspberryPiViewModel(model, identification) 2 | 3 | class RaspberryPiViewModel extends ExtendedDataGatewayViewModelBase 4 | { 5 | constructor(model, identification: ExtensionIdentificationViewModel) 6 | { 7 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(oneDasModuleModel => new OneDasModuleViewModel(oneDasModuleModel)))) 8 | 9 | this.OneDasModuleSelector.SetMaxBytes(128) 10 | } 11 | 12 | // methods 13 | public ExtendModel(model: any) 14 | { 15 | super.ExtendModel(model) 16 | 17 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()) 18 | } 19 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.RaspberryPi/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "RaspberryPi.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Udp/OneDas.Extension.Udp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Read and write data via UDP frames without overhead. 5 | $(PackageTags) OneDAS data aquisition measurement extension UDP 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | false 18 | 19 | 20 | 21 | 22 | 23 | True 24 | True 25 | ErrorMessage.resx 26 | 27 | 28 | 29 | 30 | 31 | ResXFileCodeGenerator 32 | ErrorMessage.Designer.cs 33 | OneDas.Extension.Udp 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Udp/UdpSettings.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Extensibility; 2 | using System; 3 | using System.Net; 4 | using System.Runtime.Serialization; 5 | 6 | namespace OneDas.Extension.Udp 7 | { 8 | [DataContract] 9 | [ExtensionContext(typeof(UdpGateway))] 10 | [ExtensionIdentification("Udp", "User datagram protocol", "Exchange data via UDP frames.", @"WebClient.UdpView.html", @"WebClient.Udp.js")] 11 | public class UdpSettings : ExtendedDataGatewayExtensionSettingsBase 12 | { 13 | #region "Constructors" 14 | 15 | public UdpSettings() 16 | { 17 | this.FrameRateDivider = 1; 18 | } 19 | 20 | #endregion 21 | 22 | #region "Properties" 23 | 24 | [DataMember] 25 | public string RemoteIpAddress { get; set; } 26 | 27 | [DataMember] 28 | public UInt16 LocalDataPort { get; set; } 29 | 30 | [DataMember] 31 | public UInt16 RemoteDataPort { get; set; } 32 | 33 | [DataMember] 34 | public int FrameRateDivider { get; set; } 35 | 36 | #endregion 37 | 38 | #region "Methods" 39 | 40 | public override void Validate() 41 | { 42 | IPAddress remoteIpAddress; 43 | 44 | base.Validate(); 45 | 46 | if (!OneDasUtilities.ValidateIPv4(this.RemoteIpAddress, out remoteIpAddress)) 47 | throw new Exception(ErrorMessage.UdpSettings_RemoteIpAddressInvalid); 48 | 49 | if (this.RemoteDataPort < 1024 || this.RemoteDataPort > 65535) 50 | throw new Exception(ErrorMessage.UdpSettings_DataPortInvalid); 51 | 52 | if (this.LocalDataPort < 1024 || this.LocalDataPort > 65535) 53 | throw new Exception(ErrorMessage.UdpSettings_DataPortInvalid); 54 | } 55 | 56 | #endregion 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Udp/WebClient/Udp.js: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model, identification) => new UdpViewModel(model, identification); 2 | class UdpViewModel extends ExtendedDataGatewayViewModelBase { 3 | constructor(model, identification) { 4 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(oneDasModuleModel => new OneDasModuleViewModel(oneDasModuleModel)))); 5 | this.OneDasModuleSelector().SetMaxBytes(1500); 6 | this.RemoteIpAddress = ko.observable(model.RemoteIpAddress); 7 | this.LocalDataPort = ko.observable(model.LocalDataPort); 8 | this.RemoteDataPort = ko.observable(model.RemoteDataPort); 9 | this.FrameRateDivider = ko.observable(model.FrameRateDivider); 10 | } 11 | // methods 12 | ExtendModel(model) { 13 | super.ExtendModel(model); 14 | model.RemoteIpAddress = this.RemoteIpAddress(); 15 | model.LocalDataPort = this.LocalDataPort(); 16 | model.RemoteDataPort = this.RemoteDataPort(); 17 | model.FrameRateDivider = this.FrameRateDivider(); 18 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Udp/WebClient/UdpViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new UdpViewModel(model, identification) 2 | 3 | class UdpViewModel extends ExtendedDataGatewayViewModelBase 4 | { 5 | public RemoteIpAddress: KnockoutObservable 6 | public LocalDataPort: KnockoutObservable 7 | public RemoteDataPort: KnockoutObservable 8 | public FrameRateDivider: KnockoutObservable 9 | 10 | constructor(model, identification: ExtensionIdentificationViewModel) 11 | { 12 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(oneDasModuleModel => new OneDasModuleViewModel(oneDasModuleModel)))) 13 | 14 | this.OneDasModuleSelector().SetMaxBytes(1500) 15 | 16 | this.RemoteIpAddress = ko.observable(model.RemoteIpAddress) 17 | this.LocalDataPort = ko.observable(model.LocalDataPort) 18 | this.RemoteDataPort = ko.observable(model.RemoteDataPort) 19 | this.FrameRateDivider = ko.observable(model.FrameRateDivider) 20 | } 21 | 22 | // methods 23 | public ExtendModel(model: any) 24 | { 25 | super.ExtendModel(model) 26 | 27 | model.RemoteIpAddress = this.RemoteIpAddress() 28 | model.LocalDataPort = this.LocalDataPort() 29 | model.RemoteDataPort = this.RemoteDataPort() 30 | model.FrameRateDivider = this.FrameRateDivider() 31 | 32 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()) 33 | } 34 | } -------------------------------------------------------------------------------- /extensions/OneDas.Extension.Udp/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "Udp.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ] 9 | } -------------------------------------------------------------------------------- /extensions/tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noImplicitAny": false, 4 | "noEmitOnError": true, 5 | "removeComments": false, 6 | "target": "es2015", 7 | "experimentalDecorators": true, 8 | "module": "none", 9 | "typeRoots": [ 10 | "./../web/node_modules/@types/" 11 | ] 12 | }, 13 | "files": [ 14 | "./../src/OneDas.Core.WebClient/Export/OneDas.Types.d.ts" 15 | ], 16 | "compileOnSave": true 17 | } -------------------------------------------------------------------------------- /samples/DataGatewaySample/DataGatewaySample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | OneDas.Extension.DataGatewaySample 5 | For testing only. 6 | true 7 | OneDasExtension OneDAS data aquisition measurement extension test 8 | OneDas.Extension.DataGatewaySample 9 | latest 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | false 21 | 22 | 23 | 24 | 25 | 26 | all 27 | runtime; build; native; contentfiles; analyzers 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | True 38 | True 39 | ErrorMessage.resx 40 | 41 | 42 | 43 | 44 | 45 | ResXFileCodeGenerator 46 | ErrorMessage.Designer.cs 47 | OneDas.Extension.DataGatewaySample 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /samples/DataGatewaySample/DataGatewaySampleGateway.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging.Abstractions; 2 | using OneDas.Infrastructure; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace OneDas.Extensibility.DataGatewaySample 8 | { 9 | public class DataGatewaySampleGateway : ExtendedDataGatewayExtensionLogicBase 10 | { 11 | private DataGatewaySampleSettings _settings; 12 | private List _numberGeneratorSet; 13 | 14 | public DataGatewaySampleGateway(DataGatewaySampleSettings settings) : base(settings, NullLogger.Instance) 15 | { 16 | var random = new Random(); 17 | 18 | _settings = settings; 19 | 20 | _numberGeneratorSet = this.DataPortSet.Where(dataPort => dataPort.DataDirection == DataDirection.Input).ToList().Select(dataPort => 21 | { 22 | var type = typeof(DataGatewaySampleNumberGenerator<>).MakeGenericType(OneDasUtilities.GetTypeFromOneDasDataType(dataPort.DataType)); 23 | 24 | return (DataGatewaySampleNumberGeneratorBase)Activator.CreateInstance(type, dataPort, random); 25 | }).ToList(); 26 | } 27 | 28 | protected override void OnUpdateIo(DateTime referenceDateTime) 29 | { 30 | _numberGeneratorSet.ForEach(genericGenerator => genericGenerator.Update()); 31 | 32 | this.LastSuccessfulUpdate.Restart(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /samples/DataGatewaySample/DataGatewaySampleNumberGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace OneDas.Extensibility.DataGatewaySample 5 | { 6 | public unsafe class DataGatewaySampleNumberGenerator : DataGatewaySampleNumberGeneratorBase where T : struct 7 | { 8 | public DataGatewaySampleNumberGenerator(DataPort dataPort, Random random): base(dataPort, random) 9 | { 10 | // 11 | } 12 | 13 | public override void Update() 14 | { 15 | Span value; 16 | 17 | value = new Span(this.DataPort.DataPtr.ToPointer(), 1); 18 | this.Buffer.Enqueue(this.Random.NextDouble() * 127); 19 | 20 | if (this.Buffer.Count > 10) 21 | { 22 | this.Buffer.Dequeue(); 23 | } 24 | 25 | value[0] = (T)Convert.ChangeType(this.Buffer.Average(), typeof(T)); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/DataGatewaySample/DataGatewaySampleNumberGeneratorBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace OneDas.Extensibility.DataGatewaySample 5 | { 6 | public abstract class DataGatewaySampleNumberGeneratorBase 7 | { 8 | public DataGatewaySampleNumberGeneratorBase(DataPort dataPort, Random random) 9 | { 10 | this.DataPort = dataPort; 11 | 12 | this.Random = random; 13 | this.Buffer = new Queue(); 14 | } 15 | 16 | protected DataPort DataPort { get; private set; } 17 | protected Random Random { get; private set; } 18 | protected Queue Buffer { get; private set; } 19 | 20 | public abstract void Update(); 21 | } 22 | } -------------------------------------------------------------------------------- /samples/DataGatewaySample/DataGatewaySampleSettings.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace OneDas.Extensibility.DataGatewaySample 4 | { 5 | [DataContract] 6 | [ExtensionContext(typeof(DataGatewaySampleGateway))] 7 | [ExtensionIdentification("DataGatewaySample", "Data-gateway sample", "For testing only.", @"WebClient.DataGatewaySampleView.html", @"WebClient.DataGatewaySample.js")] 8 | public class DataGatewaySampleSettings : ExtendedDataGatewayExtensionSettingsBase 9 | { 10 | // 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/DataGatewaySample/WebClient/DataGatewaySample.js: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model, identification) => new DataGatewaySampleViewModel(model, identification); 2 | class DataGatewaySampleViewModel extends ExtendedDataGatewayViewModelBase { 3 | constructor(model, identification) { 4 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(oneDasModuleModel => new OneDasModuleViewModel(oneDasModuleModel)))); 5 | } 6 | ExtendModel(model) { 7 | super.ExtendModel(model); 8 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/DataGatewaySample/WebClient/DataGatewaySampleView.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /samples/DataGatewaySample/WebClient/DataGatewaySampleViewModel.ts: -------------------------------------------------------------------------------- 1 | let ViewModelConstructor = (model: any, identification: ExtensionIdentificationViewModel) => new DataGatewaySampleViewModel(model, identification) 2 | 3 | class DataGatewaySampleViewModel extends ExtendedDataGatewayViewModelBase 4 | { 5 | constructor(model, identification: ExtensionIdentificationViewModel) 6 | { 7 | super(model, identification, new OneDasModuleSelectorViewModel(OneDasModuleSelectorModeEnum.Duplex, model.ModuleSet.map(oneDasModuleModel => new OneDasModuleViewModel(oneDasModuleModel)))) 8 | } 9 | 10 | public ExtendModel(model) 11 | { 12 | super.ExtendModel(model); 13 | 14 | model.ModuleSet = this.OneDasModuleSelector().ModuleSet().map(moduleModel => moduleModel.ToModel()) 15 | } 16 | } -------------------------------------------------------------------------------- /samples/DataGatewaySample/WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "inlineSourceMap": false, 5 | "inlineSources": false, 6 | "outFile": "DataGatewaySample.js" 7 | }, 8 | "include": [ 9 | "./../../../src/OneDas.Core.WebClient/Export/OneDas.Types.d.ts", 10 | "./**/*.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /samples/EngineSample/EngineSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/EngineSample/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | using Microsoft.Extensions.Logging; 3 | using OneDas.Core.Engine; 4 | using OneDas.ProjectManagement; 5 | using System; 6 | 7 | namespace EngineSample 8 | { 9 | class Program 10 | { 11 | /* improvements: 12 | * - settings.ChannelHubSet.Add(new ChannelHub()); // improve ChannelHub constructor 13 | * - reduce OneDasEngine dependencies (e.g. JSON.NET) 14 | */ 15 | 16 | static void Main(string[] args) 17 | { 18 | var services = new ServiceCollection(); 19 | 20 | ConfigureServices(services); 21 | 22 | var provider = services.BuildServiceProvider(); 23 | var engine = provider.GetRequiredService(); 24 | var settings = new OneDasProjectSettings("OneDAS", "Engine", "Example"); 25 | 26 | engine.ActivateProject(settings); 27 | engine.Start(); 28 | 29 | Console.ReadKey(); 30 | } 31 | 32 | static void ConfigureServices(IServiceCollection services) 33 | { 34 | services.AddOneDas(); 35 | 36 | services.AddLogging(loggingBuilder => 37 | { 38 | loggingBuilder.SetMinimumLevel(LogLevel.Debug); 39 | loggingBuilder.AddConsole(); 40 | }); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /samples/ExtensionSample/ExtensionSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /samples/PackageManagementSample/PackageManagementSample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/PackageManagementSample/Program.cs: -------------------------------------------------------------------------------- 1 | namespace PackageManagementSample 2 | { 3 | class Program 4 | { 5 | /* improvements: 6 | * - complete sample 7 | */ 8 | 9 | static void Main(string[] args) 10 | { 11 | // 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/OneDas.Core.Deployment/RemoveExe.xslt: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/ActionRequest.ts: -------------------------------------------------------------------------------- 1 | class ActionRequest 2 | { 3 | public readonly ExtensionId: string 4 | public readonly InstanceId: number 5 | public readonly MethodName: string 6 | public readonly Data: any 7 | 8 | constructor(extensionId: string, instanceId: number, methodName: string, data: any) 9 | { 10 | this.ExtensionId = extensionId; 11 | this.InstanceId = instanceId; 12 | this.MethodName = methodName; 13 | this.Data = data; 14 | } 15 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/ActionResponse.ts: -------------------------------------------------------------------------------- 1 | class ActionResponse 2 | { 3 | public Data: any 4 | 5 | constructor(data: any) 6 | { 7 | this.Data = data; 8 | } 9 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/ChartContext.ts: -------------------------------------------------------------------------------- 1 | class ChartContext 2 | { 3 | public ChannelHub: ChannelHubViewModel 4 | public Chart: Chart 5 | public Canvas: HTMLCanvasElement 6 | public ValueSet: Chart.ChartPoint[] 7 | 8 | public readonly ChartHeight: KnockoutObservable 9 | 10 | constructor(channelHub: ChannelHubViewModel, chart: Chart, canvas: HTMLCanvasElement, valueSet: Chart.ChartPoint[]) 11 | { 12 | this.ChannelHub = channelHub 13 | this.Chart = chart 14 | this.Canvas = canvas; 15 | this.ValueSet = valueSet 16 | 17 | this.ChartHeight = ko.observable(150) 18 | } 19 | 20 | // commands 21 | public ToggleYAxisLimits = (channelHub: ChannelHubViewModel) => 22 | { 23 | this.Chart.config.options.scales.yAxes.forEach(yAxis => 24 | { 25 | ((yAxis.ticks)).beginAtZero = !((yAxis.ticks)).beginAtZero 26 | }) 27 | 28 | this.Chart.update() 29 | } 30 | 31 | public ToggleChartHeight = (channelHub: ChannelHubViewModel) => 32 | { 33 | if (this.ChartHeight() === 150) 34 | { 35 | this.ChartHeight(300); 36 | } 37 | else 38 | { 39 | this.ChartHeight(150); 40 | } 41 | 42 | this.Chart.resize() 43 | } 44 | 45 | public InsertCanvas = (domElement: HTMLElement, valueAccessor, allBindingsAccessor, chartContext: ChartContext, bindingContext) => 46 | { 47 | domElement.appendChild(chartContext.Canvas) 48 | } 49 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/EventDispatcher.ts: -------------------------------------------------------------------------------- 1 | class EventDispatcher implements IEvent 2 | { 3 | private _subscriptions: Array<(sender: TSender, args: TArgs) => void> = new Array<(sender: TSender, args: TArgs) => void>(); 4 | 5 | subscribe(fn: (sender: TSender, args: TArgs) => void): void 6 | { 7 | if (fn) 8 | { 9 | this._subscriptions.push(fn); 10 | } 11 | } 12 | 13 | unsubscribe(fn: (sender: TSender, args: TArgs) => void): void 14 | { 15 | let i = this._subscriptions.indexOf(fn); 16 | 17 | if (i > -1) 18 | { 19 | this._subscriptions.splice(i, 1); 20 | } 21 | } 22 | 23 | dispatch(sender: TSender, args: TArgs): void 24 | { 25 | for (let handler of this._subscriptions) 26 | { 27 | handler(sender, args); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/IEvent.ts: -------------------------------------------------------------------------------- 1 | interface IEvent 2 | { 3 | subscribe(fn: (sender: TSender, args: TArgs) => void): void; 4 | unsubscribe(fn: (sender: TSender, args: TArgs) => void): void; 5 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/LiveViewPeriodEnum.ts: -------------------------------------------------------------------------------- 1 | enum LiveViewPeriodEnum 2 | { 3 | Period_60 = 60, 4 | Period_600 = 600, 5 | Period_3600 = 3600, 6 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/OneDasModuleSelectorModeEnum.ts: -------------------------------------------------------------------------------- 1 | enum OneDasModuleSelectorModeEnum 2 | { 3 | Duplex = 1, 4 | InputOnly = 2, 5 | OutputOnly = 3, 6 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Core/WorkspaceBase.ts: -------------------------------------------------------------------------------- 1 | class WorkspaceBase 2 | { 3 | public Address: string 4 | public Title: string 5 | public ViewName: string 6 | public ActiveProject: KnockoutObservable 7 | 8 | constructor(address: string, title: string, viewName: string, activeProject: KnockoutObservable) 9 | { 10 | this.Address = address 11 | this.Title = title 12 | this.ViewName = viewName 13 | this.ActiveProject = activeProject 14 | } 15 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Models/BufferRequestModel.ts: -------------------------------------------------------------------------------- 1 | class BufferRequestModel 2 | { 3 | public SampleRate: SampleRateEnum 4 | public GroupFilter: string 5 | 6 | constructor(sampleRate: SampleRateEnum, groupFilter: string) 7 | { 8 | this.SampleRate = sampleRate; 9 | this.GroupFilter = groupFilter; 10 | } 11 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Models/ChannelHubModel.ts: -------------------------------------------------------------------------------- 1 | class ChannelHubModel 2 | { 3 | public Name: string 4 | public Group: string 5 | public DataType: OneDasDataTypeEnum 6 | public Guid: string 7 | public CreationDateTime: string 8 | public Unit: string 9 | public TransferFunctionSet: any[] 10 | public AssociatedDataInputId: string 11 | public AssociatedDataOutputIdSet: string[] 12 | 13 | constructor(name: string, group: string, dataType: OneDasDataTypeEnum) 14 | { 15 | this.Name = name; 16 | this.Group = group; 17 | this.DataType = dataType; 18 | this.Guid = Guid.NewGuid() 19 | this.CreationDateTime = new Date().toISOString() 20 | this.Unit = "" 21 | this.TransferFunctionSet = [] 22 | this.AssociatedDataInputId = "" 23 | this.AssociatedDataOutputIdSet = [] 24 | } 25 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Models/OneDasModuleModel.ts: -------------------------------------------------------------------------------- 1 | class OneDasModuleModel 2 | { 3 | public DataType: OneDasDataTypeEnum 4 | public DataDirection: DataDirectionEnum 5 | public Endianness: EndiannessEnum 6 | public Size: number 7 | 8 | constructor(dataType: OneDasDataTypeEnum, dataDirection: DataDirectionEnum, endianness: EndiannessEnum, size: number) 9 | { 10 | this.DataType = dataType 11 | this.DataDirection = dataDirection 12 | this.Endianness = endianness 13 | this.Size = size 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Models/TransferFunctionModel.ts: -------------------------------------------------------------------------------- 1 | class TransferFunctionModel 2 | { 3 | public DateTime: string 4 | public Type: string 5 | public Option: string 6 | public Argument: string 7 | 8 | constructor(dateTime: string, type: string, option: string, argument: string) 9 | { 10 | this.DateTime = dateTime 11 | this.Type = type 12 | this.Option = option 13 | this.Argument = argument 14 | } 15 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/OneDas.Core.WebClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Library 5 | 3.7 6 | 7 | 8 | 9 | 10 | all 11 | runtime; build; native; contentfiles; analyzers 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/OneDas.Types/DataDirectionEnum.ts: -------------------------------------------------------------------------------- 1 | enum DataDirectionEnum 2 | { 3 | Input = 1, 4 | Output = 2 5 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/OneDas.Types/EndiannessEnum.ts: -------------------------------------------------------------------------------- 1 | enum EndiannessEnum 2 | { 3 | LittleEndian = 1, 4 | BigEndian = 2 5 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/OneDas.Types/FileGranularityEnum.ts: -------------------------------------------------------------------------------- 1 | enum FileGranularityEnum 2 | { 3 | Minute_1 = 60, 4 | Minute_10 = 600, 5 | Hour = 3600, 6 | Day = 86400 7 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/OneDas.Types/OneDasDataTypeEnum.ts: -------------------------------------------------------------------------------- 1 | enum OneDasDataTypeEnum 2 | { 3 | BOOLEAN = 0x008, 4 | UINT8 = 0x108, 5 | INT8 = 0x208, 6 | UINT16 = 0x110, 7 | INT16 = 0x210, 8 | UINT32 = 0x120, 9 | INT32 = 0x220, 10 | UINT64 = 0x140, 11 | INT64 = 0x240, 12 | FLOAT32 = 0x320, 13 | FLOAT64 = 0x340 14 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/OneDas.Types/OneDasStateEnum.ts: -------------------------------------------------------------------------------- 1 | enum OneDasStateEnum 2 | { 3 | Error = 1, 4 | Initialization = 2, 5 | Idle = 3, 6 | ApplyConfiguration = 4, 7 | Ready = 5, 8 | Run = 6 9 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/OneDas.Types/SampleRateEnum.ts: -------------------------------------------------------------------------------- 1 | enum SampleRateEnum 2 | { 3 | SampleRate_100 = 1, 4 | SampleRate_25 = 4, 5 | SampleRate_5 = 20, 6 | SampleRate_1 = 100 7 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:54607/", 7 | "sslPort": 44392 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "OneDas.Main.WebClient": { 19 | "commandName": "Project" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Static/ConnectionManager.ts: -------------------------------------------------------------------------------- 1 | declare var signalR: any 2 | 3 | class ConnectionManager 4 | { 5 | public static WebClientHub: any // improve: use typings 6 | 7 | public static Initialize(enableLogging: boolean) 8 | { 9 | ConnectionManager.WebClientHub = new signalR.HubConnectionBuilder() 10 | .configureLogging(signalR.LogLevel.Information) 11 | .withUrl('/webclienthub') 12 | .build(); 13 | } 14 | 15 | public static InvokeWebClientHub = async(methodName: string, ...args: any[]) => 16 | { 17 | return await Promise.resolve(ConnectionManager.WebClientHub.invoke(methodName, ...args)) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Static/EnumerationHelper.ts: -------------------------------------------------------------------------------- 1 | class EnumerationHelper 2 | { 3 | public static Description: { [index: string]: string } = {} 4 | 5 | public static GetEnumLocalization = (typeName: string, value) => 6 | { 7 | var key: string = eval(typeName + "[" + value + "]") 8 | return eval("EnumerationHelper.Description['" + typeName + "_" + key + "']") 9 | } 10 | 11 | public static GetEnumValues = (typeName: string) => 12 | { 13 | let values: any[] 14 | 15 | values = eval("Object.keys(" + typeName + ").map(key => " + typeName + "[key])") 16 | return values.filter(value => typeof (value) === "number") 17 | } 18 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Static/ErrorMessage.ts: -------------------------------------------------------------------------------- 1 | let ErrorMessage: { [index: string]: string } = {} 2 | ErrorMessage["MultiMappingEditorViewModel_InvalidSettings"] = "One or more settings are invalid." 3 | ErrorMessage["MultiMappingEditorViewModel_WrongDataType"] = "One or more channel-channel data type combinations are invalid." 4 | ErrorMessage["Project_ChannelAlreadyExists"] = "A channel with that name already exists." 5 | ErrorMessage["Project_DetachedExclamationMarkNotAllowed"] = "A detached exclamation mark is not allowed." 6 | ErrorMessage["Project_GroupFilterEmpty"] = "The group filter must not be empty." 7 | ErrorMessage["Project_IsAlreadyInGroup"] = "The channel is already a member of this group." 8 | ErrorMessage["Project_InvalidCharacters"] = "Use A-Z, a-z, 0-9 or _." 9 | ErrorMessage["Project_InvalidLeadingCharacter"] = "Use A-Z or a-z as first character." 10 | ErrorMessage["Project_NameEmpty"] = "The name must not be empty." 11 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Static/ExtensionFactory.ts: -------------------------------------------------------------------------------- 1 | class ExtensionFactory 2 | { 3 | public static CreateExtensionViewModelAsync = async (extensionType: string, extensionModel: any) => 4 | { 5 | let extensionIdentification: ExtensionIdentificationViewModel 6 | let extensionViewModel: ExtensionViewModelBase 7 | let extensionViewModelRaw: string 8 | 9 | extensionIdentification = ExtensionHive.FindExtensionIdentification(extensionType, extensionModel.Description.Id) 10 | 11 | if (extensionIdentification) 12 | { 13 | extensionViewModelRaw = await ConnectionManager.InvokeWebClientHub("GetExtensionStringResource", extensionModel.Description.Id, extensionIdentification.ViewModelResourceName) 14 | extensionViewModel = new Function(extensionViewModelRaw + "; return ViewModelConstructor")()(extensionModel, extensionIdentification) 15 | 16 | return extensionViewModel 17 | } 18 | else 19 | { 20 | throw new Error("No corresponding extension description for extension ID '" + extensionModel.Description.Id + "' found.") 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/Static/ExtensionHive.ts: -------------------------------------------------------------------------------- 1 | class ExtensionHive 2 | { 3 | // fields 4 | public static ExtensionIdentificationSet: Map 5 | 6 | // constructors 7 | static Initialize = () => 8 | { 9 | ExtensionHive.ExtensionIdentificationSet = new Map() 10 | } 11 | 12 | static FindExtensionIdentification = (extensionTypeName: string, extensionId: string) => 13 | { 14 | return ExtensionHive.ExtensionIdentificationSet.get(extensionTypeName).find(extensionIdentification => extensionIdentification.Id === extensionId); 15 | } 16 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Core/MessageLogEntryViewModel.ts: -------------------------------------------------------------------------------- 1 | class MessageLogEntryViewModel 2 | { 3 | public Prefix: string 4 | public Message: string 5 | 6 | constructor(prefix: string, message: string) 7 | { 8 | this.Prefix = prefix 9 | this.Message = message 10 | } 11 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Core/OneDasPackageSourceViewModel.ts: -------------------------------------------------------------------------------- 1 | class OneDasPackageSourceViewModel 2 | { 3 | public Name: string 4 | public Address: string 5 | 6 | constructor(oneDasPackageSource: any) 7 | { 8 | this.Name = oneDasPackageSource.Name 9 | this.Address = oneDasPackageSource.Address 10 | } 11 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Core/OneDasProjectDescriptionViewModel.ts: -------------------------------------------------------------------------------- 1 | class OneDasProjectDescriptionViewModel 2 | { 3 | public Guid: string 4 | public Version: KnockoutObservable 5 | public PrimaryGroupName: string 6 | public SecondaryGroupName: string 7 | public ProjectName: string 8 | 9 | constructor(projectDescriptionModel: any) 10 | { 11 | this.Guid = projectDescriptionModel.Guid 12 | this.Version = ko.observable(projectDescriptionModel.Version) 13 | this.PrimaryGroupName = projectDescriptionModel.PrimaryGroupName 14 | this.SecondaryGroupName = projectDescriptionModel.SecondaryGroupName 15 | this.ProjectName = projectDescriptionModel.ProjectName 16 | } 17 | 18 | public ToModel = () => 19 | { 20 | return { 21 | Guid: this.Guid, 22 | Version: this.Version(), 23 | PrimaryGroupName: this.PrimaryGroupName, 24 | SecondaryGroupName: this.SecondaryGroupName, 25 | ProjectName: this.ProjectName, 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Core/PackageMetadataViewModel.ts: -------------------------------------------------------------------------------- 1 | class PackageMetadataViewModel 2 | { 3 | public PackageId: KnockoutObservable 4 | public Description: KnockoutObservable 5 | public Version: KnockoutObservable 6 | public IsInstalled: KnockoutObservable 7 | public IsUpdateAvailable: KnockoutObservable 8 | 9 | constructor(packageMetadataModel: any) 10 | { 11 | this.PackageId = ko.observable(packageMetadataModel.PackageId) 12 | this.Description = ko.observable(packageMetadataModel.Description) 13 | this.Version = ko.observable(packageMetadataModel.Version) 14 | this.IsInstalled = ko.observable(packageMetadataModel.IsInstalled) 15 | this.IsUpdateAvailable = ko.observable(packageMetadataModel.IsUpdateAvailable) 16 | } 17 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Core/TransferFunctionViewModel.ts: -------------------------------------------------------------------------------- 1 | class TransferFunctionViewModel 2 | { 3 | public DateTime: KnockoutObservable 4 | public Type: KnockoutObservable 5 | public Option: KnockoutObservable 6 | public Argument: KnockoutObservable 7 | 8 | constructor(transferFunctionModel: TransferFunctionModel) 9 | { 10 | this.DateTime = ko.observable(transferFunctionModel.DateTime) 11 | this.Type = ko.observable(transferFunctionModel.Type) 12 | this.Option = ko.observable(transferFunctionModel.Option) 13 | this.Argument = ko.observable(transferFunctionModel.Argument) 14 | } 15 | 16 | // methods 17 | public ToModel() 18 | { 19 | return new TransferFunctionModel(this.DateTime(), this.Type(), this.Option(), this.Argument()) 20 | } 21 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Core/WebServerOptionsLightViewModel.ts: -------------------------------------------------------------------------------- 1 | class WebServerOptionsLightViewModel 2 | { 3 | public OneDasName: string 4 | public AspBaseUrl: string 5 | public BaseDirectoryPath: string 6 | public PackageSourceSet: OneDasPackageSourceViewModel[] 7 | 8 | constructor(webServerOptionsLight: any) 9 | { 10 | this.OneDasName = webServerOptionsLight.OneDasName 11 | this.AspBaseUrl = webServerOptionsLight.AspBaseUrl 12 | this.BaseDirectoryPath = webServerOptionsLight.BaseDirectoryPath 13 | this.PackageSourceSet = webServerOptionsLight.PackageSourceSet.map(packageSourceModel => new OneDasPackageSourceViewModel(packageSourceModel)) 14 | } 15 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Extension/DataGatewayViewModelBase.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | abstract class DataGatewayViewModelBase extends ExtensionViewModelBase 4 | { 5 | public readonly MaximumDatasetAge: KnockoutObservable 6 | public readonly DataPortSet: KnockoutObservableArray 7 | 8 | constructor(model, identification: ExtensionIdentificationViewModel) 9 | { 10 | super(model, identification) 11 | 12 | this.MaximumDatasetAge = ko.observable(model.MaximumDatasetAge) 13 | this.DataPortSet = ko.observableArray() 14 | } 15 | 16 | public ExtendModel(model: any) 17 | { 18 | super.ExtendModel(model) 19 | 20 | model.MaximumDatasetAge = Number.parseInt(this.MaximumDatasetAge()) 21 | } 22 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Extension/DataWriterViewModelBase.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | abstract class DataWriterViewModelBase extends ExtensionViewModelBase 4 | { 5 | public readonly FileGranularity: KnockoutObservable 6 | public readonly BufferRequestSet: KnockoutObservableArray 7 | public readonly BufferRequestSelector: KnockoutObservable 8 | 9 | constructor(model, identification: ExtensionIdentificationViewModel) 10 | { 11 | super(model, identification) 12 | 13 | this.FileGranularity = ko.observable(model.FileGranularity) 14 | this.BufferRequestSet = ko.observableArray(model.BufferRequestSet.map(bufferRequest => new BufferRequestViewModel(bufferRequest))) 15 | 16 | this.BufferRequestSelector = ko.observable(new BufferRequestSelectorViewModel(this.BufferRequestSet())) 17 | } 18 | 19 | public ExtendModel(model: any) 20 | { 21 | super.ExtendModel(model) 22 | 23 | model.FileGranularity = this.FileGranularity() 24 | model.BufferRequestSet = this.BufferRequestSet().map(bufferRequest => bufferRequest.ToModel()) 25 | } 26 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Extension/ExtensionDescriptionViewModel.ts: -------------------------------------------------------------------------------- 1 | class ExtensionDescriptionViewModel 2 | { 3 | public ProductVersion: number 4 | public Id: string 5 | public InstanceId: number 6 | public InstanceName: KnockoutObservable 7 | public IsEnabled: KnockoutObservable 8 | 9 | constructor(extensionDescriptionModel: any) 10 | { 11 | this.ProductVersion = extensionDescriptionModel.ProductVersion 12 | this.Id = extensionDescriptionModel.Id 13 | this.InstanceId = extensionDescriptionModel.InstanceId 14 | this.InstanceName = ko.observable(extensionDescriptionModel.InstanceName) 15 | this.IsEnabled = ko.observable(extensionDescriptionModel.IsEnabled) 16 | } 17 | 18 | public ToModel() 19 | { 20 | var model: any = { 21 | ProductVersion: this.ProductVersion, 22 | Id: this.Id, 23 | InstanceId: this.InstanceId, 24 | InstanceName: this.InstanceName(), 25 | IsEnabled: this.IsEnabled() 26 | } 27 | 28 | return model 29 | } 30 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Extension/ExtensionIdentificationViewModel.ts: -------------------------------------------------------------------------------- 1 | class ExtensionIdentificationViewModel 2 | { 3 | public ProductVersion: string 4 | public Id: string 5 | public Name: string 6 | public Description: string 7 | public ViewResourceName: string 8 | public ViewModelResourceName: string 9 | 10 | constructor(extensionIdentificationModel: any) 11 | { 12 | this.ProductVersion = extensionIdentificationModel.ProductVersion 13 | this.Id = extensionIdentificationModel.Id 14 | this.Name = extensionIdentificationModel.Name 15 | this.Description = extensionIdentificationModel.Description 16 | this.ViewResourceName = extensionIdentificationModel.ViewResourceName 17 | this.ViewModelResourceName = extensionIdentificationModel.ViewModelResourceName 18 | } 19 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Extension/ExtensionViewModelBase.ts: -------------------------------------------------------------------------------- 1 | abstract class ExtensionViewModelBase 2 | { 3 | public Description: ExtensionDescriptionViewModel 4 | public ExtensionIdentification: ExtensionIdentificationViewModel 5 | public IsInSettingsMode: KnockoutObservable 6 | 7 | private _model: any 8 | 9 | constructor(extensionSettingsModel: any, extensionIdentification: ExtensionIdentificationViewModel) 10 | { 11 | this._model = extensionSettingsModel 12 | this.Description = new ExtensionDescriptionViewModel(extensionSettingsModel.Description) 13 | this.ExtensionIdentification = extensionIdentification 14 | this.IsInSettingsMode = ko.observable(false) 15 | } 16 | 17 | // methods 18 | public abstract async InitializeAsync(): Promise 19 | 20 | public SendActionRequest = async (instanceId: number, methodName: string, data: any) => 21 | { 22 | return await ConnectionManager.InvokeWebClientHub("RequestAction", new ActionRequest(this.Description.Id, instanceId, methodName, data)) 23 | } 24 | 25 | public ExtendModel(model: any) 26 | { 27 | // 28 | } 29 | 30 | public ToModel() 31 | { 32 | let model: any = { 33 | $type: this._model.$type, 34 | Description: this.Description.ToModel() 35 | } 36 | 37 | this.ExtendModel(model) 38 | 39 | return model 40 | } 41 | 42 | // commands 43 | public EnableSettingsMode = () => 44 | { 45 | this.IsInSettingsMode(true) 46 | } 47 | 48 | public DisableSettingsMode = () => 49 | { 50 | this.IsInSettingsMode(false) 51 | } 52 | 53 | public ToggleSettingsMode = () => 54 | { 55 | this.IsInSettingsMode(!this.IsInSettingsMode()) 56 | } 57 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/ViewModels/Navigation/StartViewModel.ts: -------------------------------------------------------------------------------- 1 | class StartViewModel extends WorkspaceBase 2 | { 3 | constructor(activeProject: KnockoutObservable) 4 | { 5 | super('start', 'Start', 'start.html', activeProject) 6 | } 7 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "lockfileVersion": 1 3 | } 4 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebClient/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outFile": "./../OneDas.Core.WebServer/wwwroot/js/site.js" 5 | }, 6 | "include": [ 7 | "./**/*.ts" 8 | ], 9 | "exclude": [ 10 | "wwwroot", 11 | "./**/*.d.ts" 12 | ] 13 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Core/AuthorizationType.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.WebServer.Core 2 | { 3 | public enum AuthorizationType 4 | { 5 | /// 6 | /// No authorization required. 7 | /// 8 | None = 0, 9 | 10 | /// 11 | /// The OneDAS client must be registered to get authorized. 12 | /// 13 | Registered = 1, 14 | 15 | /// 16 | /// The OneDAS client must own the active status to get authorized. 17 | /// 18 | Active = 2 19 | } 20 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Core/BroadcasterException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.WebServer.Core 4 | { 5 | public class BroadcasterException : Exception 6 | { 7 | public BroadcasterException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Core/LiveViewSubscription.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Core.ProjectManagement; 2 | using System.Collections.Generic; 3 | 4 | namespace OneDas.WebServer.Core 5 | { 6 | public class LiveViewSubscription 7 | { 8 | public LiveViewSubscription(int id, IList channelHubSet) 9 | { 10 | this.Id = id; 11 | this.ChannelHubSet = channelHubSet; 12 | } 13 | 14 | public int Id { get; } 15 | 16 | public IList ChannelHubSet { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Logging/WebClientLogger.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System; 3 | 4 | namespace OneDas.WebServer.Logging 5 | { 6 | public class WebClientLogger : ILogger 7 | { 8 | private string _categoryName; 9 | private Func _filter; 10 | 11 | public WebClientLogger(string categoryName, Func filter) 12 | { 13 | _categoryName = categoryName; 14 | _filter = filter; 15 | } 16 | 17 | public IDisposable BeginScope(TState state) 18 | { 19 | //return _loggerExternalScopeProvider().Push(state); 20 | 21 | return null; 22 | } 23 | 24 | public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) 25 | { 26 | if (this.IsEnabled(logLevel)) 27 | { 28 | switch (_categoryName) 29 | { 30 | case "Nuget": 31 | AdvancedBootloader.ClientPushService?.SendNugetMessage(formatter(state, exception)); 32 | break; 33 | 34 | default: 35 | AdvancedBootloader.ClientPushService?.SendClientMessage($"{ _categoryName }: { formatter(state, exception) }"); 36 | break; 37 | } 38 | } 39 | } 40 | 41 | public bool IsEnabled(LogLevel logLevel) 42 | { 43 | return _filter == null || _filter(_categoryName, logLevel); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Logging/WebClientLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System; 3 | 4 | namespace OneDas.WebServer.Logging 5 | { 6 | public class WebClientLoggerProvider : ILoggerProvider 7 | { 8 | private Func _filter; 9 | 10 | public WebClientLoggerProvider(Func filter) 11 | { 12 | _filter = filter; 13 | } 14 | 15 | public ILogger CreateLogger(string categoryName) 16 | { 17 | return new WebClientLogger(categoryName, _filter); 18 | } 19 | 20 | public void Dispose() 21 | { 22 | // 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "OneDas.WebServer": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "ASPNETCORE_ENVIRONMENT": "Development" 7 | }, 8 | "nativeDebugging": true 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Resources/NetworkIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/Resources/NetworkIcon.ico -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Hubs/ConsoleHub.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.SignalR; 2 | using OneDas.Core.Engine; 3 | using System.Threading.Tasks; 4 | 5 | namespace OneDas.WebServer.Web 6 | { 7 | public class ConsoleHub : Hub 8 | { 9 | OneDasEngine _oneDasEngine; 10 | 11 | public ConsoleHub(OneDasEngine oneDasEngine) 12 | { 13 | _oneDasEngine = oneDasEngine; 14 | } 15 | 16 | public Task GetPerformanceInformation() 17 | { 18 | return Task.Run(() => 19 | { 20 | return _oneDasEngine.CreatePerformanceInformation(); 21 | }); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Hubs/IWebClientHub.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Core.Engine; 2 | using OneDas.Extensibility; 3 | using OneDas.PackageManagement; 4 | using OneDas.ProjectManagement; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Threading.Tasks; 8 | 9 | namespace OneDas.WebServer.Web 10 | { 11 | public interface IWebClientHub 12 | { 13 | Task SendWebServerOptionsLight(WebServerOptionsLight webServerOptionsLight); 14 | Task SendOneDasState(OneDasState oneDasState); 15 | Task SendActiveProject(OneDasProjectSettings projectSettings); 16 | Task SendPerformanceInformation(OneDasPerformanceInformation performanceInformation); 17 | Task SendDataSnapshot(DateTime dateTime, IEnumerable dataSnapshot); 18 | Task SendLiveViewData(int subscriptionId, DateTime dateTime, IEnumerable dataSnapshot); 19 | Task SendClientMessage(string message); 20 | Task SendNugetMessage(string message); 21 | Task SendInstalledPackages(List packageMetadata); 22 | Task SendExtensionIdentifications(List dataGatewayExtensionIdentificationSet, List dataWriterExtensionIdentificationSet); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Models/WebServerOptionsLight.cs: -------------------------------------------------------------------------------- 1 | using OneDas.PackageManagement; 2 | using System.Collections.Generic; 3 | 4 | namespace OneDas.WebServer.Web 5 | { 6 | public class WebServerOptionsLight 7 | { 8 | public string OneDasName; 9 | public string AspBaseUrl; 10 | public string BaseDirectoryPath; 11 | public List PackageSourceSet; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Pages/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page 2 | @model IndexModel 3 | 4 | 5 |
6 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Pages/Index.cshtml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.RazorPages; 2 | 3 | namespace OneDas.WebServer.Web.Pages 4 | { 5 | public class IndexModel : PageModel 6 | { 7 | public void OnGet() 8 | { 9 | 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Pages/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using OneDas.WebServer 2 | @namespace OneDas.WebServer.Web.Pages 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/Web/Pages/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/WebServerUtilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | 5 | namespace OneDas.WebServer 6 | { 7 | public static class WebServerUtilities 8 | { 9 | private static List _mutexSet; 10 | 11 | static WebServerUtilities() 12 | { 13 | _mutexSet = new List(); 14 | } 15 | 16 | public static bool EnsureSingeltonInstance(Guid identifier) 17 | { 18 | string name; 19 | Mutex mutex; 20 | 21 | name = identifier.ToString(); 22 | mutex = new Mutex(true, name); 23 | 24 | _mutexSet.Add(mutex); 25 | 26 | if (mutex.WaitOne(TimeSpan.Zero, true)) 27 | { 28 | mutex.ReleaseMutex(); 29 | return true; 30 | } 31 | else 32 | { 33 | return false; 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optionally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/images/activity_monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/images/activity_monitor.png -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/images/air_port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/images/air_port.png -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/images/chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/images/chart.png -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/images/console_stripes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/images/console_stripes.png -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/images/loading.gif -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/images/network_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/images/network_icon.png -------------------------------------------------------------------------------- /src/OneDas.Core.WebServer/wwwroot/images/terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OneDAS-Group/OneDAS-Core/7948d0d635ce22c99ae5d408dff84a44d13012b9/src/OneDas.Core.WebServer/wwwroot/images/terminal.png -------------------------------------------------------------------------------- /src/OneDas.Core/Engine/BufferFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Core.Engine 4 | { 5 | // still unclear if this is useful 6 | [Flags] 7 | public enum BufferFlags 8 | { 9 | IsValid = 0, // data are fully valid 10 | WithinLagTolerance = 1, // data were collected within 2 x sample rate [drawback: no gain of information] 11 | NoSync = 2 // time not synchronized 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/OneDas.Core/Engine/OneDasPerformanceInformation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace OneDas.Core.Engine 5 | { 6 | public struct OneDasPerformanceInformation 7 | { 8 | #region "Contructors" 9 | 10 | public OneDasPerformanceInformation(DateTime dateTime, OneDasState oneDasState, ProcessPriorityClass processPriorityClass, double lateBy, double cycleTime, double timerDrift, float cpuTime, int upTime, long freeDiskSpace, long totalDiskSize) 11 | { 12 | this.DateTime = dateTime; 13 | this.OneDasState = oneDasState; 14 | this.ProcessPriorityClass = processPriorityClass; 15 | this.LateBy = lateBy; 16 | this.CycleTime = cycleTime; 17 | this.TimerDrift = timerDrift; 18 | this.CpuTime = cpuTime; 19 | this.UpTime = upTime; 20 | this.FreeDiskSpace = freeDiskSpace; 21 | this.TotalDiskSize = totalDiskSize; 22 | } 23 | 24 | #endregion 25 | 26 | #region "Properties" 27 | 28 | public DateTime DateTime { get; set; } 29 | public OneDasState OneDasState { get; set; } 30 | public ProcessPriorityClass ProcessPriorityClass { get; set; } 31 | public double LateBy { get; set; } 32 | public double CycleTime { get; set; } 33 | public double TimerDrift { get; set; } 34 | public float CpuTime { get; set; } 35 | public int UpTime { get; set; } 36 | public long FreeDiskSpace { get; set; } 37 | public long TotalDiskSize { get; set; } 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /src/OneDas.Core/Engine/OneDasStateChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Core.Engine 4 | { 5 | public class OneDasStateChangedEventArgs : EventArgs 6 | { 7 | public OneDasStateChangedEventArgs(OneDasState oldState, OneDasState newState) 8 | { 9 | this.OldState = oldState; 10 | this.NewState = newState; 11 | } 12 | 13 | public OneDasState OldState { get; set; } 14 | public OneDasState NewState { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/OneDas.Core/Engine/StorageContext.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Buffers; 2 | using OneDas.Extensibility; 3 | using System.Collections.Generic; 4 | 5 | namespace OneDas.Core.Engine 6 | { 7 | public class StorageContext 8 | { 9 | public StorageContext(List buffers, DataGatewayExtensionLogicBase dataGateway, DataPort dataPort) 10 | { 11 | this.Buffers = buffers; 12 | this.DataGateway = dataGateway; 13 | this.DataPort = dataPort; 14 | } 15 | 16 | public List Buffers { get; private set; } 17 | public DataGatewayExtensionLogicBase DataGateway { get; private set; } 18 | public DataPort DataPort { get; private set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/OneDas.Core/EngineUtilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace OneDas.Core 5 | { 6 | public static class EngineUtilities 7 | { 8 | public static Exception UnwrapException(Exception exception) 9 | { 10 | if (exception is TargetInvocationException || exception is AggregateException) 11 | { 12 | return exception.InnerException; 13 | } 14 | 15 | return exception; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/OneDas.Core/OneDas.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Encapsulates the core functionality of OneDAS. 5 | OneDAS data aquisition measurement extension engine 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | ErrorMessage.resx 22 | True 23 | True 24 | 25 | 26 | 27 | 28 | 29 | OneDas.Core 30 | ErrorMessage.Designer.cs 31 | ResXFileCodeGenerator 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/OneDas.Core/OneDasDependencyInjectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using OneDas; 2 | using OneDas.Core.Engine; 3 | using OneDas.Core.Serialization; 4 | using OneDas.Extensibility; 5 | using OneDas.PackageManagement; 6 | using OneDas.Infrastructure; 7 | using System; 8 | 9 | namespace Microsoft.Extensions.DependencyInjection 10 | { 11 | public static class OneDasDependencyInjectionExtensions 12 | { 13 | public static void AddOneDas(this IServiceCollection serviceCollection) 14 | { 15 | serviceCollection.AddOneDas(oneDasOptions => { }); 16 | } 17 | 18 | public static void AddOneDas(this IServiceCollection serviceCollection, Action configure) 19 | { 20 | // options 21 | serviceCollection.Configure(configure); 22 | 23 | // common 24 | serviceCollection.AddLogging(); 25 | serviceCollection.AddOptions(); 26 | 27 | // engine 28 | serviceCollection.AddSingleton(typeof(IOneDasSerializer), typeof(OneDasSerializer)); 29 | serviceCollection.AddSingleton(typeof(IOneDasProjectSerializer), typeof(OneDasProjectSerializer)); 30 | serviceCollection.AddSingleton(typeof(IExtensionFactory), typeof(ExtensionFactory)); 31 | serviceCollection.AddSingleton(); 32 | 33 | // package manager 34 | serviceCollection.AddSingleton(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/OneDas.Core/ProjectManagement/ChannelHubBase.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using OneDas.Extensibility; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics.Contracts; 6 | using OneDas.ProjectManagement; 7 | 8 | namespace OneDas.Core.ProjectManagement 9 | { 10 | public abstract class ChannelHubBase 11 | { 12 | #region "Constructors" 13 | 14 | public ChannelHubBase(ChannelHubSettings channelHubSettings) 15 | { 16 | this.Settings = channelHubSettings; 17 | 18 | this.AssociatedDataOutputSet = new List(); 19 | } 20 | 21 | #endregion 22 | 23 | #region "Properties" 24 | 25 | public ChannelHubSettings Settings { get; } 26 | 27 | public DataPort AssociatedDataInput { get; protected set; } 28 | 29 | public List AssociatedDataOutputSet { get; } 30 | 31 | #endregion 32 | 33 | #region "Methods" 34 | 35 | public void SetAssociation(DataPort dataPort) 36 | { 37 | Contract.Requires(dataPort != null); 38 | 39 | switch (dataPort.DataDirection) 40 | { 41 | case DataDirection.Input: 42 | 43 | this.AssociatedDataInput = dataPort; 44 | 45 | break; 46 | 47 | case DataDirection.Output: 48 | 49 | this.AssociatedDataOutputSet.Add(dataPort); 50 | 51 | break; 52 | 53 | default: 54 | throw new NotImplementedException(); 55 | } 56 | } 57 | 58 | public abstract object GetValue(); 59 | 60 | #endregion 61 | } 62 | } -------------------------------------------------------------------------------- /src/OneDas.Core/SafeNativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace OneDas.Core 5 | { 6 | public static class SafeNativeMethods 7 | { 8 | // Mulitmedia timer 9 | [DllImport("winmm.dll", EntryPoint = "timeBeginPeriod")] 10 | public static extern uint TimeBeginPeriod(uint milliseconds); 11 | 12 | [DllImport("winmm.dll", EntryPoint = "timeEndPeriod")] 13 | public static extern uint TimeEndPeriod(uint milliseconds); 14 | 15 | [DllImport("ntdll.dll")] 16 | public static extern int NtQueryTimerResolution(ref uint minimumResolution, ref uint maximumResolution, ref uint currentResolution); 17 | 18 | [DllImport("ntdll.dll")] 19 | public static extern int NtSetTimerResolution(uint desiredResolution, bool setResolution, ref uint currentResolution); 20 | 21 | 22 | // Thread 23 | [DllImport("kernel32.dll")] 24 | public static extern ExecutionState SetThreadExecutionState(ExecutionState esFlags); 25 | 26 | [DllImport("kernel32.dll")] 27 | public static extern int SetThreadPriority(IntPtr hThread, UnmanagedThreadPriority nPriority); 28 | 29 | [DllImport("kernel32.dll")] 30 | public static extern IntPtr GetCurrentThread(); 31 | 32 | [DllImport("Kernel32.dll")] 33 | public static extern int GetCurrentThreadId(); 34 | } 35 | 36 | [Flags] 37 | public enum ExecutionState : uint 38 | { 39 | CONTINUOUS = 0x80000000u, 40 | DISPLAY_REQUIRED = 0x2u, 41 | SYSTEM_REQUIRED = 0x1u 42 | } 43 | 44 | public enum UnmanagedThreadPriority 45 | { 46 | THREAD_PRIORITY_LOWEST = -2, 47 | THREAD_PRIORITY_BELOW_NORMAL = -1, 48 | THREAD_PRIORITY_NORMAL = 0, 49 | THREAD_PRIORITY_ABOVE_NORMAL = 1, 50 | THREAD_PRIORITY_HIGHEST = 2, 51 | THREAD_PRIORITY_TIME_CRITICAL = 15 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/OneDas.Core/Serialization/IOneDasProjectSerializer.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using OneDas.ProjectManagement; 3 | 4 | namespace OneDas.Core.Serialization 5 | { 6 | public interface IOneDasProjectSerializer 7 | { 8 | void Save(OneDasProjectSettings projectSettings, string filePath); 9 | 10 | OneDasProjectSettings Load(string filePath); 11 | 12 | OneDasProjectDescription GetProjectDescriptionFromFile(string filePath); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/OneDas.Core/Serialization/KnownTypesBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json.Serialization; 3 | 4 | namespace OneDas.Core.Serialization 5 | { 6 | public class KnownTypesBinder : ISerializationBinder 7 | { 8 | public Type BindToType(string assemblyName, string typeName) 9 | { 10 | return SerializationHelper.GetType(typeName); 11 | } 12 | 13 | public void BindToName(Type serializedType, out string assemblyName, out string typeName) 14 | { 15 | assemblyName = serializedType.Assembly.GetName().Name; 16 | typeName = serializedType.FullName; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/OneDas.Core/Serialization/OneDasSerializer.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using OneDas.Infrastructure; 4 | 5 | namespace OneDas.Core.Serialization 6 | { 7 | public class OneDasSerializer : IOneDasSerializer 8 | { 9 | private JsonSerializer _jsonSerializer; 10 | private JsonSerializerSettings _jsonSerializerSettings; 11 | 12 | public OneDasSerializer() 13 | { 14 | _jsonSerializerSettings = SerializationHelper.CreateDefaultSerializationSettings(); 15 | _jsonSerializerSettings.Formatting = Formatting.Indented; 16 | 17 | _jsonSerializer = JsonSerializer.Create(_jsonSerializerSettings); 18 | } 19 | 20 | public string Serialize(object value) 21 | { 22 | return JsonConvert.SerializeObject(value, _jsonSerializerSettings); 23 | } 24 | 25 | public T Deserialize(object jObject) 26 | { 27 | return ((JObject)jObject).ToObject(_jsonSerializer); 28 | } 29 | 30 | public T Deserialize(string rawJson) 31 | { 32 | JObject jObject; 33 | 34 | jObject = JObject.Parse(rawJson); 35 | 36 | return jObject.ToObject(_jsonSerializer); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/OneDas.Core/Serialization/SerializationHelper.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace OneDas.Core.Serialization 5 | { 6 | internal static class SerializationHelper 7 | { 8 | private static JsonSerializer _jsonSerializer; 9 | 10 | public static JsonSerializer JsonSerializer 11 | { 12 | get 13 | { 14 | if (_jsonSerializer == null) 15 | { 16 | _jsonSerializer = JsonSerializer.Create(SerializationHelper.CreateDefaultSerializationSettings()); 17 | } 18 | 19 | return _jsonSerializer; 20 | } 21 | set 22 | { 23 | _jsonSerializer = value; 24 | } 25 | } 26 | 27 | public static JsonSerializerSettings CreateDefaultSerializationSettings() 28 | { 29 | return new JsonSerializerSettings() 30 | { 31 | TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple, 32 | TypeNameHandling = TypeNameHandling.Auto, 33 | SerializationBinder = new KnownTypesBinder(), 34 | ContractResolver = new ConstructorlessContractResolver() 35 | }; 36 | } 37 | 38 | public static Type GetType(string typeName) 39 | { 40 | Type type = Type.GetType(typeName); 41 | 42 | if (type != null) 43 | { 44 | return type; 45 | } 46 | 47 | foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) 48 | { 49 | type = assembly.GetType(typeName); 50 | 51 | if (type != null) 52 | { 53 | return type; 54 | } 55 | } 56 | 57 | return null; 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /src/OneDas.PackageManagement/OneDas.PackageManagement.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Provides a basic NuGet-based package management system for OneDAS application parts. 5 | OneDAS data aquisition measurement 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/OneDas.PackageManagement/OneDasDeleteOnRestartManager.cs: -------------------------------------------------------------------------------- 1 | using NuGet.PackageManagement; 2 | using NuGet.Packaging.Core; 3 | using NuGet.ProjectManagement; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace OneDas.PackageManagement 8 | { 9 | public class OneDasDeleteOnRestartManager : IDeleteOnRestartManager 10 | { 11 | #pragma warning disable 0067 12 | 13 | public event EventHandler PackagesMarkedForDeletionFound; 14 | 15 | #pragma warning restore 0067 16 | 17 | public void CheckAndRaisePackageDirectoriesMarkedForDeletion() 18 | { 19 | // 20 | } 21 | 22 | public void DeleteMarkedPackageDirectories(INuGetProjectContext projectContext) 23 | { 24 | // 25 | } 26 | 27 | public void MarkPackageDirectoryForDeletion(PackageIdentity package, string packageDirectory, INuGetProjectContext projectContext) 28 | { 29 | // 30 | } 31 | 32 | public IReadOnlyList GetPackageDirectoriesMarkedForDeletion() 33 | { 34 | return new List(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/OneDas.PackageManagement/OneDasNugetProject.cs: -------------------------------------------------------------------------------- 1 | using NuGet.ProjectManagement.Projects; 2 | 3 | namespace OneDas.PackageManagement 4 | { 5 | public class OneDasNugetProject : ProjectJsonNuGetProject 6 | { 7 | #region "Constructors" 8 | 9 | public OneDasNugetProject(string projectFilePath) : base(projectFilePath, projectFilePath) 10 | { 11 | // 12 | } 13 | 14 | #endregion 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/OneDas.Types/Assembly.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("OneDas.Core")] -------------------------------------------------------------------------------- /src/OneDas.Types/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("OneDas.DataManagement.Explorer.Tests")] -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/BufferRequest.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Buffers 5 | { 6 | [DataContract] 7 | public class BufferRequest 8 | { 9 | public BufferRequest() 10 | { 11 | // 12 | } 13 | 14 | [DataMember] 15 | public SampleRate SampleRate { get; private set; } 16 | 17 | [DataMember] 18 | public string GroupFilter { get; private set; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/BufferType.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Buffers 2 | { 3 | public enum BufferType 4 | { 5 | Simple = 1, 6 | Extended = 2 7 | } 8 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/ExtendedBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Buffers; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace OneDas.Buffers 6 | { 7 | internal class ExtendedBuffer : ExtendedBufferBase where T : unmanaged 8 | { 9 | #region Fields 10 | 11 | private IMemoryOwner _buffer; 12 | 13 | #endregion 14 | 15 | #region Constructors 16 | 17 | public ExtendedBuffer(int length) : base(length) 18 | { 19 | _buffer = MemoryPool.Shared.Rent(length); 20 | MemoryMarshal.AsBytes(_buffer.Memory.Span).Fill(0); 21 | 22 | this.ElementSize = OneDasUtilities.SizeOf(typeof(T)); 23 | } 24 | 25 | #endregion 26 | 27 | #region Properties 28 | 29 | public override int ElementSize { get; } 30 | 31 | public override Span RawBuffer => MemoryMarshal.Cast(_buffer.Memory.Span); 32 | 33 | public Span Buffer => _buffer.Memory.Span; 34 | 35 | #endregion 36 | 37 | #region Methods 38 | 39 | public override ISimpleBuffer ToSimpleBuffer() 40 | { 41 | return new SimpleBuffer(BufferUtilities.ApplyDatasetStatus(this.Buffer, this.StatusBuffer)); 42 | } 43 | 44 | public override void Clear() 45 | { 46 | this.Buffer.Clear(); 47 | base.Clear(); 48 | } 49 | 50 | protected override void Dispose(bool disposing) 51 | { 52 | if (disposing) 53 | _buffer.Dispose(); 54 | 55 | base.Dispose(disposing); 56 | } 57 | 58 | #endregion 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/ExtendedBufferBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Buffers; 3 | 4 | namespace OneDas.Buffers 5 | { 6 | internal abstract class ExtendedBufferBase : IExtendedBuffer 7 | { 8 | #region Fields 9 | 10 | private IMemoryOwner _statusBuffer; 11 | 12 | #endregion 13 | 14 | #region Constructors 15 | 16 | public ExtendedBufferBase(int length) 17 | { 18 | _statusBuffer = MemoryPool.Shared.Rent(length); 19 | _statusBuffer.Memory.Span.Fill(0); 20 | } 21 | 22 | #endregion 23 | 24 | #region Properties 25 | 26 | public BufferType Type => BufferType.Extended; 27 | 28 | public Span StatusBuffer => _statusBuffer.Memory.Span; 29 | 30 | public abstract int ElementSize { get; } 31 | 32 | public abstract Span RawBuffer { get; } 33 | 34 | #endregion 35 | 36 | #region Methods 37 | 38 | public abstract ISimpleBuffer ToSimpleBuffer(); 39 | 40 | public virtual void Clear() 41 | { 42 | this.StatusBuffer.Clear(); 43 | } 44 | 45 | #endregion 46 | 47 | #region IDisposable Support 48 | 49 | private bool disposedValue = false; 50 | 51 | protected virtual void Dispose(bool disposing) 52 | { 53 | if (!disposedValue) 54 | { 55 | if (disposing) 56 | _statusBuffer.Dispose(); 57 | 58 | disposedValue = true; 59 | } 60 | } 61 | 62 | public void Dispose() 63 | { 64 | Dispose(true); 65 | } 66 | 67 | #endregion 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/IBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Buffers 4 | { 5 | public interface IBuffer : IDisposable 6 | { 7 | #region Properties 8 | 9 | int ElementSize { get; } 10 | 11 | Span RawBuffer { get; } 12 | 13 | BufferType Type { get; } 14 | 15 | #endregion 16 | 17 | #region Methods 18 | 19 | ISimpleBuffer ToSimpleBuffer(); 20 | 21 | void Clear(); 22 | 23 | #endregion 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/IExtendedBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Buffers 4 | { 5 | public interface IExtendedBuffer : IBuffer 6 | { 7 | Span StatusBuffer { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/ISimpleBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Buffers 4 | { 5 | public interface ISimpleBuffer : IBuffer 6 | { 7 | Span Buffer { get; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/OneDas.Types/Buffers/SimpleBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace OneDas.Buffers 5 | { 6 | internal class SimpleBuffer : ISimpleBuffer 7 | { 8 | #region Fields 9 | 10 | private Memory _buffer; 11 | 12 | #endregion 13 | 14 | #region Constructors 15 | 16 | public SimpleBuffer(double[] data) 17 | { 18 | _buffer = new Memory(data); 19 | } 20 | 21 | #endregion 22 | 23 | #region Properties 24 | 25 | public int ElementSize => 8; 26 | 27 | public BufferType Type => BufferType.Simple; 28 | 29 | public Span RawBuffer => MemoryMarshal.Cast(_buffer.Span); 30 | 31 | public Span Buffer => _buffer.Span; 32 | 33 | #endregion 34 | 35 | #region Methods 36 | 37 | public ISimpleBuffer ToSimpleBuffer() 38 | { 39 | return this; 40 | } 41 | 42 | public void Clear() 43 | { 44 | this.Buffer.Clear(); 45 | } 46 | 47 | #endregion 48 | 49 | #region IDisposable Support 50 | 51 | private bool disposedValue = false; 52 | 53 | protected virtual void Dispose(bool disposing) 54 | { 55 | if (!disposedValue) 56 | { 57 | if (disposing) 58 | { 59 | // 60 | } 61 | 62 | disposedValue = true; 63 | } 64 | } 65 | 66 | public void Dispose() 67 | { 68 | Dispose(true); 69 | } 70 | 71 | #endregion 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/OneDas.Types/DateTimeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas 4 | { 5 | public static class DateTimeExtensions 6 | { 7 | public static string ToISO8601(this DateTime dateTime) 8 | { 9 | return dateTime.ToUniversalTime().ToString("yyyy-MM-ddTHH-mm-ssZ"); 10 | } 11 | 12 | public static DateTime RoundUp(this DateTime dateTime, TimeSpan timeSpan) 13 | { 14 | return new DateTime(dateTime.Ticks + timeSpan.Ticks - (dateTime.Ticks % timeSpan.Ticks), dateTime.Kind); 15 | } 16 | 17 | public static DateTime RoundDown(this DateTime dateTime, TimeSpan timeSpan) 18 | { 19 | return new DateTime(dateTime.Ticks - (dateTime.Ticks % timeSpan.Ticks), dateTime.Kind); 20 | } 21 | 22 | public static DateTime Round(this DateTime dateTime, TimeSpan timeSpan) 23 | { 24 | return new DateTime(Convert.ToInt64(Math.Truncate((double)(dateTime.Ticks + (timeSpan.Ticks / 2) + 1) / timeSpan.Ticks)) * timeSpan.Ticks, dateTime.Kind); 25 | // Return New DateTime(CLng(Math.Round(DateTime.Ticks / TimeSpan.Ticks, 0, MidpointRounding.AwayFromZero) * TimeSpan.Ticks)) ' maybe better alternative: round(X / N) * N 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/OneDas.Types/ExceptionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Types 4 | { 5 | public static class ExceptionExtensions 6 | { 7 | public static string GetFullMessage(this Exception ex, bool includeStackTrace = true) 8 | { 9 | if (includeStackTrace) 10 | return $"{ex.InternalGetFullMessage()} - stack trace: {ex.StackTrace}"; 11 | else 12 | return ex.InternalGetFullMessage(); 13 | } 14 | 15 | private static string InternalGetFullMessage(this Exception ex) 16 | { 17 | return ex.InnerException == null 18 | ? ex.Message 19 | : ex.Message + " --> " + ex.InnerException.GetFullMessage(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ActionRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extensibility 5 | { 6 | [DataContract] 7 | public class ActionRequest 8 | { 9 | public ActionRequest(string extensionId, int instanceId, string methodName, object data) 10 | { 11 | this.ExtensionId = extensionId; 12 | this.InstanceId = instanceId; 13 | this.MethodName = methodName; 14 | this.Data = data; 15 | } 16 | 17 | 18 | [DataMember] 19 | public string ExtensionId { get; private set; } 20 | 21 | [DataMember] 22 | public int InstanceId { get; private set; } 23 | 24 | [DataMember] 25 | public string MethodName { get; private set; } 26 | 27 | [DataMember] 28 | public object Data { get; private set; } 29 | 30 | public void Validate() 31 | { 32 | string errorMessage; 33 | 34 | if (!OneDasUtilities.CheckNamingConvention(this.ExtensionId, out errorMessage, includeValue: true)) 35 | { 36 | throw new Exception($"The extension ID is invalid: { errorMessage }"); 37 | } 38 | 39 | if (this.InstanceId < 0) 40 | { 41 | throw new Exception(ErrorMessage.ActionRequest_InstanceIdInvalid); 42 | } 43 | 44 | if (!OneDasUtilities.CheckNamingConvention(this.MethodName, out errorMessage, includeValue: true)) 45 | { 46 | throw new Exception($"The method name is invalid: { errorMessage }"); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ActionResponse.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extensibility 2 | { 3 | public class ActionResponse 4 | { 5 | public ActionResponse(object data) 6 | { 7 | this.Data = data; 8 | } 9 | 10 | public object Data { get; private set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataGateway/DataGatewayContext.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extensibility 2 | { 3 | public class DataGatewayContext 4 | { 5 | public DataGatewayContext() 6 | { 7 | // 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataGateway/DataGatewayExtensionSettingsBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extensibility 5 | { 6 | [DataContract] 7 | public abstract class DataGatewayExtensionSettingsBase : ExtensionSettingsBase 8 | { 9 | #region "Constructors 10 | 11 | public DataGatewayExtensionSettingsBase() 12 | { 13 | // 14 | } 15 | 16 | #endregion 17 | 18 | #region "Properties" 19 | 20 | [DataMember] 21 | public int MaximumDatasetAge { get; private set; } 22 | 23 | #endregion 24 | 25 | #region "Methods" 26 | 27 | public override void Validate() 28 | { 29 | base.Validate(); 30 | 31 | #warning: implement general frame rate divider setting 32 | //if (this.FrameRateDivider < 1 || this.FrameRateDivider > oneDasOptions.NativeSampleRate) 33 | //{ 34 | // throw new Exception(ErrorMessage.UdpModel_FrameRateDividerInvalid); 35 | //} 36 | 37 | if (this.MaximumDatasetAge < 0 || this.MaximumDatasetAge > 10000) 38 | throw new Exception(ErrorMessage.DataReaderExtensionSettingsBase_MaximumDatasetAgeInvalid); 39 | } 40 | 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataGateway/DataPort.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace OneDas.Extensibility 6 | { 7 | [DataContract] 8 | public class DataPort 9 | { 10 | public DataPort(string name, OneDasDataType dataType, DataDirection dataDirection, Endianness endianness) 11 | { 12 | this.Name = name; 13 | this.DataType = dataType; 14 | this.DataDirection = dataDirection; 15 | this.Endianness = endianness; 16 | 17 | this.BitOffset = -1; // i.e. bool is treated as byte-oriented 18 | } 19 | 20 | // properties 21 | [DataMember] 22 | public string Name { get; private set; } 23 | 24 | [DataMember] 25 | public OneDasDataType DataType { get; private set; } 26 | 27 | [DataMember] 28 | public DataDirection DataDirection { get; private set; } 29 | 30 | [DataMember] 31 | public Endianness Endianness { get; private set; } 32 | 33 | public DataGatewayExtensionLogicBase AssociatedDataGateway { get; set; } 34 | public IntPtr DataPtr { get; set; } 35 | public int BitOffset { get; set; } 36 | 37 | // methods 38 | public virtual string GetId() 39 | { 40 | return this.Name; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataGateway/ExtendedDataGatewayExtensionSettingsBase.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Serialization; 5 | 6 | namespace OneDas.Extensibility 7 | { 8 | [DataContract] 9 | public abstract class ExtendedDataGatewayExtensionSettingsBase : DataGatewayExtensionSettingsBase 10 | { 11 | #region "Constructors" 12 | 13 | public ExtendedDataGatewayExtensionSettingsBase() 14 | { 15 | this.ModuleSet = new List(); 16 | } 17 | 18 | #endregion 19 | 20 | #region "Properties" 21 | 22 | [DataMember] 23 | public List ModuleSet { get; set; } 24 | 25 | #endregion 26 | 27 | #region "Methods" 28 | 29 | public List GetInputModuleSet() 30 | { 31 | return this.ModuleSet.Where(module => module.DataDirection == DataDirection.Input).ToList(); 32 | } 33 | 34 | public List GetOutputModuleSet() 35 | { 36 | return this.ModuleSet.Where(module => module.DataDirection == DataDirection.Output).ToList(); 37 | } 38 | 39 | #endregion 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataGateway/IReferenceClock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Extensibility 4 | { 5 | public interface IReferenceClock 6 | { 7 | DateTime GetUtcDateTime(); 8 | long GetTimerDrift(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataGateway/OneDasModule.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace OneDas.Extensibility 6 | { 7 | [DataContract] 8 | public class OneDasModule 9 | { 10 | #region "Constructors" 11 | 12 | public OneDasModule(OneDasDataType dataType, DataDirection dataDirection, Endianness endianness, int size) 13 | { 14 | this.DataType = dataType; 15 | this.DataDirection = dataDirection; 16 | this.Endianness = endianness; 17 | this.Size = size; 18 | } 19 | 20 | #endregion 21 | 22 | #region "Properties" 23 | 24 | [DataMember] 25 | public OneDasDataType DataType { get; private set; } 26 | 27 | [DataMember] 28 | public DataDirection DataDirection { get; private set; } 29 | 30 | [DataMember] 31 | public Endianness Endianness { get; private set; } 32 | 33 | [DataMember] 34 | public int Size { get; private set; } 35 | 36 | #endregion 37 | 38 | #region "Methods" 39 | 40 | public int GetByteCount(int booleanBitSize = 8) 41 | { 42 | if (this.DataType == OneDasDataType.BOOLEAN) 43 | { 44 | return (int)Math.Ceiling(booleanBitSize * (double)this.Size / 8); 45 | } 46 | else 47 | { 48 | return ((int)this.DataType & 0x0FF) / 8 * this.Size; 49 | } 50 | } 51 | 52 | #endregion 53 | } 54 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/ChannelContext.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Buffers; 2 | using System; 3 | 4 | namespace OneDas.Extensibility 5 | { 6 | public class ChannelContext 7 | { 8 | #region "Constructors" 9 | 10 | public ChannelContext(ChannelDescription channelDescription, IBuffer buffer) 11 | { 12 | this.ChannelDescription = channelDescription; 13 | this.Buffer = buffer; 14 | 15 | if (channelDescription.BufferType != buffer.Type) 16 | throw new ArgumentException(ErrorMessage.ChannelContext_BufferTypeInvalid); 17 | } 18 | 19 | #endregion 20 | 21 | #region "Properties" 22 | 23 | public ChannelDescription ChannelDescription { get; private set; } 24 | 25 | public IBuffer Buffer { get; private set; } 26 | 27 | #endregion 28 | } 29 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/ChannelContextGroup.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace OneDas.Extensibility 6 | { 7 | public class ChannelContextGroup 8 | { 9 | public ChannelContextGroup(SampleRateContainer sampleRate, IList channelContextSet) 10 | { 11 | this.SampleRate = sampleRate; 12 | this.ChannelContextSet = channelContextSet.ToList(); 13 | } 14 | 15 | public SampleRateContainer SampleRate { get; } 16 | public List ChannelContextSet { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/ChannelDescription.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Buffers; 2 | using OneDas.Infrastructure; 3 | using System; 4 | 5 | namespace OneDas.Extensibility 6 | { 7 | public class ChannelDescription 8 | { 9 | #region "Constructors" 10 | 11 | public ChannelDescription(Guid guid, 12 | string channelName, 13 | string datasetName, 14 | string group, 15 | OneDasDataType dataType, 16 | SampleRateContainer sampleRate, 17 | string unit, 18 | BufferType bufferType) 19 | { 20 | this.Guid = guid; 21 | this.ChannelName = channelName; 22 | this.DatasetName = datasetName; 23 | this.Group = group; 24 | this.DataType = dataType; 25 | this.SampleRate = sampleRate; 26 | this.Unit = unit; 27 | this.BufferType = bufferType; 28 | } 29 | 30 | #endregion 31 | 32 | #region "Properties" 33 | 34 | public Guid Guid { get; set; } 35 | 36 | public string ChannelName { get; private set; } 37 | 38 | public string DatasetName { get; private set; } 39 | 40 | public string Group { get; private set; } 41 | 42 | public OneDasDataType DataType { get; set; } 43 | 44 | public SampleRateContainer SampleRate { get; private set; } 45 | 46 | public string Unit { get; private set; } 47 | 48 | public BufferType BufferType { get; set; } 49 | 50 | #endregion 51 | } 52 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/CustomMetadataEntry.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extensibility 2 | { 3 | public class CustomMetadataEntry 4 | { 5 | public CustomMetadataEntry(string key, string value, CustomMetadataEntryLevel customMetadataEntryLevel) 6 | { 7 | this.Key = key; 8 | this.Value = value; 9 | this.CustomMetadataEntryLevel = customMetadataEntryLevel; 10 | } 11 | 12 | public string Key { get; private set; } 13 | public string Value { get; private set; } 14 | public CustomMetadataEntryLevel CustomMetadataEntryLevel { get; private set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/CustomMetadataEntryLevel.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extensibility 2 | { 3 | public enum CustomMetadataEntryLevel 4 | { 5 | File = 1, 6 | Project = 2 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/DataWriterContext.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Infrastructure; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics.Contracts; 5 | using System.Linq; 6 | 7 | namespace OneDas.Extensibility 8 | { 9 | public class DataWriterContext 10 | { 11 | private string errorDescription; 12 | 13 | public DataWriterContext(string systemName, string dataDirectoryPath, OneDasProjectDescription projectDescription, IList customMetadataEntrySet) 14 | { 15 | Contract.Requires(customMetadataEntrySet != null); 16 | 17 | customMetadataEntrySet.ToList().ForEach(customMetaDataEntry => 18 | { 19 | if (!OneDasUtilities.CheckNamingConvention(customMetaDataEntry.Key, out errorDescription)) 20 | throw new ArgumentException($"Argument '{ nameof(customMetadataEntrySet) }', value '{ customMetaDataEntry.Key }': { errorDescription }"); 21 | }); 22 | 23 | this.SystemName = systemName; 24 | this.DataDirectoryPath = dataDirectoryPath; 25 | this.ProjectDescription = projectDescription; 26 | this.CustomMetadataEntrySet = customMetadataEntrySet; 27 | } 28 | 29 | public string SystemName { get; private set; } 30 | 31 | public string DataDirectoryPath { get; private set; } 32 | 33 | public OneDasProjectDescription ProjectDescription { get; private set; } 34 | 35 | public IList CustomMetadataEntrySet { get; private set; } 36 | } 37 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/DataWriterExtensionSettingsBase.cs: -------------------------------------------------------------------------------- 1 | using OneDas.Buffers; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Runtime.Serialization; 5 | 6 | namespace OneDas.Extensibility 7 | { 8 | [DataContract] 9 | public abstract class DataWriterExtensionSettingsBase : ExtensionSettingsBase 10 | { 11 | #region "Constructors 12 | 13 | public DataWriterExtensionSettingsBase() 14 | { 15 | this.FilePeriod = TimeSpan.FromDays(1); 16 | this.BufferRequestSet = new List(); 17 | } 18 | 19 | #endregion 20 | 21 | #region "Properties" 22 | 23 | [DataMember] 24 | public TimeSpan FilePeriod { get; set; } 25 | 26 | [DataMember] 27 | public bool SingleFile { get; set; } 28 | 29 | [DataMember] 30 | public List BufferRequestSet { get; set; } 31 | 32 | #endregion 33 | 34 | #region "Methods" 35 | 36 | public override void Validate() 37 | { 38 | base.Validate(); 39 | 40 | if (this.FilePeriod == TimeSpan.Zero) 41 | throw new Exception(ErrorMessage.DataWriterExtensionSettingsBase_FileGranularityInvalid); 42 | } 43 | 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/DataWriter/DataWriterFormatVersionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Extensibility 4 | { 5 | [AttributeUsage(validOn: AttributeTargets.Class, AllowMultiple = false)] 6 | public class DataWriterFormatVersionAttribute : Attribute 7 | { 8 | public DataWriterFormatVersionAttribute(int formatVersion) 9 | { 10 | this.FormatVersion = formatVersion; 11 | } 12 | 13 | public int FormatVersion { get; private set; } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ExtensionContextAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OneDas.Extensibility 4 | { 5 | [AttributeUsage(validOn: AttributeTargets.Class, AllowMultiple = false)] 6 | public class ExtensionContextAttribute : Attribute 7 | { 8 | public ExtensionContextAttribute(Type logicType) 9 | { 10 | this.LogicType = logicType; 11 | } 12 | 13 | public Type LogicType { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ExtensionDescription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.Contracts; 3 | using System.Runtime.Serialization; 4 | 5 | namespace OneDas.Extensibility 6 | { 7 | [DataContract] 8 | public class ExtensionDescription 9 | { 10 | public ExtensionDescription(string productVersion, string id, bool isEnabled) 11 | { 12 | this.ProductVersion = productVersion; 13 | this.Id = id; 14 | this.IsEnabled = isEnabled; 15 | 16 | this.InstanceName = string.Empty; 17 | } 18 | 19 | [DataMember] 20 | public string ProductVersion { get; private set; } 21 | 22 | [DataMember] 23 | public string Id { get; private set; } 24 | 25 | [DataMember] 26 | public int InstanceId { get; set; } 27 | 28 | [DataMember] 29 | public string InstanceName { get; set; } 30 | 31 | [DataMember] 32 | public bool IsEnabled { get; private set; } 33 | 34 | public void Validate() 35 | { 36 | Contract.Requires(this.ProductVersion != null); 37 | 38 | string errorMessage; 39 | 40 | if (!OneDasUtilities.CheckNamingConvention(this.Id, out errorMessage)) 41 | { 42 | throw new Exception($"The ID is invalid: { errorMessage }"); 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ExtensionIdentificationAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace OneDas.Extensibility 5 | { 6 | [DataContract] 7 | [AttributeUsage(validOn: AttributeTargets.Class, AllowMultiple = false)] 8 | public class ExtensionIdentificationAttribute : Attribute 9 | { 10 | public ExtensionIdentificationAttribute(string id, string name, string description, string relativeViewPath, string relativeViewModelPath) 11 | { 12 | this.Id = id; 13 | this.Name = name; 14 | this.Description = description; 15 | this.ViewResourceName = relativeViewPath; 16 | this.ViewModelResourceName = relativeViewModelPath; 17 | 18 | this.ProductVersion = "N/A"; 19 | } 20 | 21 | [DataMember] 22 | public string ProductVersion { get; set; } 23 | 24 | [DataMember] 25 | public string Id { get; } 26 | 27 | [DataMember] 28 | public string Name { get; } 29 | 30 | [DataMember] 31 | public string Description { get; } 32 | 33 | [DataMember] 34 | public string ViewResourceName { get; } 35 | 36 | [DataMember] 37 | public string ViewModelResourceName { get; } 38 | } 39 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ExtensionLogicBase.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using System; 3 | 4 | namespace OneDas.Extensibility 5 | { 6 | public abstract class ExtensionLogicBase : IDisposable 7 | { 8 | #region Constructors 9 | 10 | public ExtensionLogicBase(ExtensionSettingsBase settings, ILogger logger) 11 | { 12 | this.Settings = settings; 13 | this.Settings.Validate(); 14 | 15 | this.Logger = logger; 16 | 17 | this.DisplayName = $"{ settings.Description.Id } ({ settings.Description.InstanceId })"; 18 | } 19 | 20 | #endregion 21 | 22 | #region Properties 23 | 24 | public string DisplayName { get; } 25 | 26 | public ExtensionSettingsBase Settings { get; } 27 | 28 | protected ILogger Logger { get; } 29 | 30 | #endregion 31 | 32 | #region Methods 33 | 34 | // don't force inherited classes to overwrite this 35 | protected virtual void FreeManagedResources() 36 | { 37 | // 38 | } 39 | 40 | protected virtual void FreeUnmanagedResources() 41 | { 42 | // 43 | } 44 | 45 | #endregion 46 | 47 | #region IDisposable Support 48 | 49 | private bool hasDisposed = false; 50 | 51 | protected void Dispose(bool disposing) 52 | { 53 | if (!hasDisposed) 54 | { 55 | if (disposing) 56 | { 57 | this.FreeManagedResources(); 58 | } 59 | 60 | this.FreeUnmanagedResources(); 61 | 62 | hasDisposed = true; 63 | } 64 | } 65 | 66 | ~ExtensionLogicBase() 67 | { 68 | this.Dispose(false); 69 | } 70 | 71 | public void Dispose() 72 | { 73 | this.Dispose(true); 74 | GC.SuppressFinalize(this); 75 | } 76 | 77 | #endregion 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ExtensionSettingsBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Runtime.Serialization; 4 | 5 | namespace OneDas.Extensibility 6 | { 7 | [DataContract] 8 | public abstract class ExtensionSettingsBase 9 | { 10 | #region "Constructors" 11 | 12 | public ExtensionSettingsBase() 13 | { 14 | ExtensionIdentificationAttribute extensionIdentificationAttribute; 15 | 16 | if (!this.GetType().IsDefined(typeof(ExtensionContextAttribute), false)) 17 | throw new Exception(ErrorMessage.ExtensionSettingsBase_ExtensionContextAttributeNotDefined); 18 | 19 | if (!this.GetType().IsDefined(typeof(ExtensionIdentificationAttribute), false)) 20 | throw new Exception(ErrorMessage.ExtensionSettingsBase_ExtensionDescriptionAttributeNotDefined); 21 | 22 | extensionIdentificationAttribute = this.GetType().GetFirstAttribute(); 23 | 24 | this.Description = new ExtensionDescription(FileVersionInfo.GetVersionInfo(this.GetType().Assembly.Location).ProductVersion, extensionIdentificationAttribute.Id, true); 25 | } 26 | 27 | #endregion 28 | 29 | #region "Properties" 30 | 31 | [DataMember] 32 | public ExtensionDescription Description { get; set; } 33 | 34 | #endregion 35 | 36 | #region "Methods" 37 | 38 | public virtual void Validate() 39 | { 40 | this.Description.Validate(); 41 | } 42 | 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/ExtensionSupporterAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.Contracts; 3 | 4 | namespace OneDas.Extensibility 5 | { 6 | [AttributeUsage(validOn: AttributeTargets.Class, AllowMultiple = false)] 7 | public class ExtensionSupporterAttribute : Attribute 8 | { 9 | public ExtensionSupporterAttribute(Type type) 10 | { 11 | Contract.Requires(type != null); 12 | 13 | this.Type = type; 14 | } 15 | 16 | public Type Type { get; private set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/IExtensionFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace OneDas.Extensibility 6 | { 7 | public interface IExtensionFactory 8 | { 9 | #region "Hive" 10 | 11 | Type GetSettings(string id); 12 | 13 | Type GetLogic(string id); 14 | 15 | IEnumerable Get(); 16 | 17 | IEnumerable GetIdentifications() where TExtensionSettings : ExtensionSettingsBase; 18 | 19 | void ScanAssembly(Assembly assembly); 20 | 21 | void Add(Type type); 22 | 23 | void AddRange(IEnumerable typeSet); 24 | 25 | void Clear(); 26 | 27 | #endregion 28 | 29 | #region "Factory" 30 | 31 | IExtensionSupporter BuildSupporter(Type settingsType); 32 | 33 | IExtensionSupporter TryBuildSupporter(Type settingsType); 34 | 35 | TExtensionLogic BuildLogic(ExtensionSettingsBase settings, params object[] args) where TExtensionLogic : ExtensionLogicBase; 36 | 37 | #endregion 38 | 39 | #region "Helper" 40 | 41 | ActionResponse HandleActionRequest(ActionRequest actionRequest); 42 | 43 | string GetStringResource(string id, string resourceName); 44 | 45 | #endregion 46 | } 47 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Extensibility/IExtensionSupporter.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Extensibility 2 | { 3 | public interface IExtensionSupporter 4 | { 5 | void Initialize(); 6 | ActionResponse HandleActionRequest(ActionRequest actionRequest); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/OneDas.Types/Infrastructure/DataDirection.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Infrastructure 2 | { 3 | /// 4 | /// Specifies the data direction of the OneDAS data. 5 | /// 6 | public enum DataDirection 7 | { 8 | /// 9 | /// This is an input to measure data. 10 | /// 11 | Input = 1, 12 | 13 | /// 14 | /// This is an output for system control. 15 | /// 16 | Output = 2 17 | } 18 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Infrastructure/Endianness.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Infrastructure 2 | { 3 | public enum Endianness 4 | { 5 | LittleEndian = 1, 6 | BigEndian = 2 7 | } 8 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Infrastructure/FileGranularity.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Infrastructure 2 | { 3 | public enum FileGranularity 4 | { 5 | SingleFile = -1, 6 | Minute_1 = 60, 7 | Minute_10 = 600, 8 | Hour = 3600, 9 | Day = 86400 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/OneDas.Types/Infrastructure/IOneDasSerializer.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Infrastructure 2 | { 3 | public interface IOneDasSerializer 4 | { 5 | string Serialize(object value); 6 | T Deserialize(string rawJson); 7 | T Deserialize(object jObject); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/OneDas.Types/Infrastructure/OneDasDataType.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Infrastructure 2 | { 3 | /// 4 | /// Specifies the data type of the OneDAS data. 5 | /// 6 | public enum OneDasDataType 7 | { 8 | BOOLEAN = 0x008, 9 | UINT8 = 0x108, 10 | INT8 = 0x208, 11 | UINT16 = 0x110, 12 | INT16 = 0x210, 13 | UINT32 = 0x120, 14 | INT32 = 0x220, 15 | UINT64 = 0x140, 16 | INT64 = 0x240, 17 | FLOAT32 = 0x320, 18 | FLOAT64 = 0x340 19 | } 20 | } -------------------------------------------------------------------------------- /src/OneDas.Types/Infrastructure/SampleRate.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.Infrastructure 2 | { 3 | /// 4 | /// Specifies the sample rate of the OneDAS data. 5 | /// 6 | public enum SampleRate 7 | { 8 | /// 9 | /// 100 Hz 10 | /// 11 | SampleRate_100 = 1, 12 | 13 | /// 14 | /// 25 Hz 15 | /// 16 | SampleRate_25 = 4, 17 | 18 | /// 19 | /// 5 Hz 20 | /// 21 | SampleRate_5 = 20, 22 | 23 | /// 24 | /// 1 Hz 25 | /// 26 | SampleRate_1 = 100 27 | } 28 | } -------------------------------------------------------------------------------- /src/OneDas.Types/OneDas.Types.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Provides a common type system for all OneDAS application parts and extensions. 5 | OneDAS data aquisition measurement 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | True 17 | True 18 | ErrorMessage.resx 19 | 20 | 21 | 22 | 23 | 24 | ResXFileCodeGenerator 25 | OneDas 26 | ErrorMessage.Designer.cs 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/OneDas.Types/OneDasConstants.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas 2 | { 3 | public static class OneDasConstants 4 | { 5 | static OneDasConstants() 6 | { 7 | OneDasConstants.NativeSampleRate = 100; 8 | OneDasConstants.ChunkPeriod = 60; 9 | } 10 | 11 | public static uint NativeSampleRate { get; } 12 | public static uint ChunkPeriod { get; } 13 | public static string FileLoggerTemplate { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/OneDas.Types/OneDasOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace OneDas 5 | { 6 | public class OneDasOptions 7 | { 8 | public OneDasOptions() 9 | { 10 | this.BaseDirectoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "OneDAS", "Core"); 11 | this.PackageTypeName = "OneDasExtension"; 12 | this.RestoreRuntimeId = "any"; 13 | } 14 | 15 | public string BaseDirectoryPath { get; set; } 16 | public string PackageTypeName { get; set; } 17 | public string RestoreRuntimeId { get; set; } 18 | 19 | public string BackupDirectoryPath { get => Path.Combine(this.BaseDirectoryPath, "backup"); } 20 | public string ConfigurationDirectoryPath { get => Path.Combine(this.BaseDirectoryPath, "config"); } 21 | public string DataDirectoryPath { get => Path.Combine(this.BaseDirectoryPath, "data"); } 22 | public string NugetDirectoryPath { get => Path.Combine(this.BaseDirectoryPath, "nuget"); } 23 | public string NugetLocalDirectoryPath { get => Path.Combine(this.BaseDirectoryPath, "nuget", "local"); } 24 | public string NugetCacheDirectoryPath { get => Path.Combine(this.BaseDirectoryPath, "nuget", "cache"); } 25 | public string ProjectDirectoryPath { get => Path.Combine(this.BaseDirectoryPath, "project"); } 26 | 27 | public string NugetProjectFilePath { get => Path.Combine(this.NugetDirectoryPath, "project.json"); } 28 | } 29 | } -------------------------------------------------------------------------------- /src/OneDas.Types/OneDasState.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas 2 | { 3 | public enum OneDasState 4 | { 5 | Error = 1, 6 | Initialization = 2, 7 | Idle = 3, 8 | ApplyConfiguration = 4, 9 | Ready = 5, 10 | Run = 6 11 | } 12 | } -------------------------------------------------------------------------------- /src/OneDas.Types/PackageManagement/OneDasPackageMetadata.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace OneDas.PackageManagement 4 | { 5 | [DataContract] 6 | public class OneDasPackageMetaData 7 | { 8 | #region "Constructors" 9 | 10 | public OneDasPackageMetaData(string packageId, string description, string version, bool isInstalled, bool isUpdateAvailable) 11 | { 12 | this.PackageId = packageId; 13 | this.Description = description; 14 | this.Version = version; 15 | this.IsInstalled = isInstalled; 16 | this.IsUpdateAvailable = isUpdateAvailable; 17 | } 18 | 19 | #endregion 20 | 21 | #region "Properties" 22 | 23 | [DataMember] 24 | string PackageId { get; } 25 | 26 | [DataMember] 27 | string Description { get; } 28 | 29 | [DataMember] 30 | string Version { get; } 31 | 32 | [DataMember] 33 | bool IsInstalled { get; } 34 | 35 | [DataMember] 36 | bool IsUpdateAvailable { get; } 37 | 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/OneDas.Types/PackageManagement/OneDasPackageSource.cs: -------------------------------------------------------------------------------- 1 | namespace OneDas.PackageManagement 2 | { 3 | public class OneDasPackageSource 4 | { 5 | #region "Constructors" 6 | 7 | public OneDasPackageSource(string name, string address) 8 | { 9 | this.Name = name; 10 | this.Address = address; 11 | } 12 | 13 | #endregion 14 | 15 | #region "Properties" 16 | 17 | public string Name { get; set; } 18 | 19 | public string Address { get; set; } 20 | 21 | #endregion 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/OneDas.Types/ProjectManagement/ChannelHubSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.Serialization; 4 | using OneDas.Infrastructure; 5 | 6 | namespace OneDas.ProjectManagement 7 | { 8 | [DataContract] 9 | public class ChannelHubSettings 10 | { 11 | #region "Constructors" 12 | 13 | public ChannelHubSettings() 14 | { 15 | this.TransferFunctionSet = new List(); 16 | } 17 | 18 | #endregion 19 | 20 | #region "Properties" 21 | 22 | [DataMember] 23 | public string Name { get; private set; } 24 | 25 | [DataMember] 26 | public string Group { get; private set; } 27 | 28 | [DataMember] 29 | public OneDasDataType DataType { get; private set; } 30 | 31 | [DataMember] 32 | public Guid Guid { get; private set; } 33 | 34 | [DataMember] 35 | public DateTime CreationDateTime { get; private set; } 36 | 37 | [DataMember] 38 | public string Unit { get; private set; } 39 | 40 | [DataMember] 41 | public List TransferFunctionSet { get; private set; } 42 | 43 | [DataMember] 44 | public string AssociatedDataInputId { get; private set; } 45 | 46 | [DataMember] 47 | public IEnumerable AssociatedDataOutputIdSet { get; private set; } 48 | 49 | #endregion 50 | } 51 | } -------------------------------------------------------------------------------- /tests/OneDas.Core.Tests/DummyTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.DotNet.PlatformAbstractions; 2 | using Microsoft.Extensions.Logging; 3 | using Microsoft.Extensions.Options; 4 | using Moq; 5 | using OneDas.PackageManagement; 6 | using System.IO; 7 | using Xunit; 8 | 9 | namespace OneDas.Core.Tests 10 | { 11 | public class DummyTests 12 | { 13 | [Fact] 14 | public void OneDasPackageManagerCreatesAssetsFile() 15 | { 16 | var optionsMock = new Mock>(); 17 | optionsMock.SetupGet(x => x.Value).Returns(new OneDasOptions()); 18 | optionsMock.Object.Value.RestoreRuntimeId = RuntimeEnvironment.GetRuntimeIdentifier(); 19 | 20 | var loggerFactory = new LoggerFactory(); 21 | var packageManager = new OneDasPackageManager(optionsMock.Object, loggerFactory); 22 | 23 | Directory.CreateDirectory(optionsMock.Object.Value.NugetLocalDirectoryPath); 24 | 25 | // TODO: upload ExtensionSample to allow testing 26 | //await packageManager.InstallAsync("OneDas.Extension.Mat73"); 27 | } 28 | 29 | [Fact] 30 | public void FactTest() 31 | { 32 | Assert.False(true == false, "true should be equal to true"); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /tests/OneDas.Core.Tests/OneDas.Core.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | all 16 | runtime; build; native; contentfiles; analyzers 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "inlineSourceMap": true, 4 | "inlineSources": true, 5 | "noImplicitAny": false, 6 | "noEmitOnError": true, 7 | "removeComments": false, 8 | "target": "es2015", 9 | "experimentalDecorators": true, 10 | "module": "none", 11 | "typeRoots": [ 12 | "./web/node_modules/@types/" 13 | ] 14 | }, 15 | "compileOnSave": true 16 | } -------------------------------------------------------------------------------- /web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "dependencies": { 4 | "@aspnet/signalr": "1.0.0", 5 | "@types/chart.js": "2.7.17", 6 | "@types/jquery": "3.3.29", 7 | "@types/knockout": "3.4.66", 8 | "@types/mathjs": "0.0.37", 9 | "bootstrap": "4.0.0", 10 | "chart.js": "2.7.2", 11 | "font-awesome": "4.7.0", 12 | "jquery": "3.4.1", 13 | "knockout": "3.5.1", 14 | "mathjs": "4.2.2", 15 | "moment": "2.24.0", 16 | "pagerjs": "1.1.0", 17 | "popper.js": "1.16.0", 18 | "tempusdominus-bootstrap-4": "5.0.1" 19 | } 20 | } 21 | --------------------------------------------------------------------------------