mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-02-18 00:17:40 +01:00
Merge branch 'main' into feature/openbikecontrol
# Conflicts: # lib/pages/device.dart # lib/widgets/logviewer.dart
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:swift_control/bluetooth/ble.dart';
|
||||
import 'package:swift_control/bluetooth/devices/base_device.dart';
|
||||
import 'package:swift_control/bluetooth/devices/openbikecontrol/openbikecontrol_device.dart';
|
||||
import 'package:swift_control/bluetooth/devices/shimano/shimano_di2.dart';
|
||||
import 'package:swift_control/bluetooth/devices/wahoo/wahoo_kickr_bike_pro.dart';
|
||||
import 'package:swift_control/bluetooth/devices/wahoo/wahoo_kickr_bike_shift.dart';
|
||||
import 'package:swift_control/bluetooth/devices/zwift/constants.dart';
|
||||
import 'package:swift_control/bluetooth/devices/zwift/zwift_click.dart';
|
||||
@@ -61,6 +62,7 @@ abstract class BluetoothDevice extends BaseDevice {
|
||||
null => null,
|
||||
_ when scanResult.name!.toUpperCase().startsWith('STERZO') => EliteSterzo(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().startsWith('KICKR BIKE SHIFT') => WahooKickrBikeShift(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().startsWith('KICKR BIKE PRO') => WahooKickrBikePro(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().startsWith('CYCPLUS') && scanResult.name!.toUpperCase().contains('BC2') =>
|
||||
CycplusBc2(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().startsWith('RDR') => ShimanoDi2(scanResult),
|
||||
@@ -76,6 +78,7 @@ abstract class BluetoothDevice extends BaseDevice {
|
||||
_ when scanResult.name!.toUpperCase().startsWith('SQUARE') => EliteSquare(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().startsWith('STERZO') => EliteSterzo(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().contains('KICKR BIKE SHIFT') => WahooKickrBikeShift(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().startsWith('KICKR BIKE PRO') => WahooKickrBikePro(scanResult),
|
||||
_ when scanResult.name!.toUpperCase().startsWith('CYCPLUS') && scanResult.name!.toUpperCase().contains('BC2') =>
|
||||
CycplusBc2(scanResult),
|
||||
_ when scanResult.services.contains(CycplusBc2Constants.SERVICE_UUID.toLowerCase()) => CycplusBc2(scanResult),
|
||||
|
||||
10
lib/bluetooth/devices/wahoo/wahoo_kickr_bike_pro.dart
Normal file
10
lib/bluetooth/devices/wahoo/wahoo_kickr_bike_pro.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:swift_control/bluetooth/devices/zwift/zwift_ride.dart';
|
||||
|
||||
import '../zwift/constants.dart';
|
||||
|
||||
class WahooKickrBikePro extends ZwiftRide {
|
||||
WahooKickrBikePro(super.scanResult) : super();
|
||||
|
||||
@override
|
||||
String get customServiceId => ZwiftConstants.ZWIFT_CUSTOM_SERVICE_UUID;
|
||||
}
|
||||
@@ -81,8 +81,10 @@ abstract class ZwiftDevice extends BluetoothDevice {
|
||||
@override
|
||||
Future<void> processCharacteristic(String characteristic, Uint8List bytes) async {
|
||||
if (kDebugMode) {
|
||||
print(
|
||||
"${DateTime.now().toString().split(" ").last} Received data on $characteristic: ${bytes.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')}",
|
||||
actionStreamInternal.add(
|
||||
LogNotification(
|
||||
"${DateTime.now().toString().split(" ").last} Received data on $characteristic: ${bytes.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')}",
|
||||
),
|
||||
);
|
||||
}
|
||||
if (bytes.isEmpty) {
|
||||
|
||||
@@ -21,14 +21,16 @@ void main() async {
|
||||
// setup crash reporting
|
||||
|
||||
// Catch errors that happen in other isolates
|
||||
Isolate.current.addErrorListener(
|
||||
RawReceivePort((dynamic pair) {
|
||||
final List<dynamic> errorAndStack = pair as List<dynamic>;
|
||||
final error = errorAndStack.first;
|
||||
final stack = errorAndStack.last as StackTrace?;
|
||||
_recordError(error, stack, context: 'Isolate');
|
||||
}).sendPort,
|
||||
);
|
||||
if (!kIsWeb) {
|
||||
Isolate.current.addErrorListener(
|
||||
RawReceivePort((dynamic pair) {
|
||||
final List<dynamic> errorAndStack = pair as List<dynamic>;
|
||||
final error = errorAndStack.first;
|
||||
final stack = errorAndStack.last as StackTrace?;
|
||||
_recordError(error, stack, context: 'Isolate');
|
||||
}).sendPort,
|
||||
);
|
||||
}
|
||||
|
||||
runZonedGuarded<Future<void>>(
|
||||
() async {
|
||||
|
||||
Reference in New Issue
Block a user