• 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 MAP_MCE_PARAMETER_H
17 #define MAP_MCE_PARAMETER_H
18 
19 #include <string>
20 #include <stdint.h>
21 #include <vector>
22 
23 #include "bt_def.h"
24 
25 namespace OHOS {
26 namespace bluetooth {
27 /**
28  * @brief IProfile Map Event Report
29  *
30  * @since 1.0
31  * @version 1.0
32  */
33 struct IProfileMapEventReport {
34     std::string type = "";  // NewMessage, DeliverySuccess, SendingSuccess, DeliveryFailure ,SendingFailure ,
35                             // MemoryFull, MemoryAvailable, MessageDeleted, MessageShift, ReadStatusChanged,
36                             // MessageRemoved, MessageExtendedData-Changed, ParticipantPresence-Changed,
37                             // ParticipantChatState-Changed, ConversationChanged
38     std::string handle = "";
39     std::u16string folder = u"";
40     std::u16string old_folder = u"";
41     MapMessageType msg_type = MapMessageType::INVALID;
42     std::string datetime = "";
43     std::string subject = "";
44     std::string sender_name = "";
45     MapBoolType priority = MapBoolType::INVALID;  // Value "yes" is high priority; "no" is not of high priority.
46     std::string conversation_name = "";
47     std::string conversation_id = "";
48     std::string presence_availability = "";
49     std::string presence_text = "";
50     std::string last_activity = "";
51     std::string chat_state = "";
52     MapMessageStatus read_status =
53         MapMessageStatus::INVALID;  // Shall be used only if the event “type” is “NewMessage” or “ReadStatusChanged”.
54     std::string extended_data = "";  // be used only if the event “type” is “MessageExtendedDataChanged”.
55     std::string participant_uci = "";
56     std::string contact_uid = "";
57     std::string version = "";
58     uint8_t masInstanceId_ = 0;
59     std::string eventReportStringObject_ = "";  // all string of the event report object
60 };
61 
62 /**
63  * @brief IProfile Conversation Participant
64  *
65  * @since 1.0
66  * @version 1.0
67  */
68 struct IProfileParticipant {
69     std::string uci = "";
70     std::string display_name = "";
71     std::string chat_state = "";
72     std::string last_activity = "";
73     std::string x_bt_uid = "";
74     std::string name = "";
75     std::string presence_availability = "";
76     std::string presence_text = "";
77     std::string priority = "";
78 };
79 
80 /**
81  * @brief IProfile Conversation
82  *
83  * @since 1.0
84  * @version 1.0
85  */
86 struct IProfileConversation {
87     std::string id = "";
88     std::string name = "";
89     std::string last_activity = "";
90     std::string read_status = "";
91     std::string version_counter = "";
92     std::string summary = "";
93     std::vector<IProfileParticipant> participantList_ {};
94 };
95 
96 /**
97  * @brief IProfile ConversationListing ParamStuct
98  *
99  * @since 1.0
100  * @version 1.0
101  */
102 struct IProfileConversationListingParamStruct {
103     std::string ConversationListingVersionCounter = "";  // 128-bit value in hex string format(max 32 bytes)
104     uint16_t ListingSize = 0;
105     std::string DatabaseIdentifier = "";  // 128-bit value in hex string format(max 32 bytes)
106     std::string MseTime = "";             // String with current time basis and UTC-offset of the MSE. See Section 5.5.4
107     std::string Version = "";
108 };
109 
110 /**
111  * @brief IProfile ConversationListing Object
112  */
113 struct IProfileConversationListing {
114     std::vector<IProfileConversation> conversationOutlineList_ {};
115     IProfileConversationListingParamStruct conversationListingParam_ {};
116     std::string conversationListingStringObject_ = "";
117 };
118 
119 /**
120  * @brief MessagesOutline in messageslisting
121  *
122  * @since 1.0
123  * @version 1.0
124  */
125 struct IProfileMessageOutline {
126     std::string handle = "";   // is the message handle in hexadecimal representation with up to 16 digits
127     std::string subject = "";  // is the summary of the message
128     std::string datetime = "";  // is the timestamp of the message in format "YYYYMMDDTHHMMSS" or “YYYYMMDDTHHMMSS±HHMM”
129     std::string sender_name = "";        // is the name of the sender of the message when it is known by the MSE device.
130     std::string sender_addressing = "";  // is the addressing information of the sender
131     std::string replyto_addressing = "";  // is the address information for replies to the sender
132     std::string recipient_name = "";  // is the name of the recipient of the message when it is known by the MSE device.
133     std::string recipient_addressing = "";          // is the addressing information of the recipient.
134     MapMessageType type = MapMessageType::INVALID;  // gives the type of the message. use the type: MapMessageType.
135     MapMsgReceptionStatus receptionStatus =
136         MapMsgReceptionStatus::INVALID; // Gives the status of reception of the message. use the
137                                         // type:MapMsgReceptionStatus
138     int size = 0;             // The overall size in bytes of the original message as received from the network.
139     int attachment_size = 0;  // The overall size of the attachments in bytes.
140     MapBoolType text =
141         MapBoolType::INVALID;   // Value "yes" indicates the original message or (in case of multipart-messages) that a
142                                 // part of the message includes textual content; "no" indicates that the message has
143                                 // no textual content, only binary.
144     MapMessageStatus read =
145         MapMessageStatus::INVALID;  // Value "yes" indicates that the message has already been read on the MSE; "no"
146                                     // indicates that the message has not yet been read
147     MapBoolType sent = MapBoolType::INVALID;    // Value "yes" indicates that the message has already been sent to the
148                                                 // recipient; "no" indicates that the message has not yet been sent.
149     MapBoolType protected_ =
150         MapBoolType::INVALID;   // Value "yes" indicates that the message or a part of the message (e.g., attachment) is
151                                 // protected by a DRM scheme; "no" indicates that the message is not protected by DRM.
152     MapBoolType priority = MapBoolType::INVALID;    // Value "yes" indicates that the message is of high priority; "no"
153                                                     // indicates that the message is not of high priority.
154     MapMsgDeliveryStatus delivery_status =
155         MapMsgDeliveryStatus::INVALID;   // V1.1 support , Provides the status of delivery of the message.
156     std::string conversation_id = "";    // V1.1 support , The identification of the conversation.
157     std::string conversation_name = "";  // V1.1 support , The human readable name of the conversation.
158     MapMsgDirection direction =
159         MapMsgDirection::INVALID;  // V1.1 support , This attribute shall indicate the direction of the message.
160     std::string attachment_mime_types = "";  // V1.1 support , The MIME type of the attachment(s).
161 };
162 
163 /**
164  * @brief MessagesListing Param Struct
165  *
166  * @since 1.0
167  * @version 1.0
168  */
169 struct IProfileMessagesListingParamStruct {
170     MapOnOffType NewMessage = MapOnOffType::INVALID;  // on off
171     std::string MseTime = "";                         // String with current time basis and UTC-offset of the MSE.
172     uint16_t ListingSize = 0;
173     std::string DatabaseIdentifier = "";    // 128-bit value in hex string format,max 32 bytes
174     std::string FolderVersionCounter = "";  // 128-bit value in hex string format,max 32 bytes
175     std::string Version = "";               // "1.1" or "1.0"
176 };
177 
178 /**
179  * @brief MessagesListing  object
180  *
181  * @since 1.0
182  * @version 1.0
183  */
184 struct IProfileMessagesListing {
185     std::vector<IProfileMessageOutline> messageOutlineList_ {};
186     IProfileMessagesListingParamStruct messagesListingParam_ {};
187     std::string messagesListingStringObject_ = "";  // all string of the messagelist object
188 };
189 
190 /**
191  * @brief GetMessagesListingParameters
192  *
193  * @since 1.0
194  * @version 1.0
195  */
196 struct IProfileGetMessagesListingParameters {
197     std::u16string folder = u"";   // such as: inbox , outbox
198     uint16_t MaxListCount = 0;     // maximum number of the listing
199     uint16_t ListStartOffset = 0;  // the offset of the first entry of the returned listing object
200     uint8_t SubjectLength = 0;
201     uint32_t ParameterMask = 0;     // Bit mask:
202                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_SUBJECT 0b000000000000000000000001
203                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_DATETIME 0b000000000000000000000010
204                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_SENDER_NAME 0b000000000000000000000100
205                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_SENDER_ADDRESSING 0b000000000000000000001000
206                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_RECIPIENT_NAME 0b000000000000000000010000
207                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_RECIPIENT_ADDRESSING 0b000000000000000000100000
208                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_TYPE 0b000000000000000001000000
209                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_SIZE 0b000000000000000010000000
210                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_RECEPTION_STATUS 0b000000000000000100000000
211                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_TEXT 0b000000000000001000000000
212                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_ATTACHMENT_SIZE 0b000000000000010000000000
213                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_PRIORITY 0b000000000000100000000000
214                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_READ 0b000000000001000000000000
215                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_SENT 0b000000000010000000000000
216                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_PROTECTED 0b000000000100000000000000
217                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_REPLYTO_ADDRESSING 0b000000001000000000000000
218                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_DELIVERY_STATUS 0b000000010000000000000000
219                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_CONVERSATION_ID 0b000000100000000000000000
220                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_CONVERSATION_NAME 0b000001000000000000000000
221                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_DIRECTION 0b000010000000000000000000
222                                     // MAP_GETMESSAGELIST_PARAMETER_MASK_ATTACHMENT_MIME 0b000100000000000000000000
223     uint8_t FilterMessageType = 0;  // Bit mask:
224                                     // MAP_FILTER_MESSAGE_MASK_SMS_GSM         0b00000001
225                                     // MAP_FILTER_MESSAGE_MASK_SMS_CDMA        0b00000010
226                                     // MAP_FILTER_MESSAGE_MASK_EMAIL       0b00000100
227                                     // MAP_FILTER_MESSAGE_MASK_MMS         0b00001000
228                                     // MAP_FILTER_MESSAGE_MASK_IM          0b00010000
229                                     // MAP_FILTER_MESSAGE_MASK_NO_FILTERING    0b00000000
230     std::string FilterPeriodBegin = ""; // String with Begin of filter period.
231     std::string FilterPeriodEnd = "";   // String with End of filter period.
232     uint8_t FilterReadStatus = 0;       // Bit mask:
233                                         // MAP_FILTER_READ_STATUS_MASK_UNREAD          0b00000001
234                                         // MAP_FILTER_READ_STATUS_MASK_READ            0b00000010
235                                         // MAP_FILTER_READ_STATUS_MASK_NO_FILTERING    0b00000000
236 
237     std::string FilterRecipient = "";   // Text (UTF-8), wildcards "*" may be used if required
238     std::string FilterOriginator = "";  // Text (UTF-8), wildcards "*" may be used if required
239     uint8_t FilterPriority = 0;         // Bit mask:
240                                         // MAP_FILTER_PRIORITY_MASK_HIGH               0b00000001
241                                         // MAP_FILTER_PRIORITY_MASK_NO_HIGH            0b00000010
242                                         // MAP_FILTER_PRIORITY_MASK_NO_FILTERING       0b00000000
243     std::string ConversationID = "";
244     std::string FilterMessageHandle = "";
245 };
246 /**
247  * @brief GetMessageParameters
248  *
249  * @since 1.0
250  * @version 1.0
251  */
252 struct IProfileGetMessageParameters {
253     MapAttachmentType Attachment = MapAttachmentType::INVALID;
254     MapCharsetType Charset = MapCharsetType::INVALID;
255     MapFractionRequestType FractionRequest = MapFractionRequestType::INVALID;
256 };
257 /**
258  * @brief Get Conversation Listing Parameters
259  *
260  * @since 1.0
261  * @version 1.0
262  */
263 struct IProfileGetConversationListingParameters {
264     uint16_t MaxListCount = 0;
265     uint16_t ListStartOffset = 0;
266     uint8_t FilterReadStatus = 0;       // mask type is:
267                                         // MAP_FILTER_READ_STATUS_MASK_UNREAD          0b00000001
268                                         // MAP_FILTER_READ_STATUS_MASK_READ            0b00000010
269                                         // MAP_FILTER_READ_STATUS_MASK_NO_FILTERING    0b00000000
270     std::string FilterRecipient = "";   // Text (UTF-8), wildcards "*" may be used if required
271     std::string ConversationID = "";
272     std::string FilterLastActivityBegin = "";
273     std::string FilterLastActivityEnd = "";
274     uint32_t ConvParameterMask =
275         0;  // ConvParameterMask 0-14 is defined, 15–31 Reserved for Future Use
276             // MAP_GETCONV_PARAMETER_MASK_CONVERSATION_NAME 0b000000000000000000000001
277             // MAP_GETCONV_PARAMETER_MASK_CONVERSATION_LAST_ACTIVITY 0b000000000000000000000010
278             // MAP_GETCONV_PARAMETER_MASK_CONVERSATION_READ_STATUS 0b000000000000000000000100
279             // MAP_GETCONV_PARAMETER_MASK_CONVERSATION_VERSION_COUNTER 0b000000000000000000001000
280             // MAP_GETCONV_PARAMETER_MASK_CONVERSATION_SUMMARY 0b000000000000000000010000
281             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANTS 0b000000000000000000100000
282             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_UCI 0b000000000000000001000000
283             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_DISPLAY_NAME 0b000000000000000010000000
284             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_CHAT_STATE 0b000000000000000100000000
285             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_LAST_ACTIVITY 0b000000000000001000000000
286             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_X_BT_UID 0b000000000000010000000000
287             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_NAME 0b000000000000100000000000
288             // MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_PRESENCE_AVAILABILITY
289             // 0b000000000001000000000000 MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_PRESENCE_TEXT
290             // 0b000000000010000000000000 MAP_GETCONV_PARAMETER_MASK_PARTICIPANT_PRIORITY
291             // 0b000000000100000000000000
292 };
293 /**
294  * @brief Owner Status Parameters
295  *
296  * @since 1.0
297  * @version 1.0
298  */
299 struct IProfileOwnerStatus {
300     uint8_t PresenceAvailability = 0;
301     std::string PresenceText = "";
302     std::string LastActivity = "";
303     uint8_t ChatState = 0;
304 };
305 /**
306  * @brief Owner Status Parameters
307  *
308  * @since 1.0
309  * @version 1.0
310  */
311 struct IProfileSetOwnerStatusParameters {
312     std::string ConversationID = "";
313     IProfileOwnerStatus ownerStatus_ {};
314 };
315 
316 /**
317  * @brief Vcard 3_0
318  *
319  * @since 1.0
320  * @version 1.0
321  */
322 struct IProfileMapVcard {
323     std::string VERSION = "";             // shall be included
324     std::string N = "";                   // shall be included
325     std::vector<std::string> TEL {};       // may be used
326     std::vector<std::string> EMAIL {};     // may be used
327     std::vector<std::string> X_BT_UID {};  // bmsg V1.1
328     std::vector<std::string> X_BT_UCI {};  // bmsg V1.1
329     std::string FN = "";                  // vcard 3.0 , shall be included
330 };
331 
332 /**
333  * @brief <bmessage-content>
334  *
335  * @since 1.0
336  * @version 1.0
337  */
338 struct IProfileBMessageContent {
339     // <bmessage-body-part-ID>
340     std::string bodyPartID = "";    // This property shall be used if and only if the content of the related message
341                                     // cannot be delivered completely within one <bmessage-content> object
342     // <bmessage-body-property>
343     std::string body_encoding = "";     // Email/MMS [6], [9]: "8BIT" (for 8-Bit Clean encoding).
344                                         // GSM-SMS [14]: "G-7BIT" (GSM 7 bit Default Alphabet), "G-7BITEXT" (GSM 7 bit
345                                         // Alphabet with national language extension), "G-UCS2", and "G-8BIT". CDMA-SMS
346                                         // [13]: "C-8BIT" (Octet, unspecified), "C-EPM" (Extended Protocol Message),
347                                         // "C-7ASCII (7-bit ASCII), "C-IA5" (IA5), "C-UNICODE" (UNICODE), "C-SJIS"
348                                         // (Shift-JIS), "C-KOREAN" (Korean),"C-LATINHEB” (Latin/Hebrew), and “C-LATIN”
349                                         // (Latin). For IM: [6] "8BIT" (for 8-Bit Clean encoding). Ver1.1
350     std::string body_charset = "";  // UTF-8 or SMS PDU
351     std::string body_language = ""; // GSM-SMS [14]: " TURKISH", " SPANISH", "PORTUGUESE", "UNKNOWN"
352                                     // CDMA-SMS [13]: "ENGLISH", "FRENCH", "SPANISH", "JAPANESE", "KOREAN", "CHINESE",
353                                     // "HEBREW", "UNKNOWN"
354     int body_content_length = 0;
355 
356     // <bmessage-body-content>
357     std::string body_content = "";  // body-content  support V1.1 IM
358 };
359 
360 /**
361  * @brief <bmessage-envelope>
362  *
363  * @since 1.0
364  * @version 1.0
365  */
366 struct IProfileBMessageEnvelope {
367     // [<initial-recipient>] or [<final-recipient> if level2 and level3 size is 0]
368     std::vector<IProfileMapVcard> recipientLevel1_;
369     // [<middle-recipient>] or [<final-recipient> if level3 size is 0]
370     std::vector<IProfileMapVcard> recipientLevel2_;
371     // [<final-recipient>]
372     std::vector<IProfileMapVcard> recipientLevel3_;
373     // The maximum level of <bmessage-envelope>
374     int maxLevelOfEnvelope_ = 0;
375     // <bmessage-content>
376     IProfileBMessageContent msgBody_ {};
377 };
378 
379 /**
380  * @brief receive msg, support both 1.0 and 1.1
381  */
382 struct IProfileBMessageStruct {
383     // <bmessage-property>
384     std::string version_property = "";
385     MapMessageStatus readstatus_property = MapMessageStatus::INVALID;  // "READ" or "UNREAD"
386     MapMessageType type_property =
387         MapMessageType::INVALID;  // V1.0 include "EMAIL","SMS_GSM","SMS_CDMA","MMS", V1.1 add a "IM"
388     std::u16string folder_property =
389         u"";  // This is the folder name including the path where the bMessage is located in.
390     std::string extendeddata_property = "";  // extended data only V1.1
391     // [<bmessage-originator>]? , 0 or 1
392     std::vector<IProfileMapVcard> originator_ {};  // This property includes a vCard identifying the originator
393     // <bmessage-envelope>
394     IProfileBMessageEnvelope envelope_ {};  // The maximum level of <bmessage-envelope> encapsulation shall be three.
395 };
396 
397 /**
398  * @brief IProfileBMessage
399  *
400  * @since 1.0
401  * @version 1.0
402  */
403 struct IProfileBMessage {
404     MapFractionDeliverType FractionDeliver =
405         MapFractionDeliverType::INVALID;  // MapFractionDeliverType type, 0 = "more",1 = "last"
406     IProfileBMessageStruct bMessageParam_ {};
407     std::string bMessageStringObject_ = "";  // all string of the bmessage object
408 };
409 
410 /**
411  * @brief Map SendMessage Parameters
412  *
413  * @since 1.0
414  * @version 1.0
415  */
416 struct IProfileSendMessageParameters {
417     std::string ConversationID = "";
418     MapAttachmentType Attachment = MapAttachmentType::INVALID;
419     MapCharsetType Charset = MapCharsetType::INVALID;
420     MapOnOffType Transparent = MapOnOffType::INVALID;
421     MapOnOffType Retry = MapOnOffType::INVALID;                 // 1 is "ON", 0 is "OFF"
422     std::string MessageHandle = "";                             // if ModifyText is “PREPEND”
423     MapModifyTextType ModifyText = MapModifyTextType::INVALID;  // 0 is “REPLACE” , 1 is “PREPEND”
424     IProfileBMessageStruct bmessage_ {};
425 };
426 /**
427  * @brief Mas Instance Info Parameters
428  *
429  * @since 1.0
430  * @version 1.0
431  */
432 struct IProfileMasInstanceInfo {
433     std::string OwnerUCI = "";
434     std::string MASInstanceInformation = "";
435     int supportedMsgTypes_ = 0; // Supported Message Types mask by one instance client
436                                 // MAP_MCE_SUPPORTED_MESSAGE_TYPE_EMAIL    0x01
437                                 // MAP_MCE_SUPPORTED_MESSAGE_TYPE_SMS_GSM  0x02
438                                 // MAP_MCE_SUPPORTED_MESSAGE_TYPE_SMS_CDMA 0x04
439                                 // MAP_MCE_SUPPORTED_MESSAGE_TYPE_MMS  0x08
440                                 // MAP_MCE_SUPPORTED_MESSAGE_TYPE_IM   0x10
441                                 // MAP_MCE_SUPPORTED_MESSAGE_TYPE_ALL  0x01F
442     int instanceId = 0;         // instance id
443 };
444 /**
445  * @brief Map MasInstanceInfo List Parameters
446  *
447  * @since 1.0
448  * @version 1.0
449  */
450 struct IProfileMasInstanceInfoList {
451     bool isValid = false;  // data ready
452     std::vector<IProfileMasInstanceInfo> masInfoList {};
453 };
454 
455 /**
456  * @brief IProfile Folder list param
457  *
458  * @since 1.0
459  * @version 1.0
460  */
461 struct IProfileFolderListing {
462     uint16_t folderListingSize_ = 0;
463     std::string version_ = "";
464     std::vector<std::string> folderNameList_ {};
465     std::string folderListingStringObject_ = "";
466 };
467 
468 /**
469  * @brief Map Action
470  *
471  * @since 1.0
472  * @version 1.0
473  */
474 struct IProfileMapAction {
475     MapActionType action_ = MapActionType::UPDATE_INBOX;
476     int supportedFeatures_ = 0;
477     IProfileOwnerStatus ownerStatus_ {};
478 };
479 
480 /**
481  * @brief set message status
482  *
483  * @since 1.0
484  * @version 1.0
485  */
486 struct IProfileSetMessageStatus {
487     std::u16string msgHandle {};
488     MapStatusIndicatorType statusIndicator = MapStatusIndicatorType::INVALID;
489     MapStatusValueType statusValue = MapStatusValueType::NO;
490     std::string extendedData {};
491 };
492 }  // namespace bluetooth
493 }  // namespace OHOS
494 
495 #endif  // MAP_MCE_PARAMETER_H
496