| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476 |
- // Autogenerated from Pigeon (v9.1.0), do not edit directly.
- // See also: https://pub.dev/packages/pigeon
- #import "messages.h"
- #import <Flutter/Flutter.h>
- #if !__has_feature(objc_arc)
- #error File requires ARC to be enabled.
- #endif
- static NSArray *wrapResult(id result, FlutterError *error) {
- if (error) {
- return @[
- error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null]
- ];
- }
- return @[ result ?: [NSNull null] ];
- }
- static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
- id result = array[key];
- return (result == [NSNull null]) ? nil : result;
- }
- @interface FLTOrientation ()
- + (FLTOrientation *)fromList:(NSArray *)list;
- + (nullable FLTOrientation *)nullableFromList:(NSArray *)list;
- - (NSArray *)toList;
- @end
- @interface FLTPosition ()
- + (FLTPosition *)fromList:(NSArray *)list;
- + (nullable FLTPosition *)nullableFromList:(NSArray *)list;
- - (NSArray *)toList;
- @end
- @interface FLTSportWear ()
- + (FLTSportWear *)fromList:(NSArray *)list;
- + (nullable FLTSportWear *)nullableFromList:(NSArray *)list;
- - (NSArray *)toList;
- @end
- @interface FLTHeartRateMeasurement ()
- + (FLTHeartRateMeasurement *)fromList:(NSArray *)list;
- + (nullable FLTHeartRateMeasurement *)nullableFromList:(NSArray *)list;
- - (NSArray *)toList;
- @end
- @implementation FLTOrientation
- + (instancetype)makeWithX:(nullable NSNumber *)x
- y:(nullable NSNumber *)y
- z:(nullable NSNumber *)z {
- FLTOrientation* pigeonResult = [[FLTOrientation alloc] init];
- pigeonResult.x = x;
- pigeonResult.y = y;
- pigeonResult.z = z;
- return pigeonResult;
- }
- + (FLTOrientation *)fromList:(NSArray *)list {
- FLTOrientation *pigeonResult = [[FLTOrientation alloc] init];
- pigeonResult.x = GetNullableObjectAtIndex(list, 0);
- pigeonResult.y = GetNullableObjectAtIndex(list, 1);
- pigeonResult.z = GetNullableObjectAtIndex(list, 2);
- return pigeonResult;
- }
- + (nullable FLTOrientation *)nullableFromList:(NSArray *)list {
- return (list) ? [FLTOrientation fromList:list] : nil;
- }
- - (NSArray *)toList {
- return @[
- (self.x ?: [NSNull null]),
- (self.y ?: [NSNull null]),
- (self.z ?: [NSNull null]),
- ];
- }
- @end
- @implementation FLTPosition
- + (instancetype)makeWithLatitude:(nullable NSNumber *)latitude
- longitude:(nullable NSNumber *)longitude
- altitude:(nullable NSNumber *)altitude
- bearing:(nullable NSNumber *)bearing
- accuracy:(nullable NSNumber *)accuracy
- speed:(nullable NSNumber *)speed
- timeMs:(nullable NSNumber *)timeMs {
- FLTPosition* pigeonResult = [[FLTPosition alloc] init];
- pigeonResult.latitude = latitude;
- pigeonResult.longitude = longitude;
- pigeonResult.altitude = altitude;
- pigeonResult.bearing = bearing;
- pigeonResult.accuracy = accuracy;
- pigeonResult.speed = speed;
- pigeonResult.timeMs = timeMs;
- return pigeonResult;
- }
- + (FLTPosition *)fromList:(NSArray *)list {
- FLTPosition *pigeonResult = [[FLTPosition alloc] init];
- pigeonResult.latitude = GetNullableObjectAtIndex(list, 0);
- pigeonResult.longitude = GetNullableObjectAtIndex(list, 1);
- pigeonResult.altitude = GetNullableObjectAtIndex(list, 2);
- pigeonResult.bearing = GetNullableObjectAtIndex(list, 3);
- pigeonResult.accuracy = GetNullableObjectAtIndex(list, 4);
- pigeonResult.speed = GetNullableObjectAtIndex(list, 5);
- pigeonResult.timeMs = GetNullableObjectAtIndex(list, 6);
- return pigeonResult;
- }
- + (nullable FLTPosition *)nullableFromList:(NSArray *)list {
- return (list) ? [FLTPosition fromList:list] : nil;
- }
- - (NSArray *)toList {
- return @[
- (self.latitude ?: [NSNull null]),
- (self.longitude ?: [NSNull null]),
- (self.altitude ?: [NSNull null]),
- (self.bearing ?: [NSNull null]),
- (self.accuracy ?: [NSNull null]),
- (self.speed ?: [NSNull null]),
- (self.timeMs ?: [NSNull null]),
- ];
- }
- @end
- @implementation FLTSportWear
- + (instancetype)makeWithAddress:(nullable NSString *)address
- name:(nullable NSString *)name
- rssi:(nullable NSNumber *)rssi
- batteryLevel:(nullable NSNumber *)batteryLevel {
- FLTSportWear* pigeonResult = [[FLTSportWear alloc] init];
- pigeonResult.address = address;
- pigeonResult.name = name;
- pigeonResult.rssi = rssi;
- pigeonResult.batteryLevel = batteryLevel;
- return pigeonResult;
- }
- + (FLTSportWear *)fromList:(NSArray *)list {
- FLTSportWear *pigeonResult = [[FLTSportWear alloc] init];
- pigeonResult.address = GetNullableObjectAtIndex(list, 0);
- pigeonResult.name = GetNullableObjectAtIndex(list, 1);
- pigeonResult.rssi = GetNullableObjectAtIndex(list, 2);
- pigeonResult.batteryLevel = GetNullableObjectAtIndex(list, 3);
- return pigeonResult;
- }
- + (nullable FLTSportWear *)nullableFromList:(NSArray *)list {
- return (list) ? [FLTSportWear fromList:list] : nil;
- }
- - (NSArray *)toList {
- return @[
- (self.address ?: [NSNull null]),
- (self.name ?: [NSNull null]),
- (self.rssi ?: [NSNull null]),
- (self.batteryLevel ?: [NSNull null]),
- ];
- }
- @end
- @implementation FLTHeartRateMeasurement
- + (instancetype)makeWithDeviceMac:(nullable NSString *)deviceMac
- heartRate:(nullable NSNumber *)heartRate
- contactDetected:(nullable NSNumber *)contactDetected
- rrIntervals:(nullable NSArray<NSNumber *> *)rrIntervals
- timestampMill:(nullable NSNumber *)timestampMill {
- FLTHeartRateMeasurement* pigeonResult = [[FLTHeartRateMeasurement alloc] init];
- pigeonResult.deviceMac = deviceMac;
- pigeonResult.heartRate = heartRate;
- pigeonResult.contactDetected = contactDetected;
- pigeonResult.rrIntervals = rrIntervals;
- pigeonResult.timestampMill = timestampMill;
- return pigeonResult;
- }
- + (FLTHeartRateMeasurement *)fromList:(NSArray *)list {
- FLTHeartRateMeasurement *pigeonResult = [[FLTHeartRateMeasurement alloc] init];
- pigeonResult.deviceMac = GetNullableObjectAtIndex(list, 0);
- pigeonResult.heartRate = GetNullableObjectAtIndex(list, 1);
- pigeonResult.contactDetected = GetNullableObjectAtIndex(list, 2);
- pigeonResult.rrIntervals = GetNullableObjectAtIndex(list, 3);
- pigeonResult.timestampMill = GetNullableObjectAtIndex(list, 4);
- return pigeonResult;
- }
- + (nullable FLTHeartRateMeasurement *)nullableFromList:(NSArray *)list {
- return (list) ? [FLTHeartRateMeasurement fromList:list] : nil;
- }
- - (NSArray *)toList {
- return @[
- (self.deviceMac ?: [NSNull null]),
- (self.heartRate ?: [NSNull null]),
- (self.contactDetected ?: [NSNull null]),
- (self.rrIntervals ?: [NSNull null]),
- (self.timestampMill ?: [NSNull null]),
- ];
- }
- @end
- @interface FLTSensorApiCodecReader : FlutterStandardReader
- @end
- @implementation FLTSensorApiCodecReader
- - (nullable id)readValueOfType:(UInt8)type {
- switch (type) {
- case 128:
- return [FLTHeartRateMeasurement fromList:[self readValue]];
- case 129:
- return [FLTOrientation fromList:[self readValue]];
- case 130:
- return [FLTPosition fromList:[self readValue]];
- case 131:
- return [FLTSportWear fromList:[self readValue]];
- default:
- return [super readValueOfType:type];
- }
- }
- @end
- @interface FLTSensorApiCodecWriter : FlutterStandardWriter
- @end
- @implementation FLTSensorApiCodecWriter
- - (void)writeValue:(id)value {
- if ([value isKindOfClass:[FLTHeartRateMeasurement class]]) {
- [self writeByte:128];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FLTOrientation class]]) {
- [self writeByte:129];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FLTPosition class]]) {
- [self writeByte:130];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FLTSportWear class]]) {
- [self writeByte:131];
- [self writeValue:[value toList]];
- } else {
- [super writeValue:value];
- }
- }
- @end
- @interface FLTSensorApiCodecReaderWriter : FlutterStandardReaderWriter
- @end
- @implementation FLTSensorApiCodecReaderWriter
- - (FlutterStandardWriter *)writerWithData:(NSMutableData *)data {
- return [[FLTSensorApiCodecWriter alloc] initWithData:data];
- }
- - (FlutterStandardReader *)readerWithData:(NSData *)data {
- return [[FLTSensorApiCodecReader alloc] initWithData:data];
- }
- @end
- NSObject<FlutterMessageCodec> *FLTSensorApiGetCodec() {
- static FlutterStandardMessageCodec *sSharedObject = nil;
- static dispatch_once_t sPred = 0;
- dispatch_once(&sPred, ^{
- FLTSensorApiCodecReaderWriter *readerWriter = [[FLTSensorApiCodecReaderWriter alloc] init];
- sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter];
- });
- return sSharedObject;
- }
- void FLTSensorApiSetup(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTSensorApi> *api) {
- /// 获取当前位置,[force]为 false 时,
- /// 优先使用 lastPosition,为 true 强制重新获取当前位置。
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.getCurrentPosition"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(getCurrentPositionForce:completion:)], @"FLTSensorApi api (%@) doesn't respond to @selector(getCurrentPositionForce:completion:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- NSArray *args = message;
- NSNumber *arg_force = GetNullableObjectAtIndex(args, 0);
- [api getCurrentPositionForce:arg_force completion:^(FLTPosition *_Nullable output, FlutterError *_Nullable error) {
- callback(wrapResult(output, error));
- }];
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.locationStart"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(locationStartMinTimeMs:minDistanceM:error:)], @"FLTSensorApi api (%@) doesn't respond to @selector(locationStartMinTimeMs:minDistanceM:error:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- NSArray *args = message;
- NSNumber *arg_minTimeMs = GetNullableObjectAtIndex(args, 0);
- NSNumber *arg_minDistanceM = GetNullableObjectAtIndex(args, 1);
- FlutterError *error;
- [api locationStartMinTimeMs:arg_minTimeMs minDistanceM:arg_minDistanceM error:&error];
- callback(wrapResult(nil, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.locationStop"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(locationStopWithError:)], @"FLTSensorApi api (%@) doesn't respond to @selector(locationStopWithError:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- FlutterError *error;
- [api locationStopWithError:&error];
- callback(wrapResult(nil, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.sportWearScanStart"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(sportWearScanStartWithError:)], @"FLTSensorApi api (%@) doesn't respond to @selector(sportWearScanStartWithError:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- FlutterError *error;
- [api sportWearScanStartWithError:&error];
- callback(wrapResult(nil, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.sportWearScanStop"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(sportWearScanStopWithError:)], @"FLTSensorApi api (%@) doesn't respond to @selector(sportWearScanStopWithError:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- FlutterError *error;
- [api sportWearScanStopWithError:&error];
- callback(wrapResult(nil, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.askEnableBluetooth"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(askEnableBluetoothWithCompletion:)], @"FLTSensorApi api (%@) doesn't respond to @selector(askEnableBluetoothWithCompletion:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- [api askEnableBluetoothWithCompletion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) {
- callback(wrapResult(output, error));
- }];
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.sportWearConnect"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(sportWearConnectWear:completion:)], @"FLTSensorApi api (%@) doesn't respond to @selector(sportWearConnectWear:completion:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- NSArray *args = message;
- FLTSportWear *arg_wear = GetNullableObjectAtIndex(args, 0);
- [api sportWearConnectWear:arg_wear completion:^(FlutterError *_Nullable error) {
- callback(wrapResult(nil, error));
- }];
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.sportWearDisconnect"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(sportWearDisconnectWear:completion:)], @"FLTSensorApi api (%@) doesn't respond to @selector(sportWearDisconnectWear:completion:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- NSArray *args = message;
- FLTSportWear *arg_wear = GetNullableObjectAtIndex(args, 0);
- [api sportWearDisconnectWear:arg_wear completion:^(FlutterError *_Nullable error) {
- callback(wrapResult(nil, error));
- }];
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- /// 是否开启位置服务
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.isLocationServiceOpen"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(isLocationServiceOpenWithError:)], @"FLTSensorApi api (%@) doesn't respond to @selector(isLocationServiceOpenWithError:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- FlutterError *error;
- NSNumber *output = [api isLocationServiceOpenWithError:&error];
- callback(wrapResult(output, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.getYDPI"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(getYDPIWithError:)], @"FLTSensorApi api (%@) doesn't respond to @selector(getYDPIWithError:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- FlutterError *error;
- NSNumber *output = [api getYDPIWithError:&error];
- callback(wrapResult(output, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.getXDPI"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(getXDPIWithError:)], @"FLTSensorApi api (%@) doesn't respond to @selector(getXDPIWithError:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- FlutterError *error;
- NSNumber *output = [api getXDPIWithError:&error];
- callback(wrapResult(output, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- /// 只需要空实现即可,class必须有函数引用才会生成代码
- {
- FlutterBasicMessageChannel *channel =
- [[FlutterBasicMessageChannel alloc]
- initWithName:@"dev.flutter.pigeon.SensorApi.toGenAllClass"
- binaryMessenger:binaryMessenger
- codec:FLTSensorApiGetCodec()];
- if (api) {
- NSCAssert([api respondsToSelector:@selector(toGenAllClassOrientation:hrm:position:error:)], @"FLTSensorApi api (%@) doesn't respond to @selector(toGenAllClassOrientation:hrm:position:error:)", api);
- [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
- NSArray *args = message;
- FLTOrientation *arg_orientation = GetNullableObjectAtIndex(args, 0);
- FLTHeartRateMeasurement *arg_hrm = GetNullableObjectAtIndex(args, 1);
- FLTPosition *arg_position = GetNullableObjectAtIndex(args, 2);
- FlutterError *error;
- [api toGenAllClassOrientation:arg_orientation hrm:arg_hrm position:arg_position error:&error];
- callback(wrapResult(nil, error));
- }];
- } else {
- [channel setMessageHandler:nil];
- }
- }
- }
|