I was wondering if someone already made some first steps with AMS (Apple Media Service)
I'm trying to get a project running where I can control the music on Android and iPhone smartphones. For Android, I made my own service to get the information about the music (artist, song, album, duration and so on) and handling with HID the control.
For iOS, I saw that Apple made their own solution (as usual). With AMS I can control the media player of the iPhone where I can send controls and get all required information about the music.Unfortunately I'm having trouble building the ams service similar to Nordic's implementation of ANCS.
If someone has some piece of code to get a proper starting point for the BLE service, that would be great!
Thanks in advance.
I made some progress since yesterday...
I tried to create the Apple Media Service based on Nordic's ANCS example because the two services has some common parts...
I also made a copy of the ble_ancs_c example and integrated the ams instead of the ancs. Logically I called it ble_ams_c_example.
I manage to connect to my iPhone, pair with the Dev-Board and discover the AMS with all its characteristics. Unfortunately I have no idea how I can progress further, such as send controls or get the desired information on music tracks from the iPhone.
Attached is the current state of the project, probably one of the engineers @ Nordic has ideas what the next steps are...
PS: The project is compiled for SDK15.0.0. To get it working, copy it in the ble_peripheral example folder.
Unfortunately we do not have any examples for AMS, but as you say it seems to be quite similar to ANCS in many ways. I did not have time to look at your code. But given that you are able to bond and discover the service. You should probably subscribe to entity updates next. guess you are already looking at this, but: first needs to subscribe for GATT notifications on the Entity Update characteristic. Then, the MR writes commands to the Entity Update characteristic to inform the MS which entity/attribute pair values it wants to know
Doesn't seem to be to many id's to choose from though.
So write e.g 02 00 01 02 03 to the Entity Update characteristic in order to subscribe to:
EntityIDTrack, TrackAttributeIDArtist,TrackAttributeIDAlbum, TrackAttributeIDTitle and TrackAttributeIDDuration
TrackAttributeIDArtist,TrackAttributeIDAlbum, TrackAttributeIDTitle and TrackAttributeIDDuration
Thanks for your message.
I finished more or less the complete service.
When I start the example, I'm connecting to the device, bond, search for the AMS, assign all handles, enable the notifications (remote command and entity update).
I can also write to the remote command to play/pause a song, change the volume, change the track and so on.
I'm also able to register for different entity updates (for example artist, album and track of the track entity).
What's left is the multiple read functionality.
When I get a notification on the entity update characteristic, I receive
If the EntityUpdateFlagTruncated is 1, it means that I didn't get the complete value of the attribute and that I need to read it out manually. This happens when the data size is bigger than 1 BLE packet (MTU Size). I'm able to read out the attribute value on the Entity Attribute characteristic, unfortunately I have no idea how I can do a multiple read on the same characteristic or how this should work. Do you have any idea?