From 91989a138bf83cab7fdc2450bb5dcb14295e333d Mon Sep 17 00:00:00 2001 From: Roberto Viola Date: Wed, 31 Jul 2024 16:30:37 +0200 Subject: [PATCH] Revert "adding android zwift ride protocol" This reverts commit e66db6bb8dcfbe47b2683c88c70c275d17cdd8d9. --- .../zwiftridecontroller.proto | 114 ------------------ src/virtualdevices/virtualbike.cpp | 51 +------- src/virtualdevices/virtualbike.h | 2 - 3 files changed, 1 insertion(+), 166 deletions(-) delete mode 100644 src/devices/zwiftridecontroller/zwiftridecontroller.proto diff --git a/src/devices/zwiftridecontroller/zwiftridecontroller.proto b/src/devices/zwiftridecontroller/zwiftridecontroller.proto deleted file mode 100644 index 31e0cfb3e..000000000 --- a/src/devices/zwiftridecontroller/zwiftridecontroller.proto +++ /dev/null @@ -1,114 +0,0 @@ -syntax = "proto2"; - -package org.cagnulen.qdomyoszwift; - -//---------------- Zwift Play messages -enum PlayButtonStatus { -ON = 0; -OFF = 1; -} -// The command code prepending this message is 0x07 -message PlayKeyPadStatus { -optional PlayButtonStatus RightPad = 1; -optional PlayButtonStatus Button_Y_Up = 2; -optional PlayButtonStatus Button_Z_Left = 3; -optional PlayButtonStatus Button_A_Right = 4; -optional PlayButtonStatus Button_B_Down = 5; -optional PlayButtonStatus Button_On = 6; -optional PlayButtonStatus Button_Shift = 7; -optional sint32 Analog_LR = 8; -optional sint32 Analog_UD = 9; -} - -message PlayCommandParameters { -optional uint32 param1 = 1; -optional uint32 param2 = 2; -optional uint32 HapticPattern = 3; -} - -message PlayCommandContents { -optional PlayCommandParameters CommandParameters = 1; -} - -// The command code prepending this message is 0x12 -// This is sent to the control point to configure and make the controller vibrate -message PlayCommand { -optional PlayCommandContents CommandContents = 2; -} - -// The command code prepending this message is 0x19 -// This is sent periodically when there are no button presses -message Idle { -optional uint32 Unknown2 = 2; -} - -//----------------- Zwift Ride messages -enum RideButtonMask { -LEFT_BTN = 0x00001; -UP_BTN = 0x00002; -RIGHT_BTN = 0x00004; -DOWN_BTN = 0x00008; -A_BTN = 0x00010; -B_BTN = 0x00020; -Y_BTN = 0x00040; - -Z_BTN = 0x00100; -SHFT_UP_L_BTN = 0x00200; -SHFT_DN_L_BTN = 0x00400; -POWERUP_L_BTN = 0x00800; -ONOFF_L_BTN = 0x01000; -SHFT_UP_R_BTN = 0x02000; -SHFT_DN_R_BTN = 0x04000; - -POWERUP_R_BTN = 0x10000; -ONOFF_R_BTN = 0x20000; -} - -enum RideAnalogLocation { -LEFT = 0; -RIGHT = 1; -UP = 2; -DOWN = 3; -} - -message RideAnalogKeyPress { -optional RideAnalogLocation Location = 1; -optional sint32 AnalogValue = 2; -} - -message RideAnalogKeyGroup { -repeated RideAnalogKeyPress GroupStatus = 1; -} - -// The command code prepending this message is 0x23 -message RideKeyPadStatus { -optional uint32 ButtonMap = 1; -optional RideAnalogKeyGroup AnalogButtons = 2; -} - -//------------------ Zwift Click messages -// The command code prepending this message is 0x37 -message ClickKeyPadStatus { -optional PlayButtonStatus Button_Plus = 1; -optional PlayButtonStatus Button_Minus = 2; -} - -//------------------ Device Information requested after connection -// The command code prepending this message is 0x3c -message DeviceInformationContent { -repeated uint32 Unknown1 = 2; -optional string DeviceName = 3; -optional string SerialNumber = 6; -optional string HardwareVersion = 7; -optional uint32 Unknown2 = 9; -optional uint32 Unknown3 = 10; -} - -message SubContent { -optional DeviceInformationContent Content = 1; -} - -message DeviceInformation { -optional uint32 Unknown1 = 1; -optional SubContent SubContent = 2; -} \ No newline at end of file diff --git a/src/virtualdevices/virtualbike.cpp b/src/virtualdevices/virtualbike.cpp index a7342877b..ef7a65370 100644 --- a/src/virtualdevices/virtualbike.cpp +++ b/src/virtualdevices/virtualbike.cpp @@ -381,39 +381,6 @@ virtualbike::virtualbike(bluetoothdevice *t, bool noWriteResistance, bool noHear serviceDataChanged.addCharacteristic(charData); } - // zwift ride controller - if(1) { - QBluetoothUuid _syncRxChar(QStringLiteral("00000003-19CA-4651-86E5-FA29DCDD09D1")); - QBluetoothUuid _syncTxChar(QStringLiteral("00000004-19CA-4651-86E5-FA29DCDD09D1")); - QBluetoothUuid _asyncChar(QStringLiteral("00000002-19CA-4651-86E5-FA29DCDD09D1")); - - QLowEnergyCharacteristicData charDataASyncChar; - charDataASyncChar.setUuid(_asyncChar); - charDataASyncChar.setValue(QByteArray(2, 0)); - charDataASyncChar.setProperties(QLowEnergyCharacteristic::Notify); - const QLowEnergyDescriptorData clientConfigAsyncChar(QBluetoothUuid::ClientCharacteristicConfiguration, - QByteArray(2, 0)); - charDataASyncChar.addDescriptor(clientConfigAsyncChar); - - QLowEnergyCharacteristicData charDataSyncTxChar; - charDataASyncChar.setUuid(_syncTxChar); - charDataASyncChar.setValue(QByteArray(1, 0)); - charDataASyncChar.setProperties(QLowEnergyCharacteristic::Indicate); - const QLowEnergyDescriptorData clientConfigSyncTxChar(QBluetoothUuid::ClientCharacteristicConfiguration, - QByteArray(1, 0)); - charDataASyncChar.addDescriptor(clientConfigAsyncChar); - - QLowEnergyCharacteristicData charDataSyncRxChar; - charDataASyncChar.setUuid(_syncRxChar); - charDataASyncChar.setProperties(QLowEnergyCharacteristic::Write | QLowEnergyCharacteristic::WriteNoResponse); - - serviceDataZwiftController.setType(QLowEnergyServiceData::ServiceTypePrimary); - serviceDataZwiftController.setUuid(QBluetoothUuid(QStringLiteral("00000001-19ca-4651-86e5-fa29dcdd09d1"))); - serviceDataZwiftController.addCharacteristic(charDataASyncChar); - serviceDataZwiftController.addCharacteristic(charDataSyncTxChar); - serviceDataZwiftController.addCharacteristic(charDataSyncRxChar); - } - //! [Start Advertising] leController = QLowEnergyController::createPeripheral(); Q_ASSERT(leController); @@ -446,13 +413,6 @@ virtualbike::virtualbike(bluetoothdevice *t, bool noWriteResistance, bool noHear if (!this->noHeartService || heart_only) { serviceHR = leController->addService(serviceDataHR); - QThread::msleep(100); - } - - // zwift ride - if(1) { - serviceZwiftController = leController->addService(serviceDataZwiftController); - QThread::msleep(100); } if (!echelon && !ifit) { @@ -1070,17 +1030,8 @@ void virtualbike::reconnect() { if (battery) serviceBattery = leController->addService(serviceDataBattery); - if (!this->noHeartService || heart_only) { + if (!this->noHeartService || heart_only) serviceHR = leController->addService(serviceDataHR); - QThread::msleep(100); - } - - // zwift ride - if(1) { - serviceZwiftController = leController->addService(serviceDataZwiftController); - QThread::msleep(100); - } - #endif QLowEnergyAdvertisingParameters pars; diff --git a/src/virtualdevices/virtualbike.h b/src/virtualdevices/virtualbike.h index 2e41b765e..05fc1f90b 100644 --- a/src/virtualdevices/virtualbike.h +++ b/src/virtualdevices/virtualbike.h @@ -50,7 +50,6 @@ class virtualbike : public virtualdevice { QLowEnergyService *serviceFIT = nullptr; QLowEnergyService *service = nullptr; QLowEnergyService *serviceChanged = nullptr; - QLowEnergyService *serviceZwiftController = nullptr; QLowEnergyAdvertisingData advertisingData; QLowEnergyServiceData serviceDataHR; QLowEnergyServiceData serviceDataBattery; @@ -58,7 +57,6 @@ class virtualbike : public virtualdevice { QLowEnergyServiceData serviceData; QLowEnergyServiceData serviceDataChanged; QLowEnergyServiceData serviceEchelon; - QLowEnergyServiceData serviceDataZwiftController; QTimer bikeTimer; bluetoothdevice *Bike; CharacteristicWriteProcessor2AD9 *writeP2AD9 = 0;