Simplified value handling.
This commit is contained in:
@@ -29,12 +29,12 @@ BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver()
|
||||
struct ::TDeviceStatus status;
|
||||
|
||||
if( ::LoadDriver( NULL ) < 0 )
|
||||
throw std::runtime_error( "Driver Error: 'LoadDriver'" );
|
||||
throw BCException( "Driver Error: 'LoadDriver'" );
|
||||
|
||||
setState(BCCanDriver::DriverState::Loaded);
|
||||
|
||||
if( ::CanInitDriver( NULL ) < 0 )
|
||||
throw std::runtime_error( "Driver Error: 'InitDriver'" );
|
||||
throw BCException( "Driver Error: 'InitDriver'" );
|
||||
|
||||
if( ::CanDeviceOpen( 0, NULL ) < 0 )
|
||||
throw std::runtime_error( "Driver Error: 'DeviceOpen'" );
|
||||
@@ -46,12 +46,12 @@ BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver()
|
||||
setState(BCCanDriver::DriverState::Initialized);
|
||||
|
||||
if( status.DrvStatus < DRV_STATUS_CAN_OPEN )
|
||||
throw std::runtime_error( "Driver Error: could not open device." );
|
||||
throw BCException( "Driver Error: could not open device." );
|
||||
|
||||
if( status.CanStatus == CAN_STATUS_BUS_OFF )
|
||||
{
|
||||
::CanSetMode( 0, OP_CAN_RESET, CAN_CMD_NONE );
|
||||
throw std::runtime_error( "Driver Error: CAN Status 'BusOff'" );
|
||||
throw BCException( "Driver Error: CAN Status 'BusOff'" );
|
||||
}
|
||||
|
||||
setState(BCCanDriver::DriverState::Ready);
|
||||
@@ -74,7 +74,7 @@ BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver()
|
||||
::UnloadDriver();
|
||||
|
||||
// re-throw
|
||||
throw std::runtime_error( except.what() );
|
||||
throw BCException( except.what() );
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -156,14 +156,14 @@ retry:
|
||||
bc::delay_millis( cTIMEOUT_MS );
|
||||
|
||||
if( timeOuts == -1 )
|
||||
throw std::runtime_error( "getValue error: no response from node" );
|
||||
throw BCException( "getValue error: no response from node" );
|
||||
|
||||
// message empfangen
|
||||
int err = ::CanReceive( 0, &msg, 1 );
|
||||
qDebug() << "HÄÄ ?" << err << "reg: "<< reg <<" timeOuts: " << timeOuts;
|
||||
|
||||
if( err < 0 )
|
||||
//throw std::runtime_error( "getValue error: could not receive value" );
|
||||
//throw BCException( "getValue error: could not receive value" );
|
||||
qDebug( "getValue error: could not receive value" );
|
||||
|
||||
qDebug() << "HÄÄ 2" <<msg.Id;
|
||||
@@ -175,7 +175,7 @@ retry:
|
||||
goto retry;
|
||||
|
||||
if( !timeOuts )
|
||||
throw std::runtime_error( "CAN --response errror" );
|
||||
throw BCException( "CAN --response errror" );
|
||||
|
||||
return (bcdata_t) msg.MsgData[3];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user