Skip to content
Snippets Groups Projects
Commit c33faabb authored by David Marcec's avatar David Marcec
Browse files

Deglobalize System: Btm

parent f2b61ff0
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ namespace Service::BTM { ...@@ -17,7 +17,7 @@ namespace Service::BTM {
class IBtmUserCore final : public ServiceFramework<IBtmUserCore> { class IBtmUserCore final : public ServiceFramework<IBtmUserCore> {
public: public:
explicit IBtmUserCore() : ServiceFramework{"IBtmUserCore"} { explicit IBtmUserCore(Core::System& system) : ServiceFramework{"IBtmUserCore"} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"}, {0, &IBtmUserCore::AcquireBleScanEvent, "AcquireBleScanEvent"},
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
// clang-format on // clang-format on
RegisterHandlers(functions); RegisterHandlers(functions);
auto& kernel = Core::System::GetInstance().Kernel(); auto& kernel = system.Kernel();
scan_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, scan_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic,
"IBtmUserCore:ScanEvent"); "IBtmUserCore:ScanEvent");
connection_event = Kernel::WritableEvent::CreateEventPair( connection_event = Kernel::WritableEvent::CreateEventPair(
...@@ -108,7 +108,7 @@ private: ...@@ -108,7 +108,7 @@ private:
class BTM_USR final : public ServiceFramework<BTM_USR> { class BTM_USR final : public ServiceFramework<BTM_USR> {
public: public:
explicit BTM_USR() : ServiceFramework{"btm:u"} { explicit BTM_USR(Core::System& system) : ServiceFramework{"btm:u"}, system(system) {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &BTM_USR::GetCore, "GetCore"}, {0, &BTM_USR::GetCore, "GetCore"},
...@@ -123,8 +123,10 @@ private: ...@@ -123,8 +123,10 @@ private:
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<IBtmUserCore>(); rb.PushIpcInterface<IBtmUserCore>(system);
} }
Core::System& system;
}; };
class BTM final : public ServiceFramework<BTM> { class BTM final : public ServiceFramework<BTM> {
...@@ -268,11 +270,11 @@ private: ...@@ -268,11 +270,11 @@ private:
} }
}; };
void InstallInterfaces(SM::ServiceManager& sm) { void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) {
std::make_shared<BTM>()->InstallAsService(sm); std::make_shared<BTM>()->InstallAsService(sm);
std::make_shared<BTM_DBG>()->InstallAsService(sm); std::make_shared<BTM_DBG>()->InstallAsService(sm);
std::make_shared<BTM_SYS>()->InstallAsService(sm); std::make_shared<BTM_SYS>()->InstallAsService(sm);
std::make_shared<BTM_USR>()->InstallAsService(sm); std::make_shared<BTM_USR>(system)->InstallAsService(sm);
} }
} // namespace Service::BTM } // namespace Service::BTM
...@@ -8,8 +8,12 @@ namespace Service::SM { ...@@ -8,8 +8,12 @@ namespace Service::SM {
class ServiceManager; class ServiceManager;
} }
namespace Core {
class System;
};
namespace Service::BTM { namespace Service::BTM {
void InstallInterfaces(SM::ServiceManager& sm); void InstallInterfaces(SM::ServiceManager& sm, Core::System& system);
} // namespace Service::BTM } // namespace Service::BTM
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment