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 #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 std::unique_ptr<Sequence> sequence) | 26 std::unique_ptr<Sequence> sequence) |
27 : type_(SEQUENCE), | 27 : type_(SEQUENCE), |
28 size_(sequence->size()), | 28 size_(sequence->size()), |
29 sequence_(std::move(sequence)) {} | 29 sequence_(std::move(sequence)) {} |
30 | 30 |
31 BluetoothServiceAttributeValueBlueZ::BluetoothServiceAttributeValueBlueZ( | 31 BluetoothServiceAttributeValueBlueZ::BluetoothServiceAttributeValueBlueZ( |
32 const BluetoothServiceAttributeValueBlueZ& attribute) { | 32 const BluetoothServiceAttributeValueBlueZ& attribute) { |
33 this->type_ = attribute.type_; | 33 this->type_ = attribute.type_; |
34 this->size_ = attribute.size_; | 34 this->size_ = attribute.size_; |
35 | 35 |
| 36 if (attribute.type_ == NULLTYPE) { |
| 37 this->value_ = base::Value::CreateNullValue(); |
| 38 return; |
| 39 } |
| 40 |
36 if (attribute.type_ != SEQUENCE) { | 41 if (attribute.type_ != SEQUENCE) { |
37 this->value_ = base::WrapUnique(attribute.value_->DeepCopy()); | 42 this->value_ = base::WrapUnique(attribute.value_->DeepCopy()); |
38 return; | 43 return; |
39 } | 44 } |
40 | 45 |
41 this->sequence_ = base::MakeUnique<Sequence>(*attribute.sequence_); | 46 this->sequence_ = base::MakeUnique<Sequence>(*attribute.sequence_); |
42 } | 47 } |
43 | 48 |
44 BluetoothServiceAttributeValueBlueZ BluetoothServiceAttributeValueBlueZ:: | 49 BluetoothServiceAttributeValueBlueZ BluetoothServiceAttributeValueBlueZ:: |
45 operator=(const BluetoothServiceAttributeValueBlueZ& attribute) { | 50 operator=(const BluetoothServiceAttributeValueBlueZ& attribute) { |
46 return BluetoothServiceAttributeValueBlueZ(attribute); | 51 return BluetoothServiceAttributeValueBlueZ(attribute); |
47 } | 52 } |
48 | 53 |
49 BluetoothServiceAttributeValueBlueZ::~BluetoothServiceAttributeValueBlueZ() {} | 54 BluetoothServiceAttributeValueBlueZ::~BluetoothServiceAttributeValueBlueZ() {} |
50 | 55 |
51 } // namespace bluez | 56 } // namespace bluez |
OLD | NEW |