#include "wire_HidJoystick.hpp"
#include "../obapi_runtime.hpp"
#include <type_traits>
static_assert(std::is_same<decltype(::M_HidJoystick::ButtonInfoType::Index), uint32_t>::value, "M_HidJoystick::ButtonInfoType field Index differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::ButtonInfoType::Name), std::string>::value, "M_HidJoystick::ButtonInfoType field Name differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::ButtonInfoType::Description), std::string>::value, "M_HidJoystick::ButtonInfoType field Description differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::ButtonInfoType::DeviceId), std::vector<int64_t>>::value, "M_HidJoystick::ButtonInfoType field DeviceId differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::ButtonInfoType::HardwareAddress), std::vector<int64_t>>::value, "M_HidJoystick::ButtonInfoType field HardwareAddress differs from the data model");
static_assert(std::is_same<::M_HidJoystick::ButtonInfoListType, std::vector<::M_HidJoystick::ButtonInfoType>>::value, "typedef M_HidJoystick::ButtonInfoListType differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::AxisInfoType::Index), uint32_t>::value, "M_HidJoystick::AxisInfoType field Index differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::AxisInfoType::Name), std::string>::value, "M_HidJoystick::AxisInfoType field Name differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::AxisInfoType::Description), std::string>::value, "M_HidJoystick::AxisInfoType field Description differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::AxisInfoType::DeviceId), std::vector<int64_t>>::value, "M_HidJoystick::AxisInfoType field DeviceId differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::AxisInfoType::HardwareAddress), std::vector<int64_t>>::value, "M_HidJoystick::AxisInfoType field HardwareAddress differs from the data model");
static_assert(std::is_same<::M_HidJoystick::AxisInfoListType, std::vector<::M_HidJoystick::AxisInfoType>>::value, "typedef M_HidJoystick::AxisInfoListType differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::DeviceInfoType::Name), std::string>::value, "M_HidJoystick::DeviceInfoType field Name differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::DeviceInfoType::Description), std::string>::value, "M_HidJoystick::DeviceInfoType field Description differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::DeviceInfoType::DeviceId), std::vector<int64_t>>::value, "M_HidJoystick::DeviceInfoType field DeviceId differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::DeviceInfoType::HardwareAddress), std::vector<int64_t>>::value, "M_HidJoystick::DeviceInfoType field HardwareAddress differs from the data model");
static_assert(std::is_same<::M_HidJoystick::DeviceInfoListType, std::vector<::M_HidJoystick::DeviceInfoType>>::value, "typedef M_HidJoystick::DeviceInfoListType differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::IncrementEncoderInfoType::Index), uint32_t>::value, "M_HidJoystick::IncrementEncoderInfoType field Index differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::IncrementEncoderInfoType::Name), std::string>::value, "M_HidJoystick::IncrementEncoderInfoType field Name differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::IncrementEncoderInfoType::Description), std::string>::value, "M_HidJoystick::IncrementEncoderInfoType field Description differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::IncrementEncoderInfoType::DeviceId), std::vector<int64_t>>::value, "M_HidJoystick::IncrementEncoderInfoType field DeviceId differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::IncrementEncoderInfoType::HardwareAddress), std::vector<int64_t>>::value, "M_HidJoystick::IncrementEncoderInfoType field HardwareAddress differs from the data model");
static_assert(std::is_same<::M_HidJoystick::IncrementEncoderInfoListType, std::vector<::M_HidJoystick::IncrementEncoderInfoType>>::value, "typedef M_HidJoystick::IncrementEncoderInfoListType differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::ValueInputInfoType::Index), uint32_t>::value, "M_HidJoystick::ValueInputInfoType field Index differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::ValueInputInfoType::Name), std::string>::value, "M_HidJoystick::ValueInputInfoType field Name differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::ValueInputInfoType::Description), std::string>::value, "M_HidJoystick::ValueInputInfoType field Description differs from the data model");
static_assert(std::is_same<::M_HidJoystick::ValueInputInfoListType, std::vector<::M_HidJoystick::ValueInputInfoType>>::value, "typedef M_HidJoystick::ValueInputInfoListType differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::JoystickSettingsType::Axes), std::vector<::M_HidJoystick::AxisInfoType>>::value, "M_HidJoystick::JoystickSettingsType field Axes differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::JoystickSettingsType::Buttons), std::vector<::M_HidJoystick::ButtonInfoType>>::value, "M_HidJoystick::JoystickSettingsType field Buttons differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::JoystickSettingsType::IncrementEncoders), std::vector<::M_HidJoystick::IncrementEncoderInfoType>>::value, "M_HidJoystick::JoystickSettingsType field IncrementEncoders differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::JoystickSettingsType::ValueInputs), std::vector<::M_HidJoystick::ValueInputInfoType>>::value, "M_HidJoystick::JoystickSettingsType field ValueInputs differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::JoystickSettingsType::DeviceInfo), ::M_HidJoystick::DeviceInfoType>::value, "M_HidJoystick::JoystickSettingsType field DeviceInfo differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::JoystickSettingsType::IsConfigJoystickCurveSupported), bool>::value, "M_HidJoystick::JoystickSettingsType field IsConfigJoystickCurveSupported differs from the data model");
static_assert(std::is_same<decltype(::M_HidJoystick::JoystickSettingsType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_HidJoystick::JoystickSettingsType field AdditionalInfo differs from the data model");
namespace M_HidJoystick {
void obapi_put(::obapi::Writer& w, ButtonInfoType const& v) {
::obapi::put(w, v.Index);
::obapi::put(w, v.Name);
::obapi::put(w, v.Description);
::obapi::put(w, v.DeviceId);
::obapi::put(w, v.HardwareAddress);
}
void obapi_get(::obapi::Reader& r, ButtonInfoType& v) {
::obapi::get(r, v.Index);
::obapi::get(r, v.Name);
::obapi::get(r, v.Description);
::obapi::get(r, v.DeviceId);
::obapi::get(r, v.HardwareAddress);
}
void obapi_put(::obapi::Writer& w, AxisInfoType const& v) {
::obapi::put(w, v.Index);
::obapi::put(w, v.Name);
::obapi::put(w, v.Description);
::obapi::put(w, v.DeviceId);
::obapi::put(w, v.HardwareAddress);
}
void obapi_get(::obapi::Reader& r, AxisInfoType& v) {
::obapi::get(r, v.Index);
::obapi::get(r, v.Name);
::obapi::get(r, v.Description);
::obapi::get(r, v.DeviceId);
::obapi::get(r, v.HardwareAddress);
}
void obapi_put(::obapi::Writer& w, DeviceInfoType const& v) {
::obapi::put(w, v.Name);
::obapi::put(w, v.Description);
::obapi::put(w, v.DeviceId);
::obapi::put(w, v.HardwareAddress);
}
void obapi_get(::obapi::Reader& r, DeviceInfoType& v) {
::obapi::get(r, v.Name);
::obapi::get(r, v.Description);
::obapi::get(r, v.DeviceId);
::obapi::get(r, v.HardwareAddress);
}
void obapi_put(::obapi::Writer& w, IncrementEncoderInfoType const& v) {
::obapi::put(w, v.Index);
::obapi::put(w, v.Name);
::obapi::put(w, v.Description);
::obapi::put(w, v.DeviceId);
::obapi::put(w, v.HardwareAddress);
}
void obapi_get(::obapi::Reader& r, IncrementEncoderInfoType& v) {
::obapi::get(r, v.Index);
::obapi::get(r, v.Name);
::obapi::get(r, v.Description);
::obapi::get(r, v.DeviceId);
::obapi::get(r, v.HardwareAddress);
}
void obapi_put(::obapi::Writer& w, ValueInputInfoType const& v) {
::obapi::put(w, v.Index);
::obapi::put(w, v.Name);
::obapi::put(w, v.Description);
}
void obapi_get(::obapi::Reader& r, ValueInputInfoType& v) {
::obapi::get(r, v.Index);
::obapi::get(r, v.Name);
::obapi::get(r, v.Description);
}
void obapi_put(::obapi::Writer& w, JoystickSettingsType const& v) {
::obapi::put(w, v.Axes);
::obapi::put(w, v.Buttons);
::obapi::put(w, v.IncrementEncoders);
::obapi::put(w, v.ValueInputs);
::obapi::put(w, v.DeviceInfo);
::obapi::put(w, v.IsConfigJoystickCurveSupported);
::obapi::put(w, v.AdditionalInfo);
}
void obapi_get(::obapi::Reader& r, JoystickSettingsType& v) {
::obapi::get(r, v.Axes);
::obapi::get(r, v.Buttons);
::obapi::get(r, v.IncrementEncoders);
::obapi::get(r, v.ValueInputs);
::obapi::get(r, v.DeviceInfo);
::obapi::get(r, v.IsConfigJoystickCurveSupported);
::obapi::get(r, v.AdditionalInfo);
}
}
namespace {
struct ServiceCallbacks final : ::M_HidJoystick::IService {
::obapi::Dispatcher dispatcher;
void CmdIsJoystickAlive() override {
::obapi::Writer w;
dispatcher.dispatch(0u, w);
}
void ConfigJoystickCurve(uint32_t KeyAxisIndex, std::string const& Curve, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, KeyAxisIndex);
::obapi::put(w, Curve);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(1u, w);
}
};
struct ClientCallbacks final : ::M_HidJoystick::IClient {
::obapi::Dispatcher dispatcher;
void EventButton(uint32_t ButtonIndex, std::string const& ButtonName, bool IsSelected) override {
::obapi::Writer w;
::obapi::put(w, ButtonIndex);
::obapi::put(w, ButtonName);
::obapi::put(w, IsSelected);
dispatcher.dispatch(0u, w);
}
void EventIncrement(uint32_t Index, int32_t Steps) override {
::obapi::Writer w;
::obapi::put(w, Index);
::obapi::put(w, Steps);
dispatcher.dispatch(1u, w);
}
void ReportJoystickSettings(::M_HidJoystick::JoystickSettingsType const& Settings) override {
::obapi::Writer w;
::obapi::put(w, Settings);
dispatcher.dispatch(2u, w);
}
void ReportAxis(uint32_t KeyAxisIndex, double Value, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, KeyAxisIndex);
::obapi::put(w, Value);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(3u, w);
}
void ReportInputValue(uint32_t KeyValueInputIndex, ::M_Common::PropertyType const& Value, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, KeyValueInputIndex);
::obapi::put(w, Value);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(4u, w);
}
void ReportMenuStatus(uint32_t KeyMenuIndex, bool IsActive, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, KeyMenuIndex);
::obapi::put(w, IsActive);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(5u, w);
}
void ReportJoystickCurve(uint32_t KeyAxisIndex, std::string const& Curve, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, KeyAxisIndex);
::obapi::put(w, Curve);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(6u, w);
}
};
void service_send(::obapi::Holder<::M_HidJoystick::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
uint32_t ButtonIndex{};
::obapi::get(r, ButtonIndex);
std::string ButtonName{};
::obapi::get(r, ButtonName);
bool IsSelected{};
::obapi::get(r, IsSelected);
r.finish();
h.endpoint->EventButton(ButtonIndex, ButtonName, IsSelected);
return;
}
case 1u: {
uint32_t Index{};
::obapi::get(r, Index);
int32_t Steps{};
::obapi::get(r, Steps);
r.finish();
h.endpoint->EventIncrement(Index, Steps);
return;
}
case 2u: {
::M_HidJoystick::JoystickSettingsType Settings{};
::obapi::get(r, Settings);
r.finish();
h.endpoint->ReportJoystickSettings(Settings);
return;
}
case 3u: {
uint32_t KeyAxisIndex{};
::obapi::get(r, KeyAxisIndex);
double Value{};
::obapi::get(r, Value);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportAxis(KeyAxisIndex, Value, IsRemoved);
return;
}
case 4u: {
uint32_t KeyValueInputIndex{};
::obapi::get(r, KeyValueInputIndex);
::M_Common::PropertyType Value{};
::obapi::get(r, Value);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportInputValue(KeyValueInputIndex, Value, IsRemoved);
return;
}
case 5u: {
uint32_t KeyMenuIndex{};
::obapi::get(r, KeyMenuIndex);
bool IsActive{};
::obapi::get(r, IsActive);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportMenuStatus(KeyMenuIndex, IsActive, IsRemoved);
return;
}
case 6u: {
uint32_t KeyAxisIndex{};
::obapi::get(r, KeyAxisIndex);
std::string Curve{};
::obapi::get(r, Curve);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportJoystickCurve(KeyAxisIndex, Curve, IsRemoved);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
void client_send(::obapi::Holder<::M_HidJoystick::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
r.finish();
h.endpoint->CmdIsJoystickAlive();
return;
}
case 1u: {
uint32_t KeyAxisIndex{};
::obapi::get(r, KeyAxisIndex);
std::string Curve{};
::obapi::get(r, Curve);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ConfigJoystickCurve(KeyAxisIndex, Curve, IsRemoved);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
}
extern "C" const obapi_vtable obapi_HidJoystick_service_vtable = ::obapi::Endpoint<::M_HidJoystick::Service, ServiceCallbacks, &service_send, false>::vtable("M_HidJoystick", "Service");
extern "C" const obapi_vtable obapi_HidJoystick_client_vtable = ::obapi::Endpoint<::M_HidJoystick::Client, ClientCallbacks, &client_send, true>::vtable("M_HidJoystick", "Client");