|
@@ -23,7 +23,7 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Peack USB Handle
|
|
/// Peack USB Handle
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
- UInt16 handle = PCANBasic.PCAN_USBBUS1;
|
|
|
|
|
|
|
+ UInt16 handle = PCANBasic.PCAN_PCIBUS1;
|
|
|
|
|
|
|
|
static Logger logger = Logger.GetLogger();
|
|
static Logger logger = Logger.GetLogger();
|
|
|
|
|
|
|
@@ -44,6 +44,15 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
AUTO_STOP
|
|
AUTO_STOP
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public enum eCanRecvCase
|
|
|
|
|
+ {
|
|
|
|
|
+ NONE = 0,
|
|
|
|
|
+ CASE1,
|
|
|
|
|
+ CASE2,
|
|
|
|
|
+ CASE3,
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
enum eMsgCaseFirst : int
|
|
enum eMsgCaseFirst : int
|
|
|
{
|
|
{
|
|
|
Voltage_LOW = 2,
|
|
Voltage_LOW = 2,
|
|
@@ -93,18 +102,13 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
void TryToConnect()
|
|
void TryToConnect()
|
|
|
{
|
|
{
|
|
|
this.qqW.Clear();
|
|
this.qqW.Clear();
|
|
|
- //h.Connect( new TcpComm
|
|
|
|
|
- //{
|
|
|
|
|
- // Ip = this.manager.Config.IpAddress,
|
|
|
|
|
- // PortNo = this.manager.Config.Port,
|
|
|
|
|
- // RollCnt = 1,
|
|
|
|
|
- //} );
|
|
|
|
|
|
|
|
|
|
- var result = PCANBasic.Initialize( this.handle , TPCANBaudrate.PCAN_BAUD_500K , TPCANType.PCAN_TYPE_ISA , IOPort: 460 , 3 );
|
|
|
|
|
|
|
+ var ll = PCANBasic.Reset( this.handle );
|
|
|
|
|
+ ll = PCANBasic.Uninitialize( this.handle );
|
|
|
|
|
|
|
|
- if ( result != TPCANStatus.PCAN_ERROR_OK )
|
|
|
|
|
- throw new Exception( "AdvCan Write Error" );
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ var result = PCANBasic.Initialize( this.handle , TPCANBaudrate.PCAN_BAUD_500K , TPCANType.PCAN_TYPE_ISA , IOPort: 460 , 3 );
|
|
|
|
|
+
|
|
|
|
|
+ if ( result == TPCANStatus.PCAN_ERROR_OK )
|
|
|
this.IsConnected = this.GetStatus();
|
|
this.IsConnected = this.GetStatus();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -125,8 +129,6 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
public void _ThreadPoolingReceiveData()
|
|
public void _ThreadPoolingReceiveData()
|
|
|
{
|
|
{
|
|
|
while ( !this.manager.cancel.Canceled )
|
|
while ( !this.manager.cancel.Canceled )
|
|
@@ -135,10 +137,8 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
{
|
|
{
|
|
|
if ( !IsConnected )
|
|
if ( !IsConnected )
|
|
|
{
|
|
{
|
|
|
|
|
+ Thread.Sleep( 3000 );
|
|
|
this.TryToConnect();
|
|
this.TryToConnect();
|
|
|
-
|
|
|
|
|
- Thread.Sleep( 100 );
|
|
|
|
|
-
|
|
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -167,15 +167,15 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
}
|
|
}
|
|
|
catch ( ObjectDisposedException exception )
|
|
catch ( ObjectDisposedException exception )
|
|
|
{
|
|
{
|
|
|
- this.CanError( exception );
|
|
|
|
|
|
|
+ this.CanError( );
|
|
|
}
|
|
}
|
|
|
catch ( IOException exception )
|
|
catch ( IOException exception )
|
|
|
{
|
|
{
|
|
|
- this.CanError( exception );
|
|
|
|
|
|
|
+ this.CanError( );
|
|
|
}
|
|
}
|
|
|
catch ( Exception exception )
|
|
catch ( Exception exception )
|
|
|
{
|
|
{
|
|
|
- this.CanError( exception );
|
|
|
|
|
|
|
+ this.CanError( );
|
|
|
logger.E( $"eSlnet {exception.Message}" );
|
|
logger.E( $"eSlnet {exception.Message}" );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -217,10 +217,6 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /// <summary>
|
|
|
|
|
- /// true - auto, false - manual
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- /// <param name="auto"></param>
|
|
|
|
|
|
|
|
|
|
public int Write(eSendMode mode)
|
|
public int Write(eSendMode mode)
|
|
|
{
|
|
{
|
|
@@ -245,8 +241,8 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var result = PeakCanWrite( this.handle , data );
|
|
|
|
|
-
|
|
|
|
|
|
|
+ var result = PCANBasic.Write( this.handle , ref data );
|
|
|
|
|
+
|
|
|
if ( result != TPCANStatus.PCAN_ERROR_OK )
|
|
if ( result != TPCANStatus.PCAN_ERROR_OK )
|
|
|
throw new Exception( "Peak Write Fail" );
|
|
throw new Exception( "Peak Write Fail" );
|
|
|
|
|
|
|
@@ -271,7 +267,7 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
data.DATA[ 0 ] = Convert.ToByte( 0x60 + Convert.ToByte(this.manager.BMUConfig.ID) );
|
|
data.DATA[ 0 ] = Convert.ToByte( 0x60 + Convert.ToByte(this.manager.BMUConfig.ID) );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var result = PeakCanWrite( this.handle , data );
|
|
|
|
|
|
|
+ var result = PCANBasic.Write( this.handle , ref data );
|
|
|
|
|
|
|
|
// Write Error
|
|
// Write Error
|
|
|
if ( result != TPCANStatus.PCAN_ERROR_OK )
|
|
if ( result != TPCANStatus.PCAN_ERROR_OK )
|
|
@@ -283,13 +279,8 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
return (int)result;
|
|
return (int)result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- TPCANStatus PeakCanWrite(uint handle, TPCANMsg msg)
|
|
|
|
|
- {
|
|
|
|
|
- return PCANBasic.Write( (ushort)handle ,ref msg );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// Reading start 전 Connection 상태 체크
|
|
|
|
|
|
|
+ /// Peak Receive
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
TPCANStatus ReadMessage()
|
|
TPCANStatus ReadMessage()
|
|
@@ -299,30 +290,19 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
TPCANTimestamp CANTimeStamp;
|
|
TPCANTimestamp CANTimeStamp;
|
|
|
TPCANStatus stsResult = TPCANStatus.PCAN_ERROR_UNKNOWN;
|
|
TPCANStatus stsResult = TPCANStatus.PCAN_ERROR_UNKNOWN;
|
|
|
|
|
|
|
|
- //Thread Sleep Time - Test 필요로함.
|
|
|
|
|
- Thread.Sleep( 10 );
|
|
|
|
|
|
|
+ Thread.Sleep( 100 );
|
|
|
for ( int i = 0; i < 3; i++ )
|
|
for ( int i = 0; i < 3; i++ )
|
|
|
{
|
|
{
|
|
|
stsResult = PCANBasic.Read( this.handle , out canMsg , out CANTimeStamp );
|
|
stsResult = PCANBasic.Read( this.handle , out canMsg , out CANTimeStamp );
|
|
|
|
|
|
|
|
- if ( stsResult == TPCANStatus.PCAN_ERROR_BUSHEAVY )
|
|
|
|
|
- throw new Exception( "DisConnect" );
|
|
|
|
|
-
|
|
|
|
|
- if ( stsResult != TPCANStatus.PCAN_ERROR_QRCVEMPTY )
|
|
|
|
|
- {
|
|
|
|
|
- this.PeackCANRecv( canMsg );
|
|
|
|
|
- }
|
|
|
|
|
- // We process the received message
|
|
|
|
|
- else if ( !Convert.ToBoolean( stsResult & TPCANStatus.PCAN_ERROR_QRCVEMPTY ) == false )
|
|
|
|
|
|
|
+ if ( canMsg.ID != 0x460 )
|
|
|
{
|
|
{
|
|
|
- throw new Exception( "Peak Buffer Empty" );
|
|
|
|
|
|
|
+ this.IsConnected = false;
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
- else if ( stsResult == TPCANStatus.PCAN_ERROR_BUSHEAVY || stsResult == TPCANStatus.PCAN_ERROR_BUSOFF )
|
|
|
|
|
- {
|
|
|
|
|
- throw new Exception( "Peak CAN DisConnect" );
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- throw new Exception( "" );
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(stsResult == TPCANStatus.PCAN_ERROR_OK)
|
|
|
|
|
+ this.PeackCANRecv( canMsg );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return stsResult;
|
|
return stsResult;
|
|
@@ -331,8 +311,8 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
void PeackCANRecv(TPCANMsg recv)
|
|
void PeackCANRecv(TPCANMsg recv)
|
|
|
{
|
|
{
|
|
|
string packet = BitConverter.ToString( recv.DATA ).Replace( "-" , "" );
|
|
string packet = BitConverter.ToString( recv.DATA ).Replace( "-" , "" );
|
|
|
- byte msgType = 0;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ eCanRecvCase recvIndex = eCanRecvCase.NONE;
|
|
|
|
|
+
|
|
|
List<string> sList = new List<string>();
|
|
List<string> sList = new List<string>();
|
|
|
for ( int i = 0; i < packet.Length; i++ )
|
|
for ( int i = 0; i < packet.Length; i++ )
|
|
|
{
|
|
{
|
|
@@ -340,36 +320,30 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
sList.Add( packet.Substring( i , 2 ) );
|
|
sList.Add( packet.Substring( i , 2 ) );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if ( recv.DATA[ 1 ] == 0 )
|
|
|
|
|
|
|
+ if ( recv.DATA[ 1 ] == 0 ) //empty
|
|
|
return;
|
|
return;
|
|
|
else
|
|
else
|
|
|
- msgType = recv.DATA[ 1 ];
|
|
|
|
|
|
|
+ recvIndex = ( eCanRecvCase )recv.DATA[ 1 ];
|
|
|
|
|
|
|
|
- switch ( msgType )
|
|
|
|
|
|
|
+ switch ( recvIndex )
|
|
|
{
|
|
{
|
|
|
- case 1:
|
|
|
|
|
- {
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.Voltage ].Value = Int32.Parse( sList[ ( int )eMsgCaseFirst.Voltage_HIGH ] + sList[ ( int )eMsgCaseFirst.Voltage_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.Current ].Value = Int32.Parse( sList[ ( int )eMsgCaseFirst.Current_HIGH ] + sList[ ( int )eMsgCaseFirst.Current_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.BatteryState ].Value = Int32.Parse( sList[ ( int )eMsgCaseFirst.BatteryBitStatus_HIGH ] + sList[ ( int )eMsgCaseFirst.BatteryBitStatus_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case eCanRecvCase.NONE:
|
|
|
break;
|
|
break;
|
|
|
- case 2:
|
|
|
|
|
- {
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.ChargeCompleteTime ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.ChargeFull_HIGH ] + sList[ ( int )eMsgCaseSecond.ChargeFull_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.DisChargeCompleteTime ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.DisChargeEmpty_HIGH ] + sList[ ( int )eMsgCaseSecond.DisChargeEmpty_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.SOC ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.SOC ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.SOH ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.SOH ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case eCanRecvCase.CASE1:
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.Voltage ].Value = Int32.Parse( sList[ ( int )eMsgCaseFirst.Voltage_HIGH ] + sList[ ( int )eMsgCaseFirst.Voltage_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.Current ].Value = Int32.Parse( sList[ ( int )eMsgCaseFirst.Current_HIGH ] + sList[ ( int )eMsgCaseFirst.Current_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.BatteryState ].Value = Int32.Parse( sList[ ( int )eMsgCaseFirst.BatteryBitStatus_HIGH ] + sList[ ( int )eMsgCaseFirst.BatteryBitStatus_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
break;
|
|
break;
|
|
|
- case 3:
|
|
|
|
|
- {
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.ResidualCapacity ].Value = Int32.Parse( sList[ ( int )eMsgCaseThird.Capacity_High ] + sList[ ( int )eMsgCaseThird.Capacity_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.ResidualEnergy ].Value = Int32.Parse( sList[ ( int )eMsgCaseThird.Energy_HIGH ] + sList[ ( int )eMsgCaseThird.Energy_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- this.manager.ReceivedDataDic[ eDataKind.Temperature ].Value = Int32.Parse( sList[ ( int )eMsgCaseThird.Temperature_HIGH ] + sList[ ( int )eMsgCaseThird.Temperature_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case eCanRecvCase.CASE2:
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.ChargeCompleteTime ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.ChargeFull_HIGH ] + sList[ ( int )eMsgCaseSecond.ChargeFull_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.DisChargeCompleteTime ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.DisChargeEmpty_HIGH ] + sList[ ( int )eMsgCaseSecond.DisChargeEmpty_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.SOC ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.SOC ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.SOH ].Value = Int32.Parse( sList[ ( int )eMsgCaseSecond.SOH ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
break;
|
|
break;
|
|
|
- default:
|
|
|
|
|
|
|
+ case eCanRecvCase.CASE3:
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.ResidualCapacity ].Value = Int32.Parse( sList[ ( int )eMsgCaseThird.Capacity_High ] + sList[ ( int )eMsgCaseThird.Capacity_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.ResidualEnergy ].Value = Int32.Parse( sList[ ( int )eMsgCaseThird.Energy_HIGH ] + sList[ ( int )eMsgCaseThird.Energy_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
|
|
+ this.manager.ReceivedDataDic[ eDataKind.Temperature ].Value = Int32.Parse( sList[ ( int )eMsgCaseThird.Temperature_HIGH ] + sList[ ( int )eMsgCaseThird.Temperature_LOW ] , System.Globalization.NumberStyles.HexNumber );
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -386,77 +360,32 @@ namespace VehicleControlSystem.ControlLayer.Serial.BatteryTabos
|
|
|
var result = rs.Cast<object>().ToList();
|
|
var result = rs.Cast<object>().ToList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void CanError(Exception e)
|
|
|
|
|
|
|
+ void CanError()
|
|
|
{
|
|
{
|
|
|
|
|
+ this.IsConnected = false;
|
|
|
var result = PCANBasic.Uninitialize( this.handle );
|
|
var result = PCANBasic.Uninitialize( this.handle );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool GetStatus()
|
|
bool GetStatus()
|
|
|
{
|
|
{
|
|
|
- var result = PCANBasic.GetStatus( this.handle );
|
|
|
|
|
- bool state = false;
|
|
|
|
|
|
|
+ bool result = false;
|
|
|
|
|
|
|
|
- switch ( result )
|
|
|
|
|
- {
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_OK:
|
|
|
|
|
- state = true;
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_XMTFULL:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_OVERRUN:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_BUSLIGHT:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_BUSHEAVY:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_BUSPASSIVE:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_BUSOFF:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ANYBUSERR:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_QRCVEMPTY:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_QOVERRUN:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_QXMTFULL:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_REGTEST:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_NODRIVER:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_HWINUSE:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_NETINUSE:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLHW:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLNET:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLCLIENT:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_RESOURCE:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLPARAMTYPE:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLPARAMVAL:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_UNKNOWN:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLDATA:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLMODE:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_CAUTION:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_INITIALIZE:
|
|
|
|
|
- break;
|
|
|
|
|
- case TPCANStatus.PCAN_ERROR_ILLOPERATION:
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ TPCANMsg msg;
|
|
|
|
|
+ msg.DATA = new byte[ 8 ];
|
|
|
|
|
+ TPCANTimestamp canTimeStamp;
|
|
|
|
|
+
|
|
|
|
|
+ Write(eSendMode.MANUAL);
|
|
|
|
|
+
|
|
|
|
|
+ Thread.Sleep( 10 );
|
|
|
|
|
+
|
|
|
|
|
+ var state = PCANBasic.Read( this.handle , out msg , out canTimeStamp );
|
|
|
|
|
+
|
|
|
|
|
+ if ( msg.ID == 0x460 )
|
|
|
|
|
+ result = true;
|
|
|
|
|
+ else
|
|
|
|
|
+ result = false;
|
|
|
|
|
|
|
|
- this.errormsg = result.ToString();
|
|
|
|
|
- return state;
|
|
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void DisConnect( )
|
|
private void DisConnect( )
|