195489c19Sopenharmony_ci/* 295489c19Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 395489c19Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 495489c19Sopenharmony_ci * you may not use this file except in compliance with the License. 595489c19Sopenharmony_ci * You may obtain a copy of the License at 695489c19Sopenharmony_ci * 795489c19Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 895489c19Sopenharmony_ci * 995489c19Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1095489c19Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1195489c19Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1295489c19Sopenharmony_ci * See the License for the specific language governing permissions and 1395489c19Sopenharmony_ci * limitations under the License. 1495489c19Sopenharmony_ci */ 1595489c19Sopenharmony_ci 1695489c19Sopenharmony_ci#ifndef BLUETOOTH_UTILS_H 1795489c19Sopenharmony_ci#define BLUETOOTH_UTILS_H 1895489c19Sopenharmony_ci 1995489c19Sopenharmony_ci#include <cstdint> 2095489c19Sopenharmony_ci#include <string> 2195489c19Sopenharmony_ci 2295489c19Sopenharmony_ci#include "bluetooth_errorcode.h" 2395489c19Sopenharmony_ci#include "iremote_broker.h" 2495489c19Sopenharmony_ci#include "refbase.h" 2595489c19Sopenharmony_ci 2695489c19Sopenharmony_ciclass IRemoteObject; 2795489c19Sopenharmony_cinamespace OHOS { 2895489c19Sopenharmony_cinamespace Bluetooth { 2995489c19Sopenharmony_cistatic constexpr int GET_PROXY_SLEEP_SEC = 1; // 1s 3095489c19Sopenharmony_cistd::string GetEncryptAddr(std::string addr); 3195489c19Sopenharmony_ci#define GET_ENCRYPT_ADDR(device) (GetEncryptAddr((device).GetDeviceAddr()).c_str()) 3295489c19Sopenharmony_ci#define GET_ENCRYPT_RAW_ADDR(rawAddr) (GetEncryptAddr((rawAddr).GetAddress()).c_str()) 3395489c19Sopenharmony_ci#define GET_ENCRYPT_GATT_ADDR(device) (GetEncryptAddr((device).addr_.GetAddress()).c_str()) 3495489c19Sopenharmony_cistd::string GetBtStateName(int state); 3595489c19Sopenharmony_cistd::string GetBtTransportName(int transport); 3695489c19Sopenharmony_cistd::string GetProfileConnStateName(int state); 3795489c19Sopenharmony_cistd::string GetErrorCode(int32_t errCode); 3895489c19Sopenharmony_cistd::string GenerateRandomMacAddress(); 3995489c19Sopenharmony_cistd::string GetUpdateOutputStackActionName(int action); 4095489c19Sopenharmony_cibool CheckConnectionStrategyInvalid(int32_t strategy); 4195489c19Sopenharmony_cibool CheckAccessAuthorizationInvalid(int32_t accessAuthorization); 4295489c19Sopenharmony_ci} // namespace Bluetooth 4395489c19Sopenharmony_ci} // namespace OHOS 4495489c19Sopenharmony_ci 4595489c19Sopenharmony_ci#endif