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

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

Issue 1395783005: bluetooth: android: BluetoothRemoteGattServiceAndroid::GetUUID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed jyasskin comments 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h"
6 6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
7 #include "device/bluetooth/bluetooth_adapter_android.h" 9 #include "device/bluetooth/bluetooth_adapter_android.h"
8 #include "device/bluetooth/bluetooth_device_android.h" 10 #include "device/bluetooth/bluetooth_device_android.h"
11 #include "jni/ChromeBluetoothRemoteGattService_jni.h"
12
13 using base::android::AttachCurrentThread;
9 14
10 namespace device { 15 namespace device {
11 16
12 // static 17 // static
13 BluetoothRemoteGattServiceAndroid* BluetoothRemoteGattServiceAndroid::Create( 18 BluetoothRemoteGattServiceAndroid* BluetoothRemoteGattServiceAndroid::Create(
14 BluetoothAdapterAndroid* adapter, 19 BluetoothAdapterAndroid* adapter,
15 BluetoothDeviceAndroid* device, 20 BluetoothDeviceAndroid* device,
16 jobject bluetooth_remote_gatt_service_wrapper, 21 jobject bluetooth_remote_gatt_service_wrapper,
17 std::string instanceId) { 22 std::string instanceId) {
18 BluetoothRemoteGattServiceAndroid* service = 23 BluetoothRemoteGattServiceAndroid* service =
19 new BluetoothRemoteGattServiceAndroid(adapter, device, instanceId); 24 new BluetoothRemoteGattServiceAndroid(adapter, device, instanceId);
20 25
26 service->j_service_.Reset(Java_ChromeBluetoothRemoteGattService_create(
27 AttachCurrentThread(), bluetooth_remote_gatt_service_wrapper));
28
21 return service; 29 return service;
22 } 30 }
23 31
32 // static
33 bool BluetoothRemoteGattServiceAndroid::RegisterJNI(JNIEnv* env) {
34 return RegisterNativesImpl(
35 env); // Generated in ChromeBluetoothRemoteGattService_jni.h
36 }
37
24 std::string BluetoothRemoteGattServiceAndroid::GetIdentifier() const { 38 std::string BluetoothRemoteGattServiceAndroid::GetIdentifier() const {
25 return instanceId_; 39 return instanceId_;
26 } 40 }
27 41
28 device::BluetoothUUID BluetoothRemoteGattServiceAndroid::GetUUID() const { 42 device::BluetoothUUID BluetoothRemoteGattServiceAndroid::GetUUID() const {
29 NOTIMPLEMENTED(); 43 return device::BluetoothUUID(
30 return device::BluetoothUUID(); 44 ConvertJavaStringToUTF8(Java_ChromeBluetoothRemoteGattService_getUUID(
45 AttachCurrentThread(), j_service_.obj())));
31 } 46 }
32 47
33 bool BluetoothRemoteGattServiceAndroid::IsLocal() const { 48 bool BluetoothRemoteGattServiceAndroid::IsLocal() const {
34 return false; 49 return false;
35 } 50 }
36 51
37 bool BluetoothRemoteGattServiceAndroid::IsPrimary() const { 52 bool BluetoothRemoteGattServiceAndroid::IsPrimary() const {
38 NOTIMPLEMENTED(); 53 NOTIMPLEMENTED();
39 return true; 54 return true;
40 } 55 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 102
88 BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid( 103 BluetoothRemoteGattServiceAndroid::BluetoothRemoteGattServiceAndroid(
89 BluetoothAdapterAndroid* adapter, 104 BluetoothAdapterAndroid* adapter,
90 BluetoothDeviceAndroid* device, 105 BluetoothDeviceAndroid* device,
91 std::string instanceId) 106 std::string instanceId)
92 : adapter_(adapter), device_(device), instanceId_(instanceId) {} 107 : adapter_(adapter), device_(device), instanceId_(instanceId) {}
93 108
94 BluetoothRemoteGattServiceAndroid::~BluetoothRemoteGattServiceAndroid() {} 109 BluetoothRemoteGattServiceAndroid::~BluetoothRemoteGattServiceAndroid() {}
95 110
96 } // namespace device 111 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698