1
0
Fork 0

Adapt the UUID of Music service according to new guidelines.

This commit is contained in:
Jean-François Milants 2021-01-19 21:17:03 +01:00
parent 54d437adb8
commit ccbe2e8e1b
2 changed files with 77 additions and 41 deletions

View file

@ -24,32 +24,68 @@ int MSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_acces
} }
Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask &system) : m_system(system) { Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask &system) : m_system(system) {
msUuid.value[11] = msId[0]; msUuid.value[14] = msId[0];
msUuid.value[12] = msId[1]; msUuid.value[15] = msId[1];
msEventCharUuid.value[11] = msEventCharId[0];
msEventCharUuid.value[12] = msEventCharId[1]; msEventCharUuid.value[12] = msEventCharId[0];
msStatusCharUuid.value[11] = msStatusCharId[0]; msEventCharUuid.value[13] = msEventCharId[1];
msStatusCharUuid.value[12] = msStatusCharId[1]; msEventCharUuid.value[14] = msId[0];
msTrackCharUuid.value[11] = msTrackCharId[0]; msEventCharUuid.value[15] = msId[1];
msTrackCharUuid.value[12] = msTrackCharId[1];
msArtistCharUuid.value[11] = msArtistCharId[0]; msStatusCharUuid.value[12] = msStatusCharId[0];
msArtistCharUuid.value[12] = msArtistCharId[1]; msStatusCharUuid.value[13] = msStatusCharId[1];
msAlbumCharUuid.value[11] = msAlbumCharId[0]; msStatusCharUuid.value[14] = msId[0];
msAlbumCharUuid.value[12] = msAlbumCharId[1]; msStatusCharUuid.value[15] = msId[1];
msPositionCharUuid.value[11] = msPositionCharId[0];
msPositionCharUuid.value[12] = msPositionCharId[1]; msTrackCharUuid.value[12] = msTrackCharId[0];
msTotalLengthCharUuid.value[11] = msTotalLengthCharId[0]; msTrackCharUuid.value[13] = msTrackCharId[1];
msTotalLengthCharUuid.value[12] = msTotalLengthCharId[1]; msTrackCharUuid.value[14] = msId[0];
msTrackNumberCharUuid.value[11] = msTrackNumberCharId[0]; msTrackCharUuid.value[15] = msId[1];
msTrackNumberCharUuid.value[12] = msTrackNumberCharId[1];
msTrackTotalCharUuid.value[11] = msTrackTotalCharId[0]; msArtistCharUuid.value[12] = msArtistCharId[0];
msTrackTotalCharUuid.value[12] = msTrackTotalCharId[1]; msArtistCharUuid.value[13] = msArtistCharId[1];
msPlaybackSpeedCharUuid.value[11] = msPlaybackSpeedCharId[0]; msArtistCharUuid.value[14] = msId[0];
msPlaybackSpeedCharUuid.value[12] = msPlaybackSpeedCharId[1]; msArtistCharUuid.value[15] = msId[1];
msRepeatCharUuid.value[11] = msRepeatCharId[0];
msRepeatCharUuid.value[12] = msRepeatCharId[1]; msAlbumCharUuid.value[12] = msAlbumCharId[0];
msShuffleCharUuid.value[11] = msShuffleCharId[0]; msAlbumCharUuid.value[13] = msAlbumCharId[1];
msShuffleCharUuid.value[12] = msShuffleCharId[1]; msAlbumCharUuid.value[14] = msId[0];
msAlbumCharUuid.value[15] = msId[1];
msPositionCharUuid.value[12] = msPositionCharId[0];
msPositionCharUuid.value[13] = msPositionCharId[1];
msPositionCharUuid.value[14] = msId[0];
msPositionCharUuid.value[15] = msId[1];
msTotalLengthCharUuid.value[12] = msTotalLengthCharId[0];
msTotalLengthCharUuid.value[13] = msTotalLengthCharId[1];
msTotalLengthCharUuid.value[14] = msId[0];
msTotalLengthCharUuid.value[15] = msId[1];
msTrackNumberCharUuid.value[12] = msTrackNumberCharId[0];
msTrackNumberCharUuid.value[13] = msTrackNumberCharId[1];
msTrackNumberCharUuid.value[14] = msId[0];
msTrackNumberCharUuid.value[15] = msId[1];
msTrackTotalCharUuid.value[12] = msTrackTotalCharId[0];
msTrackTotalCharUuid.value[13] = msTrackTotalCharId[1];
msTrackTotalCharUuid.value[14] = msId[0];
msTrackTotalCharUuid.value[15] = msId[1];
msPlaybackSpeedCharUuid.value[12] = msPlaybackSpeedCharId[0];
msPlaybackSpeedCharUuid.value[13] = msPlaybackSpeedCharId[1];
msPlaybackSpeedCharUuid.value[14] = msId[0];
msPlaybackSpeedCharUuid.value[15] = msId[1];
msRepeatCharUuid.value[12] = msRepeatCharId[0];
msRepeatCharUuid.value[13] = msRepeatCharId[1];
msRepeatCharUuid.value[14] = msId[0];
msRepeatCharUuid.value[15] = msId[1];
msShuffleCharUuid.value[12] = msShuffleCharId[0];
msShuffleCharUuid.value[13] = msShuffleCharId[1];
msShuffleCharUuid.value[14] = msId[0];
msShuffleCharUuid.value[15] = msId[1];
characteristicDefinition[0] = {.uuid = (ble_uuid_t *) (&msEventCharUuid), characteristicDefinition[0] = {.uuid = (ble_uuid_t *) (&msEventCharUuid),
.access_cb = MSCallback, .access_cb = MSCallback,

View file

@ -26,8 +26,8 @@
#undef max #undef max
#undef min #undef min
//c7e50000-78fc-48fe-8e23-433b3a1942d0 //00000000-78fc-48fe-8e23-433b3a1942d0
#define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7} #define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0x00, 0x00}
namespace Pinetime { namespace Pinetime {
namespace System { namespace System {
@ -73,19 +73,19 @@ namespace Pinetime {
Playing = 0x01 Playing = 0x01
}; };
private: private:
static constexpr uint8_t msId[2] = {0x00, 0x01}; static constexpr uint8_t msId[2] = {0x01, 0x00};
static constexpr uint8_t msEventCharId[2] = {0x00, 0x02}; static constexpr uint8_t msEventCharId[2] = {0x01, 0x00};
static constexpr uint8_t msStatusCharId[2] = {0x00, 0x03}; static constexpr uint8_t msStatusCharId[2] = {0x02, 0x00};
static constexpr uint8_t msArtistCharId[2] = {0x00, 0x04}; static constexpr uint8_t msArtistCharId[2] = {0x03, 0x00};
static constexpr uint8_t msTrackCharId[2] = {0x00, 0x05}; static constexpr uint8_t msTrackCharId[2] = {0x04, 0x00};
static constexpr uint8_t msAlbumCharId[2] = {0x00, 0x06}; static constexpr uint8_t msAlbumCharId[2] = {0x05, 0x00};
static constexpr uint8_t msPositionCharId[2] = {0x00, 0x07}; static constexpr uint8_t msPositionCharId[2] = {0x06, 0x00};
static constexpr uint8_t msTotalLengthCharId[2] = {0x00, 0x08}; static constexpr uint8_t msTotalLengthCharId[2] = {0x07, 0x00};
static constexpr uint8_t msTrackNumberCharId[2] = {0x00, 0x09}; static constexpr uint8_t msTrackNumberCharId[2] = {0x08, 0x00};
static constexpr uint8_t msTrackTotalCharId[2] = {0x00, 0x0a}; static constexpr uint8_t msTrackTotalCharId[2] = {0x09, 0x00};
static constexpr uint8_t msPlaybackSpeedCharId[2] = {0x00, 0x0b}; static constexpr uint8_t msPlaybackSpeedCharId[2] = {0x0a, 0x00};
static constexpr uint8_t msRepeatCharId[2] = {0x00, 0x0c}; static constexpr uint8_t msRepeatCharId[2] = {0x0b, 0x00};
static constexpr uint8_t msShuffleCharId[2] = {0x00, 0x0d}; static constexpr uint8_t msShuffleCharId[2] = {0x0c, 0x00};
ble_uuid128_t msUuid{ ble_uuid128_t msUuid{
.u = {.type = BLE_UUID_TYPE_128}, .u = {.type = BLE_UUID_TYPE_128},