M module-services/service-bluetooth/ServiceBluetooth.cpp => module-services/service-bluetooth/ServiceBluetooth.cpp +10 -1
@@ 16,6 16,7 @@
#include <service-bluetooth/messages/BondedDevices.hpp>
#include <log/log.hpp>
+#include "SystemManager/messages/SentinelRegistrationMessage.hpp"
#include <bits/exception.h>
#include <utility>
@@ 42,7 43,15 @@ ServiceBluetooth::~ServiceBluetooth()
// this means it is an init point of bluetooth feature handling
sys::ReturnCodes ServiceBluetooth::InitHandler()
{
- LOG_ERROR("Bluetooth experimental!");
+ cpuSentinel = std::make_shared<sys::CpuSentinel>(service::name::bluetooth, this);
+
+ auto sentinelRegistrationMsg = std::make_shared<sys::SentinelRegistrationMessage>(cpuSentinel);
+ bus.sendUnicast(std::move(sentinelRegistrationMsg), service::name::system_manager);
+
+ // temporarily limit the minimum CPU frequency
+ // due to problems with the UART of the BT module
+ cpuSentinel->HoldMinimumFrequency(bsp::CpuFrequencyHz::Level_6);
+
worker = std::make_unique<BluetoothWorker>(this);
worker->run();
M module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp => module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp +2 -0
@@ 13,6 13,7 @@
#include <module-bluetooth/Bluetooth/CommandHandler.hpp>
#include "BluetoothMessage.hpp"
#include "ProfileManager.hpp"
+#include <Service/CpuSentinel.hpp>
#include <memory> // for unique_ptr
@@ 42,6 43,7 @@ class ServiceBluetooth : public sys::Service
private:
std::unique_ptr<BluetoothWorker> worker;
+ std::shared_ptr<sys::CpuSentinel> cpuSentinel;
bool enabledFromHarness = false;
};