OLD | NEW |
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 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_android.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_android.h" |
6 | 6 |
| 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "jni/ChromeBluetoothRemoteGattCharacteristic_jni.h" |
| 11 |
| 12 using base::android::AttachCurrentThread; |
8 | 13 |
9 namespace device { | 14 namespace device { |
10 | 15 |
11 // static | 16 // static |
12 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> | 17 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> |
13 BluetoothRemoteGattCharacteristicAndroid::Create( | 18 BluetoothRemoteGattCharacteristicAndroid::Create( |
14 const std::string& instanceId) { | 19 const std::string& instanceId, |
15 return make_scoped_ptr<BluetoothRemoteGattCharacteristicAndroid>( | 20 jobject /* BluetoothGattCharacteristicWrapper */ |
| 21 bluetooth_gatt_characteristic_wrapper) { |
| 22 scoped_ptr<BluetoothRemoteGattCharacteristicAndroid> characteristic( |
16 new BluetoothRemoteGattCharacteristicAndroid(instanceId)); | 23 new BluetoothRemoteGattCharacteristicAndroid(instanceId)); |
| 24 |
| 25 characteristic->j_characteristic_.Reset( |
| 26 Java_ChromeBluetoothRemoteGattCharacteristic_create( |
| 27 AttachCurrentThread(), bluetooth_gatt_characteristic_wrapper)); |
| 28 |
| 29 return characteristic; |
17 } | 30 } |
18 | 31 |
19 BluetoothRemoteGattCharacteristicAndroid:: | 32 BluetoothRemoteGattCharacteristicAndroid:: |
20 ~BluetoothRemoteGattCharacteristicAndroid() {} | 33 ~BluetoothRemoteGattCharacteristicAndroid() {} |
21 | 34 |
| 35 // static |
| 36 bool BluetoothRemoteGattCharacteristicAndroid::RegisterJNI(JNIEnv* env) { |
| 37 return RegisterNativesImpl( |
| 38 env); // Generated in ChromeBluetoothRemoteGattCharacteristic_jni.h |
| 39 } |
| 40 |
22 std::string BluetoothRemoteGattCharacteristicAndroid::GetIdentifier() const { | 41 std::string BluetoothRemoteGattCharacteristicAndroid::GetIdentifier() const { |
23 return instanceId_; | 42 return instanceId_; |
24 } | 43 } |
25 | 44 |
26 BluetoothUUID BluetoothRemoteGattCharacteristicAndroid::GetUUID() const { | 45 BluetoothUUID BluetoothRemoteGattCharacteristicAndroid::GetUUID() const { |
27 NOTIMPLEMENTED(); | 46 return device::BluetoothUUID(ConvertJavaStringToUTF8( |
28 return BluetoothUUID(); | 47 Java_ChromeBluetoothRemoteGattCharacteristic_getUUID( |
| 48 AttachCurrentThread(), j_characteristic_.obj()))); |
29 } | 49 } |
30 | 50 |
31 bool BluetoothRemoteGattCharacteristicAndroid::IsLocal() const { | 51 bool BluetoothRemoteGattCharacteristicAndroid::IsLocal() const { |
32 return false; | 52 return false; |
33 } | 53 } |
34 | 54 |
35 const std::vector<uint8>& BluetoothRemoteGattCharacteristicAndroid::GetValue() | 55 const std::vector<uint8>& BluetoothRemoteGattCharacteristicAndroid::GetValue() |
36 const { | 56 const { |
37 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
38 return value_; | 58 return value_; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const base::Closure& callback, | 123 const base::Closure& callback, |
104 const ErrorCallback& error_callback) { | 124 const ErrorCallback& error_callback) { |
105 NOTIMPLEMENTED(); | 125 NOTIMPLEMENTED(); |
106 } | 126 } |
107 | 127 |
108 BluetoothRemoteGattCharacteristicAndroid:: | 128 BluetoothRemoteGattCharacteristicAndroid:: |
109 BluetoothRemoteGattCharacteristicAndroid(const std::string& instanceId) | 129 BluetoothRemoteGattCharacteristicAndroid(const std::string& instanceId) |
110 : instanceId_(instanceId) {} | 130 : instanceId_(instanceId) {} |
111 | 131 |
112 } // namespace device | 132 } // namespace device |
OLD | NEW |