1 /* 2 * Copyright 2021 HIMSA II K/S - www.himsa.com. 3 * Represented by EHIMA - www.ehima.com 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 #pragma once 18 19 #include "base/callback.h" 20 #include "bind_helpers.h" 21 #include "bta/include/bta_groups.h" 22 #include "hardware/bt_csis.h" 23 24 namespace bluetooth { 25 namespace csis { 26 27 using CsisLockCb = base::OnceCallback<void(int group_id, bool locked, 28 CsisGroupLockStatus status)>; 29 30 class CsisClient { 31 public: 32 virtual ~CsisClient() = default; 33 static void Initialize(bluetooth::csis::CsisClientCallbacks* callbacks, 34 base::Closure initCb); 35 static void AddFromStorage(const RawAddress& addr, 36 const std::vector<uint8_t>& in, bool autoconnect); 37 static bool GetForStorage(const RawAddress& addr, std::vector<uint8_t>& out); 38 static void CleanUp(); 39 static CsisClient* Get(); 40 static void DebugDump(int fd); 41 static bool IsCsisClientRunning(); 42 virtual void Connect(const RawAddress& addr) = 0; 43 virtual void Disconnect(const RawAddress& addr) = 0; 44 virtual void RemoveDevice(const RawAddress& address) = 0; 45 virtual int GetGroupId( 46 const RawAddress& addr, 47 bluetooth::Uuid uuid = bluetooth::groups::kGenericContextUuid) = 0; 48 virtual void LockGroup(int group_id, bool lock, CsisLockCb cb) = 0; 49 virtual std::vector<RawAddress> GetDeviceList(int group_id) = 0; 50 virtual int GetDesiredSize(int group_id) = 0; 51 }; 52 } // namespace csis 53 } // namespace bluetooth 54