OLD | NEW |
---|---|
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_CHARACTERISTIC_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
7 | 7 |
8 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 8 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 | 11 |
12 @class CBCharacteristic; | 12 @class CBCharacteristic; |
13 typedef NS_ENUM(NSInteger, CBCharacteristicWriteType); | |
msarda
2016/06/27 11:41:36
Why is this typedef needed? Could CoreBluetooth he
jlebel
2016/06/27 12:20:36
Done.
| |
13 | 14 |
14 namespace device { | 15 namespace device { |
15 | 16 |
16 class BluetoothRemoteGattServiceMac; | 17 class BluetoothRemoteGattServiceMac; |
17 | 18 |
18 // The BluetoothRemoteGattCharacteristicMac class implements | 19 // The BluetoothRemoteGattCharacteristicMac class implements |
19 // BluetoothRemoteGattCharacteristic for remote GATT services on OS X. | 20 // BluetoothRemoteGattCharacteristic for remote GATT services on OS X. |
20 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicMac | 21 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicMac |
21 : public BluetoothRemoteGattCharacteristic { | 22 : public BluetoothRemoteGattCharacteristic { |
22 public: | 23 public: |
(...skipping 25 matching lines...) Expand all Loading... | |
48 | 49 |
49 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); | 50 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicMac); |
50 | 51 |
51 private: | 52 private: |
52 friend class BluetoothRemoteGattServiceMac; | 53 friend class BluetoothRemoteGattServiceMac; |
53 friend class BluetoothTestMac; | 54 friend class BluetoothTestMac; |
54 | 55 |
55 // Called by the BluetoothRemoteGattServiceMac instance when the | 56 // Called by the BluetoothRemoteGattServiceMac instance when the |
56 // characteristics value has been read. | 57 // characteristics value has been read. |
57 void DidUpdateValue(NSError* error); | 58 void DidUpdateValue(NSError* error); |
59 // Called by the BluetoothRemoteGattServiceMac instance when the | |
60 // characteristics value has been written. | |
61 void DidWriteValue(NSError* error); | |
58 // Returns true if the characteristic is readable. | 62 // Returns true if the characteristic is readable. |
59 bool IsReadable() const; | 63 bool IsReadable() const; |
64 // Returns true if the characteristic is writable. | |
65 bool IsWritable() const; | |
66 // Returns the write type (with or without responses). | |
67 CBCharacteristicWriteType GetCBWriteType() const; | |
60 // Returns CoreBluetooth characteristic. | 68 // Returns CoreBluetooth characteristic. |
61 CBCharacteristic* GetCBCharacteristic() const; | 69 CBCharacteristic* GetCBCharacteristic() const; |
62 | 70 |
63 // gatt_service_ owns instances of this class. | 71 // gatt_service_ owns instances of this class. |
64 BluetoothRemoteGattServiceMac* gatt_service_; | 72 BluetoothRemoteGattServiceMac* gatt_service_; |
65 // A characteristic from CBPeripheral.services.characteristics. | 73 // A characteristic from CBPeripheral.services.characteristics. |
66 base::scoped_nsobject<CBCharacteristic> cb_characteristic_; | 74 base::scoped_nsobject<CBCharacteristic> cb_characteristic_; |
67 // Characteristic identifier. | 75 // Characteristic identifier. |
68 std::string identifier_; | 76 std::string identifier_; |
69 // Service UUID. | 77 // Service UUID. |
70 BluetoothUUID uuid_; | 78 BluetoothUUID uuid_; |
71 // Characteristic value. | 79 // Characteristic value. |
72 std::vector<uint8_t> value_; | 80 std::vector<uint8_t> value_; |
73 // True if a gatt read or write request is in progress. | 81 // True if a gatt read or write request is in progress. |
74 bool characteristic_value_read_or_write_in_progress_; | 82 bool characteristic_value_read_or_write_in_progress_; |
75 // ReadRemoteCharacteristic request callbacks. | 83 // ReadRemoteCharacteristic request callbacks. |
76 std::pair<ValueCallback, ErrorCallback> read_characteristic_value_callbacks_; | 84 std::pair<ValueCallback, ErrorCallback> read_characteristic_value_callbacks_; |
85 // WriteRemoteCharacteristic request callbacks. | |
86 std::pair<base::Closure, ErrorCallback> write_characteristic_value_callbacks_; | |
77 }; | 87 }; |
78 | 88 |
79 } // namespace device | 89 } // namespace device |
80 | 90 |
81 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ | 91 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_MAC_H_ |
OLD | NEW |