Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: device/bluetooth/public/interfaces/test/fake_bluetooth.mojom

Issue 2874873003: bluetooth: Implement simulateGATTConnectionResponse() (Closed)
Patch Set: fix Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 module bluetooth.mojom; 5 module bluetooth.mojom;
6 6
7 import "device/bluetooth/public/interfaces/uuid.mojom"; 7 import "device/bluetooth/public/interfaces/uuid.mojom";
8 8
9 // FakeBluetooth and its related interfaces allow clients to control the global 9 // FakeBluetooth and its related interfaces allow clients to control the global
10 // Bluetooth State as well as simulate Bluetooth events including finding new 10 // Bluetooth State as well as simulate Bluetooth events including finding new
(...skipping 12 matching lines...) Expand all
23 // Set it to indicate whether the platform supports BLE. For example, Windows 23 // Set it to indicate whether the platform supports BLE. For example, Windows
24 // 7 is a platform that doesn't support Low Energy. On the other hand Windows 24 // 7 is a platform that doesn't support Low Energy. On the other hand Windows
25 // 10 is a platform that does support LE, even if there is no Bluetooth radio 25 // 10 is a platform that does support LE, even if there is no Bluetooth radio
26 // available. 26 // available.
27 SetLESupported(bool available) => (); 27 SetLESupported(bool available) => ();
28 28
29 // Initializes a fake Central with |state| as the initial state. 29 // Initializes a fake Central with |state| as the initial state.
30 SimulateCentral(CentralState state) => (FakeCentral fake_central); 30 SimulateCentral(CentralState state) => (FakeCentral fake_central);
31 }; 31 };
32 32
33 // HCI Error Codes from BT 4.2 Vol 2 Part D 1.3 List Of Error Codes.
34 const uint16 kHCISuccess = 0x0000;
35 const uint16 kHCIConnectionTimeout = 0x0008;
36
33 // FakeCentral allows clients to simulate events that a device in the 37 // FakeCentral allows clients to simulate events that a device in the
34 // Central/Observer role would receive as well as monitor the operations 38 // Central/Observer role would receive as well as monitor the operations
35 // performed by the device in the Central/Observer role. 39 // performed by the device in the Central/Observer role.
36 // 40 //
37 // A "Central" interface would allow its clients to receive advertising events 41 // A "Central" interface would allow its clients to receive advertising events
38 // and initiate connections to peripherals i.e. operations of two roles 42 // and initiate connections to peripherals i.e. operations of two roles
39 // defined by the Bluetooth Spec: Observer and Central. 43 // defined by the Bluetooth Spec: Observer and Central.
40 // See Bluetooth 4.2 Vol 3 Part C 2.2.2 "Roles when Operating over an 44 // See Bluetooth 4.2 Vol 3 Part C 2.2.2 "Roles when Operating over an
41 // LE Physical Transport". 45 // LE Physical Transport".
42 interface FakeCentral { 46 interface FakeCentral {
43 // Simulates a peripheral with |address|, |name| and |known_service_uuids| 47 // Simulates a peripheral with |address|, |name| and |known_service_uuids|
44 // that has already been connected to the system. If the peripheral existed 48 // that has already been connected to the system. If the peripheral existed
45 // already it updates its name and known UUIDs. 49 // already it updates its name and known UUIDs.
46 // 50 //
47 // Platforms offer methods to retrieve devices that have already been 51 // Platforms offer methods to retrieve devices that have already been
48 // connected to the system or weren't connected through the UA e.g. a user 52 // connected to the system or weren't connected through the UA e.g. a user
49 // connected a peripheral through the system's settings. This method is 53 // connected a peripheral through the system's settings. This method is
50 // intended to simulate peripherals that those methods would return. 54 // intended to simulate peripherals that those methods would return.
55 // Even though these devices are already connected to the OS, clients
56 // need to call the respective connect functions to signal they intend to keep
57 // the connection alive.
51 SimulatePreconnectedPeripheral(string address, 58 SimulatePreconnectedPeripheral(string address,
52 string name, 59 string name,
53 array<UUID> known_service_uuids) => (); 60 array<UUID> known_service_uuids) => ();
61
62 // Sets the next GATT Connection request response for peripheral with
63 // |address| to |code|. |code| could be an HCI Error Code from
64 // BT 4.2 Vol 2 Part D 1.3 List Of Error Codes or a number outside that range
65 // returned by specific platforms e.g. Android returns 0x101 to signal a GATT
66 // failure
67 // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.htm l#GATT_FAILURE
68 // Calls callback with false if there was any error when simulating the next
69 // response.
70 SetNextGATTConnectionResponse(string address, uint16 code) => (bool success);
54 }; 71 };
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_device_chooser_controller.cc ('k') | device/bluetooth/test/fake_central.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698