This is the documentation for the latest (main) development branch of mcuxpresso sdk. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

map_mce

Overview

This example demonstrates the MAP MCE basic functionality, the MCE device support be connected to a MAP MSE like a mobile phone or a board running a MAP MSE application. And the MCE example support browsing/uploading message on/to the MSE and receiving events from MSE.

Prepare the Demo

  1. Open example’s project and build it.

  2. Connect a USB cable between the PC host and the OpenSDA USB port on the target board.

  3. Open a serial terminal on PC for OpenSDA serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

  5. Either press the reset button on your board or launch the debugger in your IDE to begin running the example.

Run the Demo

This demo runs fully automatically. The user needs to place the MSE device to be connected as close to the MCE as possible.

The MCE will only select the device with the strongest RSSI among those with the class of device of phone or computer for connection. Here’s a log of a sample run. MSE is a mobile phone.

Bluetooth MAP MCE demo start… Bluetooth initialized BR/EDR set connectable and discoverable done Discovery started. Please wait … BR/EDR discovery complete [1]: CC:EB:5E:10:3E:79, RSSI -93 test Connect 1 Connection pending SDP discovery started Connected sdp success callback REFCOMM channel number 26 L2CAP PSM 0x1029 MAP version 0x0104 MAP supported features 0x000603FF MAS instance ID 0 Supported message type 0x00 Service name SMS/MMS Message Access Server found. Connecting … Security changed: CC:EB:5E:10:3E:79 level 2 MCE MAS connection MAX Packet Length - 509 [1]: GET_FOLDER_LISTING_ROOT MAP Get Folder Listing MAP Get Folder Listing CNF - 0xA0 ============== BODY ==============

============ END BODY ============ [2]: GET_FOLDER_LISTING_ROOT Complete [3]: SET_FOLDER_TELECOM MAP Set Folder Name - telecom MAP Set Folder CNF - 0xA0 [4]: SET_FOLDER_TELECOM Complete [5]: SET_FOLDER_MSG MAP Set Folder Name - msg MAP Set Folder CNF - 0xA0 [6]: SET_FOLDER_MSG Complete [7]: SET_FOLDER_INBOX MAP Set Folder Name - inbox MAP Set Folder CNF - 0xA0 [8]: SET_FOLDER_INBOX Complete [9]: UPDATE_INBOX MAP Update Inbox MAP Update Inbox CNF - 0xD1 [10]: UPDATE_INBOX Complete [11]: GET_MSG_LISTING MAP Get MSG Listing MAX List Count - 10 SRMP Wait Count - 2 MAP Get MSG Listing CNF - 0x90 New Message - 1 Listing Size - 10 MSE Time - 20240716T155258+0800 ============== BODY ==============

============ END BODY ============ [12]: GET_MSG_LISTING Complete [13]: GET_MSG MAP Get MSG Name - 0400000000001577 Attachment - 0 Charset - 0 SRMP Wait Count - 0 MAP Get MSG CNF - 0x90 ============== BODY ============== BEGIN:BMSG VERSION:1.0 STATUS:UNREAD TYPE:SMS_GSM FOLDER:telecom/msg/inbox BEGIN:VCARD VERSION:3.0 FN: N: TEL:+XXXXXXXXXXXXX END:VCARD BEGIN:BENV BEGIN:BBODY ENCODING:G-7BIT LENGTH:1334 BEGIN:MSG 00440d91XXXXXXXXXXXXfX000042706151648123a0050003a8040184ec7a99fe7ed3d1a066100aa296e77490905d2fd3df6f3a1ad40c4241d4f29c0e12b2eb65fafb4d47839a4128885a9ed3414276bd4c7fbfe9685033080551cb733a48c8ae97e9ef371d0d6a06a1206a794e0709d9f532fdfda6a341cd2014442dcfe92021bb5ea6bfdf7434a8198482a8e5391d2 ============ END BODY ============ MAP Get MSG CNF - 0xA0 ============== BODY ============== dfda6a341cd2014442dcfe9 END:MSG END:BBODY END:BENV END:BMSG

============ END BODY ============ [14]: GET_MSG Complete [15]: SET_MSG_STATUS MAP Set MSG Status Name - 0400000000001577 Status Indicator - 0 Status Value - 0 MAP Set MSG Status CNF - 0xA0 [16]: SET_MSG_STATUS Complete [17] ~ [18] Skip, BT_MAP_CONVO_LISTING is not supported [19]: GET_MAS_INST_INFO MAP Get MAS Instance Info MAS Instance ID - 0 SRMP Wait Count - 0 MAP Get MAS Instance Info CNF - 0xA0 ============== BODY ============== SMS/MMS ============ END BODY ============ [20]: GET_MAS_INST_INFO Complete [21]: SET_NTF_FILTER MAP Set Notification Filter Notification Filter Mask - 0 MAP Set NTF Filter CNF - 0xA0 [22]: SET_NTF_FILTER Complete [23]: SET_NTF_REG_ON MAP Set Notification Registration Notification Status - 1 MAP Set Notification Registration CNF - 0xA0 MCE MNS connection MAX Packet Length - 1790 [24]: SET_NTF_REG_ON Complete [25]: SET_NTF_REG_OFF MAP Set Notification Registration Notification Status - 0 MAP Set Notification Registration CNF - 0xA0 MCE MNS disconnection - 0xA0 [26]: SET_NTF_REG_OFF Complete [27] ~ [30] Skip, BT_MAP_OWNER_STATUS is not supported [31]: SET_FOLDER_PARENT MAP Set Folder Name - ../ MAP Set Folder CNF - 0xA0 [32]: SET_FOLDER_PARENT Complete [33]: SET_FOLDER_OUTBOX MAP Set Folder Name - outbox MAP Set Folder CNF - 0xA0 [34]: SET_FOLDER_OUTBOX Complete [35]: PUSH_MSG MAP Push MSG Charset - 0 MAP Push MSG CNF - 0x90 MAP Push MSG CNF - 0x90 MAP Push MSG CNF - 0x90 MAP Push MSG CNF - 0xA0 Name - 278DE6BF5BF6491 [36]: PUSH_MSG Complete [37]: MCE_MAS_DISCONNECT MAP MCE MAS Disconnect MCE MAS disconnection - 0xA0 Disconnected (reason 0x13)

Specific implementation steps:

  1. Initialize Bluetooth log: Bluetooth MAP MCE demo start… Bluetooth initialized BR/EDR set connectable and discoverable done

  2. Device discovery log: Discovery started. Please wait … BR/EDR discovery complete [1]: CC:EB:5E:10:3E:79, RSSI -93 test

  3. Create ACL connection The MCE finds the device with the strongest RSSI to connect from the devices that the class of device is computer or phone. log: Connect 1 Connection pending

  4. SDP discovery After the ACL connection is established, the MCE performs an SDP discovery. log: SDP discovery started Connected

  5. Create MAP MAS connection After the SDP discovery, the MCE will parse the SDP records to obtain the GoepL2capPsm, RFCOMM channel number and MapSupportedFeatures etc. Prioritize the establishment of the MAP MAS connection based on GoepL2capPsm if supported by the MSE. Otherwise the MAP MAS connection is established based on the RFCOMM channel number. After that, the MCE will automatically send requests to the MSE according to the MapSupportedFeatures. log: sdp success callback REFCOMM channel number 26 L2CAP PSM 0x1029 MAP version 0x0104 MAP supported features 0x000603FF MAS instance ID 0 Supported message type 0x00 Service name SMS/MMS Message Access Server found. Connecting … Security changed: CC:EB:5E:10:3E:79 level 2 MCE MAS connection MAX Packet Length - 509

  6. Get folder listing After MAP MAS connection is established, the MCE will get folder listing in the root directory, and then parse and print the acquired information. log: [1]: GET_FOLDER_LISTING_ROOT MAP Get Folder Listing MAP Get Folder Listing CNF - 0xA0 ============== BODY ==============

============ END BODY ============ [2]: GET_FOLDER_LISTING_ROOT Complete

  1. Set path to telecom/msg/inbox If setting path successfully, the MCE will contiune the next steps or stop here. 0xA0 indicates that setting path is success. log: [3]: SET_FOLDER_TELECOM MAP Set Folder Name - telecom MAP Set Folder CNF - 0xA0 [4]: SET_FOLDER_TELECOM Complete [5]: SET_FOLDER_MSG MAP Set Folder Name - msg MAP Set Folder CNF - 0xA0 [6]: SET_FOLDER_MSG Complete [7]: SET_FOLDER_INBOX MAP Set Folder Name - inbox MAP Set Folder CNF - 0xA0 [8]: SET_FOLDER_INBOX Complete

  2. Send UpdateInbox request After setting path to telecom/msg/inbox successfully, the MCE will send UpdateInbox request and then print the result. 0xD1 indicates that the MSE doesn’t implement this fucntion. log: [9]: UPDATE_INBOX MAP Update Inbox MAP Update Inbox CNF - 0xD1 [10]: UPDATE_INBOX Complete

  3. Get message listing After updating inbox, the MCE will get message listing in the inbox. When receiving response, parse and print the acquired infomation. log: [11]: GET_MSG_LISTING MAP Get MSG Listing MAX List Count - 10 SRMP Wait Count - 2 MAP Get MSG Listing CNF - 0x90 New Message - 1 Listing Size - 10 MSE Time - 20240716T155258+0800 ============== BODY ==============

============ END BODY ============ [12]: GET_MSG_LISTING Complete

  1. Get message After getting message listing successfully, the MCE will select the first message handle in the message listing to get its content and parse and print the acquired message. If the MCE doesn’t find the message handle, it will skip [13] ~ [16]. log: [13]: GET_MSG MAP Get MSG Name - 0400000000001577 Attachment - 0 Charset - 0 SRMP Wait Count - 0 MAP Get MSG CNF - 0x90 ============== BODY ============== BEGIN:BMSG VERSION:1.0 STATUS:UNREAD TYPE:SMS_GSM FOLDER:telecom/msg/inbox BEGIN:VCARD VERSION:3.0 FN: N: TEL:+XXXXXXXXXXXXX END:VCARD BEGIN:BENV BEGIN:BBODY ENCODING:G-7BIT LENGTH:1334 BEGIN:MSG 00440d91688120218956f1000042706151648123a0050003a8040184ec7a99fe7ed3d1a066100aa296e77490905d2fd3df6f3a1ad40c4241d4f29c0e12b2eb65fafb4d47839a4128885a9ed3414276bd4c7fbfe9685033080551cb733a48c8ae97e9ef371d0d6a06a1206a794e0709d9f532fdfda6a341cd2014442dcfe92021bb5ea6bfdf7434a8198482a8e5391d2 ============ END BODY ============ MAP Get MSG CNF - 0xA0 ============== BODY ============== dfda6a341cd2014442dcfe9 END:MSG END:BBODY END:BENV END:BMSG

============ END BODY ============ [14]: GET_MSG Complete.

  1. Set message status After getting message, the MCE will set message status to “unread”. log: [15]: SET_MSG_STATUS MAP Set MSG Status Name - 0400000000001577 Status Indicator - 0 Status Value - 0 MAP Set MSG Status CNF - 0xA0 [16]: SET_MSG_STATUS Complete

  2. Get conversation listing If the Conversation Listing feature is supported by the MSE, the MCE will send GetConversationListing request and parse and print the acquired infomation. Otherwise, skip [17] ~ [18]. log: [17] ~ [18] Skip, BT_MAP_CONVO_LISTING is not supported

  3. Get MAS instance infomation If the ‘Instance Information Feature’ bit in the MapSupportedFeatures of the MSE is set, the MCE will send GetMASInstanceInformation request and parse and print the acquired infomation. Otherwise, skip [19] ~ [20]. log: [19]: GET_MAS_INST_INFO MAP Get MAS Instance Info MAS Instance ID - 0 SRMP Wait Count - 0 MAP Get MAS Instance Info CNF - 0xA0 ============== BODY ============== SMS/MMS ============ END BODY ============ [20]: GET_MAS_INST_INFO Complete

  4. Set notification filter If the ‘Notification Filtering’ bit in the MapSupportedFeatures of the MSE is set, the MCE will send SetNotificationFilter(NotificationFilterMask = 0) request and print the result. log: [21]: SET_NTF_FILTER MAP Set Notification Filter Notification Filter Mask - 0 MAP Set NTF Filter CNF - 0xA0 [22]: SET_NTF_FILTER Complete

  5. Set notification registration If the ‘Notification Registration Feature’ bit in the MapSupportedFeatures of the MSE is set, the MCE will send SetNotificationRegistration(ON) request and print the result. After the MSE receives the SetNotificationRegistration(ON) request, it will initiate an MNS connection to the MCE. When the MNS connection is created successfully, the MCE will print the ‘MCE MNS connection’. After the MNS connection is established, the MCE will send SetNotificationRegistration(OFF) request and print the result. After the MSE receives the SetNotificationRegistration(OFF) request, it will disconnect the MNS connection. When the MNS connection is disconnected, the MCE will print the ‘MCE MNS disconnection’. [23]: SET_NTF_REG_ON MAP Set Notification Registration Notification Status - 1 MAP Set Notification Registration CNF - 0xA0 MCE MNS connection MAX Packet Length - 1790 [24]: SET_NTF_REG_ON Complete [25]: SET_NTF_REG_OFF MAP Set Notification Registration Notification Status - 0 MAP Set Notification Registration CNF - 0xA0 MCE MNS disconnection - 0xA0 [26]: SET_NTF_REG_OFF Complete

  6. Get and set owner status. If the ‘Owner status’ bit in the MapSupportedFeatures of the MSE is set, the MCE will send GetOwnerStatus request, and then parse and print the acquired infomation. Otherwise, skip [27] ~ [30]. After getting owner status, the MCE will send SetOwnerStatus and print the result. log: [27] ~ [30] Skip, BT_MAP_OWNER_STATUS is not supported

  7. Set path to ../outbox If the ‘Uploading Feature’ bit in the MapSupportedFeatures of the MSE is set, the MCE will go to outbox directory and then send a message to outbox. log: [31]: SET_FOLDER_PARENT MAP Set Folder Name - ../ MAP Set Folder CNF - 0xA0 [32]: SET_FOLDER_PARENT Complete [33]: SET_FOLDER_OUTBOX MAP Set Folder Name - outbox MAP Set Folder CNF - 0xA0 [34]: SET_FOLDER_OUTBOX Complete

  8. Push message After setting path to ../outbox, the MCE will push the message and print the result. The pushed message is a constant message for the test. 0x90 and 0xA0 indicates the response code is Continue and Success respectively. After sending the message completely, the MCE will print the mesage handle recived from the MSE. log: [35]: PUSH_MSG MAP Push MSG Charset - 0 MAP Push MSG CNF - 0x90 MAP Push MSG CNF - 0x90 MAP Push MSG CNF - 0x90 MAP Push MSG CNF - 0xA0 Name - 278DE6BF5BF6491

  9. Send MAP MAS disconnect All above operations are complete, the MCE will send MAS disconnection request and print the result. log: [37]: MCE_MAS_DISCONNECT MAP MCE MAS Disconnect MCE MAS disconnection - 0xA0

Note:

  1. When connecting to the MSE which is a moblie phone, please pay attention to the phone alert messages. In particular, please turn on the permission to allow access to messages. If the MSE is an iPhone, after connecting for the first time, the user need to actively turn on the “Show Notifications” on the iPhone and then re-run the demo.

  2. The MCE will only select the device with the strongest RSSI among those with the class of device of phone or computer for connection. Please place the MSE as close as possible to the PCE. You can lift this restriction by blocking the relevant code in the app_discover.c.

  3. Only 1 MAP MAS and MNS connection is supported.

Supported Boards