Преглед изворни кода

Test Battery SerialModule Upload

DESKTOP-6U0VOTJ\User пре 6 година
родитељ
комит
405d6463ac
19 измењених фајлова са 550 додато и 29 уклоњено
  1. 1 3
      Dev/Connection/OHVProtocolServer/OHVProtocolClient/MainWindow.xaml
  2. 5 5
      Dev/OHV/OHV.Common/App.config
  3. 9 7
      Dev/OHV/OHV.SqliteDAL/App.config
  4. 4 10
      Dev/OHV/OHV.Vehicle/App.config
  5. 3 3
      Dev/OHV/OHV.Vehicle/OHV.Vehicle.csproj
  6. 1 1
      Dev/OHV/VehicleControlSystem/Managers/AutoManager.cs
  7. 0 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/db.lock
  8. BIN
      Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/storage.ide
  9. BIN
      Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/storage.ide-shm
  10. BIN
      Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/storage.ide-wal
  11. 25 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos.sln
  12. 53 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/BatteryTabos.csproj
  13. 36 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Config.cs
  14. 36 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Delegates.cs
  15. 24 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/EnumBatteryStatus.cs
  16. 188 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Manager.cs
  17. 36 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Properties/AssemblyInfo.cs
  18. 26 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/QueObject.cs
  19. 103 0
      Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Rs232c.cs

+ 1 - 3
Dev/Connection/OHVProtocolServer/OHVProtocolClient/MainWindow.xaml

@@ -6,7 +6,5 @@
         xmlns:local="clr-namespace:OHVProtocolClient"
         mc:Ignorable="d"
         Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
-    <Grid>
-        
-    </Grid>
+    <Grid/>
 </Window>

+ 5 - 5
Dev/OHV/OHV.Common/App.config

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <configSections>
-        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-        <section name="entityFramework"
-          type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
-          requirePermission="false"/>
-    </configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework"
+      type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+      requirePermission="false"/>
+  </configSections>
   <entityFramework>
     <providers>
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>

+ 9 - 7
Dev/OHV/OHV.SqliteDAL/App.config

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
   <configSections>
-        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
-        <section name="entityFramework"
-          type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
-          requirePermission="false"/>
-    </configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework"
+      type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+      requirePermission="false"/>
+  </configSections>
 
   <connectionStrings>
     <add name="OHVDb" connectionString="data source=.\db\OHVDb\OHVDb.sqlite;foreign keys=true" providerName="System.Data.SQLite"/>
@@ -14,9 +14,11 @@
   <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"/>
+      <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"/>
+      <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>
   

+ 4 - 10
Dev/OHV/OHV.Vehicle/App.config

@@ -4,34 +4,28 @@
     <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
   </configSections>
-
   <connectionStrings>
-    <add name="OHVDb" connectionString="data source=.\DB\OHVDb.sqlite;foreign keys=true" providerName="System.Data.SQLite"/>
+    <add name="OHVDb" connectionString="data source=.\DB\OHVDb.sqlite;foreign keys=true" providerName="System.Data.SQLite" />
   </connectionStrings>
-
   <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
   </startup>
-
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
       <parameters>
-        <parameter value="mssqllocaldb"/>
+        <parameter value="mssqllocaldb" />
       </parameters>
     </defaultConnectionFactory>
     <providers>
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
       <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
-      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
     </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>
+    <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>

+ 3 - 3
Dev/OHV/OHV.Vehicle/OHV.Vehicle.csproj

@@ -179,6 +179,9 @@
     </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PostBuildEvent>copy "$(SolutionDir)\Assambly\EzPlus2\*.*" "$(TargetDir)"</PostBuildEvent>
+  </PropertyGroup>
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
@@ -189,7 +192,4 @@
   </Target>
   <Import Project="..\packages\EntityFramework.6.3.0\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.3.0\build\EntityFramework.targets')" />
   <Import Project="..\packages\System.Data.SQLite.Core.1.0.112.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.112.0\build\net45\System.Data.SQLite.Core.targets')" />
-  <PropertyGroup>
-    <PostBuildEvent>copy "$(SolutionDir)\Assambly\EzPlus2\*.*" "$(TargetDir)"</PostBuildEvent>
-  </PropertyGroup>
 </Project>

+ 1 - 1
Dev/OHV/VehicleControlSystem/Managers/AutoManager.cs

@@ -1,7 +1,7 @@
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Text;
+using System.Linq;
 using System.Threading;
 using System.Threading.Tasks;
 using GSG.NET.Concurrent;

+ 0 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/db.lock


BIN
Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/storage.ide


BIN
Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/storage.ide-shm


BIN
Dev/SerialModule/BatteryTabos/BatteryTabos/.vs/BatteryTabos/v16/Server/sqlite3/storage.ide-wal


+ 25 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatteryTabos", "BatteryTabos\BatteryTabos.csproj", "{915BD4D3-768F-466A-9DF0-984F04E5A05F}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{915BD4D3-768F-466A-9DF0-984F04E5A05F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{915BD4D3-768F-466A-9DF0-984F04E5A05F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{915BD4D3-768F-466A-9DF0-984F04E5A05F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{915BD4D3-768F-466A-9DF0-984F04E5A05F}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {A2B2AE46-20C3-48D4-A0DB-8F683C722D2B}
+	EndGlobalSection
+EndGlobal

+ 53 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/BatteryTabos.csproj

@@ -0,0 +1,53 @@
+<?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>{915BD4D3-768F-466A-9DF0-984F04E5A05F}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>BatteryTabos</RootNamespace>
+    <AssemblyName>BatteryTabos</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <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' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Config.cs" />
+    <Compile Include="Delegates.cs" />
+    <Compile Include="EnumBatteryStatus.cs" />
+    <Compile Include="Manager.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="QueObject.cs" />
+    <Compile Include="Rs232c.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 36 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Config.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BatteryTabos
+{
+    public class Config
+    {
+        public double Voltage { get; set; }
+        public double Current { get; set; }
+        public double SOC { get; set; }
+        public double BatteryStatus { get; set; }
+        public double ChargeTime { get; set; }
+        public double DisChargeTime { get; set; }
+        public double Temperature { get; set; }
+        public double SOH { get; set; }
+        public double Capacity { get; set; }
+        public double Energy { get; set; }
+
+        public Config()
+        {
+            Voltage = -1;
+            Current = -1;
+            SOC = -1;
+            BatteryStatus = -1;
+            ChargeTime = -1;
+            DisChargeTime = -1;
+            Temperature = -1;
+            SOH = -1;
+            Capacity = -1;
+            Energy = -1;
+        }
+    }
+}

+ 36 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Delegates.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BatteryTabos
+{
+    public delegate void DlgId(string _id);
+    public delegate void DlgVoltage(double _value);
+    public delegate void DlgCurrent(double _value);
+    public delegate void DlgSOC(double _value);
+    public delegate void DlgBattery(double _value);
+    public delegate void DlgCharge(double _value);
+    public delegate void DlgDisCharge(double _value);
+    public delegate void DlgTemperature(double _value);
+    public delegate void DlgSOH(double _value);
+    public delegate void DlgCapacity(double _value);
+    public delegate void DlgEnergy(double _value);
+
+    public partial class Manager
+    {
+        public event DlgId OnConnect;
+
+        public event DlgVoltage OnVoltage;
+        public event DlgCurrent OnCurrent;
+        public event DlgSOC OnSOC;
+        public event DlgBattery OnBattery;
+        public event DlgCharge OnCharge;
+        public event DlgDisCharge OnDisCharge;
+        public event DlgTemperature OnTemperature;
+        public event DlgSOH OnSOH;
+        public event DlgCapacity OnCapacity;
+        public event DlgEnergy OnEnergy;
+    }
+}

+ 24 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/EnumBatteryStatus.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BatteryTabos
+{
+    /// <summary>
+    /// Battery Status Bit Flag
+    /// 2^7 = 127
+    /// </summary>
+
+    public enum E_BatteryStatus
+    {
+        HIGH_CURRENT = 0,
+        LOW_CURRENT,
+        OVER_CHARGE_CURRENT,
+        OVER_DISCHARGE_CURRENT,
+        HIGH_TEMPERATURE,
+        LOW_TEMPERATURE,
+        BMU_ERROR
+    }
+}

+ 188 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Manager.cs

@@ -0,0 +1,188 @@
+using System;
+using System.Collections.Generic;
+using System.IO.Ports;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace BatteryTabos
+{
+    public partial class Manager
+    {
+        #region Total Packet Data
+        readonly byte StartSentence1 = 0xAF;
+        readonly byte StartSentence2 = 0xFA;
+        readonly byte Address = 0x60;
+        readonly byte Length = 0x05;
+        readonly byte ReqCommand = 0x01;
+        readonly byte Order = 0x60;
+        readonly byte Kind1 = 0x7F;
+        readonly byte Kind2 = 0x07;
+        readonly byte _CheckSum = 0x4C;
+        readonly byte EndSentence1 = 0xAF;
+        readonly byte EndSentence2 = 0xA0;
+
+        readonly byte SendCommand = 0x02;
+        readonly byte BatteryCommand = 0x03;
+        readonly byte BatteryDataErrorCommand = 0x1F;
+        #endregion
+
+        Rs232c battery;
+        Config _config { get; set; }
+
+        byte[] _allpacket;
+
+        Queue<QueObject> QQ = new Queue<QueObject>();
+
+        Thread QW;
+
+        public bool IsOpen
+        {
+            get { return battery.serial.IsOpen; }
+        }
+
+        public Manager()
+        {
+            this._config = new Config();
+
+            /*Test ComPort*/
+            this.battery = new Rs232c("COM1");
+            this._allpacket = new byte[] { StartSentence1, StartSentence2, Address, Length, ReqCommand, Order, Kind1, Kind2, _CheckSum, EndSentence1, EndSentence2 };
+
+            this.battery.serial.DataReceived += Receive;
+
+            /*event Thread Pull Start*/
+            QW = ThreadUitls.Invoke(QueWorker);
+
+            /*생성 후 Send ? Thread Send ?*/
+            //Thread.Sleep(10);
+            SendAllData();
+        }
+
+        private void Receive(object sender, SerialDataReceivedEventArgs e)
+        {
+            try
+            {
+                if (this.battery.serial.IsOpen && this.battery.serial != null)
+                {
+                    var recv = new byte[this.battery.serial.BytesToRead];
+                    this.battery.serial.Read(recv, 0, recv.Length);
+                    ByteParse(recv);
+                }
+            }
+            catch (Exception ex) { }
+        }
+
+        private void ByteParse(byte[] data)
+        {
+            //var rt = CheckSum(data);
+            //if(rt){}
+
+            var stvol = BitConverter.ToString(data, 6, 2);
+            var _voltage = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber) * 0.01;
+
+            /*-32768 ~ +32767*/
+            var stcur = BitConverter.ToString(data, 8, 2);
+            var _current = Convert.ToInt16(stcur, 16) * 0.01;
+
+            var stsoc = BitConverter.ToString(data, 10, 2);
+            var _soc = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber) * 1;
+
+            var stbr = BitConverter.ToString(data, 12, 2);
+            var _batteryStatus = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber);
+
+            var stct = BitConverter.ToString(data, 14, 2);
+            var _chargeTime = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber) * 1;
+
+            var stdct = BitConverter.ToString(data, 16, 2);
+            var _disChargeTime = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber) * 1;
+
+            /*-32768 ~ +32767*/
+            var sttp = BitConverter.ToString(data, 18, 2);
+            var _temperature = Convert.ToInt16(sttp, 16) * 0.01;
+
+            var stsoh = BitConverter.ToString(data, 20, 2);
+            var _soh = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber) * 1;
+
+            var stps = BitConverter.ToString(data, 22, 2);
+            var _residualcapacity = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber) * 0.01;
+
+            var stpe = BitConverter.ToString(data, 24, 2);
+            var _residualEnergy = Int32.Parse(stvol, System.Globalization.NumberStyles.HexNumber) * 0.1;
+        }
+
+        private void QueWorker()
+        {
+            for(; ; )
+            {
+                try
+                {
+                    var qo = this.QQ.Dequeue();
+                    if(qo is QoConnect) { DelegateUtils.Invoke(OnConnect, this.battery.serial.PortName); }
+                    if (qo is QoVoltage) { DelegateUtils.Invoke(OnVoltage, _config.Voltage); }
+                    else if (qo is QoCurrent) { DelegateUtils.Invoke(OnCurrent, _config.Current); }
+                    else if (qo is QoSOC) { DelegateUtils.Invoke(OnSOC, _config.SOC); }
+                    else if (qo is QoBattery) { DelegateUtils.Invoke(OnBattery, _config.BatteryStatus); }
+                    else if (qo is QoCharge) { DelegateUtils.Invoke(OnCharge, _config.ChargeTime); }
+                    else if (qo is QoDisCharge) { DelegateUtils.Invoke(OnDisCharge, _config.DisChargeTime); }
+                    else if (qo is QoTemperature) { DelegateUtils.Invoke(OnTemperature, _config.Temperature); }
+                    else if (qo is QoCapacity) { DelegateUtils.Invoke(OnCapacity, _config.Capacity); }
+                    else if (qo is QoEnergy) { DelegateUtils.Invoke(OnEnergy, _config.Energy); }
+                    else { /* null */ }
+                }
+                catch (Exception ex) { }
+            }
+        }
+
+        public void SendAllData()
+        {
+            try
+            {
+                if (this.IsOpen && this.battery.serial != null)
+                {
+                    /*byte*/
+                    this.battery.serial.Write(this._allpacket, 0, this._allpacket.Length);
+
+                    /*ascii*/
+                    //this.battery.serial.Write();
+                }
+            }
+            catch (Exception ex) { }
+        }
+
+        private bool CheckSum(byte[] _data)
+        {
+            bool ret = false;
+
+            int size = _data.Length;
+            var cdLow = _data[size - 2];
+            var cdHigh = _data[size - 3];
+            var cdResult = cdHigh + cdLow;
+
+            var csData = _data[2] + _data[3] + _data[4] + _data[5] + _data[6] + _data[7] + _data[8] + _data[9];
+
+            if (cdResult == csData)
+            {
+                ret = true;
+                return ret;
+            }
+            else ret = false;
+
+            return ret;
+        }
+
+        private void BatteryState(byte _data)
+        {
+            var batteryState = BitConverter.GetBytes(_data);
+        }
+
+
+        /*
+         * 미처리 작업 내용
+         * Enque 시 값이 같으면 return 어떻게할? 
+         * Deque 시 값이 같으면 return 어떻게할?
+         * Battery 상태 값 표기 어찌할? 2^7 = 조합가능 개수 2^7개 만큼
+         */
+    }
+}

+ 36 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 
+// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
+// 이러한 특성 값을 변경하세요.
+[assembly: AssemblyTitle("BatteryTabos")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BatteryTabos")]
+[assembly: AssemblyCopyright("Copyright ©  2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 
+// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
+// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
+[assembly: ComVisible(false)]
+
+// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
+[assembly: Guid("915bd4d3-768f-466a-9df0-984f04e5a05f")]
+
+// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
+//
+//      주 버전
+//      부 버전 
+//      빌드 번호
+//      수정 버전
+//
+// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
+// 기본값으로 할 수 있습니다.
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 26 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/QueObject.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BatteryTabos
+{
+    public abstract class QueObject
+    {
+        public object Arg0 { get; set; }
+        public object Arg1 { get; set; }
+    }
+
+    public class QoConnect : QueObject { }
+    public class QoVoltage : QueObject { }
+    public class QoCurrent : QueObject { }
+    public class QoSOC : QueObject { }
+    public class QoBattery : QueObject { }
+    public class QoCharge : QueObject { }
+    public class QoDisCharge : QueObject { }
+    public class QoTemperature : QueObject { }
+    public class QoSOH : QueObject { }
+    public class QoCapacity : QueObject { }
+    public class QoEnergy : QueObject { }
+}

+ 103 - 0
Dev/SerialModule/BatteryTabos/BatteryTabos/BatteryTabos/Rs232c.cs

@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.IO.Ports;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BatteryTabos
+{
+    public class Rs232c
+    {
+        public SerialPort serial { get; set; }
+
+
+        public string Port
+        {
+            get => this.serial.PortName;
+            set
+            {
+                if (this.serial.PortName == value) return;
+                this.serial.PortName = value;
+            }
+        }
+        public int BaudRate
+        {
+            get => this.serial.BaudRate;
+            set
+            {
+                if (this.serial.BaudRate == value) return;
+                this.serial.BaudRate = value;
+            }
+        }
+        public int DataBits
+        {
+            get => this.serial.DataBits;
+            set
+            {
+                if (this.serial.DataBits == value) return;
+                this.serial.DataBits = value;
+            }
+        }
+        public Parity Parity
+        {
+            get => this.serial.Parity;
+            set
+            {
+                if (this.serial.Parity == value) return;
+                this.serial.Parity = value;
+            }
+        }
+        public StopBits StopBits
+        {
+            get => this.serial.StopBits;
+            set
+            {
+                if (this.serial.StopBits == value) return;
+                this.serial.StopBits = value;
+            }
+        }
+        public int ReadTimeout
+        {
+            get => this.serial.ReadTimeout;
+            set
+            {
+                if (this.serial.ReadTimeout == value) return;
+                this.serial.ReadTimeout = value;
+            }
+        }
+        public int WriteTimeout
+        {
+            get => this.serial.WriteTimeout;
+            set
+            {
+                if (this.serial.WriteTimeout == value) return;
+                this.serial.WriteTimeout = value;
+            }
+        }
+
+
+        /// <summary>
+        ///  ctor Value
+        /// <para>_comPort = string Port Name</para>
+        /// <para>setMode = false 세부항목 설정</para> 
+        /// </summary>
+
+        public Rs232c(string _comPort, bool setMode = false)
+        {
+            if(!setMode)
+            {
+                this.serial = new SerialPort
+                {
+                    BaudRate = 19200,
+                    DataBits = 8,
+                    Parity = Parity.None,
+                    StopBits = StopBits.One,
+                    ReadTimeout = 3000,
+                    WriteTimeout = 3000
+                };
+            }
+            else this.serial = new SerialPort(_comPort);
+        }
+    }
+}