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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_service_android.h

Issue 1394973003: bluetooth: android: Create BluetoothRemoteGattServiceAndroid objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-renames-
Patch Set: Address ortuno Created 5 years, 2 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
(Empty)
1 // Copyright 2015 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include "base/android/jni_android.h"
13 #include "device/bluetooth/bluetooth_gatt_service.h"
14 #include "device/bluetooth/bluetooth_uuid.h"
15
16 namespace device {
17
18 class BluetoothAdapter;
19 class BluetoothGattCharacteristic;
20
21 class BluetoothAdapterAndroid;
22 class BluetoothDeviceAndroid;
23
24 // The BluetoothRemoteGattServiceAndroid class implements BluetootGattService
25 // for remote GATT services on Android.
26 class BluetoothRemoteGattServiceAndroid : public device::BluetoothGattService {
27 public:
28 // Create a BluetoothRemoteGattServiceAndroid instance and associated Java
29 // ChromeBluetoothRemoteGattService using the provided
30 // |bluetooth_remote_gatt_service_wrapper|.
31 //
32 // The ChromeBluetoothRemoteGattService instance will hold a Java reference
33 // to |bluetooth_remote_gatt_service_wrapper|.
34 //
35 // TODO(scheib): Return a scoped_ptr<>, but then device will need to handle
36 // this correctly. http://crbug.com/506416
37 static BluetoothRemoteGattServiceAndroid* Create(
38 BluetoothAdapterAndroid* adapter,
39 BluetoothDeviceAndroid* device,
40 jobject bluetooth_remote_gatt_service_wrapper, // Java Type:
41 // BluetoothRemoteGattServiceWrapper
42 std::string instanceId);
43
44 // device::BluetoothGattService overrides.
45 std::string GetIdentifier() const override;
46 device::BluetoothUUID GetUUID() const override;
47 bool IsLocal() const override;
48 bool IsPrimary() const override;
49 device::BluetoothDevice* GetDevice() const override;
50 std::vector<device::BluetoothGattCharacteristic*> GetCharacteristics()
51 const override;
52 std::vector<device::BluetoothGattService*> GetIncludedServices()
53 const override;
54 device::BluetoothGattCharacteristic* GetCharacteristic(
55 const std::string& identifier) const override;
56 bool AddCharacteristic(
57 device::BluetoothGattCharacteristic* characteristic) override;
58 bool AddIncludedService(device::BluetoothGattService* service) override;
59 void Register(const base::Closure& callback,
60 const ErrorCallback& error_callback) override;
61 void Unregister(const base::Closure& callback,
62 const ErrorCallback& error_callback) override;
63
64 private:
65 friend class BluetoothDeviceAndroid;
66
67 BluetoothRemoteGattServiceAndroid(BluetoothAdapterAndroid* adapter,
68 BluetoothDeviceAndroid* device,
69 std::string instanceId);
70 ~BluetoothRemoteGattServiceAndroid() override;
71
72 // The adapter associated with this service. It's ok to store a raw pointer
73 // here since |adapter_| indirectly owns this instance.
74 BluetoothAdapterAndroid* adapter_;
75
76 // The device this GATT service belongs to. It's ok to store a raw pointer
77 // here since |device_| owns this instance.
78 BluetoothDeviceAndroid* device_;
79
80 // Instance ID, cached from Android object.
81 std::string instanceId_;
82
83 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceAndroid);
84 };
85
86 } // namespace android
87
88 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_unittest.cc ('k') | device/bluetooth/bluetooth_remote_gatt_service_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698