diff options
| author | Adam Pigg <adam@piggz.co.uk> | 2020-07-20 20:28:21 (GMT) |
|---|---|---|
| committer | Adam Pigg <adam@piggz.co.uk> | 2020-07-20 20:28:21 (GMT) |
| commit | 5713eac1045394928de19e76fd00a172f63bffa7 (patch) | |
| tree | a20e130e01147c4afc89981d7bcfa6773dc6445e /src/Components/Ble/MusicService.h | |
| parent | 686e826f4e656546523e989535c74f286a91855b (diff) | |
Fully implement music app and service
SystemTask can return a reference to the nimbleController
The nimbleController can return a reference to the musicService
The musicService get a connection handle from the nimbleController
The musicApp communicated directly with the musicService
Diffstat (limited to 'src/Components/Ble/MusicService.h')
| -rw-r--r-- | src/Components/Ble/MusicService.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Components/Ble/MusicService.h b/src/Components/Ble/MusicService.h index ba87235..ab6db57 100644 --- a/src/Components/Ble/MusicService.h +++ b/src/Components/Ble/MusicService.h @@ -1,4 +1,5 @@ #pragma once + #include <cstdint> #include <array> #include <host/ble_gap.h> @@ -9,10 +10,14 @@ #define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7} namespace Pinetime { + namespace System { + class SystemTask; + } namespace Controllers { + class MusicService { public: - MusicService(); + MusicService(Pinetime::System::SystemTask &system); void Init(); int OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt); @@ -20,6 +25,8 @@ namespace Pinetime { std::string artist(); std::string track(); std::string album(); + unsigned char status(); + void event(char event); static const char EVENT_MUSIC_OPEN = 0xe0; @@ -29,7 +36,8 @@ namespace Pinetime { static const char EVENT_MUSIC_PREV = 0x04; static const char EVENT_MUSIC_VOLUP = 0x05; static const char EVENT_MUSIC_VOLDOWN = 0x06; - + static const char STATUS_MUSIC_PAUSED = 0x00; + static const char STATUS_MUSIC_PLAYING = 0x01; private: static constexpr uint8_t msId[2] = {0x00, 0x01}; @@ -67,13 +75,17 @@ namespace Pinetime { struct ble_gatt_chr_def characteristicDefinition[6]; struct ble_gatt_svc_def serviceDefinition[2]; - + uint16_t m_eventHandle; std::string m_artist; std::string m_album; std::string m_track; + unsigned char m_status; + + Pinetime::System::SystemTask& m_system; + }; } } |
