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

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

Issue 1572873002: bluetooth: android: Code cleanup fixing comments, typos, simplified names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comma Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 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 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_SERVICE_ANDROID_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 // Create a BluetoothRemoteGattServiceAndroid instance and associated Java 30 // Create a BluetoothRemoteGattServiceAndroid instance and associated Java
31 // ChromeBluetoothRemoteGattService using the provided 31 // ChromeBluetoothRemoteGattService using the provided
32 // |bluetooth_gatt_service_wrapper|. 32 // |bluetooth_gatt_service_wrapper|.
33 // 33 //
34 // The ChromeBluetoothRemoteGattService instance will hold a Java reference 34 // The ChromeBluetoothRemoteGattService instance will hold a Java reference
35 // to |bluetooth_gatt_service_wrapper|. 35 // to |bluetooth_gatt_service_wrapper|.
36 static scoped_ptr<BluetoothRemoteGattServiceAndroid> Create( 36 static scoped_ptr<BluetoothRemoteGattServiceAndroid> Create(
37 BluetoothAdapterAndroid* adapter, 37 BluetoothAdapterAndroid* adapter,
38 BluetoothDeviceAndroid* device, 38 BluetoothDeviceAndroid* device,
39 jobject /* BluetoothGattServiceWrapper */ bluetooth_gatt_service_wrapper, 39 jobject /* BluetoothGattServiceWrapper */ bluetooth_gatt_service_wrapper,
40 const std::string& instanceId, 40 const std::string& instance_id,
41 jobject /* ChromeBluetoothDevice */ chrome_bluetooth_device); 41 jobject /* ChromeBluetoothDevice */ chrome_bluetooth_device);
42 42
43 ~BluetoothRemoteGattServiceAndroid() override; 43 ~BluetoothRemoteGattServiceAndroid() override;
44 44
45 // Register C++ methods exposed to Java using JNI. 45 // Register C++ methods exposed to Java using JNI.
46 static bool RegisterJNI(JNIEnv* env); 46 static bool RegisterJNI(JNIEnv* env);
47 47
48 // Returns the associated ChromeBluetoothRemoteGattService Java object. 48 // Returns the associated ChromeBluetoothRemoteGattService Java object.
49 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); 49 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
50 50
(...skipping 21 matching lines...) Expand all
72 const std::string& identifier) const override; 72 const std::string& identifier) const override;
73 bool AddCharacteristic( 73 bool AddCharacteristic(
74 device::BluetoothGattCharacteristic* characteristic) override; 74 device::BluetoothGattCharacteristic* characteristic) override;
75 bool AddIncludedService(device::BluetoothGattService* service) override; 75 bool AddIncludedService(device::BluetoothGattService* service) override;
76 void Register(const base::Closure& callback, 76 void Register(const base::Closure& callback,
77 const ErrorCallback& error_callback) override; 77 const ErrorCallback& error_callback) override;
78 void Unregister(const base::Closure& callback, 78 void Unregister(const base::Closure& callback,
79 const ErrorCallback& error_callback) override; 79 const ErrorCallback& error_callback) override;
80 80
81 // Creates a Bluetooth GATT characteristic object and adds it to 81 // Creates a Bluetooth GATT characteristic object and adds it to
82 // |characteristics_| if it is not already there. 82 // |characteristics_|, DCHECKing that it has not already been created.
83 void CreateGattRemoteCharacteristic( 83 void CreateGattRemoteCharacteristic(
84 JNIEnv* env, 84 JNIEnv* env,
85 const base::android::JavaParamRef<jobject>& caller, 85 const base::android::JavaParamRef<jobject>& caller,
86 const base::android::JavaParamRef<jstring>& instanceId, 86 const base::android::JavaParamRef<jstring>& instance_id,
87 const base::android::JavaParamRef< 87 const base::android::JavaParamRef<
88 jobject>& /* BluetoothGattCharacteristicWrapper */ 88 jobject>& /* BluetoothGattCharacteristicWrapper */
89 bluetooth_gatt_characteristic_wrapper, 89 bluetooth_gatt_characteristic_wrapper,
90 const base::android::JavaParamRef< 90 const base::android::JavaParamRef<
91 jobject>& /* ChromeBluetoothDevice */ chrome_bluetooth_device); 91 jobject>& /* ChromeBluetoothDevice */ chrome_bluetooth_device);
92 92
93 private: 93 private:
94 BluetoothRemoteGattServiceAndroid(BluetoothAdapterAndroid* adapter, 94 BluetoothRemoteGattServiceAndroid(BluetoothAdapterAndroid* adapter,
95 BluetoothDeviceAndroid* device, 95 BluetoothDeviceAndroid* device,
96 const std::string& instanceId); 96 const std::string& instance_id);
97 97
98 // Populates |characteristics_| from Java objects if necessary. 98 // Populates |characteristics_| from Java objects if necessary.
99 void EnsureCharacteristicsCreated() const; 99 void EnsureCharacteristicsCreated() const;
100 100
101 // Java object org.chromium.device.bluetooth.ChromeBluetoothRemoteGattService. 101 // Java object org.chromium.device.bluetooth.ChromeBluetoothRemoteGattService.
102 base::android::ScopedJavaGlobalRef<jobject> j_service_; 102 base::android::ScopedJavaGlobalRef<jobject> j_service_;
103 103
104 // The adapter associated with this service. It's ok to store a raw pointer 104 // The adapter associated with this service. It's ok to store a raw pointer
105 // here since |adapter_| indirectly owns this instance. 105 // here since |adapter_| indirectly owns this instance.
106 BluetoothAdapterAndroid* adapter_; 106 BluetoothAdapterAndroid* adapter_;
107 107
108 // The device this GATT service belongs to. It's ok to store a raw pointer 108 // The device this GATT service belongs to. It's ok to store a raw pointer
109 // here since |device_| owns this instance. 109 // here since |device_| owns this instance.
110 BluetoothDeviceAndroid* device_; 110 BluetoothDeviceAndroid* device_;
111 111
112 // Adapter unique instance ID. 112 // Adapter unique instance ID.
113 std::string instanceId_; 113 std::string instance_id_;
114 114
115 // Map of characteristics, keyed by characteristic identifier. 115 // Map of characteristics, keyed by characteristic identifier.
116 base::ScopedPtrHashMap<std::string, 116 base::ScopedPtrHashMap<std::string,
117 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid>> 117 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid>>
118 characteristics_; 118 characteristics_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceAndroid); 120 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceAndroid);
121 }; 121 };
122 122
123 } // namespace device 123 } // namespace device
124 124
125 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_ 125 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698