NC_DEMO -> New features:
* CMS_CORE_Nc_Demo_Application (Server) * Added new Nc Demo into CMS_CORE_Library (Client)
@@ -1,12 +1,14 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.16
|
||||
VisualStudioVersion = 15.0.27004.2005
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMS_CORE_Application", "CMS_CORE_Application\CMS_CORE_Application.csproj", "{EEB0C188-6EFA-4ABB-9E6F-4D423006428C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMS_CORE_Library", "CMS_CORE_Library\CMS_CORE_Library.csproj", "{4ABF8EEF-2B23-483E-ACDC-53214FE28681}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMS_Core_Nc_Demo_Application", "CMS_CORE_Nc_Demo_Application\Nc_Demo_Application\CMS_Core_Nc_Demo_Application.csproj", "{23131777-64A6-41E7-A6DC-D531ACBA1BE4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -41,8 +43,23 @@ Global
|
||||
{4ABF8EEF-2B23-483E-ACDC-53214FE28681}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4ABF8EEF-2B23-483E-ACDC-53214FE28681}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4ABF8EEF-2B23-483E-ACDC-53214FE28681}.Release|x86.Build.0 = Release|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug2|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug2|Any CPU.Build.0 = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug2|x86.ActiveCfg = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug2|x86.Build.0 = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AC3986BC-C4E5-4EFF-A84B-4B67B101BB5A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CMS_CORE;
|
||||
using CMS_CORE.Exceptions;
|
||||
using CMS_CORE.Osai;
|
||||
using CMS_CORE.Demo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -32,7 +33,7 @@ namespace CMS_CORE_Application
|
||||
vv.Key = ss;
|
||||
Boolean tt= vv.IsValid;
|
||||
|
||||
Nc N = new Nc_Osai("1922.168.157.2", 8080, 2);
|
||||
Nc N = new Nc_Osai("192.168.157.2", 8080, 2);
|
||||
try
|
||||
{
|
||||
N.Connect();
|
||||
@@ -41,7 +42,15 @@ namespace CMS_CORE_Application
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
}
|
||||
|
||||
Nc_Demo nc_Demo = new Nc_Demo();
|
||||
nc_Demo.Connect();
|
||||
|
||||
DateTime testDateTime = new DateTime();
|
||||
nc_Demo.R_NCDateTime(ref testDateTime);
|
||||
|
||||
byte byteValue = 0;
|
||||
nc_Demo.RW_Byte(false, 1, Nc.MEMORY_Type.NullVariable, 0, 0, ref byteValue);
|
||||
MessageBox.Show("First byte:" + byteValue.ToString() + "DateTime " + testDateTime.ToString());
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
|
||||
@@ -13,3 +13,19 @@ C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_App
|
||||
C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.csprojResolveAssemblyReference.cache
|
||||
C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_Application\bin\x86\Debug\SKGL.dll
|
||||
C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.Form1.resources
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CMS_CORE_Application.exe.config
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CMS_CORE_Application.exe
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CMS_CORE_Application.pdb
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CMS_CORE_Library.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\SKGL.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CndexLinkDotNet.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CMS_CORE_Library.pdb
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CMS_CORE_Library.xml
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\bin\x86\Debug\CMS_CORE_Library.dll.config
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.csprojResolveAssemblyReference.cache
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.Form1.resources
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.Properties.Resources.resources
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.csproj.GenerateResource.Cache
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.csproj.CoreCompileInputs.cache
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.exe
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Application\obj\x86\Debug\CMS_CORE_Application.pdb
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceModel.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -64,6 +65,13 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Demo\ILibraryService.cs" />
|
||||
<Compile Include="Demo\Models\BinaryMemoryModel.cs" />
|
||||
<Compile Include="Demo\Models\NcAlarmModel.cs" />
|
||||
<Compile Include="Demo\Models\NcAxisModel.cs" />
|
||||
<Compile Include="Demo\Models\NcDataModel.cs" />
|
||||
<Compile Include="Demo\Models\NcProcessModel.cs" />
|
||||
<Compile Include="Demo\Nc_Demo.cs" />
|
||||
<Compile Include="Exceptions\Nc_Exception.cs" />
|
||||
<Compile Include="Fanuc\fwlib32.cs" />
|
||||
<Compile Include="Fanuc\Nc_Fanuc.cs" />
|
||||
@@ -792,8 +800,6 @@
|
||||
<LastGenOutput>Reference.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Demo\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -381,7 +381,7 @@ namespace CMS_CORE
|
||||
* <summary>Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area
|
||||
* <para>
|
||||
* Compatibility: Fanuc | Osai
|
||||
* </para>
|
||||
* </para>uW
|
||||
* </summary>
|
||||
* <exception cref="Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
* <param name="bWrite">Set True to Write-operation (Also Allowed <see cref="Nc.W"/>/<see cref="Nc.R"/>)</param>
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
<summary>Read/Write signed 4 Byte (NC: DWord:, .NET: uint) variable from/into NC Memory Area
|
||||
<para>
|
||||
Compatibility: Fanuc | Osai
|
||||
</para>
|
||||
</para>uW
|
||||
</summary>
|
||||
<exception cref="T:CMS_CORE.Exceptions.Nc_Exception">Thrown when an internal or a library error occours</exception>
|
||||
<param name="bWrite">Set True to Write-operation (Also Allowed <see cref="F:CMS_CORE.Nc.W"/>/<see cref="F:CMS_CORE.Nc.R"/>)</param>
|
||||
|
||||
@@ -7,3 +7,13 @@ C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_Lib
|
||||
C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_Library\bin\Debug2\CMS_CORE_Library.xml
|
||||
C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_Library\obj\Debug2\CMS_CORE_Library.csprojResolveAssemblyReference.cache
|
||||
C:\Users\carminatini\documents\visual studio 2017\Projects\CMS_CORE\CMS_CORE_Library\bin\Debug2\SKGL.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\bin\Debug2\CMS_CORE_Library.dll.config
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\bin\Debug2\CMS_CORE_Library.xml
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\bin\Debug2\CMS_CORE_Library.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\bin\Debug2\CMS_CORE_Library.pdb
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\bin\Debug2\CndexLinkDotNet.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\bin\Debug2\SKGL.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\obj\Debug2\CMS_CORE_Library.csprojResolveAssemblyReference.cache
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\obj\Debug2\CMS_CORE_Library.csproj.CoreCompileInputs.cache
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\obj\Debug2\CMS_CORE_Library.dll
|
||||
C:\Workspace\CMS_CORE_LIBRARY\CMS_CORE_Library\obj\Debug2\CMS_CORE_Library.pdb
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27004.2005
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMS_Core_Nc_Demo_Application", "Nc_Demo_Application\CMS_Core_Nc_Demo_Application.csproj", "{23131777-64A6-41E7-A6DC-D531ACBA1BE4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{23131777-64A6-41E7-A6DC-D531ACBA1BE4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {82010F77-C6A6-446B-B891-C645B53CCC73}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="v13.0" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="System.Data.SQLite.EF6" />
|
||||
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
|
||||
<remove invariant="System.Data.SQLite" />
|
||||
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
</configuration>
|
||||
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{23131777-64A6-41E7-A6DC-D531ACBA1BE4}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Nc_Demo_Application</RootNamespace>
|
||||
<AssemblyName>Nc_Demo_Application</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite, Version=1.0.105.2, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SQLite.Core.1.0.105.2\lib\net451\System.Data.SQLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.SQLite.EF6, Version=1.0.105.2, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SQLite.EF6.1.0.105.2\lib\net451\System.Data.SQLite.EF6.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.SQLite.Linq, Version=1.0.105.2, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.105.2\lib\net451\System.Data.SQLite.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IdentityModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceModel.Primitives, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ServiceModel.Primitives.4.4.0\lib\net461\System.ServiceModel.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Database\DatabaseController.cs" />
|
||||
<Compile Include="Database\Models\BinaryMemoryModel.cs" />
|
||||
<Compile Include="Database\Models\NcAlarmModel.cs" />
|
||||
<Compile Include="Database\Models\NcAxisModel.cs" />
|
||||
<Compile Include="Database\Models\NcProcessModel.cs" />
|
||||
<Compile Include="DemoApplication.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="DemoApplication.Designer.cs">
|
||||
<DependentUpon>DemoApplication.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Database\Models\NcDataModel.cs" />
|
||||
<Compile Include="Server\Service\ILibraryService.cs" />
|
||||
<Compile Include="Server\Service\LibraryService.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Server\ServerController.cs" />
|
||||
<EmbeddedResource Include="DemoApplication.resx">
|
||||
<DependentUpon>DemoApplication.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Images\CMS_Icon.ico" />
|
||||
<Content Include="Images\edit.png" />
|
||||
<Content Include="Images\empty.png" />
|
||||
<Content Include="Images\Folder New.png" />
|
||||
<Content Include="Images\folder.png" />
|
||||
<Content Include="Images\forward.png" />
|
||||
<Content Include="Images\Icon.png" />
|
||||
<Content Include="Images\icon_edit.png" />
|
||||
<Content Include="Images\key New.png" />
|
||||
<Content Include="Images\key.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.105.2\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.105.2\build\net451\System.Data.SQLite.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.105.2\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.105.2\build\net451\System.Data.SQLite.Core.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<StartArguments>http://localhost:8080/hello</StartArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
static class Constants
|
||||
{
|
||||
// Database configuration
|
||||
public static string RUNNING_PATH_DIR = AppDomain.CurrentDomain.BaseDirectory;
|
||||
public static string DATABASE_FILE_NAME = "Nc_Demo_Db.db";
|
||||
|
||||
// Database query
|
||||
public static string READ_NC_DATA_QUERY = "SELECT * FROM nc_data";
|
||||
public static string READ_NC_PROCESS_QUERY = "SELECT * FROM process";
|
||||
public static string READ_NC_ALARMS_QUERY = "SELECT * FROM alarm";
|
||||
public static string READ_NC_AXES_QUERY = "SELECT * FROM axis";
|
||||
public static string READ_BINARY_MEMORY_QUERY = "SELECT * FROM binary_memory";
|
||||
|
||||
|
||||
// Server configuration
|
||||
public static string SERVER_PORT = ":8080";
|
||||
public static string SERVER_IP_ADDRESS = "http://localhost";
|
||||
public static string API_URL = "/api";
|
||||
|
||||
// CMS Process Status
|
||||
public enum PROC_STATUS : ushort { IDLE = 1, RUN = 2, HOLD = 3, ERROR = 4, RESET = 5, EMERG = 6 };
|
||||
|
||||
// CMS Process mode
|
||||
public enum PROC_MODE : ushort { AUTO = 1, EDIT = 2, MDI = 3, REMOTE = 4, TEACH = 5, REF = 6, JOG = 7, JOGINC = 8, RETPROF = 9, HANDLE = 10, RESTART = 11, ERROR = 12 };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,550 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SQLite;
|
||||
using System.Net;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Web;
|
||||
using Nc_Demo_Application.Database.Models;
|
||||
using static Nc_Demo_Application.Constants;
|
||||
|
||||
namespace Nc_Demo_Application.Database
|
||||
{
|
||||
class DatabaseController
|
||||
{
|
||||
private static DatabaseController databaseInstance;
|
||||
private static SQLiteConnection sqlConnection;
|
||||
private static SQLiteCommand sqlCommand;
|
||||
|
||||
private DataTable ncDatatable;
|
||||
private DataTable ncProcessDataTable;
|
||||
private DataTable ncAlarmDataTable;
|
||||
private DataTable ncAxesDataTable;
|
||||
private DataTable BinaryMemory;
|
||||
|
||||
private DatabaseController()
|
||||
{
|
||||
SetConnection();
|
||||
ncDatatable = new DataTable();
|
||||
ncAlarmDataTable = new DataTable();
|
||||
ncAxesDataTable = new DataTable();
|
||||
|
||||
ncProcessDataTable = new DataTable();
|
||||
// Create ncProcess columns
|
||||
ncProcessDataTable.Columns.Add("status", typeof(PROC_STATUS));
|
||||
ncProcessDataTable.Columns.Add("mode", typeof(PROC_MODE));
|
||||
|
||||
BinaryMemory = new DataTable();
|
||||
|
||||
// Create byte memory dataTable columns and set order
|
||||
DataColumn address = BinaryMemory.Columns.Add("address", typeof(int));
|
||||
address.SetOrdinal(0);
|
||||
BinaryMemory.Columns.Add("value", typeof(int)).SetOrdinal(1);
|
||||
BinaryMemory.Columns.Add("binary", typeof(string)).SetOrdinal(2);
|
||||
BinaryMemory.Columns.Add("word", typeof(short)).SetOrdinal(3);
|
||||
BinaryMemory.Columns.Add("integer", typeof(int)).SetOrdinal(4);
|
||||
}
|
||||
|
||||
public static DatabaseController getInstance()
|
||||
{
|
||||
if (databaseInstance == null)
|
||||
databaseInstance = new DatabaseController();
|
||||
return databaseInstance;
|
||||
}
|
||||
|
||||
// Setup a new database connection
|
||||
private void SetConnection()
|
||||
{
|
||||
if(sqlConnection == null)
|
||||
sqlConnection = new SQLiteConnection("Data Source=" + RUNNING_PATH_DIR + DATABASE_FILE_NAME + ";Version=3;New=False;");
|
||||
}
|
||||
|
||||
public void ResetDatabase()
|
||||
{
|
||||
BinaryMemory.Clear();
|
||||
ncProcessDataTable.Clear();
|
||||
ncAlarmDataTable.Clear();
|
||||
ncAxesDataTable.Clear();
|
||||
}
|
||||
|
||||
public void ReadDataFromDatabase(string query, ref DataTable resultDataTable)
|
||||
{
|
||||
SetConnection();
|
||||
// Open connection with database
|
||||
sqlConnection.Open();
|
||||
// Create sqlCommand and sqlAdapter
|
||||
sqlCommand = new SQLiteCommand(query, sqlConnection);
|
||||
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
|
||||
// Clear Datatable
|
||||
resultDataTable.Clear();
|
||||
// Read from database
|
||||
adapter.Fill(resultDataTable);
|
||||
// Close connection
|
||||
sqlConnection.Close();
|
||||
}
|
||||
|
||||
#region Nc Data Methods
|
||||
public NcDataModel ReadNcData ()
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadDataFromDatabase(READ_NC_DATA_QUERY, ref ncDatatable);
|
||||
|
||||
return GetNcData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public NcDataModel GetNcData()
|
||||
{
|
||||
NcDataModel ncDataModel = new NcDataModel();
|
||||
|
||||
// Populate NcDataModel with db data
|
||||
foreach (DataRow row in ncDatatable.Rows)
|
||||
{
|
||||
ncDataModel.id = Convert.ToInt32(row["id"]);
|
||||
ncDataModel.name = row["name"].ToString();
|
||||
ncDataModel.serialNumber = row["serial_number"].ToString();
|
||||
ncDataModel.model = row["model"].ToString();
|
||||
ncDataModel.language = row["language"].ToString();
|
||||
ncDataModel.softwareVersion = row["software_version"].ToString();
|
||||
ncDataModel.dateTime = row["date_time"].ToString();
|
||||
ncDataModel.machineNumber = row["machine_number"].ToString();
|
||||
ncDataModel.processCount = Convert.ToInt32(row["process_count"]);
|
||||
}
|
||||
|
||||
return ncDataModel;
|
||||
}
|
||||
|
||||
public void UpdateNcData(NcDataModel ncData)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetConnection();
|
||||
|
||||
// Open the connection with database
|
||||
sqlConnection.Open();
|
||||
// Create a SQLite command with query, adapter and commandbuilder in order to update.
|
||||
sqlCommand = new SQLiteCommand(READ_NC_DATA_QUERY, sqlConnection);
|
||||
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
|
||||
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
|
||||
|
||||
// Update local ncDatatable data
|
||||
foreach (DataRow row in ncDatatable.Rows)
|
||||
{
|
||||
row["name"] = ncData.name;
|
||||
row["serial_number"] = ncData.serialNumber;
|
||||
row["model"] = ncData.model;
|
||||
row["language"] = ncData.language;
|
||||
row["software_version"] = ncData.softwareVersion;
|
||||
row["date_time"] = ncData.dateTime;
|
||||
row["machine_number"] = ncData.machineNumber;
|
||||
row["process_count"] = Convert.ToInt32(ncData.processCount);
|
||||
}
|
||||
// Update database
|
||||
adapter.Update(ncDatatable);
|
||||
|
||||
// Close the connection with database
|
||||
sqlConnection.Close();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Nc Processes Data
|
||||
public DataTable ReadNcProcesses()
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadDataFromDatabase(READ_NC_PROCESS_QUERY, ref ncProcessDataTable);
|
||||
foreach (DataRow row in ncProcessDataTable.Rows)
|
||||
{
|
||||
row["status"] = (PROC_STATUS)Convert.ToInt32(row["status"]);
|
||||
row["mode"] = (PROC_MODE)Convert.ToInt32(row["mode"]);
|
||||
}
|
||||
|
||||
return ncProcessDataTable;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<NcProcessModel> GetNcProcesses()
|
||||
{
|
||||
List<NcProcessModel> processes = new List<NcProcessModel>();
|
||||
foreach (DataRow row in ncProcessDataTable.Rows)
|
||||
{
|
||||
// Convert DataTable.row into process model
|
||||
NcProcessModel tmpProcess = new NcProcessModel
|
||||
{
|
||||
id = Convert.ToInt32(row["id"]),
|
||||
name = row["name"].ToString(),
|
||||
status = Convert.ToInt32(row["status"]),
|
||||
mode = Convert.ToInt32(row["mode"]),
|
||||
enabled = Convert.ToInt32(row["enabled"])
|
||||
};
|
||||
// Add tmp to return list
|
||||
processes.Add(tmpProcess);
|
||||
}
|
||||
|
||||
return processes;
|
||||
}
|
||||
|
||||
public void UpdateNcProcess(DataTable ncProcessData)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetConnection();
|
||||
|
||||
// Open the connection with database
|
||||
sqlConnection.Open();
|
||||
// Create a SQLite command with query, adapter and commandbuilder in order to update.
|
||||
sqlCommand = new SQLiteCommand(READ_NC_PROCESS_QUERY, sqlConnection);
|
||||
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
|
||||
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
|
||||
|
||||
// Update ncData
|
||||
adapter.Update(ncProcessData);
|
||||
|
||||
// Close the connection with database
|
||||
sqlConnection.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nc Alarms Data
|
||||
public DataTable ReadNcAlarms()
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadDataFromDatabase(READ_NC_ALARMS_QUERY, ref ncAlarmDataTable);
|
||||
|
||||
return ncAlarmDataTable;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<NcAlarmModel> GetNcAlarms()
|
||||
{
|
||||
List<NcAlarmModel> alarms = new List<NcAlarmModel>();
|
||||
foreach (DataRow row in ncAlarmDataTable.Rows)
|
||||
{
|
||||
// Convert DataTable.row into alarm model
|
||||
NcAlarmModel tmpAlarm = new NcAlarmModel
|
||||
{
|
||||
id = Convert.ToInt32(row["id"]),
|
||||
text = row["text"].ToString(),
|
||||
code = Convert.ToInt32(row["code"]),
|
||||
processId = Convert.ToInt32(row["process_id"])
|
||||
};
|
||||
alarms.Add(tmpAlarm);
|
||||
}
|
||||
|
||||
return alarms;
|
||||
}
|
||||
|
||||
public void UpdateNcAlarms(DataTable ncAlarms)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetConnection();
|
||||
|
||||
// Open the connection with database
|
||||
sqlConnection.Open();
|
||||
// Create a SQLite command with query, adapter and commandbuilder in order to update.
|
||||
sqlCommand = new SQLiteCommand(READ_NC_ALARMS_QUERY, sqlConnection);
|
||||
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
|
||||
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
|
||||
|
||||
// Update ncData
|
||||
adapter.Update(ncAlarms);
|
||||
|
||||
// Close the connection with database
|
||||
sqlConnection.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nc Axes Data
|
||||
public DataTable ReadNcAxes()
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadDataFromDatabase(READ_NC_AXES_QUERY, ref ncAxesDataTable);
|
||||
|
||||
return ncAxesDataTable;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<NcAxisModel> GetNcAxes()
|
||||
{
|
||||
List<NcAxisModel> axes = new List<NcAxisModel>();
|
||||
foreach (DataRow row in ncAxesDataTable.Rows)
|
||||
{
|
||||
// Convert DataTable.row into axis model
|
||||
NcAxisModel tmpAxis = new NcAxisModel
|
||||
{
|
||||
id = Convert.ToInt32(row["id"]),
|
||||
name = row["name"].ToString(),
|
||||
actual = Convert.ToDouble(row["actual"]),
|
||||
programmed = Convert.ToDouble(row["programmed"]),
|
||||
machinePosition = Convert.ToDouble(row["machine_position"]),
|
||||
distanceToGo = Convert.ToDouble(row["distance_to_go"]),
|
||||
processId = Convert.ToInt32(row["process_id"])
|
||||
};
|
||||
axes.Add(tmpAxis);
|
||||
}
|
||||
|
||||
return axes;
|
||||
}
|
||||
|
||||
public void UpdateNcAxes(DataTable ncAxes)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetConnection();
|
||||
|
||||
// Open the connection with database
|
||||
sqlConnection.Open();
|
||||
// Create a SQLite command with query, adapter and commandbuilder in order to update.
|
||||
sqlCommand = new SQLiteCommand(READ_NC_AXES_QUERY, sqlConnection);
|
||||
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
|
||||
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
|
||||
|
||||
// Update ncData
|
||||
adapter.Update(ncAxes);
|
||||
|
||||
// Close the connection with database
|
||||
sqlConnection.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Binary Memory
|
||||
|
||||
public DataTable ReadBinaryMemory()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read from database
|
||||
ReadDataFromDatabase(READ_BINARY_MEMORY_QUERY, ref BinaryMemory);
|
||||
|
||||
SetBinaryMemoryDataTableData();
|
||||
|
||||
return BinaryMemory;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBinaryMemoryDataTableData()
|
||||
{
|
||||
int i = 1;
|
||||
string word = "";
|
||||
string integer = "";
|
||||
foreach (DataRow row in BinaryMemory.Rows)
|
||||
{
|
||||
// Populate binary column for each row int -> binary
|
||||
row["binary"] = Convert.ToString(Convert.ToInt32(row["value"].ToString(), 10), 2).PadLeft(8, '0');
|
||||
// Add binary value to word and integer
|
||||
word = row["binary"] + word;
|
||||
integer = row["binary"] + integer;
|
||||
// Every 2 row set word value
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
row["word"] = Convert.ToInt16(word, 2);
|
||||
word = "";
|
||||
}
|
||||
// Every 4 row set integer value
|
||||
if (i % 4 == 0)
|
||||
{
|
||||
row["integer"] = Convert.ToInt32(integer, 2);
|
||||
integer = "";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateBinaryMemory(DataTable binaryMemory)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetConnection();
|
||||
|
||||
// Open the connection with database
|
||||
sqlConnection.Open();
|
||||
// Create a SQLite command with query, adapter and commandbuilder in order to update.
|
||||
sqlCommand = new SQLiteCommand(READ_BINARY_MEMORY_QUERY, sqlConnection);
|
||||
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
|
||||
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
|
||||
|
||||
// Update ncData
|
||||
adapter.Update(binaryMemory);
|
||||
|
||||
// Close the connection with database
|
||||
sqlConnection.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ReadNcData exception: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public byte GetByteValue(int index)
|
||||
{
|
||||
ValidateIndex(index);
|
||||
|
||||
return Convert.ToByte(BinaryMemory.Rows[index]["value"]);
|
||||
}
|
||||
|
||||
public string GetBinaryByteValue(int index)
|
||||
{
|
||||
ValidateIndex(index);
|
||||
|
||||
return BinaryMemory.Rows[index]["binary"].ToString();
|
||||
}
|
||||
|
||||
public string GetWordValue(int index)
|
||||
{
|
||||
ValidateIndex(index + 2);
|
||||
|
||||
// Get first byte of word
|
||||
string firstByte = GetBinaryByteValue(index);
|
||||
// Get last byte of a word and add first byte
|
||||
string word = GetBinaryByteValue(index + 1) + firstByte;
|
||||
|
||||
return word;
|
||||
}
|
||||
|
||||
public string GetIntegerValue(int index)
|
||||
{
|
||||
ValidateIndex(index + 4);
|
||||
|
||||
string integer = "";
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
// Get N byte of integer value
|
||||
integer = GetBinaryByteValue(index + i) + integer;
|
||||
}
|
||||
return integer;
|
||||
}
|
||||
|
||||
public void PutByteValue(int index, byte value)
|
||||
{
|
||||
ValidateIndex(index);
|
||||
|
||||
// Set byte with new value
|
||||
BinaryMemory.Rows[index]["value"] = value;
|
||||
|
||||
SetBinaryMemoryDataTableData();
|
||||
}
|
||||
|
||||
public void PutWordValue(int index, ushort value)
|
||||
{
|
||||
ValidateIndex(index + 2);
|
||||
|
||||
// Convert new value to binary the new word value (0-15)
|
||||
string binaryValue = Convert.ToString(value, 2).PadLeft(16, '0');
|
||||
// Set the first byte of new value (8-15)
|
||||
PutByteValue(index, Convert.ToByte(binaryValue.Substring(8, 8), 2));
|
||||
// Set the last byte (0-8)
|
||||
PutByteValue(index + 1, Convert.ToByte(binaryValue.Substring(0, 8), 2));
|
||||
|
||||
SetBinaryMemoryDataTableData();
|
||||
}
|
||||
|
||||
public void PutShortValue(int index, short value)
|
||||
{
|
||||
ValidateIndex(index + 2);
|
||||
|
||||
// Convert new value to binary the new short value (0-15)
|
||||
string binaryValue = Convert.ToString(value, 2).PadLeft(16, '0');
|
||||
// Set the first byte of new value (8-15)
|
||||
PutByteValue(index, Convert.ToByte(binaryValue.Substring(8, 8), 2));
|
||||
// Set the last byte (0-8)
|
||||
PutByteValue(index + 1, Convert.ToByte(binaryValue.Substring(0, 8), 2));
|
||||
|
||||
SetBinaryMemoryDataTableData();
|
||||
}
|
||||
|
||||
public void PutIntegerValue(int index, int value)
|
||||
{
|
||||
ValidateIndex(index + 4);
|
||||
|
||||
// Convert to binary the new integer value
|
||||
string binaryValue = Convert.ToString(value, 2).PadLeft(32, '0');
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
// Find next byte position (24-16-8-0)
|
||||
int startByte = 32 - (8 * (i + 1));
|
||||
// Set the new value
|
||||
PutByteValue(index + i, Convert.ToByte(binaryValue.Substring(startByte, 8), 2));
|
||||
}
|
||||
|
||||
SetBinaryMemoryDataTableData();
|
||||
}
|
||||
|
||||
public void PutDWordValue(int index, uint value)
|
||||
{
|
||||
ValidateIndex(index + 4);
|
||||
|
||||
// Convert to binary the new dWord value
|
||||
string binaryValue = Convert.ToString(value, 2).PadLeft(32, '0');
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
// Find next byte position (24-16-8-0)
|
||||
int startByte = 32 - (8 * (i + 1));
|
||||
// Set the new value
|
||||
PutByteValue(index + i, Convert.ToByte(binaryValue.Substring(startByte, 8), 2));
|
||||
}
|
||||
SetBinaryMemoryDataTableData();
|
||||
}
|
||||
|
||||
private void ValidateIndex(int index)
|
||||
{
|
||||
if(index > BinaryMemory.Rows.Count)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nc_Demo_Application.Database.Models
|
||||
{
|
||||
[DataContract]
|
||||
class BinaryMemoryModel
|
||||
{
|
||||
[DataMember]
|
||||
public byte binary;
|
||||
[DataMember]
|
||||
public short word;
|
||||
[DataMember]
|
||||
public ushort uWord;
|
||||
[DataMember]
|
||||
public int integer;
|
||||
[DataMember]
|
||||
public uint dWord;
|
||||
[DataMember]
|
||||
public List<byte> byteList;
|
||||
[DataMember]
|
||||
public List<short> shortList;
|
||||
[DataMember]
|
||||
public List<ushort> wordList;
|
||||
[DataMember]
|
||||
public List<int> integerList;
|
||||
[DataMember]
|
||||
public List<uint> dWordList;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nc_Demo_Application.Database.Models
|
||||
{
|
||||
[DataContract]
|
||||
class NcAlarmModel
|
||||
{
|
||||
[DataMember]
|
||||
public int id;
|
||||
[DataMember]
|
||||
public int code;
|
||||
[DataMember]
|
||||
public string text;
|
||||
[DataMember]
|
||||
public int processId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nc_Demo_Application.Database.Models
|
||||
{
|
||||
[DataContract]
|
||||
class NcAxisModel
|
||||
{
|
||||
[DataMember]
|
||||
public int id;
|
||||
|
||||
[DataMember]
|
||||
public string name;
|
||||
|
||||
[DataMember]
|
||||
public double actual;
|
||||
|
||||
[DataMember]
|
||||
public double programmed;
|
||||
|
||||
[DataMember]
|
||||
public double machinePosition;
|
||||
|
||||
[DataMember]
|
||||
public double distanceToGo;
|
||||
|
||||
[DataMember]
|
||||
public int processId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nc_Demo_Application.Database.Models
|
||||
{
|
||||
class NcDataModel
|
||||
{
|
||||
public int id;
|
||||
public string name;
|
||||
public string serialNumber;
|
||||
public string model;
|
||||
public string language;
|
||||
public string softwareVersion;
|
||||
public string dateTime;
|
||||
public string machineNumber;
|
||||
public int processCount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Nc_Demo_Application.Database.Models
|
||||
{
|
||||
class NcProcessModel
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public int status;
|
||||
public int mode;
|
||||
public int enabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,771 @@
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
partial class NcDemoApplicationForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Variabile di progettazione necessaria.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pulire le risorse in uso.
|
||||
/// </summary>
|
||||
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Codice generato da Progettazione Windows Form
|
||||
|
||||
/// <summary>
|
||||
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
|
||||
/// il contenuto del metodo con l'editor di codice.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NcDemoApplicationForm));
|
||||
this.startServer = new System.Windows.Forms.Button();
|
||||
this.stopServer = new System.Windows.Forms.Button();
|
||||
this.ncAxesSaveButton = new System.Windows.Forms.TabControl();
|
||||
this.ncDataPage = new System.Windows.Forms.TabPage();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.saveNcDataButton = new System.Windows.Forms.Button();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.processNumberTxb = new System.Windows.Forms.TextBox();
|
||||
this.dateTimeTxb = new System.Windows.Forms.TextBox();
|
||||
this.softwareVersionTxb = new System.Windows.Forms.TextBox();
|
||||
this.languageTxb = new System.Windows.Forms.TextBox();
|
||||
this.serialNumberTxb = new System.Windows.Forms.TextBox();
|
||||
this.modelTxb = new System.Windows.Forms.TextBox();
|
||||
this.machineNumberTxb = new System.Windows.Forms.TextBox();
|
||||
this.ncNameTxb = new System.Windows.Forms.TextBox();
|
||||
this.ModelLabel = new System.Windows.Forms.Label();
|
||||
this.MachineNumLabel = new System.Windows.Forms.Label();
|
||||
this.NCNameLabel = new System.Windows.Forms.Label();
|
||||
this.processPage = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveNcProcessData = new System.Windows.Forms.ToolStripButton();
|
||||
this.ncProcessGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ncProcessIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncProcessNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncProcessStatusColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.ncProcessModeColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
|
||||
this.alarms = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip3 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveNcAlarmsButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.ncAlarmsGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ncAlarmCodeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAlarmTextColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAlarmProcessIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAlarmIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAxesPage = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip4 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveNcAxesButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.ncAxisGridView = new System.Windows.Forms.DataGridView();
|
||||
this.axisIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisActualColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisProgrammedColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisMachinePositionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisDistanceToGoColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.axisProcessColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.byteMemoryPage = new System.Windows.Forms.TabPage();
|
||||
this.toolStrip2 = new System.Windows.Forms.ToolStrip();
|
||||
this.saveBinaryMemoryButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.addRowsBinaryMemory = new System.Windows.Forms.ToolStripButton();
|
||||
this.deleteRowsBinaryMemory = new System.Windows.Forms.ToolStripButton();
|
||||
this.binaryMemoryGridView = new System.Windows.Forms.DataGridView();
|
||||
this.BinaryMemoryAddressColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryDecimalColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryBinaryColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryWordColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.BinaryMemoryIntegerColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ncAxesSaveButton.SuspendLayout();
|
||||
this.ncDataPage.SuspendLayout();
|
||||
this.processPage.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncProcessGridView)).BeginInit();
|
||||
this.alarms.SuspendLayout();
|
||||
this.toolStrip3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAlarmsGridView)).BeginInit();
|
||||
this.ncAxesPage.SuspendLayout();
|
||||
this.toolStrip4.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAxisGridView)).BeginInit();
|
||||
this.byteMemoryPage.SuspendLayout();
|
||||
this.toolStrip2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.binaryMemoryGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// startServer
|
||||
//
|
||||
this.startServer.Location = new System.Drawing.Point(480, 306);
|
||||
this.startServer.Name = "startServer";
|
||||
this.startServer.Size = new System.Drawing.Size(92, 30);
|
||||
this.startServer.TabIndex = 0;
|
||||
this.startServer.Text = "Start";
|
||||
this.startServer.UseVisualStyleBackColor = true;
|
||||
this.startServer.Click += new System.EventHandler(this.StartServer_Click);
|
||||
//
|
||||
// stopServer
|
||||
//
|
||||
this.stopServer.Enabled = false;
|
||||
this.stopServer.Location = new System.Drawing.Point(383, 306);
|
||||
this.stopServer.Name = "stopServer";
|
||||
this.stopServer.Size = new System.Drawing.Size(91, 30);
|
||||
this.stopServer.TabIndex = 1;
|
||||
this.stopServer.Text = "Stop";
|
||||
this.stopServer.UseVisualStyleBackColor = true;
|
||||
this.stopServer.Click += new System.EventHandler(this.StopServer_Click);
|
||||
//
|
||||
// ncAxesSaveButton
|
||||
//
|
||||
this.ncAxesSaveButton.Controls.Add(this.ncDataPage);
|
||||
this.ncAxesSaveButton.Controls.Add(this.processPage);
|
||||
this.ncAxesSaveButton.Controls.Add(this.alarms);
|
||||
this.ncAxesSaveButton.Controls.Add(this.ncAxesPage);
|
||||
this.ncAxesSaveButton.Controls.Add(this.byteMemoryPage);
|
||||
this.ncAxesSaveButton.Location = new System.Drawing.Point(12, 12);
|
||||
this.ncAxesSaveButton.Name = "ncAxesSaveButton";
|
||||
this.ncAxesSaveButton.SelectedIndex = 0;
|
||||
this.ncAxesSaveButton.Size = new System.Drawing.Size(564, 276);
|
||||
this.ncAxesSaveButton.TabIndex = 3;
|
||||
//
|
||||
// ncDataPage
|
||||
//
|
||||
this.ncDataPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ncDataPage.Controls.Add(this.label6);
|
||||
this.ncDataPage.Controls.Add(this.saveNcDataButton);
|
||||
this.ncDataPage.Controls.Add(this.label5);
|
||||
this.ncDataPage.Controls.Add(this.label4);
|
||||
this.ncDataPage.Controls.Add(this.label3);
|
||||
this.ncDataPage.Controls.Add(this.label2);
|
||||
this.ncDataPage.Controls.Add(this.label1);
|
||||
this.ncDataPage.Controls.Add(this.processNumberTxb);
|
||||
this.ncDataPage.Controls.Add(this.dateTimeTxb);
|
||||
this.ncDataPage.Controls.Add(this.softwareVersionTxb);
|
||||
this.ncDataPage.Controls.Add(this.languageTxb);
|
||||
this.ncDataPage.Controls.Add(this.serialNumberTxb);
|
||||
this.ncDataPage.Controls.Add(this.modelTxb);
|
||||
this.ncDataPage.Controls.Add(this.machineNumberTxb);
|
||||
this.ncDataPage.Controls.Add(this.ncNameTxb);
|
||||
this.ncDataPage.Controls.Add(this.ModelLabel);
|
||||
this.ncDataPage.Controls.Add(this.MachineNumLabel);
|
||||
this.ncDataPage.Controls.Add(this.NCNameLabel);
|
||||
this.ncDataPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.ncDataPage.Name = "ncDataPage";
|
||||
this.ncDataPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.ncDataPage.Size = new System.Drawing.Size(556, 250);
|
||||
this.ncDataPage.TabIndex = 0;
|
||||
this.ncDataPage.Text = "Nc Data";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label6.Location = new System.Drawing.Point(20, 11);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(217, 18);
|
||||
this.label6.TabIndex = 52;
|
||||
this.label6.Text = "Numerical control generic data: ";
|
||||
//
|
||||
// saveNcDataButton
|
||||
//
|
||||
this.saveNcDataButton.Enabled = false;
|
||||
this.saveNcDataButton.Location = new System.Drawing.Point(413, 221);
|
||||
this.saveNcDataButton.Name = "saveNcDataButton";
|
||||
this.saveNcDataButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.saveNcDataButton.TabIndex = 51;
|
||||
this.saveNcDataButton.Text = "Save";
|
||||
this.saveNcDataButton.UseVisualStyleBackColor = true;
|
||||
this.saveNcDataButton.Click += new System.EventHandler(this.SaveCnDataButton_Click);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(352, 166);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(56, 13);
|
||||
this.label5.TabIndex = 50;
|
||||
this.label5.Text = "Process N";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(21, 163);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(53, 13);
|
||||
this.label4.TabIndex = 49;
|
||||
this.label4.Text = "DateTime";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(320, 131);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(87, 13);
|
||||
this.label3.TabIndex = 48;
|
||||
this.label3.Text = "Software Version";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(21, 124);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(55, 13);
|
||||
this.label2.TabIndex = 47;
|
||||
this.label2.Text = "Language";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(334, 91);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(73, 13);
|
||||
this.label1.TabIndex = 46;
|
||||
this.label1.Text = "Serial Number";
|
||||
//
|
||||
// processNumberTxb
|
||||
//
|
||||
this.processNumberTxb.Location = new System.Drawing.Point(414, 163);
|
||||
this.processNumberTxb.Name = "processNumberTxb";
|
||||
this.processNumberTxb.Size = new System.Drawing.Size(112, 20);
|
||||
this.processNumberTxb.TabIndex = 45;
|
||||
//
|
||||
// dateTimeTxb
|
||||
//
|
||||
this.dateTimeTxb.Location = new System.Drawing.Point(80, 160);
|
||||
this.dateTimeTxb.Name = "dateTimeTxb";
|
||||
this.dateTimeTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.dateTimeTxb.TabIndex = 44;
|
||||
//
|
||||
// softwareVersionTxb
|
||||
//
|
||||
this.softwareVersionTxb.Location = new System.Drawing.Point(413, 124);
|
||||
this.softwareVersionTxb.Name = "softwareVersionTxb";
|
||||
this.softwareVersionTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.softwareVersionTxb.TabIndex = 43;
|
||||
//
|
||||
// languageTxb
|
||||
//
|
||||
this.languageTxb.Location = new System.Drawing.Point(80, 121);
|
||||
this.languageTxb.Name = "languageTxb";
|
||||
this.languageTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.languageTxb.TabIndex = 42;
|
||||
//
|
||||
// serialNumberTxb
|
||||
//
|
||||
this.serialNumberTxb.Location = new System.Drawing.Point(413, 88);
|
||||
this.serialNumberTxb.Name = "serialNumberTxb";
|
||||
this.serialNumberTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.serialNumberTxb.TabIndex = 41;
|
||||
//
|
||||
// modelTxb
|
||||
//
|
||||
this.modelTxb.Location = new System.Drawing.Point(80, 85);
|
||||
this.modelTxb.Name = "modelTxb";
|
||||
this.modelTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.modelTxb.TabIndex = 40;
|
||||
//
|
||||
// machineNumberTxb
|
||||
//
|
||||
this.machineNumberTxb.Location = new System.Drawing.Point(413, 52);
|
||||
this.machineNumberTxb.Name = "machineNumberTxb";
|
||||
this.machineNumberTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.machineNumberTxb.TabIndex = 39;
|
||||
//
|
||||
// ncNameTxb
|
||||
//
|
||||
this.ncNameTxb.Location = new System.Drawing.Point(80, 49);
|
||||
this.ncNameTxb.Name = "ncNameTxb";
|
||||
this.ncNameTxb.Size = new System.Drawing.Size(113, 20);
|
||||
this.ncNameTxb.TabIndex = 38;
|
||||
//
|
||||
// ModelLabel
|
||||
//
|
||||
this.ModelLabel.AutoSize = true;
|
||||
this.ModelLabel.Location = new System.Drawing.Point(38, 88);
|
||||
this.ModelLabel.Name = "ModelLabel";
|
||||
this.ModelLabel.Size = new System.Drawing.Size(36, 13);
|
||||
this.ModelLabel.TabIndex = 37;
|
||||
this.ModelLabel.Text = "Model";
|
||||
//
|
||||
// MachineNumLabel
|
||||
//
|
||||
this.MachineNumLabel.AutoSize = true;
|
||||
this.MachineNumLabel.Location = new System.Drawing.Point(319, 55);
|
||||
this.MachineNumLabel.Name = "MachineNumLabel";
|
||||
this.MachineNumLabel.Size = new System.Drawing.Size(88, 13);
|
||||
this.MachineNumLabel.TabIndex = 36;
|
||||
this.MachineNumLabel.Text = "Machine Number";
|
||||
//
|
||||
// NCNameLabel
|
||||
//
|
||||
this.NCNameLabel.AutoSize = true;
|
||||
this.NCNameLabel.Location = new System.Drawing.Point(21, 52);
|
||||
this.NCNameLabel.Name = "NCNameLabel";
|
||||
this.NCNameLabel.Size = new System.Drawing.Size(53, 13);
|
||||
this.NCNameLabel.TabIndex = 35;
|
||||
this.NCNameLabel.Text = "NC Name";
|
||||
//
|
||||
// processPage
|
||||
//
|
||||
this.processPage.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.processPage.Controls.Add(this.toolStrip1);
|
||||
this.processPage.Controls.Add(this.ncProcessGridView);
|
||||
this.processPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.processPage.Name = "processPage";
|
||||
this.processPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.processPage.Size = new System.Drawing.Size(556, 250);
|
||||
this.processPage.TabIndex = 1;
|
||||
this.processPage.Text = "Nc Process";
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveNcProcessData});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(3, 3);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(550, 25);
|
||||
this.toolStrip1.TabIndex = 9;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// saveNcProcessData
|
||||
//
|
||||
this.saveNcProcessData.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveNcProcessData.Enabled = false;
|
||||
this.saveNcProcessData.Image = ((System.Drawing.Image)(resources.GetObject("saveNcProcessData.Image")));
|
||||
this.saveNcProcessData.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveNcProcessData.Name = "saveNcProcessData";
|
||||
this.saveNcProcessData.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveNcProcessData.Text = "Save";
|
||||
this.saveNcProcessData.Click += new System.EventHandler(this.SaveNcProcessData_Click);
|
||||
//
|
||||
// ncProcessGridView
|
||||
//
|
||||
this.ncProcessGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.ncProcessGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ncProcessIdColumn,
|
||||
this.ncProcessNameColumn,
|
||||
this.ncProcessStatusColumn,
|
||||
this.ncProcessModeColumn});
|
||||
this.ncProcessGridView.Location = new System.Drawing.Point(3, 28);
|
||||
this.ncProcessGridView.Name = "ncProcessGridView";
|
||||
this.ncProcessGridView.Size = new System.Drawing.Size(553, 167);
|
||||
this.ncProcessGridView.TabIndex = 4;
|
||||
this.ncProcessGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.ncProcessGridView_DataError);
|
||||
//
|
||||
// ncProcessIdColumn
|
||||
//
|
||||
this.ncProcessIdColumn.DataPropertyName = "id";
|
||||
this.ncProcessIdColumn.HeaderText = "id";
|
||||
this.ncProcessIdColumn.Name = "ncProcessIdColumn";
|
||||
this.ncProcessIdColumn.ReadOnly = true;
|
||||
//
|
||||
// ncProcessNameColumn
|
||||
//
|
||||
this.ncProcessNameColumn.DataPropertyName = "name";
|
||||
this.ncProcessNameColumn.HeaderText = "Name";
|
||||
this.ncProcessNameColumn.Name = "ncProcessNameColumn";
|
||||
//
|
||||
// ncProcessStatusColumn
|
||||
//
|
||||
this.ncProcessStatusColumn.DataPropertyName = "status";
|
||||
this.ncProcessStatusColumn.HeaderText = "Status";
|
||||
this.ncProcessStatusColumn.Name = "ncProcessStatusColumn";
|
||||
this.ncProcessStatusColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ncProcessStatusColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
//
|
||||
// ncProcessModeColumn
|
||||
//
|
||||
this.ncProcessModeColumn.DataPropertyName = "mode";
|
||||
this.ncProcessModeColumn.HeaderText = "Mode";
|
||||
this.ncProcessModeColumn.Name = "ncProcessModeColumn";
|
||||
//
|
||||
// alarms
|
||||
//
|
||||
this.alarms.Controls.Add(this.toolStrip3);
|
||||
this.alarms.Controls.Add(this.ncAlarmsGridView);
|
||||
this.alarms.Location = new System.Drawing.Point(4, 22);
|
||||
this.alarms.Name = "alarms";
|
||||
this.alarms.Size = new System.Drawing.Size(556, 250);
|
||||
this.alarms.TabIndex = 2;
|
||||
this.alarms.Text = "NC Alarms";
|
||||
this.alarms.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toolStrip3
|
||||
//
|
||||
this.toolStrip3.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveNcAlarmsButton});
|
||||
this.toolStrip3.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip3.Name = "toolStrip3";
|
||||
this.toolStrip3.Size = new System.Drawing.Size(556, 25);
|
||||
this.toolStrip3.TabIndex = 2;
|
||||
this.toolStrip3.Text = "toolStrip3";
|
||||
//
|
||||
// saveNcAlarmsButton
|
||||
//
|
||||
this.saveNcAlarmsButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveNcAlarmsButton.Enabled = false;
|
||||
this.saveNcAlarmsButton.Image = ((System.Drawing.Image)(resources.GetObject("saveNcAlarmsButton.Image")));
|
||||
this.saveNcAlarmsButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveNcAlarmsButton.Name = "saveNcAlarmsButton";
|
||||
this.saveNcAlarmsButton.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveNcAlarmsButton.Text = "save";
|
||||
this.saveNcAlarmsButton.Click += new System.EventHandler(this.SaveNcAlarmsButton_Click);
|
||||
//
|
||||
// ncAlarmsGridView
|
||||
//
|
||||
this.ncAlarmsGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.ncAlarmsGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ncAlarmCodeColumn,
|
||||
this.ncAlarmTextColumn,
|
||||
this.ncAlarmProcessIdColumn,
|
||||
this.ncAlarmIdColumn});
|
||||
this.ncAlarmsGridView.Location = new System.Drawing.Point(3, 28);
|
||||
this.ncAlarmsGridView.Name = "ncAlarmsGridView";
|
||||
this.ncAlarmsGridView.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||
this.ncAlarmsGridView.Size = new System.Drawing.Size(485, 167);
|
||||
this.ncAlarmsGridView.TabIndex = 0;
|
||||
//
|
||||
// ncAlarmCodeColumn
|
||||
//
|
||||
this.ncAlarmCodeColumn.DataPropertyName = "code";
|
||||
this.ncAlarmCodeColumn.HeaderText = "Code";
|
||||
this.ncAlarmCodeColumn.Name = "ncAlarmCodeColumn";
|
||||
//
|
||||
// ncAlarmTextColumn
|
||||
//
|
||||
this.ncAlarmTextColumn.DataPropertyName = "text";
|
||||
this.ncAlarmTextColumn.HeaderText = "Text";
|
||||
this.ncAlarmTextColumn.Name = "ncAlarmTextColumn";
|
||||
this.ncAlarmTextColumn.Width = 240;
|
||||
//
|
||||
// ncAlarmProcessIdColumn
|
||||
//
|
||||
this.ncAlarmProcessIdColumn.DataPropertyName = "process_id";
|
||||
this.ncAlarmProcessIdColumn.HeaderText = "Process";
|
||||
this.ncAlarmProcessIdColumn.Name = "ncAlarmProcessIdColumn";
|
||||
this.ncAlarmProcessIdColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.ncAlarmProcessIdColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
//
|
||||
// ncAlarmIdColumn
|
||||
//
|
||||
this.ncAlarmIdColumn.DataPropertyName = "id";
|
||||
this.ncAlarmIdColumn.HeaderText = "Id";
|
||||
this.ncAlarmIdColumn.Name = "ncAlarmIdColumn";
|
||||
this.ncAlarmIdColumn.Visible = false;
|
||||
//
|
||||
// ncAxesPage
|
||||
//
|
||||
this.ncAxesPage.Controls.Add(this.toolStrip4);
|
||||
this.ncAxesPage.Controls.Add(this.ncAxisGridView);
|
||||
this.ncAxesPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.ncAxesPage.Name = "ncAxesPage";
|
||||
this.ncAxesPage.Size = new System.Drawing.Size(556, 250);
|
||||
this.ncAxesPage.TabIndex = 3;
|
||||
this.ncAxesPage.Text = "Axes";
|
||||
this.ncAxesPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toolStrip4
|
||||
//
|
||||
this.toolStrip4.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveNcAxesButton});
|
||||
this.toolStrip4.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip4.Name = "toolStrip4";
|
||||
this.toolStrip4.Size = new System.Drawing.Size(556, 25);
|
||||
this.toolStrip4.TabIndex = 53;
|
||||
this.toolStrip4.Text = "toolStrip4";
|
||||
//
|
||||
// saveNcAxesButton
|
||||
//
|
||||
this.saveNcAxesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveNcAxesButton.Enabled = false;
|
||||
this.saveNcAxesButton.Image = ((System.Drawing.Image)(resources.GetObject("saveNcAxesButton.Image")));
|
||||
this.saveNcAxesButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveNcAxesButton.Name = "saveNcAxesButton";
|
||||
this.saveNcAxesButton.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveNcAxesButton.Text = "Save";
|
||||
this.saveNcAxesButton.Click += new System.EventHandler(this.SaveNcAxesButton_Click);
|
||||
//
|
||||
// ncAxisGridView
|
||||
//
|
||||
this.ncAxisGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.ncAxisGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.axisIdColumn,
|
||||
this.axisNameColumn,
|
||||
this.axisActualColumn,
|
||||
this.axisProgrammedColumn,
|
||||
this.axisMachinePositionColumn,
|
||||
this.axisDistanceToGoColumn,
|
||||
this.axisProcessColumn});
|
||||
this.ncAxisGridView.Location = new System.Drawing.Point(3, 28);
|
||||
this.ncAxisGridView.Name = "ncAxisGridView";
|
||||
this.ncAxisGridView.Size = new System.Drawing.Size(485, 167);
|
||||
this.ncAxisGridView.TabIndex = 0;
|
||||
//
|
||||
// axisIdColumn
|
||||
//
|
||||
this.axisIdColumn.DataPropertyName = "id";
|
||||
this.axisIdColumn.HeaderText = "id";
|
||||
this.axisIdColumn.Name = "axisIdColumn";
|
||||
this.axisIdColumn.Visible = false;
|
||||
//
|
||||
// axisNameColumn
|
||||
//
|
||||
this.axisNameColumn.DataPropertyName = "name";
|
||||
this.axisNameColumn.HeaderText = "Name";
|
||||
this.axisNameColumn.MaxInputLength = 4;
|
||||
this.axisNameColumn.Name = "axisNameColumn";
|
||||
this.axisNameColumn.Width = 65;
|
||||
//
|
||||
// axisActualColumn
|
||||
//
|
||||
this.axisActualColumn.DataPropertyName = "actual";
|
||||
this.axisActualColumn.HeaderText = "Actual";
|
||||
this.axisActualColumn.Name = "axisActualColumn";
|
||||
this.axisActualColumn.Width = 75;
|
||||
//
|
||||
// axisProgrammedColumn
|
||||
//
|
||||
this.axisProgrammedColumn.DataPropertyName = "programmed";
|
||||
this.axisProgrammedColumn.HeaderText = "Programmed";
|
||||
this.axisProgrammedColumn.Name = "axisProgrammedColumn";
|
||||
this.axisProgrammedColumn.Width = 75;
|
||||
//
|
||||
// axisMachinePositionColumn
|
||||
//
|
||||
this.axisMachinePositionColumn.DataPropertyName = "machine_position";
|
||||
this.axisMachinePositionColumn.HeaderText = "Machine Position";
|
||||
this.axisMachinePositionColumn.Name = "axisMachinePositionColumn";
|
||||
this.axisMachinePositionColumn.Width = 75;
|
||||
//
|
||||
// axisDistanceToGoColumn
|
||||
//
|
||||
this.axisDistanceToGoColumn.DataPropertyName = "distance_to_go";
|
||||
this.axisDistanceToGoColumn.HeaderText = "Distance to go";
|
||||
this.axisDistanceToGoColumn.Name = "axisDistanceToGoColumn";
|
||||
this.axisDistanceToGoColumn.Width = 75;
|
||||
//
|
||||
// axisProcessColumn
|
||||
//
|
||||
this.axisProcessColumn.DataPropertyName = "process_id";
|
||||
this.axisProcessColumn.HeaderText = "Process";
|
||||
this.axisProcessColumn.Name = "axisProcessColumn";
|
||||
this.axisProcessColumn.Width = 75;
|
||||
//
|
||||
// byteMemoryPage
|
||||
//
|
||||
this.byteMemoryPage.Controls.Add(this.toolStrip2);
|
||||
this.byteMemoryPage.Controls.Add(this.binaryMemoryGridView);
|
||||
this.byteMemoryPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.byteMemoryPage.Name = "byteMemoryPage";
|
||||
this.byteMemoryPage.Size = new System.Drawing.Size(556, 250);
|
||||
this.byteMemoryPage.TabIndex = 4;
|
||||
this.byteMemoryPage.Text = "Byte Memory";
|
||||
this.byteMemoryPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// toolStrip2
|
||||
//
|
||||
this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveBinaryMemoryButton,
|
||||
this.addRowsBinaryMemory,
|
||||
this.deleteRowsBinaryMemory});
|
||||
this.toolStrip2.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip2.Name = "toolStrip2";
|
||||
this.toolStrip2.Size = new System.Drawing.Size(556, 25);
|
||||
this.toolStrip2.TabIndex = 1;
|
||||
this.toolStrip2.Text = "toolStrip2";
|
||||
//
|
||||
// saveBinaryMemoryButton
|
||||
//
|
||||
this.saveBinaryMemoryButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.saveBinaryMemoryButton.Enabled = false;
|
||||
this.saveBinaryMemoryButton.Image = ((System.Drawing.Image)(resources.GetObject("saveBinaryMemoryButton.Image")));
|
||||
this.saveBinaryMemoryButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.saveBinaryMemoryButton.Name = "saveBinaryMemoryButton";
|
||||
this.saveBinaryMemoryButton.Size = new System.Drawing.Size(23, 22);
|
||||
this.saveBinaryMemoryButton.Text = "Save";
|
||||
this.saveBinaryMemoryButton.Click += new System.EventHandler(this.SaveBinaryMemory_Click);
|
||||
//
|
||||
// addRowsBinaryMemory
|
||||
//
|
||||
this.addRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.addRowsBinaryMemory.Image = ((System.Drawing.Image)(resources.GetObject("addRowsBinaryMemory.Image")));
|
||||
this.addRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.addRowsBinaryMemory.Name = "addRowsBinaryMemory";
|
||||
this.addRowsBinaryMemory.Size = new System.Drawing.Size(23, 22);
|
||||
this.addRowsBinaryMemory.Text = "toolStripButton1";
|
||||
this.addRowsBinaryMemory.Click += new System.EventHandler(this.addRowsBinaryMemory_Click);
|
||||
//
|
||||
// deleteRowsBinaryMemory
|
||||
//
|
||||
this.deleteRowsBinaryMemory.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.deleteRowsBinaryMemory.Image = ((System.Drawing.Image)(resources.GetObject("deleteRowsBinaryMemory.Image")));
|
||||
this.deleteRowsBinaryMemory.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.deleteRowsBinaryMemory.Name = "deleteRowsBinaryMemory";
|
||||
this.deleteRowsBinaryMemory.Size = new System.Drawing.Size(23, 22);
|
||||
this.deleteRowsBinaryMemory.Text = "toolStripButton1";
|
||||
this.deleteRowsBinaryMemory.Click += new System.EventHandler(this.deleteRowsBinaryMemory_Click);
|
||||
//
|
||||
// binaryMemoryGridView
|
||||
//
|
||||
this.binaryMemoryGridView.AllowUserToAddRows = false;
|
||||
this.binaryMemoryGridView.AllowUserToDeleteRows = false;
|
||||
this.binaryMemoryGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.binaryMemoryGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.BinaryMemoryAddressColumn,
|
||||
this.BinaryMemoryDecimalColumn,
|
||||
this.BinaryMemoryBinaryColumn,
|
||||
this.BinaryMemoryWordColumn,
|
||||
this.BinaryMemoryIntegerColumn});
|
||||
this.binaryMemoryGridView.Location = new System.Drawing.Point(3, 28);
|
||||
this.binaryMemoryGridView.Name = "binaryMemoryGridView";
|
||||
this.binaryMemoryGridView.Size = new System.Drawing.Size(550, 222);
|
||||
this.binaryMemoryGridView.TabIndex = 0;
|
||||
this.binaryMemoryGridView.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.BinaryMemoryGridView_CellEndEdit);
|
||||
this.binaryMemoryGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.BinaryMemoryGridView_CellValueChanged);
|
||||
//
|
||||
// BinaryMemoryAddressColumn
|
||||
//
|
||||
this.BinaryMemoryAddressColumn.DataPropertyName = "address";
|
||||
this.BinaryMemoryAddressColumn.HeaderText = "Byte Address";
|
||||
this.BinaryMemoryAddressColumn.Name = "BinaryMemoryAddressColumn";
|
||||
this.BinaryMemoryAddressColumn.ReadOnly = true;
|
||||
//
|
||||
// BinaryMemoryDecimalColumn
|
||||
//
|
||||
this.BinaryMemoryDecimalColumn.DataPropertyName = "value";
|
||||
this.BinaryMemoryDecimalColumn.HeaderText = "Decimal";
|
||||
this.BinaryMemoryDecimalColumn.Name = "BinaryMemoryDecimalColumn";
|
||||
//
|
||||
// BinaryMemoryBinaryColumn
|
||||
//
|
||||
this.BinaryMemoryBinaryColumn.DataPropertyName = "binary";
|
||||
this.BinaryMemoryBinaryColumn.HeaderText = "Binary";
|
||||
this.BinaryMemoryBinaryColumn.MaxInputLength = 200;
|
||||
this.BinaryMemoryBinaryColumn.Name = "BinaryMemoryBinaryColumn";
|
||||
//
|
||||
// BinaryMemoryWordColumn
|
||||
//
|
||||
this.BinaryMemoryWordColumn.DataPropertyName = "word";
|
||||
this.BinaryMemoryWordColumn.HeaderText = "Word";
|
||||
this.BinaryMemoryWordColumn.Name = "BinaryMemoryWordColumn";
|
||||
//
|
||||
// BinaryMemoryIntegerColumn
|
||||
//
|
||||
this.BinaryMemoryIntegerColumn.DataPropertyName = "integer";
|
||||
this.BinaryMemoryIntegerColumn.HeaderText = "Integer";
|
||||
this.BinaryMemoryIntegerColumn.Name = "BinaryMemoryIntegerColumn";
|
||||
//
|
||||
// NcDemoApplicationForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(588, 348);
|
||||
this.Controls.Add(this.ncAxesSaveButton);
|
||||
this.Controls.Add(this.stopServer);
|
||||
this.Controls.Add(this.startServer);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "NcDemoApplicationForm";
|
||||
this.Text = "Nc Demo Application";
|
||||
this.ncAxesSaveButton.ResumeLayout(false);
|
||||
this.ncDataPage.ResumeLayout(false);
|
||||
this.ncDataPage.PerformLayout();
|
||||
this.processPage.ResumeLayout(false);
|
||||
this.processPage.PerformLayout();
|
||||
this.toolStrip1.ResumeLayout(false);
|
||||
this.toolStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncProcessGridView)).EndInit();
|
||||
this.alarms.ResumeLayout(false);
|
||||
this.alarms.PerformLayout();
|
||||
this.toolStrip3.ResumeLayout(false);
|
||||
this.toolStrip3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAlarmsGridView)).EndInit();
|
||||
this.ncAxesPage.ResumeLayout(false);
|
||||
this.ncAxesPage.PerformLayout();
|
||||
this.toolStrip4.ResumeLayout(false);
|
||||
this.toolStrip4.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ncAxisGridView)).EndInit();
|
||||
this.byteMemoryPage.ResumeLayout(false);
|
||||
this.byteMemoryPage.PerformLayout();
|
||||
this.toolStrip2.ResumeLayout(false);
|
||||
this.toolStrip2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.binaryMemoryGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button startServer;
|
||||
private System.Windows.Forms.Button stopServer;
|
||||
private System.Windows.Forms.TabControl ncAxesSaveButton;
|
||||
private System.Windows.Forms.TabPage processPage;
|
||||
private System.Windows.Forms.TabPage ncDataPage;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button saveNcDataButton;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox processNumberTxb;
|
||||
private System.Windows.Forms.TextBox softwareVersionTxb;
|
||||
private System.Windows.Forms.TextBox languageTxb;
|
||||
private System.Windows.Forms.TextBox serialNumberTxb;
|
||||
private System.Windows.Forms.TextBox modelTxb;
|
||||
private System.Windows.Forms.TextBox machineNumberTxb;
|
||||
private System.Windows.Forms.TextBox ncNameTxb;
|
||||
private System.Windows.Forms.Label ModelLabel;
|
||||
private System.Windows.Forms.Label MachineNumLabel;
|
||||
private System.Windows.Forms.Label NCNameLabel;
|
||||
private System.Windows.Forms.TextBox dateTimeTxb;
|
||||
private System.Windows.Forms.TabPage alarms;
|
||||
private System.Windows.Forms.DataGridView ncAlarmsGridView;
|
||||
private System.Windows.Forms.TabPage ncAxesPage;
|
||||
private System.Windows.Forms.DataGridView ncAxisGridView;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmCodeColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmTextColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmProcessIdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncAlarmIdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisIdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisNameColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisActualColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisProgrammedColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisMachinePositionColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisDistanceToGoColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn axisProcessColumn;
|
||||
private System.Windows.Forms.DataGridView ncProcessGridView;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessIdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessNameColumn;
|
||||
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessStatusColumn;
|
||||
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessModeColumn;
|
||||
private System.Windows.Forms.TabPage byteMemoryPage;
|
||||
private System.Windows.Forms.DataGridView binaryMemoryGridView;
|
||||
private System.Windows.Forms.ToolStrip toolStrip3;
|
||||
private System.Windows.Forms.ToolStripButton saveNcAlarmsButton;
|
||||
private System.Windows.Forms.ToolStrip toolStrip4;
|
||||
private System.Windows.Forms.ToolStripButton saveNcAxesButton;
|
||||
private System.Windows.Forms.ToolStrip toolStrip2;
|
||||
private System.Windows.Forms.ToolStripButton saveBinaryMemoryButton;
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripButton saveNcProcessData;
|
||||
private System.Windows.Forms.ToolStripButton addRowsBinaryMemory;
|
||||
private System.Windows.Forms.ToolStripButton deleteRowsBinaryMemory;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryAddressColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryDecimalColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryBinaryColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryWordColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryIntegerColumn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,299 @@
|
||||
using Nc_Demo_Application.Database;
|
||||
using Nc_Demo_Application.Database.Models;
|
||||
using Nc_Demo_Application.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using static Nc_Demo_Application.Constants;
|
||||
using System.Data;
|
||||
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
public partial class NcDemoApplicationForm : Form
|
||||
{
|
||||
private ServerController ServerControllerInstance;
|
||||
private DatabaseController dbController;
|
||||
|
||||
public NcDemoApplicationForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void StartServer_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Initialize database connection
|
||||
dbController = DatabaseController.getInstance();
|
||||
|
||||
// Inizializa ServerController Instance and Start server
|
||||
ServerControllerInstance = ServerController.getInstance();
|
||||
ServerControllerInstance.Run();
|
||||
// Set button status
|
||||
startServer.Enabled = false;
|
||||
stopServer.Enabled = true;
|
||||
SetButtonStatus(true);
|
||||
// Populate process model and status ComboBox
|
||||
ncProcessModeColumn.ValueType = typeof(PROC_MODE);
|
||||
ncProcessModeColumn.DataSource = Enum.GetValues(typeof(PROC_MODE));
|
||||
|
||||
ncProcessStatusColumn.ValueType = typeof(PROC_STATUS);
|
||||
ncProcessStatusColumn.DataSource = Enum.GetValues(typeof(PROC_STATUS));
|
||||
|
||||
// Read data from database
|
||||
FillNcDataInput();
|
||||
FillNcProcessInput();
|
||||
FillNcAlarmsInput();
|
||||
FillNAxisInput();
|
||||
FillBinaryMemoryInput();
|
||||
}
|
||||
|
||||
private void StopServer_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Stop Server
|
||||
ServerControllerInstance.Stop();
|
||||
// Reset button status
|
||||
stopServer.Enabled = false;
|
||||
startServer.Enabled = true;
|
||||
SetButtonStatus(false);
|
||||
|
||||
dbController.ResetDatabase();
|
||||
}
|
||||
|
||||
private void SetButtonStatus(bool status)
|
||||
{
|
||||
saveNcDataButton.Enabled =
|
||||
saveNcProcessData.Enabled =
|
||||
saveNcAlarmsButton.Enabled =
|
||||
saveNcAxesButton.Enabled =
|
||||
saveBinaryMemoryButton.Enabled = status;
|
||||
}
|
||||
|
||||
private void FillNcDataInput()
|
||||
{
|
||||
// ReadData from database
|
||||
NcDataModel ncData = dbController.ReadNcData();
|
||||
|
||||
// Update user NcData input
|
||||
ncNameTxb.Text = ncData.name;
|
||||
serialNumberTxb.Text = ncData.serialNumber;
|
||||
modelTxb.Text = ncData.model;
|
||||
languageTxb.Text = ncData.language;
|
||||
softwareVersionTxb.Text = ncData.softwareVersion;
|
||||
dateTimeTxb.Text = ncData.dateTime;
|
||||
machineNumberTxb.Text = ncData.machineNumber;
|
||||
processNumberTxb.Text = ncData.processCount.ToString();
|
||||
}
|
||||
|
||||
private void FillNcProcessInput()
|
||||
{
|
||||
// Insert processes' data into Grid View
|
||||
DataTable ncProcesses = dbController.ReadNcProcesses();
|
||||
ncProcessGridView.DataSource = ncProcesses;
|
||||
}
|
||||
|
||||
private void FillNcAlarmsInput()
|
||||
{
|
||||
// Insert alarms' data into Grid View
|
||||
DataTable ncAlarmsData = dbController.ReadNcAlarms();
|
||||
ncAlarmsGridView.DataSource = ncAlarmsData;
|
||||
}
|
||||
|
||||
private void FillNAxisInput()
|
||||
{
|
||||
// Insert axes' data into Grid View
|
||||
DataTable ncAxisData = dbController.ReadNcAxes();
|
||||
ncAxisGridView.DataSource = ncAxisData;
|
||||
}
|
||||
|
||||
private void FillBinaryMemoryInput()
|
||||
{
|
||||
DataTable binaryMemoryData = dbController.ReadBinaryMemory();
|
||||
binaryMemoryGridView.DataSource = binaryMemoryData;
|
||||
}
|
||||
|
||||
private void SaveCnDataButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
NcDataModel ncData = new NcDataModel();
|
||||
|
||||
// Read data from user NcData input
|
||||
ncData.name = ncNameTxb.Text;
|
||||
ncData.model = modelTxb.Text;
|
||||
ncData.serialNumber = serialNumberTxb.Text;
|
||||
ncData.machineNumber = machineNumberTxb.Text;
|
||||
ncData.dateTime = dateTimeTxb.Text;
|
||||
ncData.processCount = Convert.ToInt32(processNumberTxb.Text);
|
||||
ncData.softwareVersion = softwareVersionTxb.Text;
|
||||
ncData.language = languageTxb.Text;
|
||||
|
||||
// Update user data
|
||||
dbController.UpdateNcData(ncData);
|
||||
}
|
||||
|
||||
private void SaveNcProcessData_Click(object sender, EventArgs e)
|
||||
{
|
||||
dbController.UpdateNcProcess((DataTable)ncProcessGridView.DataSource);
|
||||
}
|
||||
|
||||
private void SaveNcAlarmsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
dbController.UpdateNcAlarms((DataTable)ncAlarmsGridView.DataSource);
|
||||
}
|
||||
|
||||
private void SaveNcAxesButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
dbController.UpdateNcAxes((DataTable)ncAxisGridView.DataSource);
|
||||
}
|
||||
|
||||
private void SaveBinaryMemory_Click(object sender, EventArgs e)
|
||||
{
|
||||
dbController.UpdateBinaryMemory((DataTable)binaryMemoryGridView.DataSource);
|
||||
}
|
||||
|
||||
private void ncProcessGridView_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
||||
{
|
||||
// TODO
|
||||
|
||||
}
|
||||
|
||||
private void BinaryMemoryGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
// Remove startup change
|
||||
if (e.RowIndex >= 0)
|
||||
{
|
||||
// Get cells ref
|
||||
var binaryCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryBinaryColumn"];
|
||||
var decimalCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryDecimalColumn"];
|
||||
|
||||
// If decimal value is changed, by user or programmatically, update all the row cells
|
||||
if (e.ColumnIndex == 1)
|
||||
{
|
||||
// Update binary cell
|
||||
string binaryValue = Convert.ToString(Convert.ToInt32(decimalCell.Value.ToString(), 10), 2).PadLeft(8, '0'); ;
|
||||
if (Convert.ToInt32(decimalCell.Value) < 0)
|
||||
binaryValue = binaryValue.Substring(Math.Max(binaryValue.Length - 8, 0));
|
||||
binaryCell.Value = binaryValue;
|
||||
|
||||
// Update Next Word cell
|
||||
// Find next word index to be updated and which byte of the word replace
|
||||
int nextWordPos = (e.RowIndex + 1) % 2;
|
||||
int stringIndexToReplace = 8 * nextWordPos;
|
||||
|
||||
// Get the word ref
|
||||
var wordCell = binaryMemoryGridView.Rows[e.RowIndex + nextWordPos].Cells["BinaryMemoryWordColumn"];
|
||||
// Get binary value of the word
|
||||
string binaryWordCellValue = Convert.ToString(Convert.ToInt16(wordCell.Value.ToString(), 10), 2).PadLeft(16, '0');
|
||||
// Replace with the new value
|
||||
binaryWordCellValue = binaryWordCellValue.Remove(stringIndexToReplace, 8).Insert(stringIndexToReplace, binaryValue);
|
||||
// Update cell
|
||||
wordCell.Value = Convert.ToInt16(binaryWordCellValue, 2).ToString();
|
||||
|
||||
// Update next integer cell
|
||||
// Find next integer index to be updated
|
||||
// nextIntegerPos = max position next integer - edited row position
|
||||
int nextIntegerPos = 3 - (e.RowIndex % 4);
|
||||
// Find which byte of the integer replace
|
||||
stringIndexToReplace = 8 * nextIntegerPos;
|
||||
// Get the word ref
|
||||
var integerCell = binaryMemoryGridView.Rows[e.RowIndex + nextIntegerPos].Cells["BinaryMemoryIntegerColumn"];
|
||||
// Get binary value of the word
|
||||
string binaryIntegerCellValue = Convert.ToString(Convert.ToInt32(integerCell.Value.ToString(), 10), 2).PadLeft(32, '0');
|
||||
// Replace edited byte with the new value
|
||||
binaryIntegerCellValue = binaryIntegerCellValue.Remove(stringIndexToReplace, 8).Insert(stringIndexToReplace, binaryValue);
|
||||
// Update cell
|
||||
integerCell.Value = Convert.ToInt32(binaryIntegerCellValue, 2).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BinaryMemoryGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
var decimalCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryDecimalColumn"];
|
||||
|
||||
// Find which column user has changed
|
||||
switch (e.ColumnIndex)
|
||||
{
|
||||
// Case: user change binary column
|
||||
case 2:
|
||||
{
|
||||
var binaryCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryBinaryColumn"];
|
||||
// Update decimal Value
|
||||
decimalCell.Value = Convert.ToSByte(binaryCell.Value.ToString(), 2);
|
||||
// Insert zeros up to a lenght of 8
|
||||
binaryCell.Value = binaryCell.Value.ToString().PadLeft(8, '0');
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
var wordCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryWordColumn"];
|
||||
// Convert integer word into a binary string (0-15)
|
||||
string binary = Convert.ToString(Convert.ToInt32(wordCell.Value.ToString(), 10), 2).PadLeft(16, '0');
|
||||
|
||||
// Set the current edited current row value with the first half of the binary string (0-8)
|
||||
decimalCell.Value = Convert.ToByte(binary.Substring(0, 8), 2);
|
||||
|
||||
// Set the previus row value with the second half of the binary string (8-15)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 1].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(8, 8), 2);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
var integerCell = binaryMemoryGridView.Rows[e.RowIndex].Cells["BinaryMemoryIntegerColumn"];
|
||||
// Convert integer word into a binary string (0-32)
|
||||
string binary = Convert.ToString(Convert.ToInt32(integerCell.Value.ToString(), 10), 2).PadLeft(32, '0');
|
||||
|
||||
// Set the current edited current row value with the first part of the binary string (0-8)
|
||||
decimalCell.Value = Convert.ToByte(binary.Substring(0, 8), 2);
|
||||
|
||||
// Set the -1 row value with the second part of the binary string (8-15)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 1].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(8, 8), 2);
|
||||
|
||||
// Set the -2 row value with the third pard of the binary string (16-23)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 2].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(16, 8), 2);
|
||||
|
||||
// Set the -3 row value with the fourth part of the binary string (24-31)
|
||||
binaryMemoryGridView.Rows[e.RowIndex - 3].Cells["BinaryMemoryDecimalColumn"].Value = Convert.ToByte(binary.Substring(24, 8), 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void addRowsBinaryMemory_Click(object sender, EventArgs e)
|
||||
{
|
||||
DataTable dt = binaryMemoryGridView.DataSource as DataTable;
|
||||
//Create new 4 rows with empty value
|
||||
int startAddress = binaryMemoryGridView.RowCount;
|
||||
|
||||
//Populate the rows with data
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
DataRow row = dt.NewRow();
|
||||
|
||||
row["address"] = startAddress + i;
|
||||
row["value"] = 0;
|
||||
row["binary"] = "00000000";
|
||||
|
||||
// Every 2 row set word value
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
row["word"] = 0;
|
||||
}
|
||||
// Every 4 row set integer value
|
||||
if (i % 4 == 0)
|
||||
{
|
||||
row["integer"] = 0;
|
||||
}
|
||||
|
||||
//Add the row to data table
|
||||
dt.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteRowsBinaryMemory_Click(object sender, EventArgs e)
|
||||
{
|
||||
int lenght = binaryMemoryGridView.RowCount - 1;
|
||||
for (int i = lenght; i > (lenght - 4); i--)
|
||||
{
|
||||
binaryMemoryGridView.Rows.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 248 B |
|
After Width: | Height: | Size: 653 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Nc_Demo_Application
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Punto di ingresso principale dell'applicazione.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new NcDemoApplicationForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Le informazioni generali relative a un assembly sono controllate dal seguente
|
||||
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
|
||||
// associate a un assembly.
|
||||
[assembly: AssemblyTitle("Nc_Demo_Application")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Nc_Demo_Application")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
|
||||
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
|
||||
// COM, impostare su true l'attributo ComVisible per tale tipo.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
|
||||
[assembly: Guid("23131777-64a6-41e7-a6dc-d531acba1be4")]
|
||||
|
||||
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
|
||||
//
|
||||
// Versione principale
|
||||
// Versione secondaria
|
||||
// Numero di build
|
||||
// Revisione
|
||||
//
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Il codice è stato generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Nc_Demo_Application.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
|
||||
/// </summary>
|
||||
// Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder.
|
||||
// tramite uno strumento quale ResGen o Visual Studio.
|
||||
// Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen
|
||||
// con l'opzione /str oppure ricompilare il progetto VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Nc_Demo_Application.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
|
||||
/// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Il codice è stato generato da uno strumento.
|
||||
// Versione runtime:4.0.30319.42000
|
||||
//
|
||||
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Nc_Demo_Application.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.ServiceModel.Description;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Web;
|
||||
using Nc_Demo_Application.Server.Service;
|
||||
|
||||
namespace Nc_Demo_Application.Server
|
||||
{
|
||||
class ServerController
|
||||
{
|
||||
private static ServerController Instance;
|
||||
Uri WebUri;
|
||||
WebServiceHost WebHost;
|
||||
WebHttpBinding Binding;
|
||||
|
||||
|
||||
// Singleton Method
|
||||
public static ServerController getInstance()
|
||||
{
|
||||
if (Instance == null)
|
||||
Instance = new ServerController();
|
||||
return Instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Stop the Server
|
||||
public void Stop()
|
||||
{
|
||||
//Stop WebHost
|
||||
if (WebHost != null)
|
||||
{
|
||||
WebHost.Close();
|
||||
Console.WriteLine("Server closed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Start server
|
||||
public void Run()
|
||||
{
|
||||
try
|
||||
{
|
||||
//Create Server Uri
|
||||
WebUri = new Uri(Constants.SERVER_IP_ADDRESS + Constants.SERVER_PORT + Constants.API_URL);
|
||||
|
||||
//Create WebHost
|
||||
Console.WriteLine("RUNNING: Creating API Server on \"" + WebUri + "\"... ");
|
||||
WebHost = new WebServiceHost(typeof(LibraryService), WebUri);
|
||||
|
||||
//Add LibraryService endpoint
|
||||
Binding = new WebHttpBinding();
|
||||
Binding.MaxBufferPoolSize = long.MaxValue;
|
||||
ServiceEndpoint ep = WebHost.AddServiceEndpoint(typeof(ILibraryService), new WebHttpBinding(), "");
|
||||
//Start WebHost
|
||||
WebHost.Open();
|
||||
Console.WriteLine("RUNNING: API Server Created ");
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Exception: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
using Nc_Demo_Application.Database.Models;
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Web;
|
||||
using static Nc_Demo_Application.Constants;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Nc_Demo_Application.Server.Service
|
||||
{
|
||||
[ServiceContract]
|
||||
interface ILibraryService
|
||||
{
|
||||
[OperationContract]
|
||||
|
||||
#region Nc Data API
|
||||
|
||||
[WebGet(UriTemplate = "cn/name/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void Name(out string name);
|
||||
[WebGet(UriTemplate = "cn/language/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void Language(out string language);
|
||||
|
||||
[WebGet(UriTemplate = "cn/serial_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void SerialNumber(out string serialNumber);
|
||||
|
||||
[WebGet(UriTemplate = "cn/software_version/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void SoftwareVersion(out string softwareVersion);
|
||||
|
||||
[WebGet(UriTemplate = "cn/model/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void Model(out string model);
|
||||
|
||||
[WebGet(UriTemplate = "cn/date_time/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void DateTime(out string dateTime);
|
||||
|
||||
[WebGet(UriTemplate = "cn/machine_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void MachineNumber(out string machineNumber);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Process API
|
||||
|
||||
[WebGet(UriTemplate = "cn/process_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void ProcessNumber(out ushort processNumber);
|
||||
|
||||
[WebGet(UriTemplate = "process/{id}/status/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void ProcessStatus(string id, out int status);
|
||||
|
||||
[WebGet(UriTemplate = "process/{id}/mode/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void ProcessMode(string id, out int mode);
|
||||
|
||||
[WebGet(UriTemplate = "process/{id}/alarms/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void ProcessAlarms(string id, out List<NcAlarmModel> alarms);
|
||||
|
||||
[WebGet(UriTemplate = "processes/alarms/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void ProcessesAlarms(out List<NcAlarmModel> alarms);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Process Axes API
|
||||
|
||||
[WebGet(UriTemplate = "process/{id}/axes/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetAxesActualPosition(string id, out List<NcAxisModel> axes);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Binary Memory
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/byte/{index}/{bit}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetBoolean(string index, string bit, out bool value);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/byte/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetByte(string index, out byte value);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/word/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetWord(string index, out ushort value);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/short/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetShort(string index, out short value);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/dword/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetDWord(string index, out uint value);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/integer/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetInteger(string index, out int value);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/byte/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
|
||||
void PutByte(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/word/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutWord(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/short/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutShort(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/integer/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutInteger(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/dword/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutDWord(string index, BinaryMemoryModel body);
|
||||
#endregion
|
||||
|
||||
#region Binary Memory List
|
||||
[WebGet(UriTemplate = "binary_memory/byte/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetByteList(string index, string number, out List<byte> byteList);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/word/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetWordList(string index, string number, out List<ushort> byteList);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/short/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetShortList(string index, string number, out List<short> byteList);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory/integer/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetIntegerList(string index, string number, out List<int> byteList);
|
||||
|
||||
[WebGet(UriTemplate = "binary_memory//{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
|
||||
void GetDWordList(string index, string number, out List<uint> byteList);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/byte/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutByteList(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/word/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutWordList(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/short/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutShortList(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/integer/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutIntegerList(string index, BinaryMemoryModel body);
|
||||
|
||||
[WebInvoke(Method = "PUT", UriTemplate = "binary_memory/dword/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
|
||||
void PutDWordList(string index, BinaryMemoryModel body);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
using Nc_Demo_Application.Database;
|
||||
using Nc_Demo_Application.Database.Models;
|
||||
using System;
|
||||
using System.ServiceModel;
|
||||
using System.Collections.Generic;
|
||||
using static Nc_Demo_Application.Constants;
|
||||
using System.Linq;
|
||||
using System.ServiceModel.Web;
|
||||
using System.Net;
|
||||
|
||||
namespace Nc_Demo_Application.Server.Service
|
||||
{
|
||||
[ServiceBehavior(MaxItemsInObjectGraph = int.MaxValue, InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]
|
||||
class LibraryService : ILibraryService
|
||||
{
|
||||
private DatabaseController dbController = DatabaseController.getInstance();
|
||||
private NcDataModel ncDataData = new NcDataModel();
|
||||
|
||||
#region Nc Data API
|
||||
public void Name(out string name)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
name = ncDataData.name;
|
||||
}
|
||||
|
||||
public void DateTime(out string dateTime)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
dateTime = ncDataData.dateTime;
|
||||
}
|
||||
|
||||
public void Language(out string language)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
language = ncDataData.language;
|
||||
}
|
||||
|
||||
public void MachineNumber(out string machineNumber)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
machineNumber = ncDataData.machineNumber;
|
||||
}
|
||||
|
||||
public void Model(out string model)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
model = ncDataData.model;
|
||||
}
|
||||
|
||||
public void SerialNumber(out string serialNumber)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
serialNumber = ncDataData.serialNumber;
|
||||
}
|
||||
|
||||
public void SoftwareVersion(out string softwareVersion)
|
||||
{
|
||||
ncDataData = dbController.GetNcData();
|
||||
softwareVersion = ncDataData.softwareVersion;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Process API
|
||||
public void ProcessNumber(out ushort processNumber)
|
||||
{
|
||||
List<NcProcessModel> ncProcessesData = dbController.GetNcProcesses();
|
||||
processNumber = (ushort)ncProcessesData.Count;
|
||||
}
|
||||
|
||||
public void ProcessStatus(string id, out int status)
|
||||
{
|
||||
List<NcProcessModel> ncProcessesData = dbController.GetNcProcesses();
|
||||
status = ncProcessesData.Find(i => i.id == Convert.ToInt32(id)).status;
|
||||
}
|
||||
|
||||
public void ProcessMode(string id, out int mode)
|
||||
{
|
||||
List<NcProcessModel> ncProcessesData = dbController.GetNcProcesses();
|
||||
mode = ncProcessesData.Find(i => i.id == Convert.ToInt32(id)).mode;
|
||||
}
|
||||
|
||||
public void ProcessAlarms(string id, out List<NcAlarmModel> alarms)
|
||||
{
|
||||
List<NcAlarmModel> ncAlarmsData = dbController.GetNcAlarms();
|
||||
alarms = ncAlarmsData.FindAll(i => i.processId == Convert.ToInt32(id));
|
||||
}
|
||||
public void ProcessesAlarms(out List<NcAlarmModel> alarms)
|
||||
{
|
||||
alarms = dbController.GetNcAlarms();
|
||||
}
|
||||
public void GetAxesActualPosition(string id, out List<NcAxisModel> axes)
|
||||
{
|
||||
List<NcAxisModel> ncAxesModel = dbController.GetNcAxes();
|
||||
axes = ncAxesModel.FindAll(i => i.processId == Convert.ToInt32(id));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Binary Memory
|
||||
|
||||
public void GetBoolean(string index, string bit, out bool value)
|
||||
{
|
||||
string binaryByte = dbController.GetBinaryByteValue(Convert.ToInt32(index));
|
||||
binaryByte = binaryByte.Substring(8 - Convert.ToInt32(bit + 1), 1);
|
||||
value = Convert.ToBoolean(binaryByte);
|
||||
}
|
||||
|
||||
public void GetByte(string index, out byte value)
|
||||
{
|
||||
value = dbController.GetByteValue(Convert.ToInt32(index));
|
||||
}
|
||||
|
||||
public void GetWord(string index, out ushort value)
|
||||
{
|
||||
// Read Unsigned word
|
||||
value = Convert.ToUInt16(dbController.GetWordValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void GetShort(string index, out short value)
|
||||
{
|
||||
// Read signed Word
|
||||
value = Convert.ToInt16(dbController.GetWordValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void GetDWord(string index, out uint value)
|
||||
{
|
||||
// Read Unsigned Integer
|
||||
value = Convert.ToUInt32(dbController.GetIntegerValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void GetInteger(string index, out int value)
|
||||
{
|
||||
// Read Signed Integer
|
||||
value = Convert.ToInt32(dbController.GetIntegerValue(Convert.ToInt32(index)), 2);
|
||||
}
|
||||
|
||||
public void PutByte(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
// Edit byte
|
||||
dbController.PutByteValue(Convert.ToInt32(index), body.binary);
|
||||
}
|
||||
|
||||
public void PutWord(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutWordValue(Convert.ToInt32(index), body.uWord);
|
||||
}
|
||||
|
||||
public void PutShort(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutShortValue(Convert.ToInt32(index), body.word);
|
||||
}
|
||||
|
||||
public void PutInteger(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutIntegerValue(Convert.ToInt32(index), body.integer);
|
||||
}
|
||||
|
||||
public void PutDWord(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if(body == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
dbController.PutDWordValue(Convert.ToInt32(index), body.dWord);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Binary Memory List
|
||||
public void GetByteList(string index, string number, out List<byte> byteList)
|
||||
{
|
||||
int idx = Convert.ToInt32(index);
|
||||
byteList = new List<byte>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
byteList.Add(dbController.GetByteValue(idx + i));
|
||||
}
|
||||
}
|
||||
|
||||
public void GetWordList(string index, string number, out List<ushort> wordList)
|
||||
{
|
||||
int idx = Convert.ToInt32(index);
|
||||
wordList = new List<ushort>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
wordList.Add(Convert.ToUInt16(dbController.GetWordValue(idx + i), 2));
|
||||
}
|
||||
}
|
||||
|
||||
public void GetShortList(string index, string number, out List<short> wordList)
|
||||
{
|
||||
int idx = Convert.ToInt32(index);
|
||||
wordList = new List<short>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
wordList.Add(Convert.ToInt16(dbController.GetWordValue(idx + i), 2));
|
||||
}
|
||||
}
|
||||
|
||||
public void GetIntegerList(string index, string number, out List<int> integerList)
|
||||
{
|
||||
int idx = Convert.ToInt32(index);
|
||||
integerList = new List<int>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
integerList.Add(Convert.ToInt32(dbController.GetIntegerValue(idx + (4*i)), 2));
|
||||
}
|
||||
}
|
||||
|
||||
public void GetDWordList(string index, string number, out List<uint> dWordList)
|
||||
{
|
||||
int idx = Convert.ToInt32(index);
|
||||
dWordList = new List<uint>();
|
||||
for (int i = 0; i < Convert.ToInt32(number); i++)
|
||||
{
|
||||
dWordList.Add(Convert.ToUInt32(dbController.GetWordValue(idx + i), 2));
|
||||
}
|
||||
}
|
||||
|
||||
public void PutByteList(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null && body.byteList == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (byte item in body.byteList)
|
||||
{
|
||||
dbController.PutByteValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
public void PutWordList(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null && body.wordList == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (ushort item in body.wordList)
|
||||
{
|
||||
dbController.PutWordValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
public void PutShortList(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null && body.shortList == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (short item in body.shortList)
|
||||
{
|
||||
dbController.PutShortValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
public void PutIntegerList(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null && body.shortList == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (int item in body.shortList)
|
||||
{
|
||||
dbController.PutIntegerValue(idx, item);
|
||||
}
|
||||
}
|
||||
|
||||
public void PutDWordList(string index, BinaryMemoryModel body)
|
||||
{
|
||||
if (body == null && body.dWordList == null)
|
||||
{
|
||||
throw new WebFaultException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
int idx = Convert.ToInt32(index);
|
||||
foreach (int item in body.dWordList)
|
||||
{
|
||||
dbController.PutIntegerValue(idx, item);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="v13.0" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="System.Data.SQLite.EF6" />
|
||||
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
|
||||
<remove invariant="System.Data.SQLite" />
|
||||
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
</configuration>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
*
|
||||
* System.Data.SQLite.dll.config -
|
||||
*
|
||||
* WARNING: This XML configuration file is intended for use within the NuGet
|
||||
* package directories only. Please do not copy this file to any of
|
||||
* the build output directories because it could interfere with the
|
||||
* native library pre-loading feature.
|
||||
*
|
||||
* Written by Joe Mistachkin.
|
||||
* Released to the public domain, use at your own risk!
|
||||
*
|
||||
-->
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="PreLoadSQLite_BaseDirectory"
|
||||
value="%PreLoadSQLite_AssemblyDirectory%\..\..\build\%PreLoadSQLite_TargetFramework%" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -0,0 +1 @@
|
||||
11f6b4a003b7449a519bdf088b56a7b01e02f84d
|
||||
@@ -0,0 +1,20 @@
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.exe.config
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.exe
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.pdb
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.SqlServer.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.EF6.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.Linq.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.ServiceModel.Primitives.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.xml
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.SqlServer.xml
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.xml
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.dll.config
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_Application.csprojResolveAssemblyReference.cache
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.NcDemoApplicationForm.resources
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.Properties.Resources.resources
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_Application.csproj.GenerateResource.Cache
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\CMS_Core_Nc_Demo_Application.csproj.CoreCompileInputs.cache
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.exe
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.pdb
|
||||
@@ -0,0 +1 @@
|
||||
cdcdb105eb156913c4923e6fa5a0328f3b578f15
|
||||
@@ -0,0 +1,20 @@
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.exe.config
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.exe
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\Nc_Demo_Application.pdb
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.SqlServer.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.EF6.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.Linq.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.ServiceModel.Primitives.dll
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.xml
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\EntityFramework.SqlServer.xml
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.xml
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\bin\Debug\System.Data.SQLite.dll.config
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.csprojResolveAssemblyReference.cache
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.Properties.Resources.resources
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.csproj.GenerateResource.Cache
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.csproj.CoreCompileInputs.cache
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.exe
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.pdb
|
||||
C:\Workspace\Nc_Demo_Application\Nc_Demo_Application\obj\Debug\Nc_Demo_Application.NcDemoApplicationForm.resources
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.1.3" targetFramework="net452" />
|
||||
<package id="System.Data.SQLite" version="1.0.105.2" targetFramework="net452" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.105.2" targetFramework="net452" />
|
||||
<package id="System.Data.SQLite.EF6" version="1.0.105.2" targetFramework="net452" />
|
||||
<package id="System.Data.SQLite.Linq" version="1.0.105.2" targetFramework="net452" />
|
||||
<package id="System.ServiceModel.Primitives" version="4.4.0" targetFramework="net461" requireReinstallation="true" />
|
||||
</packages>
|
||||
@@ -0,0 +1,5 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
</configSections>
|
||||
</configuration>
|
||||
@@ -0,0 +1,5 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
</configSections>
|
||||
</configuration>
|
||||