119e95205Sopenharmony_ci/* 219e95205Sopenharmony_ci * Copyright (C) 2021-2022 Huawei Device Co., Ltd. 319e95205Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 419e95205Sopenharmony_ci * you may not use this file except in compliance with the License. 519e95205Sopenharmony_ci * You may obtain a copy of the License at 619e95205Sopenharmony_ci * 719e95205Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 819e95205Sopenharmony_ci * 919e95205Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1019e95205Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1119e95205Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1219e95205Sopenharmony_ci * See the License for the specific language governing permissions and 1319e95205Sopenharmony_ci * limitations under the License. 1419e95205Sopenharmony_ci */ 1519e95205Sopenharmony_ci 1619e95205Sopenharmony_ci/** 1719e95205Sopenharmony_ci * @addtogroup Bluetooth 1819e95205Sopenharmony_ci * @{ 1919e95205Sopenharmony_ci * 2019e95205Sopenharmony_ci * @brief Defines basic profile for profile service. 2119e95205Sopenharmony_ci * 2219e95205Sopenharmony_ci * @since 6 2319e95205Sopenharmony_ci */ 2419e95205Sopenharmony_ci 2519e95205Sopenharmony_ci/** 2619e95205Sopenharmony_ci * @file interface_profile.h 2719e95205Sopenharmony_ci * 2819e95205Sopenharmony_ci * @brief basic profile interface. 2919e95205Sopenharmony_ci * 3019e95205Sopenharmony_ci * @since 6 3119e95205Sopenharmony_ci */ 3219e95205Sopenharmony_ci 3319e95205Sopenharmony_ci#ifndef INTERFACE_PROFILE_H 3419e95205Sopenharmony_ci#define INTERFACE_PROFILE_H 3519e95205Sopenharmony_ci 3619e95205Sopenharmony_ci#include <list> 3719e95205Sopenharmony_ci 3819e95205Sopenharmony_ci#include "bt_def.h" 3919e95205Sopenharmony_ci#include "raw_address.h" 4019e95205Sopenharmony_ci 4119e95205Sopenharmony_ci/** 4219e95205Sopenharmony_ci * @brief forward declaration for class Context in namespace utility 4319e95205Sopenharmony_ci */ 4419e95205Sopenharmony_cinamespace utility { 4519e95205Sopenharmony_ciclass Context; 4619e95205Sopenharmony_ci} 4719e95205Sopenharmony_ci 4819e95205Sopenharmony_cinamespace OHOS { 4919e95205Sopenharmony_cinamespace bluetooth { 5019e95205Sopenharmony_ci/** 5119e95205Sopenharmony_ci * @brief profile service name Define 5219e95205Sopenharmony_ci */ 5319e95205Sopenharmony_ciconst std::string PROFILE_NAME_GATT_CLIENT = "GattClientService"; 5419e95205Sopenharmony_ciconst std::string PROFILE_NAME_GATT_SERVER = "GattServerService"; 5519e95205Sopenharmony_ciconst std::string PROFILE_NAME_A2DP_SRC = "A2dpSrcService"; 5619e95205Sopenharmony_ciconst std::string PROFILE_NAME_A2DP_SINK = "A2dpSnkService"; 5719e95205Sopenharmony_ciconst std::string PROFILE_NAME_AVRCP_CT = "AvrcpCtService"; 5819e95205Sopenharmony_ciconst std::string PROFILE_NAME_AVRCP_TG = "AvrcpTgService"; 5919e95205Sopenharmony_ciconst std::string PROFILE_NAME_HFP_AG = "HfpAgService"; 6019e95205Sopenharmony_ciconst std::string PROFILE_NAME_HFP_HF = "HfpHfService"; 6119e95205Sopenharmony_ciconst std::string PROFILE_NAME_MAP_MCE = "MapMceService"; 6219e95205Sopenharmony_ciconst std::string PROFILE_NAME_MAP_MSE = "MapMseService"; 6319e95205Sopenharmony_ciconst std::string PROFILE_NAME_PAN = "PanService"; 6419e95205Sopenharmony_ciconst std::string PROFILE_NAME_OPP = "OppService"; 6519e95205Sopenharmony_ciconst std::string PROFILE_NAME_PBAP_PCE = "PbapPceService"; 6619e95205Sopenharmony_ciconst std::string PROFILE_NAME_PBAP_PSE = "PbapPseService"; 6719e95205Sopenharmony_ciconst std::string PROFILE_NAME_SPP = "SocketService"; 6819e95205Sopenharmony_ciconst std::string PROFILE_NAME_DI = "DIService"; 6919e95205Sopenharmony_ciconst std::string PROFILE_NAME_HID_HOST = "HidHostService"; 7019e95205Sopenharmony_ci 7119e95205Sopenharmony_ci/** 7219e95205Sopenharmony_ci * @brief profile connect state define, using to GetConnectState()... 7319e95205Sopenharmony_ci */ 7419e95205Sopenharmony_ciconst uint8_t PROFILE_STATE_CONNECTED = 0x08; 7519e95205Sopenharmony_ciconst uint8_t PROFILE_STATE_CONNECTING = 0x04; 7619e95205Sopenharmony_ciconst uint8_t PROFILE_STATE_DISCONNECTING = 0x02; 7719e95205Sopenharmony_ciconst uint8_t PROFILE_STATE_DISCONNECTED = 0x01; 7819e95205Sopenharmony_ci 7919e95205Sopenharmony_ci/** 8019e95205Sopenharmony_ci * @brief Represents basic profile for each profile service, including the common functions. 8119e95205Sopenharmony_ci * 8219e95205Sopenharmony_ci * @since 6 8319e95205Sopenharmony_ci */ 8419e95205Sopenharmony_ciclass IProfile { 8519e95205Sopenharmony_cipublic: 8619e95205Sopenharmony_ci /** 8719e95205Sopenharmony_ci * @brief A destructor used to delete the <b>IProfile</b> instance. 8819e95205Sopenharmony_ci * 8919e95205Sopenharmony_ci * @since 6 9019e95205Sopenharmony_ci */ 9119e95205Sopenharmony_ci virtual ~IProfile() = default; 9219e95205Sopenharmony_ci 9319e95205Sopenharmony_ci /** 9419e95205Sopenharmony_ci * @brief Connect with device. 9519e95205Sopenharmony_ci * 9619e95205Sopenharmony_ci * @param device Remote device address. 9719e95205Sopenharmony_ci * @return Returns Result for connect operation. 9819e95205Sopenharmony_ci * @since 6 9919e95205Sopenharmony_ci */ 10019e95205Sopenharmony_ci virtual int Connect(const RawAddress &device) = 0; 10119e95205Sopenharmony_ci 10219e95205Sopenharmony_ci /** 10319e95205Sopenharmony_ci * @brief Disconnect with device. 10419e95205Sopenharmony_ci * 10519e95205Sopenharmony_ci * @param device Remote device address. 10619e95205Sopenharmony_ci * @return Returns Result for disconnect operation. 10719e95205Sopenharmony_ci * @since 6 10819e95205Sopenharmony_ci */ 10919e95205Sopenharmony_ci virtual int Disconnect(const RawAddress &device) = 0; 11019e95205Sopenharmony_ci 11119e95205Sopenharmony_ci /** 11219e95205Sopenharmony_ci * @brief Get connected devices. 11319e95205Sopenharmony_ci * 11419e95205Sopenharmony_ci * @return Returns List for connected devices. 11519e95205Sopenharmony_ci * @since 6 11619e95205Sopenharmony_ci */ 11719e95205Sopenharmony_ci virtual std::list<RawAddress> GetConnectDevices() = 0; 11819e95205Sopenharmony_ci 11919e95205Sopenharmony_ci /** 12019e95205Sopenharmony_ci * @brief Get connect state. 12119e95205Sopenharmony_ci * 12219e95205Sopenharmony_ci * @return Returns connect state for profile service. 12319e95205Sopenharmony_ci * @since 6 12419e95205Sopenharmony_ci */ 12519e95205Sopenharmony_ci virtual int GetConnectState() = 0; 12619e95205Sopenharmony_ci 12719e95205Sopenharmony_ci /** 12819e95205Sopenharmony_ci * @brief Get max number profile can connect. 12919e95205Sopenharmony_ci * 13019e95205Sopenharmony_ci * @return Returns max number profile can connect. 13119e95205Sopenharmony_ci * @since 6 13219e95205Sopenharmony_ci */ 13319e95205Sopenharmony_ci virtual int GetMaxConnectNum() = 0; 13419e95205Sopenharmony_ci 13519e95205Sopenharmony_ci /** 13619e95205Sopenharmony_ci * @brief Get utility::Context pointer for each profile service. 13719e95205Sopenharmony_ci * 13819e95205Sopenharmony_ci * @return Returns the pointer for adapter. 13919e95205Sopenharmony_ci * @since 6 14019e95205Sopenharmony_ci */ 14119e95205Sopenharmony_ci virtual utility::Context *GetContext() = 0; 14219e95205Sopenharmony_ci}; 14319e95205Sopenharmony_ci} // namespace bluetooth 14419e95205Sopenharmony_ci} // namespace OHOS 14519e95205Sopenharmony_ci 14619e95205Sopenharmony_ci#endif // INTERFACE_PROFILE_H