1 /* 2 * Copyright 2018 The Android Open Source Project 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 <cstdint> 20 21 #include "types/address.h" 22 23 namespace test_vendor_lib { 24 25 // Model the connection of a device to the controller. 26 class AclConnection { 27 public: AclConnection(const Address & addr)28 AclConnection(const Address& addr) : address_(addr), connected_(false), encrypted_(false) {} 29 30 virtual ~AclConnection() = default; 31 SetConnected(bool connected)32 void SetConnected(bool connected) { 33 connected_ = connected; 34 }; IsConnected()35 bool IsConnected() const { 36 return connected_; 37 }; 38 Encrypt()39 void Encrypt() { 40 encrypted_ = true; 41 }; IsEncrypted()42 bool IsEncrypted() const { 43 return encrypted_; 44 }; 45 GetAddress()46 const Address& GetAddress() const { 47 return address_; 48 } SetAddress(const Address & address)49 void SetAddress(const Address& address) { 50 address_ = address; 51 } 52 53 private: 54 Address address_; 55 56 // State variables 57 bool connected_; 58 bool encrypted_; 59 }; 60 61 } // namespace test_vendor_lib 62