MusicService: Remove SystemTask dependency
This commit is contained in:
parent
310ea81eec
commit
c7a9b3d7d3
|
@ -16,7 +16,7 @@
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "components/ble/MusicService.h"
|
#include "components/ble/MusicService.h"
|
||||||
#include "systemtask/SystemTask.h"
|
#include "components/ble/NimbleController.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -53,7 +53,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask& system) : m_system(system) {
|
Pinetime::Controllers::MusicService::MusicService(Pinetime::Controllers::NimbleController& nimble) : nimble(nimble) {
|
||||||
characteristicDefinition[0] = {.uuid = &msEventCharUuid.u,
|
characteristicDefinition[0] = {.uuid = &msEventCharUuid.u,
|
||||||
.access_cb = MusicCallback,
|
.access_cb = MusicCallback,
|
||||||
.arg = this,
|
.arg = this,
|
||||||
|
@ -212,7 +212,7 @@ int Pinetime::Controllers::MusicService::getTrackLength() const {
|
||||||
void Pinetime::Controllers::MusicService::event(char event) {
|
void Pinetime::Controllers::MusicService::event(char event) {
|
||||||
auto* om = ble_hs_mbuf_from_flat(&event, 1);
|
auto* om = ble_hs_mbuf_from_flat(&event, 1);
|
||||||
|
|
||||||
uint16_t connectionHandle = m_system.nimble().connHandle();
|
uint16_t connectionHandle = nimble.connHandle();
|
||||||
|
|
||||||
if (connectionHandle == 0 || connectionHandle == BLE_HS_CONN_HANDLE_NONE) {
|
if (connectionHandle == 0 || connectionHandle == BLE_HS_CONN_HANDLE_NONE) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,14 +27,12 @@
|
||||||
#undef min
|
#undef min
|
||||||
|
|
||||||
namespace Pinetime {
|
namespace Pinetime {
|
||||||
namespace System {
|
|
||||||
class SystemTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Controllers {
|
namespace Controllers {
|
||||||
|
class NimbleController;
|
||||||
|
|
||||||
class MusicService {
|
class MusicService {
|
||||||
public:
|
public:
|
||||||
explicit MusicService(Pinetime::System::SystemTask& system);
|
explicit MusicService(NimbleController& nimble);
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
@ -89,7 +87,7 @@ namespace Pinetime {
|
||||||
bool repeat {false};
|
bool repeat {false};
|
||||||
bool shuffle {false};
|
bool shuffle {false};
|
||||||
|
|
||||||
Pinetime::System::SystemTask& m_system;
|
NimbleController& nimble;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
|
||||||
anService {systemTask, notificationManager},
|
anService {systemTask, notificationManager},
|
||||||
alertNotificationClient {systemTask, notificationManager},
|
alertNotificationClient {systemTask, notificationManager},
|
||||||
currentTimeService {dateTimeController},
|
currentTimeService {dateTimeController},
|
||||||
musicService {systemTask},
|
musicService {*this},
|
||||||
weatherService {systemTask, dateTimeController},
|
weatherService {systemTask, dateTimeController},
|
||||||
navService {systemTask},
|
navService {systemTask},
|
||||||
batteryInformationService {batteryController},
|
batteryInformationService {batteryController},
|
||||||
|
|
Loading…
Reference in a new issue