mirror of
https://github.com/cagnulein/qdomyos-zwift.git
synced 2026-02-17 16:07:43 +01:00
carnielli (i-running) treadmill experimental support
Signed-off-by: Roberto Viola <roberto.viola@systemceramics.com>
This commit is contained in:
committed by
Roberto Viola
parent
44ce147e1a
commit
35c0f32787
BIN
btlogs/carnielli_i-running.jpg
Normal file
BIN
btlogs/carnielli_i-running.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
@@ -115,7 +115,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device)
|
||||
connect(toorx, SIGNAL(debug(QString)), this, SLOT(debug(QString)));
|
||||
toorx->deviceDiscovered(device);
|
||||
}
|
||||
else if((device.name().startsWith("TOORX")) && filter)
|
||||
else if(((device.name().startsWith("TOORX")) || (device.name().startsWith("i-Running"))) && filter)
|
||||
{
|
||||
discoveryAgent->stop();
|
||||
trxappgateusb = new trxappgateusbtreadmill();
|
||||
|
||||
@@ -108,7 +108,9 @@ void trxappgateusbtreadmill::update()
|
||||
if(requestStart != -1)
|
||||
{
|
||||
debug("starting...");
|
||||
btinit(true);
|
||||
//btinit(true);
|
||||
const uint8_t startTape[] = { 0xf0, 0xa5, 0x01, 0xd3, 0x04, 0x6d };
|
||||
writeCharacteristic((uint8_t*)startTape, sizeof(startTape), "startTape", false);
|
||||
requestStart = -1;
|
||||
emit tapeStarted();
|
||||
}
|
||||
@@ -259,8 +261,17 @@ void trxappgateusbtreadmill::stateChanged(QLowEnergyService::ServiceState state)
|
||||
debug("characteristic " + c.uuid().toString());
|
||||
}
|
||||
|
||||
QBluetoothUuid _gattWriteCharacteristicId((QString)"0000fff2-0000-1000-8000-00805f9b34fb");
|
||||
QBluetoothUuid _gattNotifyCharacteristicId((QString)"0000fff1-0000-1000-8000-00805f9b34fb");
|
||||
QString uuidWrite = "0000fff2-0000-1000-8000-00805f9b34fb";
|
||||
QString uuidNotify = "0000fff1-0000-1000-8000-00805f9b34fb";
|
||||
|
||||
if(treadmill_type == TYPE::IRUNNING)
|
||||
{
|
||||
uuidWrite = "49535343-4C8A-39B3-2F49-511CFF073B7E";
|
||||
uuidNotify = "49535343-1E4D-4BD9-BA61-23C647249616";
|
||||
}
|
||||
|
||||
QBluetoothUuid _gattWriteCharacteristicId((QString)uuidWrite);
|
||||
QBluetoothUuid _gattNotifyCharacteristicId((QString)uuidNotify);
|
||||
|
||||
gattWriteCharacteristic = gattCommunicationChannelService->characteristic(_gattWriteCharacteristicId);
|
||||
gattNotifyCharacteristic = gattCommunicationChannelService->characteristic(_gattNotifyCharacteristicId);
|
||||
@@ -311,7 +322,11 @@ void trxappgateusbtreadmill::serviceScanDone(void)
|
||||
{
|
||||
debug("serviceScanDone");
|
||||
|
||||
QBluetoothUuid _gattCommunicationChannelServiceId((QString)"0000fff0-0000-1000-8000-00805f9b34fb");
|
||||
QString uuid = "0000fff0-0000-1000-8000-00805f9b34fb";
|
||||
if(treadmill_type == TYPE::IRUNNING)
|
||||
uuid = "49535343-FE7D-4AE5-8FA9-9FAFD205E455";
|
||||
|
||||
QBluetoothUuid _gattCommunicationChannelServiceId((QString)uuid);
|
||||
gattCommunicationChannelService = m_control->createServiceObject(_gattCommunicationChannelServiceId);
|
||||
connect(gattCommunicationChannelService, SIGNAL(stateChanged(QLowEnergyService::ServiceState)), this, SLOT(stateChanged(QLowEnergyService::ServiceState)));
|
||||
gattCommunicationChannelService->discoverDetails();
|
||||
@@ -333,8 +348,13 @@ void trxappgateusbtreadmill::error(QLowEnergyController::Error err)
|
||||
void trxappgateusbtreadmill::deviceDiscovered(const QBluetoothDeviceInfo &device)
|
||||
{
|
||||
debug("Found new device: " + device.name() + " (" + device.address().toString() + ')');
|
||||
if(device.name().startsWith("TOORX"))
|
||||
if(device.name().startsWith("TOORX") || device.name().startsWith("i-Running"))
|
||||
{
|
||||
if(device.name().startsWith("i-Running"))
|
||||
treadmill_type = TYPE::IRUNNING;
|
||||
else
|
||||
treadmill_type = TYPE::TRXAPPGATE;
|
||||
|
||||
bluetoothDevice = device;
|
||||
m_control = QLowEnergyController::createCentral(bluetoothDevice, this);
|
||||
connect(m_control, SIGNAL(serviceDiscovered(const QBluetoothUuid &)),
|
||||
|
||||
@@ -72,6 +72,12 @@ private:
|
||||
bool initDone = false;
|
||||
bool initRequest = false;
|
||||
|
||||
typedef enum TYPE {
|
||||
TRXAPPGATE = 0,
|
||||
IRUNNING = 1
|
||||
} TYPE;
|
||||
TYPE treadmill_type = TRXAPPGATE;
|
||||
|
||||
|
||||
signals:
|
||||
void disconnected();
|
||||
|
||||
Reference in New Issue
Block a user