SK.Kang hace 6 años
padre
commit
521d6ecf8d

+ 138 - 131
Dev/Connection/OHVProtocolServer/OHVConnector/Manager.cs

@@ -74,64 +74,61 @@ namespace OHVConnector
         #endregion
 
         #region Connection Method
-        public void Connect(bool active = false)
+        public void Connect( bool active = false )
         {
             ModeActive = active;
-            if (!inited.HasValue)//최초 한번 실행.
+            if ( !inited.HasValue )//최초 한번 실행.
             {
-                _TQ = ThreadUtils.Invoke(_ThPullQueue);
+                _TQ = ThreadUtils.Invoke( _ThPullQueue );
                 inited = false;
             }
-            Assert.IsFalse(inited.Value, "Already connecting");
+            Assert.IsFalse( inited.Value, "Already connecting" );
 
             inited = true;
 
-            _TW = ThreadUtils.Invoke(_ThWriteTcp);
-            _TR = ThreadUtils.Invoke(_ThReadTcp);
-            _TLINK = ThreadUtils.Invoke(_ThLinkQuz);
+            _TW = ThreadUtils.Invoke( _ThWriteTcp );
+            _TR = ThreadUtils.Invoke( _ThReadTcp );
+            _TLINK = ThreadUtils.Invoke( _ThLinkQuz );
 
-            _OnLog("OHV CONNECT REQ " + Config);
+            _OnLog( "OHV CONNECT REQ " + Config );
         }
 
         public void Disconnect()
         {
             //if (inited.HasValue && inited.Value)
-            if (Connecting)
-            {
-                _OnLog("HSMS DISCONNECT REQ " + Config);
+            _OnLog( "HSMS DISCONNECT REQ " + Config );
 
-                inited = false;
-                quzT3.StopAll();
+            inited = false;
+            quzT3.StopAll();
 
-                ThreadUtils.Kill(_TLINK);
-                ThreadUtils.Kill(_TW);
-                h.StopListen();
-                ThreadUtils.Kill(_TR);
+            ThreadUtils.Kill( _TLINK );
+            ThreadUtils.Kill( _TW );
+            h.StopListen();
+            ThreadUtils.Kill( _TR );
 
-                h.CloseSocket();//Kill을 사용할 경우 뒤에 존재해야 한다.
-            }
+            h.CloseSocket();//Kill을 사용할 경우 뒤에 존재해야 한다.
         }
 
-        void _OnDicontd(Exception e)
+        void _OnDicontd( Exception e )
         {
-            _OnLog("OHV DISCONNECTED");
+            _OnLog( "OHV DISCONNECTED" );
             sysbyte = 0;
             ctrl_sysbyte = INIT_CTRL_SYSBYTE;
             quzT3.StopAll();
             ddReq.Clear();
 
-            qQ.Enqueue(new QoNotComm { Arg0 = e });
+            qQ.Enqueue( new QoNotComm { Arg0 = e } );
         }
 
         void _OnContd()
         {
-            _OnLog("OHV CONNECTED");
-            qQ.Enqueue(new QoComm());
+            _OnLog( "OHV CONNECTED" );
+            qQ.Enqueue( new QoComm() );
         }
 
         void TcpConnect()
         {
-            h.Connect(new TcpComm
+            h.Connect( new TcpComm
             {
                 Active = ModeActive,
                 RetryCnt = 1, //T5를 처리해야 함.
@@ -139,17 +136,17 @@ namespace OHVConnector
                 PortNo = Config.Port,
                 T5 = Config.T5,
                 T6 = Config.T6,//Config.TcpRecdTimeout,
-            });
+            } );
 
-            if (!h.Connected)
+            if ( !h.Connected )
             {
-                if (ModeActive)
-                    _OnLog("T5 TIMEOUT " + Config.ID);
+                if ( ModeActive )
+                    _OnLog( "T5 TIMEOUT " + Config.ID );
                 return;
             }
             _OnContd();
 
-            ChgTcpTimeout(true);
+            ChgTcpTimeout( true );
             //if (ModeActive)
             //SendCtrlMsg(1);//무조건 HSMS Active
         }
@@ -157,20 +154,20 @@ namespace OHVConnector
         #endregion
 
 
-        private void _OnLog(string obj)
+        private void _OnLog( string obj )
         {
-            qQ.Enqueue(new QoLog { Arg0 = obj });
+            qQ.Enqueue( new QoLog { Arg0 = obj } );
         }
 
-        private void _OnTimeout(byte id, OCSMessage msg)
+        private void _OnTimeout( byte id, OCSMessage msg )
         {
-            if (null == msg)
+            if ( null == msg )
             {
-                logger.W("T3 [{0}] attachment is null", id);
+                logger.W( "T3 [{0}] attachment is null", id );
                 return;
             }
 
-            qQ.Enqueue(new QoTimeout { Arg0 = msg });
+            qQ.Enqueue( new QoTimeout { Arg0 = msg } );
             //_OnLog("T3 TIMEOUT {0}".format(msg.LogHeader));
         }
 
@@ -184,40 +181,40 @@ namespace OHVConnector
                 {
                     bool waked;
 
-                    if (Config.LinkOn)
-                        waked = LockUtils.Wait(Config.TLink, lockLink);
+                    if ( Config.LinkOn )
+                        waked = LockUtils.Wait( Config.TLink, lockLink );
                     else
-                        waked = LockUtils.Wait(lockLink);
+                        waked = LockUtils.Wait( lockLink );
 
-                    if (waked)
+                    if ( waked )
                         continue;//notify: 패킷을 수신할때마다 reset함.
 
-                    if (Connected)//연결여부와 상관없이 thread가 기동되므로 연결시에만.
+                    if ( Connected )//연결여부와 상관없이 thread가 기동되므로 연결시에만.
                     {
                         //SendCtrlMsg(5);
                     }
                 }
-                catch (ThreadAbortException)
+                catch ( ThreadAbortException )
                 {
                     break;
                 }
-                catch (Exception e)
+                catch ( Exception e )
                 {
-                    logger.E(e);
+                    logger.E( e );
                 }
             }
         }
 
         void _ThWriteTcp()
         {
-            logger.I("Write {0}", ThreadUtils.GetCurrThreadID());
+            logger.I( "Write {0}", ThreadUtils.GetCurrThreadID() );
             for (; ; )
             {
                 try
                 {
                     var v = qqW.Dequeue();
 
-                    this.TcpWriteMsg(v);
+                    this.TcpWriteMsg( v );
                     //v.IsRecd = false;
 
                     //if (v.AfterMillis > 0)
@@ -228,13 +225,13 @@ namespace OHVConnector
                     //else
                     //    TcpWriteNormalMsg(v);
                 }
-                catch (ThreadAbortException)
+                catch ( ThreadAbortException )
                 {
                     break;
                 }
-                catch (Exception e)
+                catch ( Exception e )
                 {
-                    logger.E(e);
+                    logger.E( e );
                 }
             }
         }
@@ -245,30 +242,30 @@ namespace OHVConnector
             {
                 try
                 {
-                    if (!h.Connected)
+                    if ( !h.Connected )
                     {
                         TcpConnect();
                         continue;
                     }
                     ReadSocket();
                 }
-                catch (ObjectDisposedException e)
+                catch ( ObjectDisposedException e )
                 {
-                    TcpError(e);
+                    TcpError( e );
                 }
-                catch (IOException e)
+                catch ( IOException e )
                 {
-                    TcpError(e);
+                    TcpError( e );
                 }
-                catch (ThreadAbortException)
+                catch ( ThreadAbortException )
                 {
-                    _OnLog("DISCONNECT REQUEST APPLIED " + Config);
-                    TcpError(new IOException("DISCONNECT REQUEST"));
+                    _OnLog( "DISCONNECT REQUEST APPLIED " + Config );
+                    TcpError( new IOException( "DISCONNECT REQUEST" ) );
                     break;
                 }
-                catch (Exception e)
+                catch ( Exception e )
                 {
-                    logger.E(e);
+                    logger.E( e );
                 }
             }
         }
@@ -281,44 +278,44 @@ namespace OHVConnector
                 {
                     var qo = this.qQ.Dequeue();
 
-                    if (qo is QoRecdUnk)
+                    if ( qo is QoRecdUnk )
                     {
-                        DelegateUtils.Invoke(OnRecdUnk, qo.Arg0, qo.Arg1);
+                        DelegateUtils.Invoke( OnRecdUnk, qo.Arg0, qo.Arg1 );
                         //if (AutoS9Fy)
                         //{
                         //    var v = qo.Arg0 as SFMessage;
                         //    Send(v.S9Fy);
                         //}
                     }
-                    else if (qo is QoComm)
-                        DelegateUtils.Invoke(OnContd, Config.ID);
-                    else if (qo is QoNotComm)
-                        DelegateUtils.Invoke(OnDiscontd, Config.ID, qo.Arg0);
-                    else if (qo is QoLog)
-                        DelegateUtils.Invoke(OnLog, Config.ID, qo.Arg0);
-                    else if (qo is QoRecd)
-                        DelegateUtils.Invoke(OnRecd, qo.Arg0);
-                    else if (qo is QoTimeout)
+                    else if ( qo is QoComm )
+                        DelegateUtils.Invoke( OnContd, Config.ID );
+                    else if ( qo is QoNotComm )
+                        DelegateUtils.Invoke( OnDiscontd, Config.ID, qo.Arg0 );
+                    else if ( qo is QoLog )
+                        DelegateUtils.Invoke( OnLog, Config.ID, qo.Arg0 );
+                    else if ( qo is QoRecd )
+                        DelegateUtils.Invoke( OnRecd, qo.Arg0 );
+                    else if ( qo is QoTimeout )
                     {
-                        DelegateUtils.Invoke(OnT3Timeout, qo.Arg0);
+                        DelegateUtils.Invoke( OnT3Timeout, qo.Arg0 );
                         //if (AutoS9Fy)
                         //{
                         //    var v = qo.Arg0 as SFMessage;
                         //    Send(MessageSupport.MakeS9FX(9, v));
                         //}
                     }
-                    else if (qo is QoSent)
-                        DelegateUtils.Invoke(OnSent, qo.Arg0);
+                    else if ( qo is QoSent )
+                        DelegateUtils.Invoke( OnSent, qo.Arg0 );
                     else
-                        Assert.Fail("Unk Object {0}", qo);
+                        Assert.Fail( "Unk Object {0}", qo );
                 }
-                catch (ThreadAbortException)
+                catch ( ThreadAbortException )
                 {
                     break;
                 }
-                catch (Exception e)
+                catch ( Exception e )
                 {
-                    logger.E(e);
+                    logger.E( e );
                 }
             }
         }
@@ -328,36 +325,46 @@ namespace OHVConnector
         #region Read Method
         void ReadSocket()
         {
-            h.ReadByte(); //STX
+            byte stx = 0x0;
+            do
+            {
+                stx = h.ReadByte(); //STX
+            }
+            while ( stx != STX );
+            if ( stx == 0xBF )
+            {
+                OnLog( this.Config.ID, $"{stx}" );
+                return;
+            }
 
             string revID = string.Empty;
             string sendID = string.Empty;
 
-            if (ModeActive)
+            if ( ModeActive )
             {
-                revID = h.ReadAscii(2);
-                sendID = h.ReadAscii(5);
+                revID = h.ReadAscii( 2 );
+                sendID = h.ReadAscii( 5 );
             }
             else
             {
-                revID = h.ReadAscii(5);
-                sendID = h.ReadAscii(2);
+                revID = h.ReadAscii( 5 );
+                sendID = h.ReadAscii( 2 );
             }
 
-            if (!this.Config.ID.Equals(revID))
-                OnLog(this.Config.ID, $"RevID Not Equals");
+            if ( !this.Config.ID.Equals( revID ) )
+                OnLog( this.Config.ID, $"RevID Not Equals" );
 
             var ocsMeg = new OCSMessage();
             ocsMeg.RevID = revID;
             ocsMeg.SendID = sendID;
-            ocsMeg.Kind = h.ReadAscii(1).ToEnum<eKind>(eKind.Unknown);
-            ocsMeg.Tag = h.ReadAscii(4);
-            ocsMeg.SubCode = h.ReadAscii(3);
+            ocsMeg.Kind = h.ReadAscii( 1 ).ToEnum<eKind>( eKind.Unknown );
+            ocsMeg.Tag = h.ReadAscii( 4 );
+            ocsMeg.SubCode = h.ReadAscii( 3 );
 
             //CheckSum 을 해야 하나??
             ocsMeg.CheckSum = h.ReadByte();
 
-            h.ReadUntil(ETX);
+            h.ReadUntil( ETX );
 
             //Todo: 응답으로 온건지 그냥 보낸건지 분류가 필요. = CheckSum 을 저장 했다가 이용하자.
 
@@ -368,20 +375,20 @@ namespace OHVConnector
             //var head = h.ReadBytes(10);
             //var body = h.ReadBytes(len - 10);
 
-            ChgTcpTimeout(true);//무언가 받으면
+            ChgTcpTimeout( true );//무언가 받으면
 
-            LockUtils.NotifyAll(lockLink);//Linktest thread 변환의 notify
+            LockUtils.NotifyAll( lockLink );//Linktest thread 변환의 notify
 
             //var v = new OCSMessage { Header = head, Body = body, IsRecd = true };
             //v.Decoding();
 
-            _OnRecd(ocsMeg);
+            _OnRecd( ocsMeg );
         }
 
-        void _OnRecd(OCSMessage recd)
+        void _OnRecd( OCSMessage recd )
         {
             //Alive Check Reply
-            if (recd.Kind == eKind.A && !ModeActive) //자동으로 응답을 보낸다. OCS 가 Active 상태
+            if ( recd.Kind == eKind.A && !ModeActive ) //자동으로 응답을 보낸다. OCS 가 Active 상태
             {
                 var reply = new OCSMessage()
                 {
@@ -392,7 +399,7 @@ namespace OHVConnector
                     Tag = recd.Tag,
                     SubCode = recd.SubCode,
                 };
-                Reply(reply);
+                Reply( reply );
                 return;
             }
 
@@ -403,38 +410,38 @@ namespace OHVConnector
             }
 
             //Send 한 Message 의 Reply 로 판단.
-            if (this.quzT3.HasId(recd.CheckSum))
+            if ( this.quzT3.HasId( recd.CheckSum ) )
             {
                 //Send 목록에서 삭제한다.
-                this.quzT3.Stop(recd.CheckSum);
-                this._OnLog($"[Received] - Reply - {recd.LogFormat()}");
+                this.quzT3.Stop( recd.CheckSum );
+                this._OnLog( $"[Received] - Reply - {recd.LogFormat()}" );
                 return;
             }
 
-            this.qQ.Enqueue(new QoRecd { Arg0 = recd });
+            this.qQ.Enqueue( new QoRecd { Arg0 = recd } );
         }
 
-        void TcpError(Exception e)
+        void TcpError( Exception e )
         {
-            _OnLog(TcpUtils.GetTcpErrMsg(h.IPClient, e));
+            _OnLog( TcpUtils.GetTcpErrMsg( h.IPClient, e ) );
 
             h.CloseSocket();
-            _OnDicontd(e);
+            _OnDicontd( e );
 
-            LockUtils.Wait(1000);//잠시대기.
+            LockUtils.Wait( 1000 );//잠시대기.
         }
 
         #endregion
 
         #region Write Method
-        void TcpWriteMsg(OCSMessage msg)
+        void TcpWriteMsg( OCSMessage msg )
         {
-            qQ.Enqueue(new QoSent { Arg0 = msg });
+            qQ.Enqueue( new QoSent { Arg0 = msg } );
 
-            this.h.WriteFlush(msg.ToMemoryBuffer().ToBytes);
+            this.h.WriteFlush( msg.ToMemoryBuffer().ToBytes );
         }
 
-        void TcpWriteNormalMsg(OCSMessage nm)
+        void TcpWriteNormalMsg( OCSMessage nm )
         {
             //nm.Encoding();
 
@@ -452,7 +459,7 @@ namespace OHVConnector
             //h.WriteFlush(mb.ToBytes);
         }
 
-        void TcpWriteCtrlMsg(OCSMessage ctrl)
+        void TcpWriteCtrlMsg( OCSMessage ctrl )
         {
             //var mb = new MemoryBuffer(16);
             //mb.AppendBeInt(10);
@@ -465,26 +472,26 @@ namespace OHVConnector
             //h.WriteFlush(mb.ToBytes);
         }
 
-        void SendCtrlMsg(int stype)
+        void SendCtrlMsg( int stype )
         {
             //Send(new OCSMessage { SType = stype });
         }
 
-        public void Send(OCSMessage msg, int after)
+        public void Send( OCSMessage msg, int after )
         {
-            if (after > 0)
-                TimerUtils.Once(after, Send, msg);
+            if ( after > 0 )
+                TimerUtils.Once( after, Send, msg );
             else
-                Send(msg);
+                Send( msg );
         }
 
-        public void Send(OCSMessage msg)
+        public void Send( OCSMessage msg )
         {
             //msg.Id = Config.ID;
 
-            if (!Connected)
+            if ( !Connected )
             {
-                _OnLog("Send fail not connected" + msg.LogFormat());
+                _OnLog( "Send fail not connected" + msg.LogFormat() );
                 return;
             }
 
@@ -497,13 +504,13 @@ namespace OHVConnector
                 qqW.Enqueue( msg );
             }
 
-            if (this.quzT3.HasId(msg.GetCheckSum()))
+            if ( this.quzT3.HasId( msg.GetCheckSum() ) )
             {
-                _OnLog("quzT3 Has ID" + msg.LogFormat());
+                _OnLog( "quzT3 Has ID" + msg.LogFormat() );
                 return;
             }
 
-            this.quzT3.StartOnce(Config.T3 * ConstUtils.ONE_SECOND, msg.GetCheckSum(), msg);
+            this.quzT3.StartOnce( Config.T3 * ConstUtils.ONE_SECOND, msg.GetCheckSum(), msg );
             //if (msg.CtrlMsg)
             //{
             //    if (msg.CtrlSelectReq || msg.CtrlLinkReq)
@@ -520,42 +527,42 @@ namespace OHVConnector
             //        msg.Systembyte = Interlocked.Increment(ref sysbyte);
             //}
 
-            qqW.Enqueue(msg);
+            qqW.Enqueue( msg );
         }
 
         /// <summary>
         /// 응답을 보낼 때 사용.
         /// </summary>
         /// <param name="msg"></param>
-        public void Reply(OCSMessage msg)
+        public void Reply( OCSMessage msg )
         {
-            if (!Connected)
+            if ( !Connected )
             {
-                _OnLog("Reply fail not connected" + msg.LogFormat());
+                _OnLog( "Reply fail not connected" + msg.LogFormat() );
                 return;
             }
             msg.RevID = Config.HostID;
             msg.SendID = Config.ID;
 
-            qqW.Enqueue(msg);
+            qqW.Enqueue( msg );
         }
 
         #endregion
 
         #region HelpMothed
-        void ChgTcpTimeout(bool infinite)
+        void ChgTcpTimeout( bool infinite )
         {
-            if (h.Connected)
+            if ( h.Connected )
             {
-                if (infinite)
+                if ( infinite )
                 {
-                    if (h.Socket.ReceiveTimeout != Timeout.Infinite)
-                        h.ChangeRecvTimeout(Timeout.Infinite);
+                    if ( h.Socket.ReceiveTimeout != Timeout.Infinite )
+                        h.ChangeRecvTimeout( Timeout.Infinite );
                 }
                 else
                 {
-                    if (Config.LinkOn)
-                        h.ChangeRecvTimeout(Config.T6 * ConstUtils.ONE_SECOND);
+                    if ( Config.LinkOn )
+                        h.ChangeRecvTimeout( Config.T6 * ConstUtils.ONE_SECOND );
                 }
             }
         }

+ 2 - 1
Dev/Connection/OHVProtocolServer/OHVConnector/OCSMessage.cs

@@ -128,9 +128,10 @@ namespace OHVConnector
             byte rb = 0;
             foreach ( var item in bs )
             {
+                if ( item == STX ) continue;
                 rb += item;
             }
-            return (byte)( rb & 0xff );
+            return (byte)( rb & 0xf ); //&0xff 수정.
         }
     }
 }

+ 3 - 6
Dev/Connection/OHVProtocolServer/OHVConnector/OHVConnector.csproj

@@ -31,6 +31,9 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="GSG.NET">
+      <HintPath>..\..\..\OHV\Assambly\GSG.NET.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
@@ -48,11 +51,5 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="QueueObject.cs" />
   </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\..\..\GSG\GSG\GSG.NET\GSG.NET.csproj">
-      <Project>{11e12a58-fdbc-444a-90e6-db96b7e98ff4}</Project>
-      <Name>GSG.NET</Name>
-    </ProjectReference>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

BIN
Dev/OHV/Assambly/GSG.NET.dll


BIN
Dev/OHV/Assambly/GSG.NET.pdb


BIN
Dev/OHV/Assambly/OHVConnector.dll


BIN
Dev/OHV/Assambly/OHVConnector.pdb


+ 2 - 2
Dev/OHV/OHV.Module.Interactivity/ConfirmationPopupView.xaml

@@ -60,10 +60,10 @@
             <Rectangle Fill="#FFBABABA" Height="2" VerticalAlignment="Bottom" Margin="20,0" Grid.Row="1" Visibility="Hidden"/>
 
             <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,5,0,0">
-                <Button x:Name="btnSend" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Margin="0,0,20,0" Height="25" Command="{Binding CloseDialogCommand}" CommandParameter="true" Content="확인" Background="#263238" Style="{StaticResource MaterialDesignRaisedButton}"/>
+                <Button x:Name="btnSend" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Margin="0,0,20,0" Height="40" Command="{Binding CloseDialogCommand}" CommandParameter="true" Content="확인" Background="#263238" Style="{StaticResource MaterialDesignRaisedButton}"/>
                 <!--Style="{DynamicResource btn_Send}"-->
 
-                <Button x:Name="btnCancel" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="25"  Content="취소" Command="{Binding CloseDialogCommand}" CommandParameter="false" Background="#263238" Style="{StaticResource MaterialDesignRaisedButton}"/>
+                <Button x:Name="btnCancel" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="40"  Content="취소" Command="{Binding CloseDialogCommand}" CommandParameter="false" Background="#263238" Style="{StaticResource MaterialDesignRaisedButton}"/>
                 <!--Style="{DynamicResource btn_Close}"-->
             </StackPanel>
         </Grid>

+ 1 - 1
Dev/OHV/OHV.Module.Interactivity/NotificatioinView.xaml

@@ -66,7 +66,7 @@
             <Rectangle Fill="#FFBABABA" Height="2" VerticalAlignment="Top" Margin="20,0" Grid.Row="2" Visibility="Hidden"/>
             <StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,5,0,0">
 
-                <Button x:Name="btnSend" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="25" Content="OK" AutomationProperties.AutomationId="CustomPopupCloseButton" Command="{Binding CloseDialogCommand}" Style="{StaticResource MaterialDesignRaisedButton}" Background="#FF1368BD"/>
+                <Button x:Name="btnSend" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="40" Content="OK" AutomationProperties.AutomationId="CustomPopupCloseButton" Command="{Binding CloseDialogCommand}" Style="{StaticResource MaterialDesignRaisedButton}" Background="#FF1368BD"/>
                 <!--Style="{DynamicResource btn_Send}-->
             </StackPanel>
 

+ 28 - 8
Dev/OHV/OHV.Vehicle/Concept/D_MainWindow.xaml

@@ -34,10 +34,24 @@
 
             <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                 <TextBlock Style="{StaticResource MaterialDesignHeadline3TextBlock}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="60" FontWeight="Bold">
-                Over Head Vehicle
+                Vehicle Control System
                 </TextBlock>
             </StackPanel>
 
+            <StackPanel Orientation="Vertical" HorizontalAlignment="Right" Width="200" Margin="0,0,300,0" Height="70">
+                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
+                    <materialDesign:PackIcon Kind="Chip" Margin="0,0,0,0" Height="36" Width="36" RenderTransformOrigin="-1.972,1.347" HorizontalAlignment="Left" Foreground="White"/>
+                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White">CPU</TextBlock>
+                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0" Foreground="White" Text="{Binding CPU, StringFormat={}{0:0.0} %, FallbackValue=0%}"/>
+                </StackPanel>
+
+                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
+                    <materialDesign:PackIcon Kind="Memory" Margin="0,0,0,0" Height="36" Width="36" RenderTransformOrigin="-1.972,1.347" HorizontalAlignment="Left" Foreground="White"/>
+                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White" >Memory</TextBlock>
+                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="10,0,0,0" Foreground="White" Text="{Binding RAM, StringFormat={}{0:0.0} %, FallbackValue=0%}"/>
+                </StackPanel>
+            </StackPanel>
+
             <StackPanel Margin="0,0,50,0" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Right">
                 <!--<Button Margin="1"
                    Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"     
@@ -54,8 +68,7 @@
                     </StackPanel>
                 </Button>-->
 
-                <Button Margin="1" HorizontalAlignment="Left" Height="40" BorderBrush="Gray" BorderThickness="0" Background="{x:Null}"
-                        >
+                <Button Margin="1" HorizontalAlignment="Left" Height="40" BorderBrush="Gray" BorderThickness="0" Background="{x:Null}">
                     <StackPanel Orientation="Horizontal">
                         <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="AccessPointNetworkOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="35" Width="auto" Foreground="Red"
                                                  Visibility="{c:Binding 'OcsState == OHVCommonShareds:eOcsState.DisConnect'}"/>
@@ -67,13 +80,13 @@
 
                 <Button Margin="1" HorizontalAlignment="Center" Height="40" BorderBrush="Gray" BorderThickness="0" Background="{x:Null}"
                         HorizontalContentAlignment="Left">
-                    <StackPanel Orientation="Horizontal">
+                    <StackPanel Orientation="Horizontal" Margin="3,0,0,0">
                         <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="AUto" Foreground="Red"
                                                  Visibility="{c:Binding 'BatteryState == local:eBatteryState.DisConnect'}"/>
-                        
+
                         <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="BatteryCharging" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="auto" Foreground="Blue"
                                                  Visibility="{c:Binding 'BatteryState == local:eBatteryState.Charge'}"/>
-                        
+
                         <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="Battery" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Height="30" Width="auto" Foreground="LimeGreen"
                                                  Visibility="{c:Binding 'BatteryState == local:eBatteryState.Connect'}"/>
                         <TextBlock Margin="2" Text="{Binding BatteryConnect, FallbackValue=Battery - }" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
@@ -83,8 +96,15 @@
             </StackPanel>
 
             <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20,0,0,0">
-                <TextBlock Text="{Binding VehicleID, FallbackValue=VehicleControlSystem 1.0.0.1}" TextAlignment="Left" VerticalAlignment="Center" Foreground="LightGray" FontSize="20" Margin="0,0,0,5"/>
-                <TextBlock Text="{Binding DateTime, FallbackValue=2020-02-24 13:09:33, StringFormat=' \{0:yyyy-MM-dd HH:mm:ss\}'}" TextAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="LightGray"/>
+                <StackPanel Orientation="Horizontal">
+                    <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="FileDocumentBoxOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto" Foreground="White"/>
+                    <TextBlock TextAlignment="Left" VerticalAlignment="Center" Foreground="White" FontSize="20" Margin="10,0,0,0">ID : </TextBlock>
+                    <TextBlock Text="{Binding VehicleID, FallbackValue=VehicleControlSystem 1.0.0.1}" TextAlignment="Left" VerticalAlignment="Center" Foreground="White" FontSize="20" Margin="10,0,0,0"/>
+                </StackPanel>
+                <StackPanel Orientation="Horizontal">
+                    <materialDesign:PackIcon HorizontalContentAlignment="Left" Kind="Timetable" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto" Foreground="White" Margin="1,0,0,0"/>                
+                    <TextBlock Text="{Binding DateTime, FallbackValue=2020-02-24 13:09:33, StringFormat=' \{0:yyyy-MM-dd HH:mm:ss\}'}" TextAlignment="Left" VerticalAlignment="Center" FontSize="20" Foreground="White" Margin="6,0,0,0"/>
+                </StackPanel>
             </StackPanel>
         </Grid>
 

+ 0 - 45
Dev/OHV/OHV.Vehicle/Concept/D_MainWindowViewModel.cs

@@ -161,22 +161,12 @@ namespace OHV.Vehicle.Concept
             get { return this.ocsState; }
             set { this.SetProperty( ref this.ocsState, value ); }
         }
-<<<<<<< HEAD
-
-=======
->>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
-
 
         eBatteryState batteryState = eBatteryState.DisConnect;
         public eBatteryState BatteryState
         {
-<<<<<<< HEAD
-            get { return this.batteryConnectState; }
-            set { this.SetProperty( ref this.batteryConnectState, value ); }
-=======
             get { return this.batteryState; }
             set { this.SetProperty( ref this.batteryState , value ); }
->>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
         }
 
         #endregion
@@ -436,20 +426,6 @@ namespace OHV.Vehicle.Concept
 
         private void UICallbackCommunication( GUIMessageEventArgs obj )
         {
-<<<<<<< HEAD
-=======
-            if ( obj.Kind == GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange )
-            {
-                if ( obj.MessageKey.Equals( MessageKey.Vehicle ) )
-                {
-                    switch ( obj.ModelPropertyName )
-                    {
-                        
-                    }
-                }
-            }
-
->>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
             switch ( obj.Kind )
             {
                 case GUIMessageEventArgs.eGUIMessageKind.ModelPropertyChange:
@@ -540,11 +516,7 @@ namespace OHV.Vehicle.Concept
 
             if ( args.MessageKey.Equals( MessageKey.Vehicle ) )
             {
-<<<<<<< HEAD
-                switch ( args.ModelPropertyName )
-=======
                 switch(args.ModelPropertyName)
->>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
                 {
                     case "VehicleStateProperty":
                         {
@@ -555,22 +527,6 @@ namespace OHV.Vehicle.Concept
                                 this.IsVehicleAlarm = false;
                         }
                         break;
-<<<<<<< HEAD
-
-                    case "MachineMode":
-                        this.MachineMode = CastTo<eMachineMode>.From<object>( args.Args );
-                        break;
-
-                    case "BatteryIsConnect":
-                        this.RspBatteryConnected( args );
-                        break;
-
-                    case "BatteryStateOfCharge":
-                        this.SOC = CastTo<double>.From<object>( args.Args );
-                        break;
-
-                    default:
-=======
                     case "MachineMode":
                         this.MachineMode = CastTo<eMachineMode>.From<object>( args.Args );
                         break;
@@ -590,7 +546,6 @@ namespace OHV.Vehicle.Concept
                         {
                             var cTime = CastTo<double>.From<object>( args.Args );
                         }
->>>>>>> 69c47f10da3d0471e11a86cb5cebfd28044ec0fd
                         break;
                 }
             }

+ 11 - 0
Dev/OHV/OHV.sln

@@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OHV.Module.ListViews", "OHV
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OHV.Module.Status", "OHV.Module.Status\OHV.Module.Status.csproj", "{D00450D6-DE54-4584-A377-7AA5D5964D2C}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OHVConnector", "..\Connection\OHVProtocolServer\OHVConnector\OHVConnector.csproj", "{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -153,6 +155,14 @@ Global
 		{D00450D6-DE54-4584-A377-7AA5D5964D2C}.Remote1|Any CPU.Build.0 = Remote1|Any CPU
 		{D00450D6-DE54-4584-A377-7AA5D5964D2C}.Remote2|Any CPU.ActiveCfg = Remote|Any CPU
 		{D00450D6-DE54-4584-A377-7AA5D5964D2C}.Remote2|Any CPU.Build.0 = Remote|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Remote1|Any CPU.ActiveCfg = Release|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Remote1|Any CPU.Build.0 = Release|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Remote2|Any CPU.ActiveCfg = Debug|Any CPU
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A}.Remote2|Any CPU.Build.0 = Debug|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -173,6 +183,7 @@ Global
 		{712D75B5-89DD-4064-BC4B-2F9D9F157604} = {B2DE533E-C8A8-41CD-97CB-E88905233610}
 		{0043B4EC-A651-401C-9845-57A7C7576E28} = {6C7A1445-7F2F-46C4-9AAD-AEB739F9BD2D}
 		{D00450D6-DE54-4584-A377-7AA5D5964D2C} = {6C7A1445-7F2F-46C4-9AAD-AEB739F9BD2D}
+		{B9A8B13B-518B-4AE4-B8B6-C2684DF6608A} = {E991DE17-D541-45A9-85B0-1AA1B0D50D89}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {2222F9E2-CBEF-4156-9636-5DF54ECDDA89}

+ 1 - 1
Dev/OHV/VehicleControlSystem/ControlLayer/Vehicle.cs

@@ -1117,7 +1117,7 @@ namespace VehicleControlSystem.ControlLayer
             //이미 알람이면 체크 안함.
             if ( this.VehicleStateProperty == eVehicleState.Abnormal ) return;
 
-            if ( !this.iO.IsConnectError ) return;
+            if ( this.iO.IsConnectError ) return;
 
             if ( this.iO.IsOn( "IN_EMS_SW" ) ) this.OccurVehicleAlarm( 28 );
             if ( !this.iO.IsOn( "IN_CP_ON_SAFETY" ) ) this.OccurVehicleAlarm( 31 );

+ 4 - 4
Dev/OHV/VehicleControlSystem/VehicleControlSystem.csproj

@@ -73,10 +73,6 @@
     <Reference Include="NPOI">
       <HintPath>..\Assambly\ExcelMapper\NPOI.dll</HintPath>
     </Reference>
-    <Reference Include="OHVConnector, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\Assambly\OHVConnector.dll</HintPath>
-    </Reference>
     <Reference Include="Prism, Version=7.2.0.1422, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
       <HintPath>..\packages\Prism.Core.7.2.0.1422\lib\net45\Prism.dll</HintPath>
     </Reference>
@@ -153,6 +149,10 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\Connection\OHVProtocolServer\OHVConnector\OHVConnector.csproj">
+      <Project>{b9a8b13b-518b-4ae4-b8b6-c2684df6608a}</Project>
+      <Name>OHVConnector</Name>
+    </ProjectReference>
     <ProjectReference Include="..\OHV.Common\OHV.Common.csproj">
       <Project>{0d1f7fbc-bfb0-4ee4-852d-e2a8d62c5708}</Project>
       <Name>OHV.Common</Name>