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