First compile.
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
BionxControl.pro.user
|
||||
build/
|
||||
@@ -26,21 +26,21 @@ windows
|
||||
|
||||
SOURCES += \
|
||||
bccommand.cpp \
|
||||
bccommandmanager.cpp \
|
||||
bccommandrunner.cpp \
|
||||
bcvalue.cpp \
|
||||
bcvaluemanager.cpp \
|
||||
bcvaluemodel.cpp \
|
||||
main.cpp \
|
||||
bcmainwindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
bc.h \
|
||||
bccommand.h \
|
||||
bccommandmanager.h \
|
||||
bccommandrunner.h \
|
||||
bcmainwindow.h \
|
||||
bcvalue.h \
|
||||
bcvaluemanager.h
|
||||
bcvaluemanager.h \
|
||||
bcvaluemodel.h
|
||||
|
||||
FORMS += \
|
||||
bcmainwindow.ui
|
||||
|
||||
1
bc.h
1
bc.h
@@ -27,6 +27,7 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef BC_H
|
||||
#define BC_H
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <bccommand.h>
|
||||
|
||||
|
||||
@@ -44,3 +45,5 @@ uint8_t BCCommand::getLongValue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef BCCOMMAND_H
|
||||
#define BCCOMMAND_H
|
||||
|
||||
@@ -34,7 +35,6 @@
|
||||
#include <bc.h>
|
||||
|
||||
|
||||
class BCCommandRunner;
|
||||
|
||||
struct BCCommand
|
||||
{
|
||||
@@ -50,6 +50,8 @@ struct BCCommand
|
||||
|
||||
};
|
||||
|
||||
class BCCommandRunner;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#include <bccommandmanager.h>
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#ifndef BCCOMMANDMANAGER_H
|
||||
#define BCCOMMANDMANAGER_H
|
||||
|
||||
|
||||
#endif // BCCOMMANDMANAGER_H
|
||||
46
bcvalue.cpp
46
bcvalue.cpp
@@ -1,17 +1,31 @@
|
||||
/***************************************************************************
|
||||
|
||||
BionxControl
|
||||
Copyright © 2025 christoph holzheuer
|
||||
christoph.holzheuer@gmail.com
|
||||
|
||||
Using:
|
||||
|
||||
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
|
||||
|
||||
mhs_can_drv.c 3.00
|
||||
© 2011 - 2015 by MHS-Elektronik GmbH & Co. KG, Germany
|
||||
Demlehner Klaus, info@mhs-elektronik.de
|
||||
@see www.mhs-elektronik.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
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <bcvalue.h>
|
||||
|
||||
|
||||
BCRawValue::BCRawValue(BCDevice::ID deviceID_, BC::ID targetID_)
|
||||
: deviceID{deviceID_}, targetID{targetID_}
|
||||
{
|
||||
}
|
||||
|
||||
void BCRawValue::setLongValue( uint8_t value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint8_t BCRawValue::getLongValue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
87
bcvalue.h
87
bcvalue.h
@@ -1,25 +1,42 @@
|
||||
/***************************************************************************
|
||||
|
||||
BionxControl
|
||||
Copyright © 2025 christoph holzheuer
|
||||
christoph.holzheuer@gmail.com
|
||||
|
||||
Using:
|
||||
|
||||
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
|
||||
|
||||
mhs_can_drv.c 3.00
|
||||
© 2011 - 2015 by MHS-Elektronik GmbH & Co. KG, Germany
|
||||
Demlehner Klaus, info@mhs-elektronik.de
|
||||
@see www.mhs-elektronik.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
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef BCRawValue_H
|
||||
#define BCRawValue_H
|
||||
|
||||
|
||||
class BCRawValueRunner;
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
#include <bc.h>
|
||||
|
||||
struct BCRawValue
|
||||
{
|
||||
|
||||
BCRawValue( BCDevice::ID deviceID, BC::ID targetID );
|
||||
|
||||
void setLongValue( uint8_t value);
|
||||
uint8_t getLongValue();
|
||||
|
||||
QString label;
|
||||
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
||||
BC::ID targetID{BC::ID::Invalid};
|
||||
|
||||
};
|
||||
|
||||
struct BCUnit
|
||||
{
|
||||
@@ -33,8 +50,48 @@ struct BCUnit
|
||||
class BCValue
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
BCValue() = default;
|
||||
BCValue( BCDevice::ID deviceID, BC::ID targetID );
|
||||
|
||||
void setLongValue( uint8_t value);
|
||||
uint8_t getLongValue();
|
||||
|
||||
QString label;
|
||||
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
||||
BC::ID targetID{BC::ID::Invalid};
|
||||
double _value{-1};
|
||||
};
|
||||
|
||||
// abbreviations:
|
||||
// SOC = State Of Charge
|
||||
// LMD = Last Measured Discharge
|
||||
// NIP = ?
|
||||
|
||||
/*
|
||||
|
||||
Needed ?
|
||||
#include <type_traits>
|
||||
|
||||
template <typename E>
|
||||
constexpr auto to_u(E e) noexcept {
|
||||
return static_cast<std::underlying_type_t<E>>(e);
|
||||
}
|
||||
*/
|
||||
|
||||
class BCValueShort
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
class BCValueLong
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
using BCValueList = QList<BCValue*>;
|
||||
|
||||
|
||||
#endif // BCRawValue_H
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
#ifndef BCRawValue_H
|
||||
#define BCRawValue_H
|
||||
|
||||
|
||||
class BCRawValueRunner;
|
||||
|
||||
#include <QString>
|
||||
#include <bc.h>
|
||||
|
||||
struct BCRawValue
|
||||
{
|
||||
|
||||
BCRawValue( BCDevice::ID deviceID, BC::ID targetID );
|
||||
|
||||
void setLongValue( uint8_t value);
|
||||
uint8_t getLongValue();
|
||||
|
||||
QString label;
|
||||
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
||||
BC::ID targetID{BC::ID::Invalid};
|
||||
|
||||
};
|
||||
|
||||
struct BCUnit
|
||||
{
|
||||
enum class ID
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class BCValue
|
||||
{
|
||||
public:
|
||||
BCValue( BCDevice::ID deviceID, BC::ID targetID );
|
||||
|
||||
void setLongValue( uint8_t value);
|
||||
uint8_t getLongValue();
|
||||
|
||||
QString label;
|
||||
BCDevice::ID deviceID{BCDevice::ID::Invalid};
|
||||
BC::ID targetID{BC::ID::Invalid};
|
||||
double _value{-1};
|
||||
};
|
||||
|
||||
|
||||
class BCValueShort
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
class BCValueLong
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // BCRawValue_H
|
||||
@@ -1,3 +1,122 @@
|
||||
#include "bcvaluemanager.h"
|
||||
/***************************************************************************
|
||||
|
||||
BCValueManager::BCValueManager() {}
|
||||
BionxControl
|
||||
Copyright © 2025 christoph holzheuer
|
||||
christoph.holzheuer@gmail.com
|
||||
|
||||
Using:
|
||||
|
||||
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
|
||||
|
||||
mhs_can_drv.c 3.00
|
||||
© 2011 - 2015 by MHS-Elektronik GmbH & Co. KG, Germany
|
||||
Demlehner Klaus, info@mhs-elektronik.de
|
||||
@see www.mhs-elektronik.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
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QTableView>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
#include <QStatusBar>
|
||||
#include <bcvaluemanager.h>
|
||||
|
||||
BCValueManager::BCValueManager()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
void BCValueManager::loadXml()
|
||||
{
|
||||
/*
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "XML öffnen", "", "XML Files (*.xml)");
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::warning(this, "Fehler", "Datei konnte nicht geöffnet werden.");
|
||||
return;
|
||||
}
|
||||
|
||||
QList<Device> parsedDevices;
|
||||
QXmlStreamReader xml(&file);
|
||||
|
||||
while (!xml.atEnd() && !xml.hasError()) {
|
||||
QXmlStreamReader::TokenType token = xml.readNext();
|
||||
if (token == QXmlStreamReader::StartElement && xml.name() == u"device") {
|
||||
Device d;
|
||||
d.name = xml.attributes().value(u"name").toString();
|
||||
d.ip = xml.attributes().value(u"ip").toString();
|
||||
parsedDevices.append(d);
|
||||
}
|
||||
}
|
||||
|
||||
if (xml.hasError())
|
||||
{
|
||||
QMessageBox::critical(this, "Parsing Fehler", xml.errorString());
|
||||
} else {
|
||||
m_model->setDevices(parsedDevices);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// --- NEU: Speichern mit QXmlStreamWriter ---
|
||||
void BCValueManager::saveXml()
|
||||
{
|
||||
/*
|
||||
QString fileName = QFileDialog::getSaveFileName(this, "XML speichern", "", "XML Files (*.xml)");
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QMessageBox::warning(this, "Fehler", "Datei konnte nicht zum Schreiben geöffnet werden.");
|
||||
return;
|
||||
}
|
||||
|
||||
QXmlStreamWriter xml(&file);
|
||||
xml.setAutoFormatting(true); // Sorgt für schöne Einrückungen (Tabs/Spaces)
|
||||
xml.writeStartDocument();
|
||||
xml.writeStartElement("devices");
|
||||
|
||||
// Daten vom Model holen
|
||||
const QList<Device> &devices = m_model->getDevices();
|
||||
|
||||
for (const Device &d : devices) {
|
||||
xml.writeStartElement("device");
|
||||
xml.writeAttribute("name", d.name);
|
||||
xml.writeAttribute("ip", d.ip);
|
||||
xml.writeEndElement(); // </device>
|
||||
}
|
||||
|
||||
xml.writeEndElement(); // </devices>
|
||||
xml.writeEndDocument();
|
||||
|
||||
// Prüfen ob alles geschrieben wurde
|
||||
if (file.error() != QFile::NoError) {
|
||||
QMessageBox::critical(this, "Fehler", "Fehler beim Schreiben der Datei.");
|
||||
} else {
|
||||
statusBar()->showMessage("Datei erfolgreich gespeichert!", 3000);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,10 +1,56 @@
|
||||
/***************************************************************************
|
||||
|
||||
BionxControl
|
||||
Copyright © 2025 christoph holzheuer
|
||||
christoph.holzheuer@gmail.com
|
||||
|
||||
Using:
|
||||
|
||||
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
|
||||
|
||||
mhs_can_drv.c 3.00
|
||||
© 2011 - 2015 by MHS-Elektronik GmbH & Co. KG, Germany
|
||||
Demlehner Klaus, info@mhs-elektronik.de
|
||||
@see www.mhs-elektronik.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
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef BCVALUEMANAGER_H
|
||||
#define BCVALUEMANAGER_H
|
||||
|
||||
class BCValueManager
|
||||
#include <bcvalue.h>
|
||||
|
||||
class BCValueManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
|
||||
BCValueManager();
|
||||
~BCValueManager() = default;
|
||||
|
||||
BCValue* makeValue();
|
||||
|
||||
void loadXml();
|
||||
void saveXml();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // BCVALUEMANAGER_H
|
||||
|
||||
58
main.cpp
58
main.cpp
@@ -27,16 +27,42 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include <bcmainwindow.h>
|
||||
#include <bc.h>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMetaEnum>
|
||||
|
||||
// main.cpp
|
||||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
#include <bcmainwindow.h>
|
||||
#include <bcvalue.h>
|
||||
|
||||
|
||||
/*
|
||||
#include <QMetaEnum>
|
||||
|
||||
void parseString(const QString &inputString) {
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<BCValue::ID>();
|
||||
|
||||
bool ok = false;
|
||||
// keyToValue parst den String ("x1") und liefert den int-Wert
|
||||
int intVal = metaEnum.keyToValue(inputString.toLatin1().constData(), &ok);
|
||||
|
||||
if (ok) {
|
||||
BCValue::ID id = static_cast<BCValue::ID>(intVal);
|
||||
// Erfolg!
|
||||
} else {
|
||||
// Fehler: String existiert nicht im Enum
|
||||
qWarning() << "Unbekannter Enum String:" << inputString;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <QThread>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -52,9 +78,27 @@ int main(int argc, char *argv[])
|
||||
|
||||
qDebug() << " --- sach bloss das geht: " << x << " ui: " << uint8_t(x) << " : " << map[Color::Red];
|
||||
|
||||
QApplication a(argc, argv);
|
||||
//BCMainWindow w;
|
||||
//w.show();
|
||||
return a.exec();
|
||||
|
||||
QApplication app(argc, argv);
|
||||
BCMainWindow w;
|
||||
w.show();
|
||||
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<BC::ID>();
|
||||
|
||||
bool ok = false;
|
||||
QString inputString = "x3";
|
||||
BC::ID yyy{};
|
||||
|
||||
// keyToValue parst den String ("x1") und liefert den int-Wert
|
||||
int intVal = metaEnum.keyToValue(inputString.toLatin1().constData(), &ok);
|
||||
if (ok)
|
||||
yyy = static_cast<BC::ID>(intVal);
|
||||
|
||||
auto xxx = BC::ID::Battery_Config_Force_Done;
|
||||
//QString result = fullString.section("::", -1);
|
||||
qDebug() << " schön: " << xxx << " -- " << uint8_t(xxx) << " : " << yyy;
|
||||
qDebug() << " nice: " << metaEnum.enumName() << " : " <<metaEnum.name() << ": " << metaEnum.enclosingMetaObject()->className();
|
||||
|
||||
return app.exec();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user