-
Notifications
You must be signed in to change notification settings - Fork 4
/
schema.dart
93 lines (80 loc) · 1.56 KB
/
schema.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import 'package:pigeon/pigeon.dart';
/// Higher priority drains battery but receives more data
enum ScanPriority {
High,
Low,
}
/// ODID Message Source
enum MessageSource {
BluetoothLegacy,
BluetoothLongRange,
WifiNan,
WifiBeacon,
Unknown,
}
/// State of the Bluetooth adapter
enum BluetoothState {
Unknown,
Resetting,
Unsupported,
Unauthorized,
PoweredOff,
PoweredOn,
}
/// State of the Wifi adapter
enum WifiState {
Disabling,
Disabled,
Enabling,
Enabled,
}
/// Payload send from native to dart contains raw data and metadata
class ODIDPayload {
final Uint8List rawData;
final int receivedTimestamp;
final String macAddress;
final int? rssi;
final MessageSource source;
final String? btName;
ODIDPayload(
this.rawData,
this.receivedTimestamp,
this.macAddress,
this.rssi,
this.source,
this.btName,
);
}
@HostApi()
abstract class Api {
@async
void startScanBluetooth();
@async
void startScanWifi();
@async
void stopScanBluetooth();
@async
void stopScanWifi();
@async
void setBtScanPriority(ScanPriority priority);
@async
bool isScanningBluetooth();
@async
bool isScanningWifi();
@async
int bluetoothState();
@async
int wifiState();
@async
bool btExtendedSupported();
@async
int btMaxAdvDataLen();
@async
bool wifiNaNSupported();
}
// ODIDPayload is not generated until used in API
@HostApi()
abstract class PayloadApi {
ODIDPayload buildPayload(Uint8List rawData, MessageSource source,
String macAddress, String? btName, int rssi, int receivedTimestamp);
}