Skip to content

Commit c7a9b3d

Browse files
committed
MusicService: Remove SystemTask dependency
1 parent 310ea81 commit c7a9b3d

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

src/components/ble/MusicService.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818
#include "components/ble/MusicService.h"
19-
#include "systemtask/SystemTask.h"
19+
#include "components/ble/NimbleController.h"
2020
#include <cstring>
2121

2222
namespace {
@@ -53,7 +53,7 @@ namespace {
5353
}
5454
}
5555

56-
Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask& system) : m_system(system) {
56+
Pinetime::Controllers::MusicService::MusicService(Pinetime::Controllers::NimbleController& nimble) : nimble(nimble) {
5757
characteristicDefinition[0] = {.uuid = &msEventCharUuid.u,
5858
.access_cb = MusicCallback,
5959
.arg = this,
@@ -212,7 +212,7 @@ int Pinetime::Controllers::MusicService::getTrackLength() const {
212212
void Pinetime::Controllers::MusicService::event(char event) {
213213
auto* om = ble_hs_mbuf_from_flat(&event, 1);
214214

215-
uint16_t connectionHandle = m_system.nimble().connHandle();
215+
uint16_t connectionHandle = nimble.connHandle();
216216

217217
if (connectionHandle == 0 || connectionHandle == BLE_HS_CONN_HANDLE_NONE) {
218218
return;

src/components/ble/MusicService.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@
2727
#undef min
2828

2929
namespace Pinetime {
30-
namespace System {
31-
class SystemTask;
32-
}
33-
3430
namespace Controllers {
31+
class NimbleController;
32+
3533
class MusicService {
3634
public:
37-
explicit MusicService(Pinetime::System::SystemTask& system);
35+
explicit MusicService(NimbleController& nimble);
3836

3937
void Init();
4038

@@ -89,7 +87,7 @@ namespace Pinetime {
8987
bool repeat {false};
9088
bool shuffle {false};
9189

92-
Pinetime::System::SystemTask& m_system;
90+
NimbleController& nimble;
9391
};
9492
}
9593
}

src/components/ble/NimbleController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
4242
anService {systemTask, notificationManager},
4343
alertNotificationClient {systemTask, notificationManager},
4444
currentTimeService {dateTimeController},
45-
musicService {systemTask},
45+
musicService {*this},
4646
weatherService {systemTask, dateTimeController},
4747
navService {systemTask},
4848
batteryInformationService {batteryController},

0 commit comments

Comments
 (0)