• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PCE_PARAMETER_H
17 #define PBAP_PCE_PARAMETER_H
18 
19 #include <stdint.h>
20 #include <string>
21 #include <vector>
22 
23 #include "cstdint"
24 #include "iosfwd"
25 
26 namespace OHOS {
27 namespace bluetooth {
28 class IPbapPullPhoneBookParam {
29 public:
30     IPbapPullPhoneBookParam();
31     virtual ~IPbapPullPhoneBookParam();
32     IPbapPullPhoneBookParam(const IPbapPullPhoneBookParam &other);
33     std::string ToDebugString() const;
34     bool Validate() const;
35     IPbapPullPhoneBookParam &operator=(const IPbapPullPhoneBookParam &other) = delete;
36     enum {
37         NAME = 1 << 0,
38         PROPERTY_SELECTOR = 1 << 1,
39         FORMAT = 1 << 2,
40         MAX_LIST_COUNT = 1 << 3,
41         LIST_START_OFFSET = 1 << 4,
42         RESET_NEW_MISSED_CALLS = 1 << 5,
43         VCARD_SELECTOR = 1 << 6,
44         VCARD_SELECTOROP = 1 << 7,
45     };
46 
47 public:
48     std::u16string GetName() const;
49     void SetName(const std::u16string &name);
50     uint64_t GetPropertySelector() const;
51     void SetPropertySelector(uint64_t propertySelector);
52     uint8_t GetFormat() const;
53     void SetFormat(uint8_t format);
54     uint16_t GetMaxListCount() const;
55     void SetMaxListCount(uint16_t maxListCount);
56     uint16_t GetListStartOffset() const;
57     void SetListStartOffset(uint16_t listStartOffset);
58     uint8_t GetResetNewMissedCalls() const;
59     void SetResetNewMissedCalls(uint8_t resetNewMissedCalls);
60     uint64_t GetvCardSelector() const;
61     void SetvCardSelector(uint64_t vCardSelector);
62     uint8_t GetvCardSelectorOp() const;
63     void SetvCardSelectorOp(uint8_t vCardSelectorOp);
64     uint64_t GetSpecifiedBitset() const;
65     void SetSpecifiedBitset(uint64_t specifiedBitset);
66     bool IsSpecified(int bitSpecified) const;
67 
68 private:
69     std::u16string name_ = u"";
70     uint64_t propertySelector_ = 0ULL;
71     uint8_t format_ = 0;
72     uint16_t maxListCount_ = 0;
73     uint16_t listStartOffset_ = 0;
74     uint8_t resetNewMissedCalls_ = 0;
75     uint64_t vCardSelector_ = 0ULL;
76     uint8_t vCardSelectorOp_ = 0;
77     uint64_t specifiedBitset_ = 0ULL;
78 };
79 
80 class IPbapPullvCardListingParam {
81 public:
82     IPbapPullvCardListingParam();
83     virtual ~IPbapPullvCardListingParam();
84     IPbapPullvCardListingParam(const IPbapPullvCardListingParam &other);
85     IPbapPullvCardListingParam &operator=(const IPbapPullvCardListingParam &other) = delete;
86     std::string ToDebugString() const;
87     bool Validate() const;
88     enum {
89         NAME = 1 << 0,
90         ORDER = 1 << 1,
91         SEARCH_VALUE = 1 << 2,
92         SEARCH_PROPERTY = 1 << 3,
93         MAX_LIST_COUNT = 1 << 4,
94         LIST_START_OFFSET = 1 << 5,
95         RESET_NEW_MISSED_CALLS = 1 << 6,
96         VCARD_SELECTOR = 1 << 7,
97         VCARD_SELECTOROP = 1 << 8,
98     };
99 
100 public:
101     std::u16string GetName() const;
102     void SetName(const std::u16string &name);
103     uint8_t GetOrder() const;
104     void SetOrder(uint8_t order);
105     std::string GetSearchValue() const;
106     void SetSearchValue(const std::string &searchValue);
107     uint8_t GetSearchProperty() const;
108     void SetSearchProperty(uint8_t searchProperty);
109     uint16_t GetMaxListCount() const;
110     void SetMaxListCount(uint16_t maxListCount);
111     uint16_t GetListStartOffset() const;
112     void SetListStartOffset(uint16_t listStartOffset);
113     uint8_t GetResetNewMissedCalls() const;
114     void SetResetNewMissedCalls(uint8_t resetNewMissedCalls);
115     uint64_t GetvCardSelector() const;
116     void SetvCardSelector(uint64_t vCardSelector);
117     uint8_t GetvCardSelectorOp() const;
118     void SetvCardSelectorOp(uint8_t vCardSelectorOp);
119     uint64_t GetSpecifiedBitset() const;
120     void SetSpecifiedBitset(uint64_t specifiedBitset);
121     bool IsSpecified(int bitSpecified) const;
122 
123 private:
124     std::u16string name_ = u"";
125     uint8_t order_ = 0;
126     std::string searchValue_ = "";
127     uint8_t searchProperty_ = 0;
128     uint16_t maxListCount_ = 0;
129     uint16_t listStartOffset_ = 0;
130     uint8_t resetNewMissedCalls_ = 0;
131     uint64_t vCardSelector_ = 0ULL;
132     uint8_t vCardSelectorOp_ = 0;
133     uint64_t specifiedBitset_ = 0ULL;
134 };
135 
136 class IPbapPullvCardEntryParam {
137 public:
138     IPbapPullvCardEntryParam();
139     virtual ~IPbapPullvCardEntryParam();
140     IPbapPullvCardEntryParam(const IPbapPullvCardEntryParam &other);
141     IPbapPullvCardEntryParam &operator=(const IPbapPullvCardEntryParam &other) = delete;
142     std::string ToDebugString() const;
143     bool Validate() const;
144     enum {
145         NAME = 1 << 0,
146         PROPERTY_SELECTOR = 1 << 1,
147         FORMAT = 1 << 2,
148     };
149 
150 public:
151     std::u16string GetName() const;
152     void SetName(const std::u16string &name);
153     uint64_t GetPropertySelector() const;
154     void SetPropertySelector(uint64_t propertySelector);
155     uint8_t GetFormat() const;
156     void SetFormat(uint8_t format);
157     uint64_t GetSpecifiedBitset() const;
158     void SetSpecifiedBitset(uint64_t specifiedBitset);
159     bool IsSpecified(int bitSpecified) const;
160 
161 private:
162     std::u16string name_ = u"";
163     uint64_t propertySelector_ = 0ULL;
164     uint8_t format_ = 0;
165     uint64_t specifiedBitset_ = 0ULL;
166 };
167 
168 /**
169  * @brief
170  *
171  * @since 1.0
172  * @version 1.0
173  */
174 class IPbapPhoneBookData {
175 public:
176     explicit IPbapPhoneBookData();
177     virtual ~IPbapPhoneBookData();
178     explicit IPbapPhoneBookData(const IPbapPhoneBookData &other);
179     IPbapPhoneBookData &operator=(const IPbapPhoneBookData &other);
180     void Load(std::vector<uint8_t> &retResult);
181     uint16_t phoneBookSize_ = 0;                      // VCard size
182     std::vector<uint8_t> primaryFolderVersion_ {};    // VCard PrimaryFolderVersion 16 bytes
183     std::vector<uint8_t> secondaryFolderVersion_ {};  // VCard SecondaryFolderVersion 16 bytes
184     std::vector<uint8_t> databaseIdentifier_ {};      // VCard DatabaseIdentifier 16 bytes
185     std::string deviceAddr_ = "";                     // device address
186     std::string vcardPath_ = "";                      // vcard path
187     std::string vcardFileName_ = "";                  // file name
188     uint16_t resultLoaded_ = 1;                       // result loaded:1 , otherwise 0
189     std::vector<uint8_t> result_ {};                  // VCard bytes with utf-8
190 };
191 }  // namespace bluetooth
192 }  // namespace OHOS
193 
194 #endif  // PBAP_PCE_PARAMETER_H
195