messages.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:pigeon/pigeon.dart';
  2. class Orientation{
  3. double? x;
  4. double? y;
  5. double? z;
  6. }
  7. class Position{
  8. double? latitude;
  9. double? longitude;
  10. double? altitude;
  11. double? bearing;
  12. double? accuracy;
  13. /// the speed at the time of this location in meters per second.
  14. double? speed;
  15. int? timeMs;
  16. }
  17. class SportWear{
  18. String? address;
  19. String? name;
  20. int? rssi;
  21. int? batteryLevel;
  22. }
  23. class HeartRateMeasurement{
  24. String? deviceMac;
  25. int? heartRate;
  26. bool? contactDetected;
  27. List<int?>? rrIntervals;
  28. int? timestampMill;
  29. }
  30. @HostApi()
  31. abstract class SensorApi {
  32. /// 获取当前位置,[force]为 false 时,
  33. /// 优先使用 lastPosition,为 true 强制重新获取当前位置。
  34. @async
  35. Position getCurrentPosition(bool force);
  36. void locationStart(int minTimeMs, double minDistanceM);
  37. void locationStop();
  38. void sportWearScanStart();
  39. void sportWearScanStop();
  40. @async
  41. bool askEnableBluetooth();
  42. @async
  43. void sportWearConnect(SportWear wear);
  44. @async
  45. void sportWearDisconnect(SportWear wear);
  46. /// 是否开启位置服务
  47. bool isLocationServiceOpen();
  48. double getYDPI();
  49. double getXDPI();
  50. /// 只需要空实现即可,class必须有函数引用才会生成代码
  51. void toGenAllClass(
  52. Orientation orientation,
  53. HeartRateMeasurement hrm,
  54. Position position,
  55. );
  56. }