// Autogenerated from Pigeon (v9.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; class Orientation { Orientation({ this.x, this.y, this.z, }); double? x; double? y; double? z; Object encode() { return [ x, y, z, ]; } static Orientation decode(Object result) { result as List; return Orientation( x: result[0] as double?, y: result[1] as double?, z: result[2] as double?, ); } } class Position { Position({ this.latitude, this.longitude, this.altitude, this.bearing, this.accuracy, this.speed, this.timeMs, }); double? latitude; double? longitude; double? altitude; double? bearing; double? accuracy; /// the speed at the time of this location in meters per second. double? speed; int? timeMs; Object encode() { return [ latitude, longitude, altitude, bearing, accuracy, speed, timeMs, ]; } static Position decode(Object result) { result as List; return Position( latitude: result[0] as double?, longitude: result[1] as double?, altitude: result[2] as double?, bearing: result[3] as double?, accuracy: result[4] as double?, speed: result[5] as double?, timeMs: result[6] as int?, ); } } class SportWear { SportWear({ this.address, this.name, this.rssi, this.batteryLevel, }); String? address; String? name; int? rssi; int? batteryLevel; Object encode() { return [ address, name, rssi, batteryLevel, ]; } static SportWear decode(Object result) { result as List; return SportWear( address: result[0] as String?, name: result[1] as String?, rssi: result[2] as int?, batteryLevel: result[3] as int?, ); } } class HeartRateMeasurement { HeartRateMeasurement({ this.deviceMac, this.heartRate, this.contactDetected, this.rrIntervals, this.timestampMill, }); String? deviceMac; int? heartRate; bool? contactDetected; List? rrIntervals; int? timestampMill; Object encode() { return [ deviceMac, heartRate, contactDetected, rrIntervals, timestampMill, ]; } static HeartRateMeasurement decode(Object result) { result as List; return HeartRateMeasurement( deviceMac: result[0] as String?, heartRate: result[1] as int?, contactDetected: result[2] as bool?, rrIntervals: (result[3] as List?)?.cast(), timestampMill: result[4] as int?, ); } } class _SensorApiCodec extends StandardMessageCodec { const _SensorApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { if (value is HeartRateMeasurement) { buffer.putUint8(128); writeValue(buffer, value.encode()); } else if (value is Orientation) { buffer.putUint8(129); writeValue(buffer, value.encode()); } else if (value is Position) { buffer.putUint8(130); writeValue(buffer, value.encode()); } else if (value is SportWear) { buffer.putUint8(131); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } } @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: return HeartRateMeasurement.decode(readValue(buffer)!); case 129: return Orientation.decode(readValue(buffer)!); case 130: return Position.decode(readValue(buffer)!); case 131: return SportWear.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } } } class SensorApi { /// Constructor for [SensorApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. SensorApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _SensorApiCodec(); /// 获取当前位置,[force]为 false 时, /// 优先使用 lastPosition,为 true 强制重新获取当前位置。 Future getCurrentPosition(bool arg_force) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.getCurrentPosition', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_force]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as Position?)!; } } Future locationStart(int arg_minTimeMs, double arg_minDistanceM) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.locationStart', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_minTimeMs, arg_minDistanceM]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } Future locationStop() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.locationStop', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } Future sportWearScanStart() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.sportWearScanStart', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } Future sportWearScanStop() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.sportWearScanStop', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } Future askEnableBluetooth() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.askEnableBluetooth', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as bool?)!; } } Future sportWearConnect(SportWear arg_wear) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.sportWearConnect', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_wear]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } Future sportWearDisconnect(SportWear arg_wear) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.sportWearDisconnect', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_wear]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } /// 是否开启位置服务 Future isLocationServiceOpen() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.isLocationServiceOpen', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as bool?)!; } } Future getYDPI() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.getYDPI', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as double?)!; } } Future getXDPI() async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.getXDPI', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else if (replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { return (replyList[0] as double?)!; } } /// 只需要空实现即可,class必须有函数引用才会生成代码 Future toGenAllClass(Orientation arg_orientation, HeartRateMeasurement arg_hrm, Position arg_position) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.SensorApi.toGenAllClass', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_orientation, arg_hrm, arg_position]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); } else if (replyList.length > 1) { throw PlatformException( code: replyList[0]! as String, message: replyList[1] as String?, details: replyList[2], ); } else { return; } } }