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 <vector> 20 21 #include "base/functional/callback.h" 22 #include "bind_helpers.h" 23 #include "bta/include/bta_groups.h" 24 #include "hardware/bt_csis.h" 25 26 namespace bluetooth { 27 namespace csis { 28 29 using CsisLockCb = base::OnceCallback<void(int group_id, bool locked, CsisGroupLockStatus status)>; 30 31 class CsisClient { 32 public: 33 virtual ~CsisClient() = default; 34 static void Initialize(bluetooth::csis::CsisClientCallbacks* callbacks, base::Closure initCb); 35 static void AddFromStorage(const RawAddress& addr, const std::vector<uint8_t>& in); 36 static bool GetForStorage(const RawAddress& addr, std::vector<uint8_t>& out); 37 static void CleanUp(); 38 static CsisClient* Get(); 39 static void DebugDump(int fd); 40 static bool IsCsisClientRunning(); 41 virtual void Connect(const RawAddress& addr) = 0; 42 virtual void Disconnect(const RawAddress& addr) = 0; 43 virtual void RemoveDevice(const RawAddress& address) = 0; 44 virtual int GetGroupId(const RawAddress& addr, 45 bluetooth::Uuid uuid = bluetooth::groups::kGenericContextUuid) = 0; 46 virtual void LockGroup(int group_id, bool lock, CsisLockCb cb) = 0; 47 virtual std::vector<RawAddress> GetDeviceList(int group_id) = 0; 48 virtual int GetDesiredSize(int group_id) const = 0; 49 }; 50 } // namespace csis 51 } // namespace bluetooth 52