1 // 2 // Copyright (C) 2015 Google, Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at: 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #pragma once 18 19 #include <bluetooth/descriptor.h> 20 #include <bluetooth/uuid.h> 21 22 #include <vector> 23 24 namespace bluetooth { 25 class Characteristic { 26 public: 27 Characteristic() = default; 28 Characteristic(const Characteristic& other); Characteristic(uint16_t handle,const UUID & uuid,uint8_t properties,uint16_t permissions,const std::vector<Descriptor> & descriptors)29 Characteristic(uint16_t handle, const UUID& uuid, uint8_t properties, 30 uint16_t permissions, 31 const std::vector<Descriptor>& descriptors) 32 : handle_(handle), 33 uuid_(uuid), 34 properties_(properties), 35 permissions_(permissions), 36 descriptors_(descriptors){}; 37 Characteristic& operator=(const Characteristic& other); 38 virtual ~Characteristic() = default; 39 40 // Comparison function and operator. 41 bool Equals(const Characteristic& other) const; 42 bool operator==(const Characteristic& rhs) const; 43 bool operator!=(const Characteristic& rhs) const; 44 handle()45 uint16_t handle() const { return handle_; } uuid()46 const UUID& uuid() const { return uuid_; } properties()47 uint8_t properties() const { return properties_; } permissions()48 uint16_t permissions() const { return permissions_; } descriptors()49 const std::vector<Descriptor>& descriptors() const { return descriptors_; } descriptors()50 std::vector<Descriptor>& descriptors() { return descriptors_; } 51 52 protected: 53 uint16_t handle_; 54 UUID uuid_; 55 uint8_t properties_; 56 uint16_t permissions_; 57 std::vector<Descriptor> descriptors_; 58 }; 59 } 60