wear_engine_api.dart 2.16 KB
import 'package:pigeon/pigeon.dart';

class WearDeviceInfo {
  WearDeviceInfo({
    this.deviceId,
    this.deviceName,
    this.isPaired,
    this.isReachable,
    this.isWatchAppInstalled,
  });

  String? deviceId;
  String? deviceName;
  bool? isPaired;
  bool? isReachable;
  bool? isWatchAppInstalled;
}

class WatchTransformTheme {
  WatchTransformTheme({
    required this.themeId,
    required this.themeName,
    required this.energeticDescription,
    this.energeticImage,
    required this.normalDescription,
    this.normalImage,
    required this.slightStressfulDescription,
    this.slightStressfulImage,
    required this.stressfulDescription,
    this.stressfulImage,
  });

  int themeId;
  final String themeName;
  final String energeticDescription;
  final Uint8List? energeticImage;
  final String normalDescription;
  final Uint8List? normalImage;
  final String slightStressfulDescription;
  final Uint8List? slightStressfulImage;
  final String stressfulDescription;
  final Uint8List? stressfulImage;
}

@ConfigurePigeon(
  PigeonOptions(
    dartOut: 'lib/pigeon/wear_engine_api.g.dart',
    dartPackageName: 'doublefeel_flutter',
    dartOptions: DartOptions(),
    kotlinOut:
        'android/app/src/main/kotlin/com/doublefeel/app/pigeon/WearEngineApi.kt',
    kotlinOptions: KotlinOptions(
      package: 'com.doublefeel.app.pigeon.wear',
    ),
    swiftOut: 'ios/Runner/Pigeon/WearEngineApi.swift',
    swiftOptions: SwiftOptions(),
    arkTSOut: 'ohos/entry/src/main/ets/pigeon/WearEngineApi.ets',
    copyrightHeader: 'pigeon/copyright.txt',
  ),
)
@HostApi()
abstract class WearEngineHostApi {
  bool hasAvailableDevices();

  @async
  WearDeviceInfo? checkConnectedDevice();

  bool registerMessageReceiver();

  bool sendTextMessage(String message);

  /// 添加表盘
  @async
  bool addWatchSurface();

/// 添加或者删除主题
  @async
  bool syncWatchTheme(WatchTransformTheme? theme);

  /// Opens the system photo picker and returns a local PNG file path after
  /// removing the image background on the host platform.
  @async
  String? removeBackground(String originImagePath);

  /// 是否有已安装的表盘
  @async
  bool hasInstalledWatchSurface();
}