• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 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 /**
17  * @addtogroup Bluetooth
18  * @{
19  *
20  * @brief Defines map client service instance request object.
21  *
22  */
23 
24 /**
25  * @file map_mce_instance_request.h
26  *
27  * @brief map client service instance request header file .
28  *
29  */
30 
31 #ifndef MAP_MCE_INSTANCE_REQUEST_H
32 #define MAP_MCE_INSTANCE_REQUEST_H
33 
34 #include <cstdint>
35 #include <list>
36 #include <string>
37 #include <vector>
38 #include "../obex/obex_headers.h"
39 #include "../obex/obex_mp_client.h"
40 #include "bt_def.h"
41 #include "map_mce_data_analyse.h"
42 #include "map_mce_parameter.h"
43 #include "map_mce_types.h"
44 
45 namespace OHOS {
46 namespace bluetooth {
47 class MapMceInstanceClient;
48 #define MCE_DEBUG_SEND_DATA
49 #define MCE_DEBUG_RECEIVE_DATA
50 
51 enum MapMceSetPathEnum {
52     // SetFolder Function Flags Enum
53     MASSTM_SETPATH_DOWN = 0x02,                 // Go down 1 level
54     MASSTM_SETPATH_ROOT = MASSTM_SETPATH_DOWN,  // Go back to root
55     MASSTM_SETPATH_UP = 0x03,                   // Go up 1 level
56     MASSTM_SETPATH_LIST = 0x04                  // multi path
57 };
58 
59 enum MceClientResExcuteType {
60     MCE_RESPONSE_CONTINUE_NO_CALLBACK,
61     MCE_RESPONSE_CONTINUE_WITH_CALLBACK,
62     MCE_RESPONSE_FINISH,  // OK or NG
63     MCE_RESPONSE_FINISH_NO_CALLBACK,
64     MCE_RESPONSE_FINISH_NG  // NG
65 };
66 
67 struct MasInstanceInformation {
68     bool isValid = false;
69     std::string ownerUciUtf8 = "";
70     std::string masInstanceInfoUtf8 = "";
71 };
72 
73 struct MapRequestResponseAction {
74     MapActionType action_ {};
75     int supportedFeatures = 0;
76     IProfileOwnerStatus ownerStatus_ {};
77     MceTypesBMessage bmessage_ {};
78     MceTypesMessagesListing messageList_ {};
79     MceTypesConversationListing conversationList_ {};
80 };
81 
82 // Tag Id
83 static const uint8_t MCE_MAX_LIST_COUNT = 0x01;
84 static const uint8_t MCE_LIST_START_OFF_SET = 0x02;
85 static const uint8_t MCE_FILTER_MESSAGE_TYPE = 0x03;
86 static const uint8_t MCE_FILTER_PERIOD_BEGIN = 0x04;
87 static const uint8_t MCE_FILTER_PERIOD_END = 0x05;
88 static const uint8_t MCE_FILTER_READ_STATUS = 0x06;
89 static const uint8_t MCE_FILTER_RECIPIENT = 0x07;
90 static const uint8_t MCE_FILTER_ORIGINATOR = 0x08;
91 static const uint8_t MCE_FILTER_PRIORITY = 0x09;
92 static const uint8_t MCE_ATTACHMENT = 0x0A;
93 static const uint8_t MCE_TRANSPARENT = 0x0B;
94 static const uint8_t MCE_RETRY = 0x0C;
95 static const uint8_t MCE_NEW_MESSAGE = 0x0D;
96 static const uint8_t MCE_NOTIFICATION_STATUS = 0x0E;
97 static const uint8_t MCE_MAS_INSTANCEID = 0x0F;
98 // Tag Length
99 static const uint8_t MCE_MAX_LIST_COUNT_LENGTH = 0x02;
100 static const uint8_t MCE_LIST_START_OFF_SET_LENGTH = 0x02;
101 static const uint8_t MCE_FILTER_MESSAGE_TYPE_LENGTH = 0x01;
102 static const uint8_t MCE_FILTER_PERIOD_BEGIN_LENGTH = 0x10;
103 static const uint8_t MCE_FILTER_PERIOD_END_LENGTH = 0x10;
104 static const uint8_t MCE_FILTER_READ_STATUS_LENGTH = 0x01;
105 static const uint8_t MCE_FILTER_PRIORITY_LENGTH = 0x01;
106 static const uint8_t MCE_ATTACHMENT_LENGTH = 0x01;
107 static const uint8_t MCE_TRANSPARENT_LENGTH = 0x01;
108 static const uint8_t MCE_RETRY_LENGTH = 0x01;
109 static const uint8_t MCE_NEW_MESSAGE_LENGTH = 0x01;
110 static const uint8_t MCE_NOTIFICATION_STATUS_LENGTH = 0x01;
111 static const uint8_t MCE_MAS_INSTANCEID_LENGTH = 0x01;
112 
113 // Tag Id
114 static const uint8_t MCE_PARAMETER_MASK = 0x10;
115 static const uint8_t MCE_FOLDER_LISTING_SIZE = 0x11;
116 static const uint8_t MCE_LISTING_SIZE = 0x12;
117 static const uint8_t MCE_SUBJECT_LENGTH = 0x13;
118 static const uint8_t MCE_CHARSET = 0x14;
119 static const uint8_t MCE_FRACTION_REQUEST = 0x15;
120 static const uint8_t MCE_FRACTION_DELIVER = 0x16;
121 static const uint8_t MCE_STATUS_INDICATOR = 0x17;
122 static const uint8_t MCE_STATUS_VALUE = 0x18;
123 static const uint8_t MCE_MSE_TIME = 0x19;
124 static const uint8_t MCE_DATABASE_IDENTIFIER = 0x1A;
125 static const uint8_t MCE_CONVERSATION_LISTING_VERSION_COUNTER = 0x1B;
126 static const uint8_t MCE_PRESENCE_AVAILABILITY = 0x1C;
127 static const uint8_t MCE_PRESENCE_TEXT = 0x1D;
128 static const uint8_t MCE_LAST_ACTIVITY = 0x1E;
129 static const uint8_t MCE_FILTER_LAST_ACTIVITY_BEGIN = 0x1F;
130 static const uint8_t MCE_FILTER_LAST_ACTIVITY_END = 0x20;
131 // Tag Length
132 static const uint8_t MCE_PARAMETER_MASK_LENGTH = 0x04;
133 static const uint8_t MCE_FOLDER_LISTING_SIZE_LENGTH = 0x02;
134 static const uint8_t MCE_LISTING_SIZE_LENGTH = 0x02;
135 static const uint8_t MCE_SUBJECT_LENGTH_LENGTH = 0x01;
136 static const uint8_t MCE_CHARSET_LENGTH = 0x01;
137 static const uint8_t MCE_FRACTION_REQUEST_LENGTH = 0x01;
138 static const uint8_t MCE_FRACTION_DELIVER_LENGTH = 0x01;
139 static const uint8_t MCE_STATUS_INDICATOR_LENGTH = 0x01;
140 static const uint8_t MCE_STATUS_VALUE_LENGTH = 0x01;
141 static const uint8_t MCE_DATABASE_IDENTIFIER_LENGTH = 0x80;
142 static const uint8_t MCE_CONVERSATION_LISTING_VERSION_COUNTER_LENGTH = 0x80;
143 static const uint8_t MCE_PRESENCE_AVAILABILITY_LENGTH = 0x01;
144 
145 // Tag Id
146 static const uint8_t MCE_CHAT_STATE = 0x21;
147 static const uint8_t MCE_CONVERSATION_ID = 0x22;
148 static const uint8_t MCE_FOLDER_VERSION_COUNTER = 0x23;
149 static const uint8_t MCE_FILTER_MESSAGE_HANDLE = 0x24;
150 static const uint8_t MCE_NOTIFICATION_FILTER_MASK = 0x25;
151 static const uint8_t MCE_CONV_PARAMETER_MASK = 0x26;
152 static const uint8_t MCE_OWNER_UCI = 0x27;
153 static const uint8_t MCE_EXTENDED_DATA = 0x28;
154 static const uint8_t MCE_MAP_SUPPORTED_FEATURES = 0x29;
155 static const uint8_t MCE_MESSAGE_HANDLE = 0x2A;
156 static const uint8_t MCE_MODIFY_TEXT = 0x2B;
157 // Tag Length
158 static const uint8_t MCE_CHAT_STATE_LENGTH = 0x01;
159 static const uint8_t MCE_CONVERSATION_ID_LENGTH = 0x80;
160 static const uint8_t MCE_FOLDER_VERSION_COUNTER_LENGTH = 0x80;
161 static const uint8_t MCE_FILTER_MESSAGE_HANDLE_LENGTH = 0x40;
162 static const uint8_t MCE_NOTIFICATION_FILTER_MASK_LENGTH = 0x04;
163 static const uint8_t MCE_CONV_PARAMETER_MASK_LENGTH = 0x04;
164 static const uint8_t MCE_MAP_SUPPORTED_FEATURES_LENGTH = 0x04;
165 static const uint8_t MCE_MESSAGE_HANDLE_LENGTH = 0x40;
166 static const uint8_t MCE_MODIFY_TEXT_LENGTH = 0x01;
167 
168 // folder names
169 const std::u16string MCE_FOLDER_TELECOM = u"telecom";
170 const std::u16string MCE_FOLDER_MSG = u"msg";  // telecom/msg/inbox
171 
172 // request type
173 const std::string MCE_HEADER_TYPE_SET_NOTIFICATION_FILTER = "x-bt/MAP-notification-filter";
174 const std::string MCE_HEADER_TYPE_SET_NOTIFICATION_REGISTRATION = "x-bt/MAP-NotificationRegistration";
175 const std::string MCE_HEADER_TYPE_GET_FOLDER_LISTING = "x-obex/folder-listing";
176 const std::string MCE_HEADER_TYPE_GET_MESSAGE_LISTING = "x-bt/MAP-msg-listing";
177 const std::string MCE_HEADER_TYPE_GET_CONVO_LISTING = "x-bt/MAP-convo-listing";
178 const std::string MCE_HEADER_TYPE_MESSAGE = "x-bt/message";
179 const std::string MCE_HEADER_TYPE_SET_MESSAGE_STATUS = "x-bt/messageStatus";
180 const std::string MCE_HEADER_TYPE_MESSAGE_UPDATE = "x-bt/MAP-messageUpdate";
181 const std::string MCE_HEADER_TYPE_GET_MAS_INSTANCE_INFORMATION = "x-bt/MASInstanceInformation";
182 const std::string MCE_HEADER_TYPE_SET_OWNER_STATUS = "x-bt/ownerStatus";
183 
184 /**
185  * @brief config data
186  */
187 struct MapMceRequestConfig {
188     bool isUseSrmp = false;
189     int srmpCount = 0;
190     int maxOfGetUnread = 100;
191 };
192 
193 /**
194  * @brief Mce InstanceClient request base
195  */
196 class MapMceInstanceRequest {
197 public:
198     /**
199      * @brief Construct a new Map Mce Instance Request object
200      */
201     MapMceInstanceRequest();
202     /**
203      * @brief Destroy the Map Mce Instance Request object
204      */
205     virtual ~MapMceInstanceRequest();
206     /**
207      * @brief Get the Request Type object
208      * @return MceRequestType
209      */
210     virtual MceRequestType GetRequestType() = 0;
211     /**
212      * @brief  Send Request
213      * @param  obexIns  obex object
214      * @return int
215      */
216     virtual int SendRequest(ObexMpClient &obexIns) = 0;
217     /**
218      * @brief  Process Response
219      * @param  clientInst   obex object
220      * @param  resp         obex header
221      * @param  retAction    action
222      * @return int
223      */
224     virtual int ProcessResponse(
225         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) = 0;
226     /**
227      * @brief Set the Support Message Type object
228      * @param  type   message type
229      */
230     void SetSupportMessageType(int type);
231     /**
232      * @brief Get the Support Message Type object
233      * @return int
234      */
235     int GetSupportMessageType() const;
236     /**
237      * @brief Set the Owner Uci object
238      * @param  owner   Owner Uci
239      */
240     void SetOwnerUci(const std::string &owner);
241     /**
242      * @brief Get the Owner Uci object
243      * @return std::string Owner Uci
244      */
245     std::string GetOwnerUci() const;
246     /**
247      * @brief Save Request
248      */
249     void SaveReq();
250     /**
251      * @brief Set the Request Config object
252      * @param  cfg        request config
253      */
254     void SetRequestConfig(MapMceRequestConfig cfg);
255     /**
256      * @brief Get the Request Config object
257      * @return Request Config
258      */
259     MapMceRequestConfig GetRequestConfig() const;
260 
261 protected:
262     /**
263      * @brief  Trans MapMessageType To IprofileMask
264      * @param  type     Message Type
265      * @return int
266      */
267     int MapMessageTypeToIprofileMask(MapMessageType type) const;
268     /**
269      * @brief Trans MapMessageType To FrameworkMask
270      * @param  type     Message Type
271      * @return int
272      */
273     int MapMessageTypeToFrameworkMask(MapMessageType type) const;
274     /**
275      * @brief  Trans IprofileMask To MapMessageType
276      * @param  mask      IprofileMask
277      * @return  MessageType
278      */
279     MapMessageType IprofileMaskToMapMessageType(int mask) const;
280 
281 private:
282     // saved flag
283     bool saveFlag_ = false;
284     // message type
285     int messageType_ = 0;
286     // owner uci name
287     std::string ownerUci_ = "";
288     // config parameter
289     MapMceRequestConfig config_ {};
290 };
291 
292 /**
293  * @brief Request SetNotificationFilter
294  */
295 class MapMceRequestSetNotificationFilter : public MapMceInstanceRequest {
296 public:
297     /**
298      * @brief Construct a new Map Mce Request Set Notification Filter object
299      * @param  mask             mask value
300      */
301     explicit MapMceRequestSetNotificationFilter(const int mask);
302     /**
303      * @brief Destroy the Map Mce Request Set Notification Filter object
304      */
305     ~MapMceRequestSetNotificationFilter() override;
306     /**
307      * @brief Get the Request Type object
308      * @return MceRequestType
309      */
310     MceRequestType GetRequestType() override;
311     /**
312      * @brief  Send Request process
313      * @param  obexIns          obex client
314      * @return int
315      */
316     int SendRequest(ObexMpClient &obexIns) override;
317     /**
318      * @brief  Process Response
319      * @param  clientInst       obex client object
320      * @param  resp             ObexHeader
321      * @param  retAction        action observer data
322      * @return int
323      */
324     int ProcessResponse(
325         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
326 
327 private:
328     int notificationFilterMask_ = 0;
329 };
330 
331 /**
332  * @brief Request SetNotificationRegistration
333  */
334 class MapMceRequestSetNotificationRegistration : public MapMceInstanceRequest {
335 public:
336     /**
337      * @brief Construct a new Map Mce Request Set Notification Registration object
338      * @param  on               on / off
339      */
340     explicit MapMceRequestSetNotificationRegistration(bool on);
341     /**
342      * @brief Destroy the Map Mce Request Set Notification Registration object
343      */
344     ~MapMceRequestSetNotificationRegistration() override;
345     /**
346      * @brief Get the Request Type object
347      * @return MceRequestType
348      */
349     MceRequestType GetRequestType() override;
350     /**
351      * @brief  Send Request process
352      * @param  obexIns          obex client
353      * @return int
354      */
355     int SendRequest(ObexMpClient &obexIns) override;
356     /**
357      * @brief  Process Response
358      * @param  clientInst       obex client object
359      * @param  resp             ObexHeader
360      * @param  retAction        action observer data
361      * @return int
362      */
363     int ProcessResponse(
364         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
365 
366 private:
367     bool setupValue_ = false;
368 };
369 
370 /**
371  * @brief Request GetMasInstanceInformation
372  */
373 class MapMceRequestGetMasInstanceInformation : public MapMceInstanceRequest {
374 public:
375     /**
376      * @brief Construct a new Map Mce Request Get Mas Instance Information object
377      * @param  instId           instance id
378      */
379     explicit MapMceRequestGetMasInstanceInformation(uint8_t instId);
380     /**
381      * @brief Destroy the Map Mce Request Get Mas Instance Information object
382      */
383     ~MapMceRequestGetMasInstanceInformation() override;
384     /**
385      * @brief Get the Request Type object
386      * @return MceRequestType
387      */
388     MceRequestType GetRequestType() override;
389     /**
390      * @brief  Send Request process
391      * @param  obexIns          obex client
392      * @return int
393      */
394     int SendRequest(ObexMpClient &obexIns) override;
395     /**
396      * @brief  Process Response
397      * @param  clientInst       obex client object
398      * @param  resp             ObexHeader
399      * @param  retAction        action observer data
400      * @return int
401      */
402     int ProcessResponse(
403         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
404 
405 private:
406     // instance id
407     uint8_t instanceId_ = 0;
408 };
409 
410 /**
411  * @brief Request GetGetFolderListing
412  */
413 class MapMceRequestGetFolderListing : public MapMceInstanceRequest {
414 public:
415     /**
416      * @brief Construct a new Map Mce Request Get Folder Listing object
417      * @param  listCnt          list count
418      * @param  offset           offset
419      */
420     MapMceRequestGetFolderListing(uint16_t listCnt, uint16_t offset);
421     /**
422      * @brief Destroy the Map Mce Request Get Folder Listing object
423      */
424     ~MapMceRequestGetFolderListing() override;
425     /**
426      * @brief Get the Request Type object
427      * @return MceRequestType
428      */
429     MceRequestType GetRequestType() override;
430     /**
431      * @brief  Send Request process
432      * @param  obexIns          obex client
433      * @return int
434      */
435     int SendRequest(ObexMpClient &obexIns) override;
436     /**
437      * @brief  Process Response
438      * @param  clientInst       obex client object
439      * @param  resp             ObexHeader
440      * @param  retAction        action observer data
441      * @return int
442      */
443     int ProcessResponse(
444         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
445 
446 private:
447     // max of list count
448     uint16_t maxOfListCount_ = 0;
449     // start offset
450     uint16_t startOffset_ = 0;
451     // list size
452     uint16_t listSize_ = 0;
453     // folder list parameter
454     IProfileFolderListing folderListingParam_ {};
455 };
456 
457 /**
458  * @brief Request SetPath
459  */
460 class MapMceRequestSetPath : public MapMceInstanceRequest {
461 public:
462     /**
463      * @brief Construct a new Map Mce Request Set Path object
464      * @param  flags            setpath type
465      * @param  paths            path string
466      * @param  pathsList        path string list
467      */
468     MapMceRequestSetPath(uint8_t flags, const std::u16string &paths, const std::vector<std::u16string> &pathsList);
469     /**
470      * @brief Destroy the Map Mce Request Set Path object
471      */
472     ~MapMceRequestSetPath() override;
473     /**
474      * @brief Get the Request Type object
475      * @return MceRequestType
476      */
477     MceRequestType GetRequestType() override;
478     /**
479      * @brief  Send Request process
480      * @param  obexIns          obex client
481      * @return int
482      */
483     int SendRequest(ObexMpClient &obexIns) override;
484     /**
485      * @brief  Process Response
486      * @param  clientInst       obex client object
487      * @param  resp             ObexHeader
488      * @param  retAction        action observer data
489      * @return int
490      */
491     int ProcessResponse(
492         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
493 
494 private:
495     uint8_t pathFlags_ = 0;
496     std::u16string pathsString_ = u"";
497     std::vector<std::u16string> pathsList_ {};
498 };
499 
500 /**
501  * @brief Request Push Message
502  */
503 class MapMceRequestPushMessage : public MapMceInstanceRequest {
504 public:
505     explicit MapMceRequestPushMessage(const IProfileSendMessageParameters &msg);
506     ~MapMceRequestPushMessage() override;
507     MceRequestType GetRequestType() override;
508     int SendRequest(ObexMpClient &obexIns) override;
509     int ProcessResponse(
510         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
511 
512 private:
513     IProfileSendMessageParameters messageParam_ {};
514 };
515 
516 /**
517  * @brief Request Push Message
518  */
519 class MapMceRequestGetMessage : public MapMceInstanceRequest {
520 public:
521     MapMceRequestGetMessage(const std::u16string &msgHandle, const IProfileGetMessageParameters &para);
522     ~MapMceRequestGetMessage() override;
523     MceRequestType GetRequestType() override;
524     int SendRequest(ObexMpClient &obexIns) override;
525     int ProcessResponse(
526         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
527 
528 private:
529     std::u16string msgHandle_ = u"";
530     IProfileGetMessageParameters msgPara_ {};
531     std::ostringstream stream_ {};
532 };
533 
534 /**
535  * @brief Request Get Update Inbox
536  */
537 class MapMceRequestUpdateInbox : public MapMceInstanceRequest {
538 public:
539     MapMceRequestUpdateInbox();
540     ~MapMceRequestUpdateInbox() override;
541     MceRequestType GetRequestType() override;
542     int SendRequest(ObexMpClient &obexIns) override;
543     int ProcessResponse(
544         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
545 
546 private:
547 };
548 
549 /**
550  * @brief Request Set Owner Status
551  */
552 class MapMceRequestSetOwnerStatus : public MapMceInstanceRequest {
553 public:
554     explicit MapMceRequestSetOwnerStatus(const IProfileSetOwnerStatusParameters &para);
555     ~MapMceRequestSetOwnerStatus() override;
556     MceRequestType GetRequestType() override;
557     int SendRequest(ObexMpClient &obexIns) override;
558     int ProcessResponse(
559         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
560 
561 private:
562     IProfileSetOwnerStatusParameters ownerPara_ {};
563 };
564 
565 /**
566  * @brief Request Get Owner Status
567  */
568 class MapMceRequestGetOwnerStatus : public MapMceInstanceRequest {
569 public:
570     explicit MapMceRequestGetOwnerStatus(const std::string &conversationId);
571     ~MapMceRequestGetOwnerStatus() override;
572     MceRequestType GetRequestType() override;
573     int SendRequest(ObexMpClient &obexIns) override;
574     int ProcessResponse(
575         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
576 
577 private:
578     std::string ownerConversationId_ = "";
579 };
580 
581 /**
582  * @brief Request Get Owner Status
583  */
584 class MapMceRequestSetMessageStatus : public MapMceInstanceRequest {
585 public:
586     MapMceRequestSetMessageStatus(const std::u16string &msgHandle, MapStatusIndicatorType statusIndicator,
587         MapStatusValueType statusValue, const std::string &exData);
588     ~MapMceRequestSetMessageStatus() override;
589     MceRequestType GetRequestType() override;
590     int SendRequest(ObexMpClient &obexIns) override;
591     int ProcessResponse(
592         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
593 
594 private:
595     std::u16string msgHandle_ = u"";
596     uint8_t msgStatusIndicator_ = 0;
597     uint8_t msgstatusValue_ = 0;
598     std::string extendedData_ = "";
599 };
600 
601 /**
602  * @brief Request Set Owner Status
603  */
604 class MapMceRequestGetConversationListing : public MapMceInstanceRequest {
605 public:
606     explicit MapMceRequestGetConversationListing(const IProfileGetConversationListingParameters &para);
607     ~MapMceRequestGetConversationListing() override;
608     MceRequestType GetRequestType() override;
609     int SendRequest(ObexMpClient &obexIns) override;
610     int ProcessResponse(
611         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
612 
613 private:
614     void SetAppendParam(ObexTlvParamters &appParams);
615     IProfileGetConversationListingParameters converPara_ {};
616     static void MapMceGetItemAppParams(IProfileConversationListingParamStruct &data, const ObexHeader &resp);
617 };
618 
619 /**
620  * @brief Request Get Message listing
621  */
622 class MapMceRequestGetMessagesListing : public MapMceInstanceRequest {
623 public:
624     explicit MapMceRequestGetMessagesListing(const IProfileGetMessagesListingParameters &para);
625     ~MapMceRequestGetMessagesListing() override;
626     MceRequestType GetRequestType() override;
627     int SendRequest(ObexMpClient &obexIns) override;
628     int ProcessResponse(
629         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
630 
631 private:
632     static void MapMceGetItemAppParams(IProfileMessagesListingParamStruct &data, const ObexHeader &resp);
633     void SendRequestSetAppParamsStep1(ObexTlvParamters &appParams);
634     void SendRequestSetAppParamsStep2(ObexTlvParamters &appParams);
635     IProfileGetMessagesListingParameters msgPara_ {};
636     std::ostringstream stream_ {};
637 };
638 
639 /**
640  * @brief Request Get Uread Messages
641  */
642 class MapMceRequestGetUreadMessages : public MapMceInstanceRequest {
643 public:
644     BT_DISALLOW_COPY_AND_ASSIGN(MapMceRequestGetUreadMessages);
645     MapMceRequestGetUreadMessages(MapMessageType type, const IProfileGetMessagesListingParameters &para);
646     ~MapMceRequestGetUreadMessages() override;
647     MceRequestType GetRequestType() override;
648     int SendRequest(ObexMpClient &obexIns) override;
649     int ProcessResponse(
650         MapMceInstanceClient &clientInst, const ObexHeader &resp, MapRequestResponseAction &retAction) override;
651 
652 private:
653     std::list<std::string> msgHandleList_ {};
654     std::unique_ptr<MapMceInstanceRequest> requestPtr_ = nullptr;
655     ObexMpClient *obexInsBackup_ = nullptr;
656     IProfileGetMessagesListingParameters listParam_ {};
657 };
658 }  // namespace bluetooth
659 }  // namespace OHOS
660 #endif  // MAP_MCE_INSTANCE_REQUEST_H
661