1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef PBAP_PSE_DEF_H 17 #define PBAP_PSE_DEF_H 18 19 #include <cstdint> 20 #include <string> 21 #include "log.h" 22 namespace OHOS { 23 namespace bluetooth { 24 #define PBAP_PSE_L2CAP_ENABLE 25 #define PBAP_PSE_LOG_DEBUG(fmt, ...) LOG_DEBUG("[PBAP_PSE]:" fmt, ##__VA_ARGS__) 26 #define PBAP_PSE_LOG_INFO(fmt, ...) LOG_INFO("[PBAP_PSE]:" fmt, ##__VA_ARGS__) 27 #define PBAP_PSE_LOG_ERROR(fmt, ...) LOG_ERROR("[PBAP_PSE]:" fmt, ##__VA_ARGS__) 28 29 static const std::string PBAP_PSE_SERVICE_NAME = "Phonebook Access PSE"; 30 static const uint16_t PBAP_PSE_GOEP_L2CAP_PSM = 0x1001; 31 32 // incoming connect time out 25 sec (must < l2cap's timeout 30 sec) 33 static const uint16_t PBAP_PSE_INCOMING_TIME_OUT = 25000; 34 35 static const uint8_t PBAP_SERVICE_UUID_LEN = 16; 36 static constexpr uint8_t PBAP_SERVICE_UUID[PBAP_SERVICE_UUID_LEN] = { 37 0x79, 0x61, 0x35, 0xf0, 0xf0, 0xc5, 0x11, 0xd8, 0x09, 0x66, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 38 }; 39 40 // Supported pbap repositories 41 static const uint8_t PBAP_SUPPORTED_LOCAL_PHONEBOOK = 1 << 0; 42 static const uint8_t PBAP_SUPPORTED_SIM_CARD = 1 << 1; 43 static const uint8_t PBAP_SUPPORTED_SPEED_DIAL = 1 << 2; 44 static const uint8_t PBAP_SUPPORTED_FAVORITES = 1 << 3; 45 static constexpr uint8_t PBAP_PSE_SUPPORTED_REPOSITORIES = 46 PBAP_SUPPORTED_LOCAL_PHONEBOOK | PBAP_SUPPORTED_SIM_CARD | PBAP_SUPPORTED_SPEED_DIAL | PBAP_SUPPORTED_FAVORITES; 47 48 // Supported pbap features 49 static const uint32_t PBAP_FEATURES_DOWNLOAD = 1 << 0; 50 static const uint32_t PBAP_FEATURES_BROWSING = 1 << 1; 51 static const uint32_t PBAP_FEATURES_DATABASE_IDENTIFIER = 1 << 2; 52 static const uint32_t PBAP_FEATURES_FOLDER_VERSION_COUNTERS = 1 << 3; 53 static const uint32_t PBAP_FEATURES_VCARD_SELECTING = 1 << 4; 54 static const uint32_t PBAP_FEATURES_ENHANCED_MISSED_CALLS = 1 << 5; 55 static const uint32_t PBAP_FEATURES_X_BT_UCI_VCARD_PROPERTY = 1 << 6; 56 static const uint32_t PBAP_FEATURES_X_BT_UID_VCARD_PROPERTY = 1 << 7; 57 static const uint32_t PBAP_FEATURES_CONTACT_REFERENCING = 1 << 8; 58 static const uint32_t PBAP_FEATURES_DEFAULT_CONTACT_IMAGE_FORMAT = 1 << 9; 59 static constexpr uint32_t PBAP_PSE_SUPPORTED_FEATURES = PBAP_FEATURES_DOWNLOAD | 60 PBAP_FEATURES_BROWSING | 61 PBAP_FEATURES_DATABASE_IDENTIFIER | 62 PBAP_FEATURES_FOLDER_VERSION_COUNTERS | 63 PBAP_FEATURES_VCARD_SELECTING | 64 PBAP_FEATURES_X_BT_UCI_VCARD_PROPERTY | 65 PBAP_FEATURES_X_BT_UID_VCARD_PROPERTY | 66 PBAP_FEATURES_CONTACT_REFERENCING | 67 PBAP_FEATURES_DEFAULT_CONTACT_IMAGE_FORMAT; 68 69 static const std::string PBAP_PSE_TYPE_PB = "x-bt/phonebook"; // type for PullPhoneBook function 70 static const std::string PBAP_PSE_TYPE_LISTING = "x-bt/vcard-listing"; // type for PullvCardListing function 71 static const std::string PBAP_PSE_TYPE_VCARD = "x-bt/vcard"; // type for PullvCardEntry Function 72 static const std::u16string PBAP_PSE_X_BT_UID_PREFIX = u"X-BT-UID:"; 73 static const std::u16string PBAP_PSE_VCARD_SUFFIX = u".vcf"; 74 static const uint8_t PBAP_PSE_HANDLE_MAX_LENGTH = 4; 75 static const std::string PBAP_PSE_DEFAULT_DB_FILE = "pbap_pse.s3db"; 76 } // namespace bluetooth 77 } // namespace OHOS 78 #endif // PBAP_PSE_DEF_H