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 #include "pbap_pce_app_params.h"
17 #include <cstring>
18 #include "pbap_pce_def.h"
19
20 namespace OHOS {
21 namespace bluetooth {
22 const std::map<uint8_t, int> PbapPceAppParams::LENS_MAP = {
23 {ORDER, 1},
24 {SEARCH_VALUE, -1},
25 {SEARCH_PROPERTY, 1},
26 {MAX_LIST_COUNT, 2},
27 {LIST_START_OFFSET, 2},
28 {PROPERTY_SELECTOR, 8},
29 {FORMAT, 1},
30 {PHONEBOOK_SIZE, 2},
31 {NEW_MISSED_CALLS, 1},
32 {PRIMARY_FOLDER_VERSION, 16},
33 {SECONDARY_FOLDER_VERSION, 16},
34 {VCARD_SELECTOR, 8},
35 {DATABASE_IDENTIFIER, 16},
36 {VCARD_SELECTOR_OPERATOR, 1},
37 {RESET_NEW_MISSED_CALLS, 1},
38 {PBAP_SUPPORTED_FEATURES, 4}
39 };
40
CheckParams(const ObexTlvParamters & obexTlvParamters)41 bool PbapPceAppParams::CheckParams(const ObexTlvParamters &obexTlvParamters)
42 {
43 for (auto &tlv : obexTlvParamters.GetTlvTriplets()) {
44 if (LENS_MAP.find(tlv->GetTagId()) == LENS_MAP.end()) {
45 PBAP_PCE_LOG_ERROR("unknow Application Parameters header : %x", tlv->GetTagId());
46 return false;
47 }
48 int expectLen = LENS_MAP.at(tlv->GetTagId());
49 if (expectLen != -1 && expectLen != tlv->GetLen()) {
50 PBAP_PCE_LOG_ERROR(
51 "Wrong Application Parameters header Length for TagId[%x]:expect is [%{public}d], actual is [%u].",
52 tlv->GetTagId(),
53 expectLen,
54 tlv->GetLen());
55 return false;
56 }
57 }
58 return true;
59 }
60
Init(const ObexTlvParamters & obexTlvParamters)61 bool PbapPceAppParams::Init(const ObexTlvParamters &obexTlvParamters)
62 {
63 if (!CheckParams(obexTlvParamters)) {
64 return false;
65 }
66 SetOrderTlv(obexTlvParamters);
67 SetSearchValueUtf8Tlv(obexTlvParamters);
68 SetSearchPropertyTlv(obexTlvParamters);
69 SetMaxListCountTlv(obexTlvParamters);
70 SetListStartOffsetTlv(obexTlvParamters);
71 SetPropertySelectorTlv(obexTlvParamters);
72 SetFormatTlv(obexTlvParamters);
73 SetPhonebookSizeTlv(obexTlvParamters);
74 SetNewMissedCallsTlv(obexTlvParamters);
75 SetPrimaryFolderVersionTlv(obexTlvParamters);
76 SetSecondaryFolderVersionTlv(obexTlvParamters);
77 SetVcardSelectorTlv(obexTlvParamters);
78 SetDatabaseIdentifierTlv(obexTlvParamters);
79 SetVcardSelectorOperatorTlv(obexTlvParamters);
80 SetResetNewMissedCallsTlv(obexTlvParamters);
81 SetPbapSupportedFeaturesTlv(obexTlvParamters);
82 return true;
83 }
84
AddToObexHeader(ObexHeader & hdr) const85 void PbapPceAppParams::AddToObexHeader(ObexHeader &hdr) const
86 {
87 ObexTlvParamters obexTlvParamters;
88 AddTlvOrder(obexTlvParamters);
89 AddTlvSearchValueUtf8(obexTlvParamters);
90 AddTlvSearchProperty(obexTlvParamters);
91 AddTlvMaxListCount(obexTlvParamters);
92 AddTlvListStartOffAddTlv(obexTlvParamters);
93 AddTlvPropertySelector(obexTlvParamters);
94 AddTlvFormat(obexTlvParamters);
95 AddTlvPhonebookSize(obexTlvParamters);
96 AddTlvNewMissedCalls(obexTlvParamters);
97 AddTlvPrimaryFolderVersion(obexTlvParamters);
98 AddTlvSecondaryFolderVersion(obexTlvParamters);
99 AddTlvVcardSelector(obexTlvParamters);
100 AddTlvDatabaseIdentifier(obexTlvParamters);
101 AddTlvVcardSelectorOperator(obexTlvParamters);
102 AddTlvReAddTlvNewMissedCalls(obexTlvParamters);
103 AddTlvPbapSupportedFeatures(obexTlvParamters);
104 if (obexTlvParamters.GetTlvTriplets().size() > 0) {
105 hdr.AppendItemAppParams(obexTlvParamters);
106 }
107 }
108
GetOrder() const109 const uint8_t *PbapPceAppParams::GetOrder() const
110 {
111 if (!order_) {
112 return nullptr;
113 }
114 return order_.get();
115 }
116
GetSearchValueUtf8() const117 const std::vector<uint8_t> &PbapPceAppParams::GetSearchValueUtf8() const
118 {
119 return searchValueUtf8_;
120 }
121
GetSearchProperty() const122 const uint8_t *PbapPceAppParams::GetSearchProperty() const
123 {
124 if (!searchProperty_) {
125 return nullptr;
126 }
127 return searchProperty_.get();
128 }
129
GetMaxListCount() const130 const uint16_t *PbapPceAppParams::GetMaxListCount() const
131 {
132 if (!maxListCount_) {
133 return nullptr;
134 }
135 return maxListCount_.get();
136 }
137
GetListStartOffset() const138 const uint16_t *PbapPceAppParams::GetListStartOffset() const
139 {
140 if (!listStartOffset_) {
141 return nullptr;
142 }
143 return listStartOffset_.get();
144 }
145
GetPropertySelector() const146 const uint64_t *PbapPceAppParams::GetPropertySelector() const
147 {
148 if (!propertySelector_) {
149 return nullptr;
150 }
151 return propertySelector_.get();
152 }
153
GetFormat() const154 const uint8_t *PbapPceAppParams::GetFormat() const
155 {
156 if (!format_) {
157 return nullptr;
158 }
159 return format_.get();
160 }
161
GetPhonebookSize() const162 const uint16_t *PbapPceAppParams::GetPhonebookSize() const
163 {
164 if (!phonebookSize_) {
165 return nullptr;
166 }
167 return phonebookSize_.get();
168 }
169
GetNewMissedCalls() const170 const uint8_t *PbapPceAppParams::GetNewMissedCalls() const
171 {
172 if (!newMissedCalls_) {
173 return nullptr;
174 }
175 return newMissedCalls_.get();
176 }
177
GetPrimaryFolderVersion() const178 const std::vector<uint8_t> &PbapPceAppParams::GetPrimaryFolderVersion() const
179 {
180 return primaryFolderVer_;
181 }
182
GetSecondaryFolderVersion() const183 const std::vector<uint8_t> &PbapPceAppParams::GetSecondaryFolderVersion() const
184 {
185 return secondaryFolderVer_;
186 }
187
GetVcardSelector() const188 const uint64_t *PbapPceAppParams::GetVcardSelector() const
189 {
190 if (!vcardSelector_) {
191 return nullptr;
192 }
193 return vcardSelector_.get();
194 }
195
GetDatabaseIdentifier() const196 const std::vector<uint8_t> &PbapPceAppParams::GetDatabaseIdentifier() const
197 {
198 return databaseIdentifier_;
199 }
200
GetVcardSelectorOperator() const201 const uint8_t *PbapPceAppParams::GetVcardSelectorOperator() const
202 {
203 if (!vcardSelectorOp_) {
204 return nullptr;
205 }
206 return vcardSelectorOp_.get();
207 }
208
GetResetNewMissedCalls() const209 const uint8_t *PbapPceAppParams::GetResetNewMissedCalls() const
210 {
211 if (!resetNewMissedCalls_) {
212 return nullptr;
213 }
214 return resetNewMissedCalls_.get();
215 }
216
GetPbapSupportedFeatures() const217 const uint32_t *PbapPceAppParams::GetPbapSupportedFeatures() const
218 {
219 if (!pbapSupportedFeatures_) {
220 return nullptr;
221 }
222 return pbapSupportedFeatures_.get();
223 }
224
SetOrder(uint8_t val)225 void PbapPceAppParams::SetOrder(uint8_t val)
226 {
227 if (!order_) {
228 order_ = std::make_unique<uint8_t>();
229 }
230 *order_ = val;
231 }
232
SetSearchValueUtf8(const std::vector<uint8_t> & val)233 void PbapPceAppParams::SetSearchValueUtf8(const std::vector<uint8_t> &val)
234 {
235 searchValueUtf8_ = val;
236 }
237
SetSearchProperty(uint8_t val)238 void PbapPceAppParams::SetSearchProperty(uint8_t val)
239 {
240 if (!searchProperty_) {
241 searchProperty_ = std::make_unique<uint8_t>();
242 }
243 *searchProperty_ = val;
244 }
245
SetMaxListCount(uint16_t val)246 void PbapPceAppParams::SetMaxListCount(uint16_t val)
247 {
248 if (!maxListCount_) {
249 maxListCount_ = std::make_unique<uint16_t>();
250 }
251 *maxListCount_ = val;
252 }
253
SetListStartOffset(uint16_t val)254 void PbapPceAppParams::SetListStartOffset(uint16_t val)
255 {
256 if (!listStartOffset_) {
257 listStartOffset_ = std::make_unique<uint16_t>();
258 }
259 *listStartOffset_ = val;
260 }
261
SetPropertySelector(uint64_t val)262 void PbapPceAppParams::SetPropertySelector(uint64_t val)
263 {
264 if (!propertySelector_) {
265 propertySelector_ = std::make_unique<uint64_t>();
266 }
267 *propertySelector_ = val;
268 }
269
SetFormat(uint8_t val)270 void PbapPceAppParams::SetFormat(uint8_t val)
271 {
272 if (!format_) {
273 format_ = std::make_unique<uint8_t>();
274 }
275 *format_ = val;
276 }
277
SetPhonebookSize(uint16_t val)278 void PbapPceAppParams::SetPhonebookSize(uint16_t val)
279 {
280 if (!phonebookSize_) {
281 phonebookSize_ = std::make_unique<uint16_t>();
282 }
283 *phonebookSize_ = val;
284 }
285
SetNewMissedCalls(uint8_t val)286 void PbapPceAppParams::SetNewMissedCalls(uint8_t val)
287 {
288 if (!newMissedCalls_) {
289 newMissedCalls_ = std::make_unique<uint8_t>();
290 }
291 *newMissedCalls_ = val;
292 }
293
SetPrimaryFolderVersion(const std::vector<uint8_t> & val)294 void PbapPceAppParams::SetPrimaryFolderVersion(const std::vector<uint8_t> &val)
295 {
296 primaryFolderVer_ = val;
297 }
298
SetSecondaryFolderVersion(const std::vector<uint8_t> & val)299 void PbapPceAppParams::SetSecondaryFolderVersion(const std::vector<uint8_t> &val)
300 {
301 secondaryFolderVer_ = val;
302 }
303
SetVcardSelector(uint64_t val)304 void PbapPceAppParams::SetVcardSelector(uint64_t val)
305 {
306 if (!vcardSelector_) {
307 vcardSelector_ = std::make_unique<uint64_t>();
308 }
309 *vcardSelector_ = val;
310 }
311
SetDatabaseIdentifier(const std::vector<uint8_t> & val)312 void PbapPceAppParams::SetDatabaseIdentifier(const std::vector<uint8_t> &val)
313 {
314 databaseIdentifier_ = val;
315 }
316
SetVcardSelectorOperator(uint8_t val)317 void PbapPceAppParams::SetVcardSelectorOperator(uint8_t val)
318 {
319 if (!vcardSelectorOp_) {
320 vcardSelectorOp_ = std::make_unique<uint8_t>();
321 }
322 *vcardSelectorOp_ = val;
323 }
324
SetResetNewMissedCalls(uint8_t val)325 void PbapPceAppParams::SetResetNewMissedCalls(uint8_t val)
326 {
327 if (!resetNewMissedCalls_) {
328 resetNewMissedCalls_ = std::make_unique<uint8_t>();
329 }
330 *resetNewMissedCalls_ = val;
331 }
332
SetPbapSupportedFeatures(uint32_t val)333 void PbapPceAppParams::SetPbapSupportedFeatures(uint32_t val)
334 {
335 if (!pbapSupportedFeatures_) {
336 pbapSupportedFeatures_ = std::make_unique<uint32_t>();
337 }
338 *pbapSupportedFeatures_ = val;
339 }
340
SetOrderTlv(const ObexTlvParamters & obexTlvParamters)341 void PbapPceAppParams::SetOrderTlv(const ObexTlvParamters &obexTlvParamters)
342 {
343 auto tlv = obexTlvParamters.GetTlvtriplet(ORDER);
344 if (tlv != nullptr) {
345 SetOrder(*tlv->GetVal());
346 }
347 }
348
SetSearchValueUtf8Tlv(const ObexTlvParamters & obexTlvParamters)349 void PbapPceAppParams::SetSearchValueUtf8Tlv(const ObexTlvParamters &obexTlvParamters)
350 {
351 auto tlv = obexTlvParamters.GetTlvtriplet(SEARCH_VALUE);
352 if (tlv != nullptr) {
353 std::vector<uint8_t> data(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
354 SetSearchValueUtf8(data);
355 }
356 }
357
SetSearchPropertyTlv(const ObexTlvParamters & obexTlvParamters)358 void PbapPceAppParams::SetSearchPropertyTlv(const ObexTlvParamters &obexTlvParamters)
359 {
360 auto tlv = obexTlvParamters.GetTlvtriplet(SEARCH_PROPERTY);
361 if (tlv != nullptr) {
362 SetSearchProperty(*tlv->GetVal());
363 }
364 }
365
SetMaxListCountTlv(const ObexTlvParamters & obexTlvParamters)366 void PbapPceAppParams::SetMaxListCountTlv(const ObexTlvParamters &obexTlvParamters)
367 {
368 auto tlv = obexTlvParamters.GetTlvtriplet(MAX_LIST_COUNT);
369 if (tlv != nullptr) {
370 SetMaxListCount(tlv->GetUint16());
371 }
372 }
373
SetListStartOffsetTlv(const ObexTlvParamters & obexTlvParamters)374 void PbapPceAppParams::SetListStartOffsetTlv(const ObexTlvParamters &obexTlvParamters)
375 {
376 auto tlv = obexTlvParamters.GetTlvtriplet(LIST_START_OFFSET);
377 if (tlv != nullptr) {
378 SetListStartOffset(tlv->GetUint16());
379 }
380 }
381
SetPropertySelectorTlv(const ObexTlvParamters & obexTlvParamters)382 void PbapPceAppParams::SetPropertySelectorTlv(const ObexTlvParamters &obexTlvParamters)
383 {
384 auto tlv = obexTlvParamters.GetTlvtriplet(PROPERTY_SELECTOR);
385 if (tlv != nullptr) {
386 SetPropertySelector(tlv->GetUint64());
387 }
388 }
389
SetFormatTlv(const ObexTlvParamters & obexTlvParamters)390 void PbapPceAppParams::SetFormatTlv(const ObexTlvParamters &obexTlvParamters)
391 {
392 auto tlv = obexTlvParamters.GetTlvtriplet(FORMAT);
393 if (tlv != nullptr) {
394 SetFormat(*tlv->GetVal());
395 }
396 }
397
SetPhonebookSizeTlv(const ObexTlvParamters & obexTlvParamters)398 void PbapPceAppParams::SetPhonebookSizeTlv(const ObexTlvParamters &obexTlvParamters)
399 {
400 auto tlv = obexTlvParamters.GetTlvtriplet(PHONEBOOK_SIZE);
401 if (tlv != nullptr) {
402 SetPhonebookSize(tlv->GetUint16());
403 }
404 }
405
SetNewMissedCallsTlv(const ObexTlvParamters & obexTlvParamters)406 void PbapPceAppParams::SetNewMissedCallsTlv(const ObexTlvParamters &obexTlvParamters)
407 {
408 auto tlv = obexTlvParamters.GetTlvtriplet(NEW_MISSED_CALLS);
409 if (tlv != nullptr) {
410 SetNewMissedCalls(*tlv->GetVal());
411 }
412 }
413
SetPrimaryFolderVersionTlv(const ObexTlvParamters & obexTlvParamters)414 void PbapPceAppParams::SetPrimaryFolderVersionTlv(const ObexTlvParamters &obexTlvParamters)
415 {
416 auto tlv = obexTlvParamters.GetTlvtriplet(PRIMARY_FOLDER_VERSION);
417 if (tlv != nullptr) {
418 std::vector<uint8_t> data(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
419 SetPrimaryFolderVersion(data);
420 }
421 }
422
SetSecondaryFolderVersionTlv(const ObexTlvParamters & obexTlvParamters)423 void PbapPceAppParams::SetSecondaryFolderVersionTlv(const ObexTlvParamters &obexTlvParamters)
424 {
425 auto tlv = obexTlvParamters.GetTlvtriplet(SECONDARY_FOLDER_VERSION);
426 if (tlv != nullptr) {
427 std::vector<uint8_t> data(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
428 SetSecondaryFolderVersion(data);
429 }
430 }
431
SetVcardSelectorTlv(const ObexTlvParamters & obexTlvParamters)432 void PbapPceAppParams::SetVcardSelectorTlv(const ObexTlvParamters &obexTlvParamters)
433 {
434 auto tlv = obexTlvParamters.GetTlvtriplet(VCARD_SELECTOR);
435 if (tlv != nullptr) {
436 SetVcardSelector(tlv->GetUint64());
437 }
438 }
439
SetDatabaseIdentifierTlv(const ObexTlvParamters & obexTlvParamters)440 void PbapPceAppParams::SetDatabaseIdentifierTlv(const ObexTlvParamters &obexTlvParamters)
441 {
442 auto tlv = obexTlvParamters.GetTlvtriplet(DATABASE_IDENTIFIER);
443 if (tlv != nullptr) {
444 std::vector<uint8_t> data(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
445 SetDatabaseIdentifier(data);
446 }
447 }
448
SetVcardSelectorOperatorTlv(const ObexTlvParamters & obexTlvParamters)449 void PbapPceAppParams::SetVcardSelectorOperatorTlv(const ObexTlvParamters &obexTlvParamters)
450 {
451 auto tlv = obexTlvParamters.GetTlvtriplet(VCARD_SELECTOR_OPERATOR);
452 if (tlv != nullptr) {
453 SetVcardSelectorOperator(*tlv->GetVal());
454 }
455 }
456
SetResetNewMissedCallsTlv(const ObexTlvParamters & obexTlvParamters)457 void PbapPceAppParams::SetResetNewMissedCallsTlv(const ObexTlvParamters &obexTlvParamters)
458 {
459 auto tlv = obexTlvParamters.GetTlvtriplet(RESET_NEW_MISSED_CALLS);
460 if (tlv != nullptr) {
461 SetResetNewMissedCalls(*tlv->GetVal());
462 }
463 }
464
SetPbapSupportedFeaturesTlv(const ObexTlvParamters & obexTlvParamters)465 void PbapPceAppParams::SetPbapSupportedFeaturesTlv(const ObexTlvParamters &obexTlvParamters)
466 {
467 auto tlv = obexTlvParamters.GetTlvtriplet(PBAP_SUPPORTED_FEATURES);
468 if (tlv != nullptr) {
469 SetPbapSupportedFeatures(tlv->GetUint32());
470 }
471 }
472
AddTlvOrder(ObexTlvParamters & obexTlvParamters) const473 void PbapPceAppParams::AddTlvOrder(ObexTlvParamters &obexTlvParamters) const
474 {
475 if (order_ != nullptr) {
476 obexTlvParamters.AppendTlvtriplet(TlvTriplet(ORDER, *order_));
477 }
478 }
479
AddTlvSearchValueUtf8(ObexTlvParamters & obexTlvParamters) const480 void PbapPceAppParams::AddTlvSearchValueUtf8(ObexTlvParamters &obexTlvParamters) const
481 {
482 if (searchValueUtf8_.size() > 0) {
483 obexTlvParamters.AppendTlvtriplet(TlvTriplet(SEARCH_VALUE, searchValueUtf8_.size(), searchValueUtf8_.data()));
484 }
485 }
486
AddTlvSearchProperty(ObexTlvParamters & obexTlvParamters) const487 void PbapPceAppParams::AddTlvSearchProperty(ObexTlvParamters &obexTlvParamters) const
488 {
489 if (searchProperty_ != nullptr) {
490 obexTlvParamters.AppendTlvtriplet(TlvTriplet(SEARCH_PROPERTY, *searchProperty_));
491 }
492 }
493
AddTlvMaxListCount(ObexTlvParamters & obexTlvParamters) const494 void PbapPceAppParams::AddTlvMaxListCount(ObexTlvParamters &obexTlvParamters) const
495 {
496 if (maxListCount_ != nullptr) {
497 obexTlvParamters.AppendTlvtriplet(TlvTriplet(MAX_LIST_COUNT, *maxListCount_));
498 }
499 }
500
AddTlvListStartOffAddTlv(ObexTlvParamters & obexTlvParamters) const501 void PbapPceAppParams::AddTlvListStartOffAddTlv(ObexTlvParamters &obexTlvParamters) const
502 {
503 if (listStartOffset_ != nullptr) {
504 obexTlvParamters.AppendTlvtriplet(TlvTriplet(LIST_START_OFFSET, *listStartOffset_));
505 }
506 }
507
AddTlvPropertySelector(ObexTlvParamters & obexTlvParamters) const508 void PbapPceAppParams::AddTlvPropertySelector(ObexTlvParamters &obexTlvParamters) const
509 {
510 if (propertySelector_ != nullptr) {
511 obexTlvParamters.AppendTlvtriplet(TlvTriplet(PROPERTY_SELECTOR, *propertySelector_));
512 }
513 }
514
AddTlvFormat(ObexTlvParamters & obexTlvParamters) const515 void PbapPceAppParams::AddTlvFormat(ObexTlvParamters &obexTlvParamters) const
516 {
517 if (format_ != nullptr) {
518 obexTlvParamters.AppendTlvtriplet(TlvTriplet(FORMAT, *format_));
519 }
520 }
521
AddTlvPhonebookSize(ObexTlvParamters & obexTlvParamters) const522 void PbapPceAppParams::AddTlvPhonebookSize(ObexTlvParamters &obexTlvParamters) const
523 {
524 if (phonebookSize_ != nullptr) {
525 obexTlvParamters.AppendTlvtriplet(TlvTriplet(PHONEBOOK_SIZE, *phonebookSize_));
526 }
527 }
528
AddTlvNewMissedCalls(ObexTlvParamters & obexTlvParamters) const529 void PbapPceAppParams::AddTlvNewMissedCalls(ObexTlvParamters &obexTlvParamters) const
530 {
531 if (newMissedCalls_ != nullptr) {
532 obexTlvParamters.AppendTlvtriplet(TlvTriplet(NEW_MISSED_CALLS, *newMissedCalls_));
533 }
534 }
535
AddTlvPrimaryFolderVersion(ObexTlvParamters & obexTlvParamters) const536 void PbapPceAppParams::AddTlvPrimaryFolderVersion(ObexTlvParamters &obexTlvParamters) const
537 {
538 if (primaryFolderVer_.size() > 0) {
539 obexTlvParamters.AppendTlvtriplet(
540 TlvTriplet(PRIMARY_FOLDER_VERSION, primaryFolderVer_.size(), primaryFolderVer_.data()));
541 }
542 }
543
AddTlvSecondaryFolderVersion(ObexTlvParamters & obexTlvParamters) const544 void PbapPceAppParams::AddTlvSecondaryFolderVersion(ObexTlvParamters &obexTlvParamters) const
545 {
546 if (secondaryFolderVer_.size() > 0) {
547 obexTlvParamters.AppendTlvtriplet(
548 TlvTriplet(SECONDARY_FOLDER_VERSION, secondaryFolderVer_.size(), secondaryFolderVer_.data()));
549 }
550 }
551
AddTlvVcardSelector(ObexTlvParamters & obexTlvParamters) const552 void PbapPceAppParams::AddTlvVcardSelector(ObexTlvParamters &obexTlvParamters) const
553 {
554 if (vcardSelector_ != nullptr) {
555 obexTlvParamters.AppendTlvtriplet(TlvTriplet(VCARD_SELECTOR, *vcardSelector_));
556 }
557 }
558
AddTlvDatabaseIdentifier(ObexTlvParamters & obexTlvParamters) const559 void PbapPceAppParams::AddTlvDatabaseIdentifier(ObexTlvParamters &obexTlvParamters) const
560 {
561 if (databaseIdentifier_.size() > 0) {
562 obexTlvParamters.AppendTlvtriplet(
563 TlvTriplet(DATABASE_IDENTIFIER, databaseIdentifier_.size(), databaseIdentifier_.data()));
564 }
565 }
566
AddTlvVcardSelectorOperator(ObexTlvParamters & obexTlvParamters) const567 void PbapPceAppParams::AddTlvVcardSelectorOperator(ObexTlvParamters &obexTlvParamters) const
568 {
569 if (vcardSelectorOp_ != nullptr) {
570 obexTlvParamters.AppendTlvtriplet(TlvTriplet(VCARD_SELECTOR_OPERATOR, *vcardSelectorOp_));
571 }
572 }
573
AddTlvReAddTlvNewMissedCalls(ObexTlvParamters & obexTlvParamters) const574 void PbapPceAppParams::AddTlvReAddTlvNewMissedCalls(ObexTlvParamters &obexTlvParamters) const
575 {
576 if (resetNewMissedCalls_ != nullptr) {
577 obexTlvParamters.AppendTlvtriplet(TlvTriplet(RESET_NEW_MISSED_CALLS, *resetNewMissedCalls_));
578 }
579 }
580
AddTlvPbapSupportedFeatures(ObexTlvParamters & obexTlvParamters) const581 void PbapPceAppParams::AddTlvPbapSupportedFeatures(ObexTlvParamters &obexTlvParamters) const
582 {
583 if (pbapSupportedFeatures_ != nullptr) {
584 obexTlvParamters.AppendTlvtriplet(TlvTriplet(PBAP_SUPPORTED_FEATURES, *pbapSupportedFeatures_));
585 }
586 }
587
588 const uint8_t PbapPceAppParams::ORDER;
589 const uint8_t PbapPceAppParams::SEARCH_VALUE;
590 const uint8_t PbapPceAppParams::SEARCH_PROPERTY;
591 const uint8_t PbapPceAppParams::MAX_LIST_COUNT;
592 const uint8_t PbapPceAppParams::LIST_START_OFFSET;
593 const uint8_t PbapPceAppParams::PROPERTY_SELECTOR;
594 const uint8_t PbapPceAppParams::FORMAT;
595 const uint8_t PbapPceAppParams::PHONEBOOK_SIZE;
596 const uint8_t PbapPceAppParams::NEW_MISSED_CALLS;
597 const uint8_t PbapPceAppParams::PRIMARY_FOLDER_VERSION;
598 const uint8_t PbapPceAppParams::SECONDARY_FOLDER_VERSION;
599 const uint8_t PbapPceAppParams::VCARD_SELECTOR;
600 const uint8_t PbapPceAppParams::DATABASE_IDENTIFIER;
601 const uint8_t PbapPceAppParams::VCARD_SELECTOR_OPERATOR;
602 const uint8_t PbapPceAppParams::RESET_NEW_MISSED_CALLS;
603 const uint8_t PbapPceAppParams::PBAP_SUPPORTED_FEATURES;
604 } // namespace bluetooth
605 } // namespace OHOS
606