#include "wire_Device.hpp"
#include "../obapi_runtime.hpp"
#include <type_traits>
static_assert(std::is_same<decltype(::M_Device::HardwareInfoType::ModuleName), std::string>::value, "M_Device::HardwareInfoType field ModuleName differs from the data model");
static_assert(std::is_same<decltype(::M_Device::HardwareInfoType::HardwareVersion), std::string>::value, "M_Device::HardwareInfoType field HardwareVersion differs from the data model");
static_assert(std::is_same<decltype(::M_Device::HardwareInfoType::HardwarePartNumber), std::string>::value, "M_Device::HardwareInfoType field HardwarePartNumber differs from the data model");
static_assert(std::is_same<decltype(::M_Device::HardwareInfoType::HardwareSerialNumber), std::string>::value, "M_Device::HardwareInfoType field HardwareSerialNumber differs from the data model");
static_assert(std::is_same<::M_Device::HardwareInfoListType, std::vector<::M_Device::HardwareInfoType>>::value, "typedef M_Device::HardwareInfoListType differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::ModuleName), std::string>::value, "M_Device::SoftwareVersionType field ModuleName differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::ChildModuleNames), std::vector<std::string>>::value, "M_Device::SoftwareVersionType field ChildModuleNames differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::Major), uint32_t>::value, "M_Device::SoftwareVersionType field Major differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::Minor), uint32_t>::value, "M_Device::SoftwareVersionType field Minor differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::Patch), uint32_t>::value, "M_Device::SoftwareVersionType field Patch differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::PartNumber), std::string>::value, "M_Device::SoftwareVersionType field PartNumber differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::Tag), std::string>::value, "M_Device::SoftwareVersionType field Tag differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::VcsId), std::string>::value, "M_Device::SoftwareVersionType field VcsId differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::MaterialRevision), std::string>::value, "M_Device::SoftwareVersionType field MaterialRevision differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::BuildDate), std::vector<::M_Common::TimeType>>::value, "M_Device::SoftwareVersionType field BuildDate differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::CommitDate), std::vector<::M_Common::TimeType>>::value, "M_Device::SoftwareVersionType field CommitDate differs from the data model");
static_assert(std::is_same<decltype(::M_Device::SoftwareVersionType::Checksum), std::string>::value, "M_Device::SoftwareVersionType field Checksum differs from the data model");
static_assert(std::is_same<::M_Device::SoftwareVersionListType, std::vector<::M_Device::SoftwareVersionType>>::value, "typedef M_Device::SoftwareVersionListType differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::DeviceName), std::string>::value, "M_Device::DeviceSettingsType field DeviceName differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::Description), std::string>::value, "M_Device::DeviceSettingsType field Description differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::HwInfoList), std::vector<::M_Device::HardwareInfoType>>::value, "M_Device::DeviceSettingsType field HwInfoList differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::SwVersionList), std::vector<::M_Device::SoftwareVersionType>>::value, "M_Device::DeviceSettingsType field SwVersionList differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::IsSetDeviceModeSupported), bool>::value, "M_Device::DeviceSettingsType field IsSetDeviceModeSupported differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::SupportedOperationStatusList), std::vector<::M_Common::OperationStatusType>>::value, "M_Device::DeviceSettingsType field SupportedOperationStatusList differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::IsShutdownDeviceSupported), bool>::value, "M_Device::DeviceSettingsType field IsShutdownDeviceSupported differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::ShutdownDurationSec), std::vector<uint32_t>>::value, "M_Device::DeviceSettingsType field ShutdownDurationSec differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::IsRestartDeviceSupported), bool>::value, "M_Device::DeviceSettingsType field IsRestartDeviceSupported differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::RestartDurationSec), std::vector<uint32_t>>::value, "M_Device::DeviceSettingsType field RestartDurationSec differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceSettingsType::AdditionalInfo), std::vector<::M_Common::PropertyType>>::value, "M_Device::DeviceSettingsType field AdditionalInfo differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceStatusType::IsEnabled), bool>::value, "M_Device::DeviceStatusType field IsEnabled differs from the data model");
static_assert(std::is_same<decltype(::M_Device::DeviceStatusType::OperationStatus), ::M_Common::OperationStatusType>::value, "M_Device::DeviceStatusType field OperationStatus differs from the data model");
namespace M_Device {
void obapi_put(::obapi::Writer& w, HardwareInfoType const& v) {
::obapi::put(w, v.ModuleName);
::obapi::put(w, v.HardwareVersion);
::obapi::put(w, v.HardwarePartNumber);
::obapi::put(w, v.HardwareSerialNumber);
}
void obapi_get(::obapi::Reader& r, HardwareInfoType& v) {
::obapi::get(r, v.ModuleName);
::obapi::get(r, v.HardwareVersion);
::obapi::get(r, v.HardwarePartNumber);
::obapi::get(r, v.HardwareSerialNumber);
}
void obapi_put(::obapi::Writer& w, SoftwareVersionType const& v) {
::obapi::put(w, v.ModuleName);
::obapi::put(w, v.ChildModuleNames);
::obapi::put(w, v.Major);
::obapi::put(w, v.Minor);
::obapi::put(w, v.Patch);
::obapi::put(w, v.PartNumber);
::obapi::put(w, v.Tag);
::obapi::put(w, v.VcsId);
::obapi::put(w, v.MaterialRevision);
::obapi::put(w, v.BuildDate);
::obapi::put(w, v.CommitDate);
::obapi::put(w, v.Checksum);
}
void obapi_get(::obapi::Reader& r, SoftwareVersionType& v) {
::obapi::get(r, v.ModuleName);
::obapi::get(r, v.ChildModuleNames);
::obapi::get(r, v.Major);
::obapi::get(r, v.Minor);
::obapi::get(r, v.Patch);
::obapi::get(r, v.PartNumber);
::obapi::get(r, v.Tag);
::obapi::get(r, v.VcsId);
::obapi::get(r, v.MaterialRevision);
::obapi::get(r, v.BuildDate);
::obapi::get(r, v.CommitDate);
::obapi::get(r, v.Checksum);
}
void obapi_put(::obapi::Writer& w, DeviceSettingsType const& v) {
::obapi::put(w, v.DeviceName);
::obapi::put(w, v.Description);
::obapi::put(w, v.HwInfoList);
::obapi::put(w, v.SwVersionList);
::obapi::put(w, v.IsSetDeviceModeSupported);
::obapi::put(w, v.SupportedOperationStatusList);
::obapi::put(w, v.IsShutdownDeviceSupported);
::obapi::put(w, v.ShutdownDurationSec);
::obapi::put(w, v.IsRestartDeviceSupported);
::obapi::put(w, v.RestartDurationSec);
::obapi::put(w, v.AdditionalInfo);
}
void obapi_get(::obapi::Reader& r, DeviceSettingsType& v) {
::obapi::get(r, v.DeviceName);
::obapi::get(r, v.Description);
::obapi::get(r, v.HwInfoList);
::obapi::get(r, v.SwVersionList);
::obapi::get(r, v.IsSetDeviceModeSupported);
::obapi::get(r, v.SupportedOperationStatusList);
::obapi::get(r, v.IsShutdownDeviceSupported);
::obapi::get(r, v.ShutdownDurationSec);
::obapi::get(r, v.IsRestartDeviceSupported);
::obapi::get(r, v.RestartDurationSec);
::obapi::get(r, v.AdditionalInfo);
}
void obapi_put(::obapi::Writer& w, DeviceStatusType const& v) {
::obapi::put(w, v.IsEnabled);
::obapi::put(w, v.OperationStatus);
}
void obapi_get(::obapi::Reader& r, DeviceStatusType& v) {
::obapi::get(r, v.IsEnabled);
::obapi::get(r, v.OperationStatus);
}
}
namespace {
struct ServiceCallbacks final : ::M_Device::IService {
::obapi::Dispatcher dispatcher;
void CmdIsDeviceAlive() override {
::obapi::Writer w;
dispatcher.dispatch(0u, w);
}
void CmdEnableDevice(bool IsEnabled) override {
::obapi::Writer w;
::obapi::put(w, IsEnabled);
dispatcher.dispatch(1u, w);
}
void CmdShutdownDevice() override {
::obapi::Writer w;
dispatcher.dispatch(2u, w);
}
void CmdRestartDevice() override {
::obapi::Writer w;
dispatcher.dispatch(3u, w);
}
void CmdSetDeviceMode(::M_Common::OperationModeType const& Mode) override {
::obapi::Writer w;
::obapi::put(w, Mode);
dispatcher.dispatch(4u, w);
}
void CmdSetValue(std::string const& Id, ::M_Common::PropertyType const& Value) override {
::obapi::Writer w;
::obapi::put(w, Id);
::obapi::put(w, Value);
dispatcher.dispatch(5u, w);
}
void CmdSetValueIncrementally(std::string const& Id, ::M_Common::PropertyType const& Value) override {
::obapi::Writer w;
::obapi::put(w, Id);
::obapi::put(w, Value);
dispatcher.dispatch(6u, w);
}
void RequestValue(std::string const& Id) override {
::obapi::Writer w;
::obapi::put(w, Id);
dispatcher.dispatch(7u, w);
}
};
struct ClientCallbacks final : ::M_Device::IClient {
::obapi::Dispatcher dispatcher;
void ReportDeviceSettings(::M_Device::DeviceSettingsType const& Settings) override {
::obapi::Writer w;
::obapi::put(w, Settings);
dispatcher.dispatch(0u, w);
}
void ReportDeviceStatus(::M_Device::DeviceStatusType const& Status, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, Status);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(1u, w);
}
void ReportValue(std::string const& KeyId, ::M_Common::PropertyType const& Value, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, KeyId);
::obapi::put(w, Value);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(2u, w);
}
void ResponseValue(std::string const& Id, ::M_Common::PropertyType const& Value) override {
::obapi::Writer w;
::obapi::put(w, Id);
::obapi::put(w, Value);
dispatcher.dispatch(3u, w);
}
};
void service_send(::obapi::Holder<::M_Device::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
::M_Device::DeviceSettingsType Settings{};
::obapi::get(r, Settings);
r.finish();
h.endpoint->ReportDeviceSettings(Settings);
return;
}
case 1u: {
::M_Device::DeviceStatusType Status{};
::obapi::get(r, Status);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportDeviceStatus(Status, IsRemoved);
return;
}
case 2u: {
std::string KeyId{};
::obapi::get(r, KeyId);
::M_Common::PropertyType Value{};
::obapi::get(r, Value);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportValue(KeyId, Value, IsRemoved);
return;
}
case 3u: {
std::string Id{};
::obapi::get(r, Id);
::M_Common::PropertyType Value{};
::obapi::get(r, Value);
r.finish();
h.endpoint->ResponseValue(Id, Value);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
void client_send(::obapi::Holder<::M_Device::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
r.finish();
h.endpoint->CmdIsDeviceAlive();
return;
}
case 1u: {
bool IsEnabled{};
::obapi::get(r, IsEnabled);
r.finish();
h.endpoint->CmdEnableDevice(IsEnabled);
return;
}
case 2u: {
r.finish();
h.endpoint->CmdShutdownDevice();
return;
}
case 3u: {
r.finish();
h.endpoint->CmdRestartDevice();
return;
}
case 4u: {
::M_Common::OperationModeType Mode{};
::obapi::get(r, Mode);
r.finish();
h.endpoint->CmdSetDeviceMode(Mode);
return;
}
case 5u: {
std::string Id{};
::obapi::get(r, Id);
::M_Common::PropertyType Value{};
::obapi::get(r, Value);
r.finish();
h.endpoint->CmdSetValue(Id, Value);
return;
}
case 6u: {
std::string Id{};
::obapi::get(r, Id);
::M_Common::PropertyType Value{};
::obapi::get(r, Value);
r.finish();
h.endpoint->CmdSetValueIncrementally(Id, Value);
return;
}
case 7u: {
std::string Id{};
::obapi::get(r, Id);
r.finish();
h.endpoint->RequestValue(Id);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
}
extern "C" const obapi_vtable obapi_Device_service_vtable = ::obapi::Endpoint<::M_Device::Service, ServiceCallbacks, &service_send, false>::vtable("M_Device", "Service");
extern "C" const obapi_vtable obapi_Device_client_vtable = ::obapi::Endpoint<::M_Device::Client, ClientCallbacks, &client_send, true>::vtable("M_Device", "Client");