1
0
Fork 0

ir_u: convert to ServiceFramework

This commit is contained in:
wwylele 2017-12-09 12:34:23 +02:00
parent 69caf8c5dc
commit f3e41fe941
5 changed files with 36 additions and 35 deletions

View File

@ -13,7 +13,6 @@ namespace IR {
void Init() { void Init() {
AddService(new IR_RST_Interface); AddService(new IR_RST_Interface);
AddService(new IR_U_Interface);
AddService(new IR_User_Interface); AddService(new IR_User_Interface);
InitUser(); InitUser();
@ -30,6 +29,10 @@ void ReloadInputDevices() {
ReloadInputDevicesRST(); ReloadInputDevicesRST();
} }
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<IR_U>()->InstallAsService(service_manager);
}
} // namespace IR } // namespace IR
} // namespace Service } // namespace Service

View File

@ -4,10 +4,11 @@
#pragma once #pragma once
namespace SM {
class ServiceManager;
}
namespace Service { namespace Service {
class Interface;
namespace IR { namespace IR {
/// Initialize IR service /// Initialize IR service
@ -19,5 +20,7 @@ void Shutdown();
/// Reload input devices. Used when input configuration changed /// Reload input devices. Used when input configuration changed
void ReloadInputDevices(); void ReloadInputDevices();
void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace IR } // namespace IR
} // namespace Service } // namespace Service

View File

@ -7,31 +7,28 @@
namespace Service { namespace Service {
namespace IR { namespace IR {
const Interface::FunctionInfo FunctionTable[] = { IR_U::IR_U() : ServiceFramework("ir:u", 1) {
// clang-format off static const FunctionInfo functions[] = {
{0x00010000, nullptr, "Initialize"}, {0x00010000, nullptr, "Initialize"},
{0x00020000, nullptr, "Shutdown"}, {0x00020000, nullptr, "Shutdown"},
{0x00030042, nullptr, "StartSendTransfer"}, {0x00030042, nullptr, "StartSendTransfer"},
{0x00040000, nullptr, "WaitSendTransfer"}, {0x00040000, nullptr, "WaitSendTransfer"},
{0x000500C2, nullptr, "StartRecvTransfer"}, {0x000500C2, nullptr, "StartRecvTransfer"},
{0x00060000, nullptr, "WaitRecvTransfer"}, {0x00060000, nullptr, "WaitRecvTransfer"},
{0x00070080, nullptr, "GetRecvTransferCount"}, {0x00070080, nullptr, "GetRecvTransferCount"},
{0x00080000, nullptr, "GetSendState"}, {0x00080000, nullptr, "GetSendState"},
{0x00090040, nullptr, "SetBitRate"}, {0x00090040, nullptr, "SetBitRate"},
{0x000A0000, nullptr, "GetBitRate"}, {0x000A0000, nullptr, "GetBitRate"},
{0x000B0040, nullptr, "SetIRLEDState"}, {0x000B0040, nullptr, "SetIRLEDState"},
{0x000C0000, nullptr, "GetIRLEDRecvState"}, {0x000C0000, nullptr, "GetIRLEDRecvState"},
{0x000D0000, nullptr, "GetSendFinishedEvent"}, {0x000D0000, nullptr, "GetSendFinishedEvent"},
{0x000E0000, nullptr, "GetRecvFinishedEvent"}, {0x000E0000, nullptr, "GetRecvFinishedEvent"},
{0x000F0000, nullptr, "GetTransferState"}, {0x000F0000, nullptr, "GetTransferState"},
{0x00100000, nullptr, "GetErrorStatus"}, {0x00100000, nullptr, "GetErrorStatus"},
{0x00110040, nullptr, "SetSleepModeActive"}, {0x00110040, nullptr, "SetSleepModeActive"},
{0x00120040, nullptr, "SetSleepModeState"}, {0x00120040, nullptr, "SetSleepModeState"},
// clang-format on };
}; RegisterHandlers(functions);
IR_U_Interface::IR_U_Interface() {
Register(FunctionTable);
} }
} // namespace IR } // namespace IR

View File

@ -9,13 +9,10 @@
namespace Service { namespace Service {
namespace IR { namespace IR {
class IR_U_Interface : public Service::Interface { /// Interface to "ir:u" service
class IR_U final : public ServiceFramework<IR_U> {
public: public:
IR_U_Interface(); IR_U();
std::string GetPortName() const override {
return "ir:u";
}
}; };
} // namespace IR } // namespace IR

View File

@ -274,6 +274,7 @@ void Init() {
FRD::Init(); FRD::Init();
HID::Init(); HID::Init();
IR::Init(); IR::Init();
IR::InstallInterfaces(*SM::g_service_manager);
MVD::Init(); MVD::Init();
NDM::Init(); NDM::Init();
NEWS::Init(); NEWS::Init();