Ongoing GUI updates.
This commit is contained in:
@@ -37,12 +37,48 @@
|
||||
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
// Unter Windows steht der Treibername in der registry
|
||||
static const char* cMHS_DRIVERNAME = NULL;
|
||||
#elif defined(Q_OS_LINUX)
|
||||
// Linux-spezifischer Code (z.B. /proc Filesystem, D-Bus)
|
||||
// Unter linux(artigen) muss der Treibername explizit mit übergeben werden
|
||||
static const char* cMHS_DRIVERNAME = "libmhstcan.so";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
// TinyCan C-Api
|
||||
// -------------
|
||||
|
||||
int32_t CanInitDriver(char *options);
|
||||
void CanDownDriver(void);
|
||||
int32_t CanSetOptions(char *options);
|
||||
int32_t CanDeviceOpen(uint32_t index, char *parameter);
|
||||
int32_t CanDeviceClose(uint32_t index);
|
||||
|
||||
int32_t CanSetMode(uint32_t index, unsigned char can_op_mode, uint16_t can_command);
|
||||
|
||||
int32_t CanTransmit(uint32_t index, struct TCanMsg *msg, int32_t count);
|
||||
void CanTransmitClear(uint32_t index);
|
||||
uint32_t CanTransmitGetCount(uint32_t index);
|
||||
int32_t CanTransmitSet(uint32_t index, uint16_t cmd, uint32_t time);
|
||||
int32_t CanReceive(uint32_t index, struct TCanMsg *msg, int32_t count);
|
||||
void CanReceiveClear(uint32_t index);
|
||||
uint32_t CanReceiveGetCount(uint32_t index);
|
||||
|
||||
int32_t CanSetSpeed(uint32_t index, uint16_t speed);
|
||||
int32_t CanSetSpeedUser(uint32_t index, uint32_t value);
|
||||
char* CanDrvInfo(void);
|
||||
char* CanDrvHwInfo(uint32_t index);
|
||||
int32_t CanSetFilter(uint32_t index, struct TMsgFilter *msg_filter);
|
||||
int32_t CanGetDeviceStatus(uint32_t index, struct TDeviceStatus *status);
|
||||
void CanSetPnPEventCallback(void (DRV_CALLBACK_TYPE *event)(uint32_t index, int32_t status));
|
||||
void CanSetStatusEventCallback(void (DRV_CALLBACK_TYPE *event) (uint32_t index, struct TDeviceStatus *device_status) );
|
||||
void CanSetRxEventCallback(void (DRV_CALLBACK_TYPE *event)(uint32_t index, struct TCanMsg *msg, int32_t count) );
|
||||
|
||||
void CanSetEvents( uint16_t events );
|
||||
uint32_t CanEventStatus(void);
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Destruktor. Entlädt den CAN-Bus Treiber wieder.
|
||||
*/
|
||||
@@ -76,8 +112,6 @@ BCDriver::DriverStateResult BCDriverTinyCan::loadDriver()
|
||||
{
|
||||
auto callLoadDriver = [&]() -> DriverStateResult
|
||||
{
|
||||
qDebug() << " -- Hier!";
|
||||
//if( ::LoadDriver( NULL ) < 0 )
|
||||
if( ::LoadDriver( cMHS_DRIVERNAME ) < 0 )
|
||||
return std::unexpected(QString("Driver Error: 'LoadDriver'"));
|
||||
_driverState = DriverState::Loaded;
|
||||
@@ -126,19 +160,20 @@ BCDriver::DriverStateResult BCDriverTinyCan::loadDriver()
|
||||
.and_then( callInitDriver )
|
||||
.and_then( callOpenDevice );
|
||||
|
||||
// success:
|
||||
if(newDriverState)
|
||||
{
|
||||
// return 'DriverState::Opened'
|
||||
return _driverState;
|
||||
}
|
||||
// return driver error message,
|
||||
// _driverState ist irgendwo unter DriverState::Opened
|
||||
// in Fehlerfall ist der Errorstring gesetzt,
|
||||
// der interne _driverstate ist
|
||||
// irgendwo unter DriverState::Opened
|
||||
return newDriverState;
|
||||
|
||||
}
|
||||
|
||||
// __fix
|
||||
|
||||
/**
|
||||
* @brief Um mit dem Bionx eBike reden zu können, müssen wir
|
||||
* die Console in den Slave-Mode setzen.
|
||||
* @return Fehlerstring oder DriverState::DeviceReady
|
||||
*/
|
||||
|
||||
BCDriver::DriverStateResult BCDriverTinyCan::setConsoleSlaveMode()
|
||||
{
|
||||
|
||||
@@ -164,7 +199,6 @@ BCDriver::DriverStateResult BCDriverTinyCan::setConsoleSlaveMode()
|
||||
|
||||
unsigned int retry = cTimeOuts;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
writeRawByte( console, slaveFlag, 1 );
|
||||
@@ -192,6 +226,7 @@ void BCDriverTinyCan::resetDriver()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief BCDriverTinyCan::readRawByte
|
||||
* Kapselt den Treiberzugiff über die legacy C-Api. Liest ein byte, gibt dieses im std::expected aber
|
||||
|
||||
Reference in New Issue
Block a user