Files
BionxControl/bcdriver.cpp

98 lines
2.4 KiB
C++
Raw Normal View History

2025-12-26 14:07:55 +01:00
/***************************************************************************
BionxControl
2026-01-03 23:51:14 +01:00
© 2025 -2026 christoph holzheuer
2025-12-26 14:07:55 +01:00
christoph.holzheuer@gmail.com
Using:
mhs_can_drv.c
© 2011 - 2023 by MHS-Elektronik GmbH & Co. KG, Germany
Klaus Demlehner, klaus@mhs-elektronik.de
@see www.mhs-elektronik.de
Based on Bionx data type descriptions from:
BigXionFlasher USB V 0.2.4 rev. 97
© 2011-2013 by Thomas Koenig <info@bigxionflasher.org>
@see www.bigxionflasher.org
Bionx Bike Info
© 2018 Thorsten Schmidt (tschmidt@ts-soft.de)
@see www.ts-soft.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
@see https://github.com/bikemike/bionx-bikeinfo
***************************************************************************/
2025-12-20 16:33:00 +01:00
#include <QDebug>
2025-12-30 14:42:49 +01:00
#include <QRandomGenerator>
2025-12-20 16:33:00 +01:00
2025-12-30 10:12:01 +01:00
#include <bcdriver.h>
2025-12-20 16:33:00 +01:00
2026-01-05 23:39:45 +01:00
/**
* @brief Gibt den Treiberstatus zurück.
*/
2025-12-20 16:33:00 +01:00
2026-01-01 23:01:31 +01:00
BCDriver::DriverState BCDriver::getDriverState() const
2025-12-20 16:33:00 +01:00
{
return _driverState;
}
/**
*
* @brief Der Slot, der das Initialisieren des Treibers auslöst.
* Teilt sich in die zwei Etappen
* - Driver dll laden
* - Driver mit der Console verbinden
* D.h. initDriver kann als Wiedereinstiegspunkt
* verwendet werden, falls der Treiber geladen wurde,
* aber die Console noch nicht eingeschaltet war.
*/
2026-01-03 20:10:30 +01:00
BCDriver::DriverStateResult BCDriverDummy::loadAndStartDriver()
2025-12-20 16:33:00 +01:00
{
2026-01-01 13:28:17 +01:00
_driverState = DriverState::DeviceReady;
2026-01-03 20:10:30 +01:00
return _driverState;
2026-01-01 00:40:27 +01:00
}
2025-12-20 16:33:00 +01:00
2025-12-30 14:42:49 +01:00
/// -----------------------------------------------------------------------------------
/// -----------------------------------------------------------------------------------
2026-01-05 23:39:45 +01:00
/**
* @brief Gibt ein Zufallsbyte zurück.
*/
2025-12-30 14:42:49 +01:00
2026-01-02 16:25:21 +01:00
TransmitResult BCDriverDummy::readRawByte( uint32_t deviceID, uint8_t registerID ) const
2025-12-30 14:42:49 +01:00
{
2026-01-01 13:28:17 +01:00
Q_UNUSED(deviceID)
Q_UNUSED(registerID)
2026-01-09 10:47:29 +01:00
// Tätigkeit simulieren
2026-01-10 22:18:54 +01:00
//bc::delay_millis(200);
bc::delay_millis(50);
2026-01-01 13:28:17 +01:00
uint8_t myRandomByte = static_cast<uint8_t>(QRandomGenerator::global()->bounded(256));
2025-12-30 14:42:49 +01:00
return myRandomByte;
}
2026-01-05 23:39:45 +01:00
/**
* @brief Simuliert erfolgreiches scheiben. Tut nix.
*/
2026-01-02 16:25:21 +01:00
TransmitResult BCDriverDummy::writeRawByte( uint32_t deviceID, uint8_t registerID, uint8_t value ) const
2025-12-30 14:42:49 +01:00
{
2026-01-01 13:28:17 +01:00
Q_UNUSED(deviceID)
Q_UNUSED(registerID)
2026-01-09 10:47:29 +01:00
Q_UNUSED(value)
2026-01-01 13:28:17 +01:00
return 0;
2025-12-30 14:42:49 +01:00
}
2025-12-20 16:33:00 +01:00