OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 module bluetooth.mojom; |
| 6 |
| 7 enum FakeLECentralManagerState { |
| 8 ABSENT, |
| 9 POWERED_ON, |
| 10 POWERED_OFF, |
| 11 }; |
| 12 |
| 13 struct FakeLECentralManagerOptions { |
| 14 FakeLECentralManagerState state; |
| 15 }; |
| 16 |
| 17 interface FakeBluetooth { |
| 18 SetLEAvailability(bool available) => (); |
| 19 SimulateLECentralManager(FakeLECentralManagerOptions options) => (FakeLECentra
lManager central_manager); |
| 20 }; |
| 21 |
| 22 struct Appearance { |
| 23 bool has_value; |
| 24 uint8 value; |
| 25 }; |
| 26 |
| 27 struct Power { |
| 28 bool has_value; |
| 29 int8 value; |
| 30 }; |
| 31 |
| 32 struct ScanResult { |
| 33 string device_address; |
| 34 uint8 rssi; |
| 35 ScanRecord scanRecord; |
| 36 }; |
| 37 |
| 38 struct ScanRecord { |
| 39 string? name; |
| 40 array<string>? uuids; |
| 41 Appearance appearance; |
| 42 Power txPower; |
| 43 |
| 44 map<uint8, array<uint8>> manufacturer_data; |
| 45 map<string, array<uint8>> service_data; |
| 46 }; |
| 47 |
| 48 struct FakeLEPeripheralOptions { |
| 49 string address; |
| 50 string name; |
| 51 }; |
| 52 |
| 53 interface FakeLECentralManager { |
| 54 SimulateAdvertisementReceived(ScanResult result) => (FakeLEPeripheral? periphe
ral); |
| 55 |
| 56 AddConnectedLEPeripheral(FakeLEPeripheralOptions options) => (FakeLEPeripheral
? peripheral); |
| 57 |
| 58 |
| 59 SetState(FakeLECentralManagerState state) => (); |
| 60 GetStartScanCalls() => (uint64 calls); |
| 61 GetStopScanCalls() => (uint64 calls); |
| 62 }; |
| 63 |
| 64 // TODO: Add more connection errors. |
| 65 enum GATTConnectionResult { |
| 66 TIMEOUT, |
| 67 }; |
| 68 |
| 69 struct FakeRemoteGATTServiceOptions { |
| 70 string uuid; |
| 71 }; |
| 72 |
| 73 interface FakeLEPeripheral { |
| 74 SimulateGATTConnection(GATTConnectionResult result) => (); |
| 75 SimulateGATTDiscoveryComplete() => (); |
| 76 SimulateGATTServicesChanged() => (); |
| 77 |
| 78 AddFakeService(FakeRemoteGATTServiceOptions options) => (FakeRemoteGATTService
? fake_service); |
| 79 |
| 80 GetConnectCalls() => (uint64 calls); |
| 81 GetDisconnectCalls() => (uint64 calls); |
| 82 }; |
| 83 |
| 84 struct FakeRemoteGATTCharacteristicOptions { |
| 85 string uuid; |
| 86 int32 permissions; |
| 87 }; |
| 88 |
| 89 interface FakeRemoteGATTService { |
| 90 AddFakeCharacteristic(FakeRemoteGATTCharacteristicOptions options) => (FakeRem
oteGATTCharacteristic? characteristic); |
| 91 AddFakeIncludedService(FakeRemoteGATTServiceOptions options) => (FakeRemoteGAT
TService? service); |
| 92 }; |
| 93 |
| 94 struct FakeRemoteGATTDescriptorOptions { |
| 95 string uuid; |
| 96 }; |
| 97 |
| 98 enum GATTOperationResult { |
| 99 SUCCESS, |
| 100 FAILED, |
| 101 }; |
| 102 |
| 103 enum NotificationType { |
| 104 INDICATION, |
| 105 NOTIFICATION, |
| 106 }; |
| 107 |
| 108 struct FakeNotificationOptions { |
| 109 NotificationType type; |
| 110 array<uint8> value; |
| 111 }; |
| 112 |
| 113 interface FakeRemoteGATTCharacteristic { |
| 114 SimulateRead(GATTOperationResult result, array<uint8>? value) => (); |
| 115 SimulateWrite(GATTOperationResult result) => (array<uint8> value); |
| 116 SimulateNotificationsStarted(GATTOperationResult result) => (); |
| 117 SimulateNotificationsStopped(GATTOperationResult result) => (); |
| 118 SimulateNotification(FakeNotificationOptions options) => (); |
| 119 |
| 120 AddFakeDescriptor(FakeRemoteGATTDescriptorOptions options) => (FakeRemoteGATTD
escriptor? descriptor); |
| 121 |
| 122 GetReadCalls() => (uint64 calls); |
| 123 GetWriteCalls() => (uint64 calls); |
| 124 GetStartNotificationsCalls() => (uint64 calls); |
| 125 GetStopNotificationsCalls() => (uint64 calls); |
| 126 }; |
| 127 |
| 128 interface FakeRemoteGATTDescriptor { |
| 129 SimulateRead(GATTOperationResult result, array<uint8>? value) => (); |
| 130 SimulateWrite(GATTOperationResult result) => (array<uint8> value); |
| 131 }; |
OLD | NEW |