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_pse_app_params.h"
17 #include <cstring>
18 #include "pbap_pse_def.h"
19
20 namespace OHOS {
21 namespace bluetooth {
22 const std::map<uint8_t, int> PbapPseAppParams::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 PbapPseAppParams::CheckParams(const ObexTlvParamters &obexTlvParamters)
42 {
43 for (auto &tlv : obexTlvParamters.GetTlvTriplets()) {
44 if (LENS_MAP.find(tlv->GetTagId()) == LENS_MAP.end()) {
45 PBAP_PSE_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_PSE_LOG_ERROR("Wrong Application Parameters header Length for TagId[%{public}x]:expect "
51 "is [%{public}d], actual is [%{public}u].", tlv->GetTagId(), expectLen, tlv->GetLen());
52 return false;
53 }
54 }
55 return true;
56 }
57
Init(const ObexTlvParamters & obexTlvParamters)58 bool PbapPseAppParams::Init(const ObexTlvParamters &obexTlvParamters)
59 {
60 if (!CheckParams(obexTlvParamters)) {
61 return false;
62 }
63 SetOrderTlv(obexTlvParamters);
64 SetSearchValueUtf8Tlv(obexTlvParamters);
65 SetSearchPropertyTlv(obexTlvParamters);
66 SetMaxListCountTlv(obexTlvParamters);
67 SetListStartOffsetTlv(obexTlvParamters);
68 SetPropertySelectorTlv(obexTlvParamters);
69 SetFormatTlv(obexTlvParamters);
70 SetPhonebookSizeTlv(obexTlvParamters);
71 SetNewMissedCallsTlv(obexTlvParamters);
72 SetPrimaryFolderVersionTlv(obexTlvParamters);
73 SetSecondaryFolderVersionTlv(obexTlvParamters);
74 SetVcardSelectorTlv(obexTlvParamters);
75 SetDatabaseIdentifierTlv(obexTlvParamters);
76 SetVcardSelectorOperatorTlv(obexTlvParamters);
77 SetResetNewMissedCallsTlv(obexTlvParamters);
78 SetPbapSupportedFeaturesTlv(obexTlvParamters);
79 return true;
80 }
81
AddToObexHeader(ObexHeader & hdr) const82 void PbapPseAppParams::AddToObexHeader(ObexHeader &hdr) const
83 {
84 ObexTlvParamters obexTlvParamters;
85 AddTlvOrder(obexTlvParamters);
86 AddTlvSearchValueUtf8(obexTlvParamters);
87 AddTlvSearchProperty(obexTlvParamters);
88 AddTlvMaxListCount(obexTlvParamters);
89 AddTlvListStartOffAddTlv(obexTlvParamters);
90 AddTlvPropertySelector(obexTlvParamters);
91 AddTlvFormat(obexTlvParamters);
92 AddTlvPhonebookSize(obexTlvParamters);
93 AddTlvNewMissedCalls(obexTlvParamters);
94 AddTlvPrimaryFolderVersion(obexTlvParamters);
95 AddTlvSecondaryFolderVersion(obexTlvParamters);
96 AddTlvVcardSelector(obexTlvParamters);
97 AddTlvDatabaseIdentifier(obexTlvParamters);
98 AddTlvVcardSelectorOperator(obexTlvParamters);
99 AddTlvReAddTlvNewMissedCalls(obexTlvParamters);
100 AddTlvPbapSupportedFeatures(obexTlvParamters);
101 if (obexTlvParamters.GetTlvTriplets().size() > 0) {
102 hdr.AppendItemAppParams(obexTlvParamters);
103 }
104 }
105
GetOrder() const106 const uint8_t *PbapPseAppParams::GetOrder() const
107 {
108 if (!order_) {
109 return nullptr;
110 }
111 return order_.get();
112 }
113
GetSearchValueUtf8() const114 const std::vector<uint8_t> &PbapPseAppParams::GetSearchValueUtf8() const
115 {
116 return searchValueUtf8_;
117 }
118
GetSearchProperty() const119 const uint8_t *PbapPseAppParams::GetSearchProperty() const
120 {
121 if (!searchProperty_) {
122 return nullptr;
123 }
124 return searchProperty_.get();
125 }
126
GetMaxListCount() const127 const uint16_t *PbapPseAppParams::GetMaxListCount() const
128 {
129 if (!maxListCount_) {
130 return nullptr;
131 }
132 return maxListCount_.get();
133 }
134
GetListStartOffset() const135 const uint16_t *PbapPseAppParams::GetListStartOffset() const
136 {
137 if (!listStartOffset_) {
138 return nullptr;
139 }
140 return listStartOffset_.get();
141 }
142
GetPropertySelector() const143 const uint64_t *PbapPseAppParams::GetPropertySelector() const
144 {
145 if (!propertySelector_) {
146 return nullptr;
147 }
148 return propertySelector_.get();
149 }
150
GetFormat() const151 const uint8_t *PbapPseAppParams::GetFormat() const
152 {
153 if (!format_) {
154 return nullptr;
155 }
156 return format_.get();
157 }
158
GetPhonebookSize() const159 const uint16_t *PbapPseAppParams::GetPhonebookSize() const
160 {
161 if (!phonebookSize_) {
162 return nullptr;
163 }
164 return phonebookSize_.get();
165 }
166
GetNewMissedCalls() const167 const uint8_t *PbapPseAppParams::GetNewMissedCalls() const
168 {
169 if (!newMissedCalls_) {
170 return nullptr;
171 }
172 return newMissedCalls_.get();
173 }
174
GetPrimaryFolderVersion() const175 const std::vector<uint8_t> &PbapPseAppParams::GetPrimaryFolderVersion() const
176 {
177 return primaryFolderVer_;
178 }
179
GetSecondaryFolderVersion() const180 const std::vector<uint8_t> &PbapPseAppParams::GetSecondaryFolderVersion() const
181 {
182 return secondaryFolderVer_;
183 }
184
GetVcardSelector() const185 const uint64_t *PbapPseAppParams::GetVcardSelector() const
186 {
187 if (!vcardSelector_) {
188 return nullptr;
189 }
190 return vcardSelector_.get();
191 }
192
GetDatabaseIdentifier() const193 const std::vector<uint8_t> &PbapPseAppParams::GetDatabaseIdentifier() const
194 {
195 return databaseIdentifier_;
196 }
197
GetVcardSelectorOperator() const198 const uint8_t *PbapPseAppParams::GetVcardSelectorOperator() const
199 {
200 if (!vcardSelectorOp_) {
201 return nullptr;
202 }
203 return vcardSelectorOp_.get();
204 }
205
GetResetNewMissedCalls() const206 const uint8_t *PbapPseAppParams::GetResetNewMissedCalls() const
207 {
208 if (!resetNewMissedCalls_) {
209 return nullptr;
210 }
211 return resetNewMissedCalls_.get();
212 }
213
GetPbapSupportedFeatures() const214 const uint32_t *PbapPseAppParams::GetPbapSupportedFeatures() const
215 {
216 if (!pbapSupportedFeatures_) {
217 return nullptr;
218 }
219 return pbapSupportedFeatures_.get();
220 }
221
SetOrder(uint8_t val)222 void PbapPseAppParams::SetOrder(uint8_t val)
223 {
224 if (!order_) {
225 order_ = std::make_unique<uint8_t>();
226 }
227 *order_ = val;
228 }
229
SetSearchValueUtf8(const std::vector<uint8_t> & val)230 void PbapPseAppParams::SetSearchValueUtf8(const std::vector<uint8_t> &val)
231 {
232 searchValueUtf8_ = val;
233 }
234
SetSearchProperty(uint8_t val)235 void PbapPseAppParams::SetSearchProperty(uint8_t val)
236 {
237 if (!searchProperty_) {
238 searchProperty_ = std::make_unique<uint8_t>();
239 }
240 *searchProperty_ = val;
241 }
242
SetMaxListCount(uint16_t val)243 void PbapPseAppParams::SetMaxListCount(uint16_t val)
244 {
245 if (!maxListCount_) {
246 maxListCount_ = std::make_unique<uint16_t>();
247 }
248 *maxListCount_ = val;
249 }
250
SetListStartOffset(uint16_t val)251 void PbapPseAppParams::SetListStartOffset(uint16_t val)
252 {
253 if (!listStartOffset_) {
254 listStartOffset_ = std::make_unique<uint16_t>();
255 }
256 *listStartOffset_ = val;
257 }
258
SetPropertySelector(uint64_t val)259 void PbapPseAppParams::SetPropertySelector(uint64_t val)
260 {
261 if (!propertySelector_) {
262 propertySelector_ = std::make_unique<uint64_t>();
263 }
264 *propertySelector_ = val;
265 }
266
SetFormat(uint8_t val)267 void PbapPseAppParams::SetFormat(uint8_t val)
268 {
269 if (!format_) {
270 format_ = std::make_unique<uint8_t>();
271 }
272 *format_ = val;
273 }
274
SetPhonebookSize(uint16_t val)275 void PbapPseAppParams::SetPhonebookSize(uint16_t val)
276 {
277 if (!phonebookSize_) {
278 phonebookSize_ = std::make_unique<uint16_t>();
279 }
280 *phonebookSize_ = val;
281 }
282
SetNewMissedCalls(uint8_t val)283 void PbapPseAppParams::SetNewMissedCalls(uint8_t val)
284 {
285 if (!newMissedCalls_) {
286 newMissedCalls_ = std::make_unique<uint8_t>();
287 }
288 *newMissedCalls_ = val;
289 }
290
SetPrimaryFolderVersion(const std::vector<uint8_t> & val)291 void PbapPseAppParams::SetPrimaryFolderVersion(const std::vector<uint8_t> &val)
292 {
293 primaryFolderVer_ = val;
294 }
295
SetSecondaryFolderVersion(const std::vector<uint8_t> & val)296 void PbapPseAppParams::SetSecondaryFolderVersion(const std::vector<uint8_t> &val)
297 {
298 secondaryFolderVer_ = val;
299 }
300
SetVcardSelector(uint64_t val)301 void PbapPseAppParams::SetVcardSelector(uint64_t val)
302 {
303 if (!vcardSelector_) {
304 vcardSelector_ = std::make_unique<uint64_t>();
305 }
306 *vcardSelector_ = val;
307 }
308
SetDatabaseIdentifier(const std::vector<uint8_t> & val)309 void PbapPseAppParams::SetDatabaseIdentifier(const std::vector<uint8_t> &val)
310 {
311 databaseIdentifier_ = val;
312 }
313
SetVcardSelectorOperator(uint8_t val)314 void PbapPseAppParams::SetVcardSelectorOperator(uint8_t val)
315 {
316 if (!vcardSelectorOp_) {
317 vcardSelectorOp_ = std::make_unique<uint8_t>();
318 }
319 *vcardSelectorOp_ = val;
320 }
321
SetResetNewMissedCalls(uint8_t val)322 void PbapPseAppParams::SetResetNewMissedCalls(uint8_t val)
323 {
324 if (!resetNewMissedCalls_) {
325 resetNewMissedCalls_ = std::make_unique<uint8_t>();
326 }
327 *resetNewMissedCalls_ = val;
328 }
329
SetPbapSupportedFeatures(uint32_t val)330 void PbapPseAppParams::SetPbapSupportedFeatures(uint32_t val)
331 {
332 if (!pbapSupportedFeatures_) {
333 pbapSupportedFeatures_ = std::make_unique<uint32_t>();
334 }
335 *pbapSupportedFeatures_ = val;
336 }
337
SetOrderTlv(const ObexTlvParamters & obexTlvParamters)338 void PbapPseAppParams::SetOrderTlv(const ObexTlvParamters &obexTlvParamters)
339 {
340 auto tlv = obexTlvParamters.GetTlvtriplet(ORDER);
341 if (tlv != nullptr) {
342 SetOrder(*tlv->GetVal());
343 }
344 }
345
SetSearchValueUtf8Tlv(const ObexTlvParamters & obexTlvParamters)346 void PbapPseAppParams::SetSearchValueUtf8Tlv(const ObexTlvParamters &obexTlvParamters)
347 {
348 auto tlv = obexTlvParamters.GetTlvtriplet(SEARCH_VALUE);
349 if (tlv != nullptr) {
350 std::vector<uint8_t> datas(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
351 SetSearchValueUtf8(datas);
352 }
353 }
354
SetSearchPropertyTlv(const ObexTlvParamters & obexTlvParamters)355 void PbapPseAppParams::SetSearchPropertyTlv(const ObexTlvParamters &obexTlvParamters)
356 {
357 auto tlv = obexTlvParamters.GetTlvtriplet(SEARCH_PROPERTY);
358 if (tlv != nullptr) {
359 SetSearchProperty(*tlv->GetVal());
360 }
361 }
362
SetMaxListCountTlv(const ObexTlvParamters & obexTlvParamters)363 void PbapPseAppParams::SetMaxListCountTlv(const ObexTlvParamters &obexTlvParamters)
364 {
365 auto tlv = obexTlvParamters.GetTlvtriplet(MAX_LIST_COUNT);
366 if (tlv != nullptr) {
367 SetMaxListCount(tlv->GetUint16());
368 }
369 }
370
SetListStartOffsetTlv(const ObexTlvParamters & obexTlvParamters)371 void PbapPseAppParams::SetListStartOffsetTlv(const ObexTlvParamters &obexTlvParamters)
372 {
373 auto tlv = obexTlvParamters.GetTlvtriplet(LIST_START_OFFSET);
374 if (tlv != nullptr) {
375 SetListStartOffset(tlv->GetUint16());
376 }
377 }
378
SetPropertySelectorTlv(const ObexTlvParamters & obexTlvParamters)379 void PbapPseAppParams::SetPropertySelectorTlv(const ObexTlvParamters &obexTlvParamters)
380 {
381 auto tlv = obexTlvParamters.GetTlvtriplet(PROPERTY_SELECTOR);
382 if (tlv != nullptr) {
383 SetPropertySelector(tlv->GetUint64());
384 }
385 }
386
SetFormatTlv(const ObexTlvParamters & obexTlvParamters)387 void PbapPseAppParams::SetFormatTlv(const ObexTlvParamters &obexTlvParamters)
388 {
389 auto tlv = obexTlvParamters.GetTlvtriplet(FORMAT);
390 if (tlv != nullptr) {
391 SetFormat(*tlv->GetVal());
392 }
393 }
394
SetPhonebookSizeTlv(const ObexTlvParamters & obexTlvParamters)395 void PbapPseAppParams::SetPhonebookSizeTlv(const ObexTlvParamters &obexTlvParamters)
396 {
397 auto tlv = obexTlvParamters.GetTlvtriplet(PHONEBOOK_SIZE);
398 if (tlv != nullptr) {
399 SetPhonebookSize(tlv->GetUint16());
400 }
401 }
402
SetNewMissedCallsTlv(const ObexTlvParamters & obexTlvParamters)403 void PbapPseAppParams::SetNewMissedCallsTlv(const ObexTlvParamters &obexTlvParamters)
404 {
405 auto tlv = obexTlvParamters.GetTlvtriplet(NEW_MISSED_CALLS);
406 if (tlv != nullptr) {
407 SetNewMissedCalls(*tlv->GetVal());
408 }
409 }
410
SetPrimaryFolderVersionTlv(const ObexTlvParamters & obexTlvParamters)411 void PbapPseAppParams::SetPrimaryFolderVersionTlv(const ObexTlvParamters &obexTlvParamters)
412 {
413 auto tlv = obexTlvParamters.GetTlvtriplet(PRIMARY_FOLDER_VERSION);
414 if (tlv != nullptr) {
415 std::vector<uint8_t> datas(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
416 SetPrimaryFolderVersion(datas);
417 }
418 }
419
SetSecondaryFolderVersionTlv(const ObexTlvParamters & obexTlvParamters)420 void PbapPseAppParams::SetSecondaryFolderVersionTlv(const ObexTlvParamters &obexTlvParamters)
421 {
422 auto tlv = obexTlvParamters.GetTlvtriplet(SECONDARY_FOLDER_VERSION);
423 if (tlv != nullptr) {
424 std::vector<uint8_t> datas(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
425 SetSecondaryFolderVersion(datas);
426 }
427 }
428
SetVcardSelectorTlv(const ObexTlvParamters & obexTlvParamters)429 void PbapPseAppParams::SetVcardSelectorTlv(const ObexTlvParamters &obexTlvParamters)
430 {
431 auto tlv = obexTlvParamters.GetTlvtriplet(VCARD_SELECTOR);
432 if (tlv != nullptr) {
433 SetVcardSelector(tlv->GetUint64());
434 }
435 }
436
SetDatabaseIdentifierTlv(const ObexTlvParamters & obexTlvParamters)437 void PbapPseAppParams::SetDatabaseIdentifierTlv(const ObexTlvParamters &obexTlvParamters)
438 {
439 auto tlv = obexTlvParamters.GetTlvtriplet(DATABASE_IDENTIFIER);
440 if (tlv != nullptr) {
441 std::vector<uint8_t> datas(tlv->GetVal(), tlv->GetVal() + tlv->GetLen());
442 SetDatabaseIdentifier(datas);
443 }
444 }
445
SetVcardSelectorOperatorTlv(const ObexTlvParamters & obexTlvParamters)446 void PbapPseAppParams::SetVcardSelectorOperatorTlv(const ObexTlvParamters &obexTlvParamters)
447 {
448 auto tlv = obexTlvParamters.GetTlvtriplet(VCARD_SELECTOR_OPERATOR);
449 if (tlv != nullptr) {
450 SetVcardSelectorOperator(*tlv->GetVal());
451 }
452 }
453
SetResetNewMissedCallsTlv(const ObexTlvParamters & obexTlvParamters)454 void PbapPseAppParams::SetResetNewMissedCallsTlv(const ObexTlvParamters &obexTlvParamters)
455 {
456 auto tlv = obexTlvParamters.GetTlvtriplet(RESET_NEW_MISSED_CALLS);
457 if (tlv != nullptr) {
458 SetResetNewMissedCalls(*tlv->GetVal());
459 }
460 }
461
SetPbapSupportedFeaturesTlv(const ObexTlvParamters & obexTlvParamters)462 void PbapPseAppParams::SetPbapSupportedFeaturesTlv(const ObexTlvParamters &obexTlvParamters)
463 {
464 auto tlv = obexTlvParamters.GetTlvtriplet(PBAP_SUPPORTED_FEATURES);
465 if (tlv != nullptr) {
466 SetPbapSupportedFeatures(tlv->GetUint32());
467 }
468 }
469
AddTlvOrder(ObexTlvParamters & obexTlvParamters) const470 void PbapPseAppParams::AddTlvOrder(ObexTlvParamters &obexTlvParamters) const
471 {
472 if (order_ != nullptr) {
473 obexTlvParamters.AppendTlvtriplet(TlvTriplet(ORDER, *order_));
474 }
475 }
476
AddTlvSearchValueUtf8(ObexTlvParamters & obexTlvParamters) const477 void PbapPseAppParams::AddTlvSearchValueUtf8(ObexTlvParamters &obexTlvParamters) const
478 {
479 if (searchValueUtf8_.size() > 0) {
480 obexTlvParamters.AppendTlvtriplet(TlvTriplet(SEARCH_VALUE, searchValueUtf8_.size(), searchValueUtf8_.data()));
481 }
482 }
483
AddTlvSearchProperty(ObexTlvParamters & obexTlvParamters) const484 void PbapPseAppParams::AddTlvSearchProperty(ObexTlvParamters &obexTlvParamters) const
485 {
486 if (searchProperty_ != nullptr) {
487 obexTlvParamters.AppendTlvtriplet(TlvTriplet(SEARCH_PROPERTY, *searchProperty_));
488 }
489 }
490
AddTlvMaxListCount(ObexTlvParamters & obexTlvParamters) const491 void PbapPseAppParams::AddTlvMaxListCount(ObexTlvParamters &obexTlvParamters) const
492 {
493 if (maxListCount_ != nullptr) {
494 obexTlvParamters.AppendTlvtriplet(TlvTriplet(MAX_LIST_COUNT, *maxListCount_));
495 }
496 }
497
AddTlvListStartOffAddTlv(ObexTlvParamters & obexTlvParamters) const498 void PbapPseAppParams::AddTlvListStartOffAddTlv(ObexTlvParamters &obexTlvParamters) const
499 {
500 if (listStartOffset_ != nullptr) {
501 obexTlvParamters.AppendTlvtriplet(TlvTriplet(LIST_START_OFFSET, *listStartOffset_));
502 }
503 }
504
AddTlvPropertySelector(ObexTlvParamters & obexTlvParamters) const505 void PbapPseAppParams::AddTlvPropertySelector(ObexTlvParamters &obexTlvParamters) const
506 {
507 if (propertySelector_ != nullptr) {
508 obexTlvParamters.AppendTlvtriplet(TlvTriplet(PROPERTY_SELECTOR, *propertySelector_));
509 }
510 }
511
AddTlvFormat(ObexTlvParamters & obexTlvParamters) const512 void PbapPseAppParams::AddTlvFormat(ObexTlvParamters &obexTlvParamters) const
513 {
514 if (format_ != nullptr) {
515 obexTlvParamters.AppendTlvtriplet(TlvTriplet(FORMAT, *format_));
516 }
517 }
518
AddTlvPhonebookSize(ObexTlvParamters & obexTlvParamters) const519 void PbapPseAppParams::AddTlvPhonebookSize(ObexTlvParamters &obexTlvParamters) const
520 {
521 if (phonebookSize_ != nullptr) {
522 obexTlvParamters.AppendTlvtriplet(TlvTriplet(PHONEBOOK_SIZE, *phonebookSize_));
523 }
524 }
525
AddTlvNewMissedCalls(ObexTlvParamters & obexTlvParamters) const526 void PbapPseAppParams::AddTlvNewMissedCalls(ObexTlvParamters &obexTlvParamters) const
527 {
528 if (newMissedCalls_ != nullptr) {
529 obexTlvParamters.AppendTlvtriplet(TlvTriplet(NEW_MISSED_CALLS, *newMissedCalls_));
530 }
531 }
532
AddTlvPrimaryFolderVersion(ObexTlvParamters & obexTlvParamters) const533 void PbapPseAppParams::AddTlvPrimaryFolderVersion(ObexTlvParamters &obexTlvParamters) const
534 {
535 if (primaryFolderVer_.size() > 0) {
536 obexTlvParamters.AppendTlvtriplet(
537 TlvTriplet(PRIMARY_FOLDER_VERSION, primaryFolderVer_.size(), primaryFolderVer_.data()));
538 }
539 }
540
AddTlvSecondaryFolderVersion(ObexTlvParamters & obexTlvParamters) const541 void PbapPseAppParams::AddTlvSecondaryFolderVersion(ObexTlvParamters &obexTlvParamters) const
542 {
543 if (secondaryFolderVer_.size() > 0) {
544 obexTlvParamters.AppendTlvtriplet(
545 TlvTriplet(SECONDARY_FOLDER_VERSION, secondaryFolderVer_.size(), secondaryFolderVer_.data()));
546 }
547 }
548
AddTlvVcardSelector(ObexTlvParamters & obexTlvParamters) const549 void PbapPseAppParams::AddTlvVcardSelector(ObexTlvParamters &obexTlvParamters) const
550 {
551 if (vcardSelector_ != nullptr) {
552 obexTlvParamters.AppendTlvtriplet(TlvTriplet(VCARD_SELECTOR, *vcardSelector_));
553 }
554 }
555
AddTlvDatabaseIdentifier(ObexTlvParamters & obexTlvParamters) const556 void PbapPseAppParams::AddTlvDatabaseIdentifier(ObexTlvParamters &obexTlvParamters) const
557 {
558 if (databaseIdentifier_.size() > 0) {
559 obexTlvParamters.AppendTlvtriplet(
560 TlvTriplet(DATABASE_IDENTIFIER, databaseIdentifier_.size(), databaseIdentifier_.data()));
561 }
562 }
563
AddTlvVcardSelectorOperator(ObexTlvParamters & obexTlvParamters) const564 void PbapPseAppParams::AddTlvVcardSelectorOperator(ObexTlvParamters &obexTlvParamters) const
565 {
566 if (vcardSelectorOp_ != nullptr) {
567 obexTlvParamters.AppendTlvtriplet(TlvTriplet(VCARD_SELECTOR_OPERATOR, *vcardSelectorOp_));
568 }
569 }
570
AddTlvReAddTlvNewMissedCalls(ObexTlvParamters & obexTlvParamters) const571 void PbapPseAppParams::AddTlvReAddTlvNewMissedCalls(ObexTlvParamters &obexTlvParamters) const
572 {
573 if (resetNewMissedCalls_ != nullptr) {
574 obexTlvParamters.AppendTlvtriplet(TlvTriplet(RESET_NEW_MISSED_CALLS, *resetNewMissedCalls_));
575 }
576 }
577
AddTlvPbapSupportedFeatures(ObexTlvParamters & obexTlvParamters) const578 void PbapPseAppParams::AddTlvPbapSupportedFeatures(ObexTlvParamters &obexTlvParamters) const
579 {
580 if (pbapSupportedFeatures_ != nullptr) {
581 obexTlvParamters.AppendTlvtriplet(TlvTriplet(PBAP_SUPPORTED_FEATURES, *pbapSupportedFeatures_));
582 }
583 }
584
585 const uint8_t PbapPseAppParams::ORDER;
586 const uint8_t PbapPseAppParams::SEARCH_VALUE;
587 const uint8_t PbapPseAppParams::SEARCH_PROPERTY;
588 const uint8_t PbapPseAppParams::MAX_LIST_COUNT;
589 const uint8_t PbapPseAppParams::LIST_START_OFFSET;
590 const uint8_t PbapPseAppParams::PROPERTY_SELECTOR;
591 const uint8_t PbapPseAppParams::FORMAT;
592 const uint8_t PbapPseAppParams::PHONEBOOK_SIZE;
593 const uint8_t PbapPseAppParams::NEW_MISSED_CALLS;
594 const uint8_t PbapPseAppParams::PRIMARY_FOLDER_VERSION;
595 const uint8_t PbapPseAppParams::SECONDARY_FOLDER_VERSION;
596 const uint8_t PbapPseAppParams::VCARD_SELECTOR;
597 const uint8_t PbapPseAppParams::DATABASE_IDENTIFIER;
598 const uint8_t PbapPseAppParams::VCARD_SELECTOR_OPERATOR;
599 const uint8_t PbapPseAppParams::RESET_NEW_MISSED_CALLS;
600 const uint8_t PbapPseAppParams::PBAP_SUPPORTED_FEATURES;
601 } // namespace bluetooth
602 } // namespace OHOS
603