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

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

Issue 1898643002: Refactor device::BluetoothGattXXX classes to split into remote/local. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "device/bluetooth/bluetooth_gatt_descriptor.h" 12 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
13 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h"
13 14
14 namespace device { 15 namespace device {
15 16
16 // BluetoothRemoteGattDescriptorAndroid along with its owned Java class 17 // BluetoothRemoteGattDescriptorAndroid along with its owned Java class
17 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor 18 // org.chromium.device.bluetooth.ChromeBluetoothRemoteGattDescriptor
18 // implement BluetootGattDescriptor. 19 // implement BluetootGattDescriptor.
19 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorAndroid 20 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattDescriptorAndroid
20 : public BluetoothGattDescriptor { 21 : public BluetoothRemoteGattDescriptor {
21 public: 22 public:
22 // Create a BluetoothRemoteGattDescriptorAndroid instance and associated 23 // Create a BluetoothRemoteGattDescriptorAndroid instance and associated
23 // Java ChromeBluetoothRemoteGattDescriptor using the provided 24 // Java ChromeBluetoothRemoteGattDescriptor using the provided
24 // |bluetooth_gatt_descriptor_wrapper|. 25 // |bluetooth_gatt_descriptor_wrapper|.
25 // 26 //
26 // The ChromeBluetoothRemoteGattDescriptor instance will hold a Java 27 // The ChromeBluetoothRemoteGattDescriptor instance will hold a Java
27 // reference to |bluetooth_gatt_descriptor_wrapper|. 28 // reference to |bluetooth_gatt_descriptor_wrapper|.
28 static std::unique_ptr<BluetoothRemoteGattDescriptorAndroid> Create( 29 static std::unique_ptr<BluetoothRemoteGattDescriptorAndroid> Create(
29 const std::string& instanceId, 30 const std::string& instanceId,
30 jobject /* BluetoothGattDescriptorWrapper */ 31 jobject /* BluetoothGattDescriptorWrapper */
31 bluetooth_gatt_descriptor_wrapper, 32 bluetooth_gatt_descriptor_wrapper,
32 jobject /* chromeBluetoothDevice */ chrome_bluetooth_device); 33 jobject /* chromeBluetoothDevice */ chrome_bluetooth_device);
33 34
34 ~BluetoothRemoteGattDescriptorAndroid() override; 35 ~BluetoothRemoteGattDescriptorAndroid() override;
35 36
36 // Register C++ methods exposed to Java using JNI. 37 // Register C++ methods exposed to Java using JNI.
37 static bool RegisterJNI(JNIEnv* env); 38 static bool RegisterJNI(JNIEnv* env);
38 39
39 // Returns the associated ChromeBluetoothRemoteGattDescriptor Java object. 40 // Returns the associated ChromeBluetoothRemoteGattDescriptor Java object.
40 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); 41 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
41 42
42 // BluetoothGattDescriptor interface: 43 // BluetoothRemoteGattDescriptor interface:
43 std::string GetIdentifier() const override; 44 std::string GetIdentifier() const override;
44 BluetoothUUID GetUUID() const override; 45 BluetoothUUID GetUUID() const override;
45 bool IsLocal() const override;
46 const std::vector<uint8_t>& GetValue() const override; 46 const std::vector<uint8_t>& GetValue() const override;
47 BluetoothGattCharacteristic* GetCharacteristic() const override; 47 BluetoothRemoteGattCharacteristic* GetCharacteristic() const override;
48 BluetoothGattCharacteristic::Permissions GetPermissions() const override; 48 BluetoothRemoteGattCharacteristic::Permissions GetPermissions()
49 const override;
49 void ReadRemoteDescriptor(const ValueCallback& callback, 50 void ReadRemoteDescriptor(const ValueCallback& callback,
50 const ErrorCallback& error_callback) override; 51 const ErrorCallback& error_callback) override;
51 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value, 52 void WriteRemoteDescriptor(const std::vector<uint8_t>& new_value,
52 const base::Closure& callback, 53 const base::Closure& callback,
53 const ErrorCallback& error_callback) override; 54 const ErrorCallback& error_callback) override;
54 55
55 // Called when Read operation completes. 56 // Called when Read operation completes.
56 void OnRead(JNIEnv* env, 57 void OnRead(JNIEnv* env,
57 const base::android::JavaParamRef<jobject>& jcaller, 58 const base::android::JavaParamRef<jobject>& jcaller,
58 int32_t status, 59 int32_t status,
(...skipping 25 matching lines...) Expand all
84 ErrorCallback write_error_callback_; 85 ErrorCallback write_error_callback_;
85 86
86 std::vector<uint8_t> value_; 87 std::vector<uint8_t> value_;
87 88
88 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid); 89 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattDescriptorAndroid);
89 }; 90 };
90 91
91 } // namespace device 92 } // namespace device
92 93
93 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_ 94 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_DESCRIPTOR_ANDROID_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_descriptor.cc ('k') | device/bluetooth/bluetooth_remote_gatt_descriptor_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698