blob: 5220fadddef11989abc8c1a8ada8b06aa53a929e [file] [log] [blame]
// iioservice/mojo/sensor.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "iioservice/mojo/sensor.mojom-shared.h"
// Used to support stream output operator for enums.
// TODO(dcheng): Consider omitting this somehow if not needed.
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "iioservice/mojo/sensor.mojom-params-data.h"
namespace cros {
namespace mojom {
NOINLINE static const char* DeviceTypeToStringHelper(DeviceType value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case DeviceType::NONE:
return "NONE";
case DeviceType::ACCEL:
return "ACCEL";
case DeviceType::ANGLVEL:
return "ANGLVEL";
case DeviceType::LIGHT:
return "LIGHT";
case DeviceType::COUNT:
return "COUNT";
case DeviceType::MAGN:
return "MAGN";
case DeviceType::ANGL:
return "ANGL";
case DeviceType::BARO:
return "BARO";
case DeviceType::ACCEL_UNCALIBRATED:
return "ACCEL_UNCALIBRATED";
case DeviceType::ANGLVEL_UNCALIBRATED:
return "ANGLVEL_UNCALIBRATED";
case DeviceType::MAGN_UNCALIBRATED:
return "MAGN_UNCALIBRATED";
case DeviceType::GRAVITY:
return "GRAVITY";
case DeviceType::PROXIMITY:
return "PROXIMITY";
default:
return nullptr;
}
}
std::string DeviceTypeToString(DeviceType value) {
const char *str = DeviceTypeToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown DeviceType value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, DeviceType value) {
return os << DeviceTypeToString(value);
}
NOINLINE static const char* ObserverErrorTypeToStringHelper(ObserverErrorType value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case ObserverErrorType::ALREADY_STARTED:
return "ALREADY_STARTED";
case ObserverErrorType::SET_FREQUENCY_IO_FAILED:
return "SET_FREQUENCY_IO_FAILED";
case ObserverErrorType::FREQUENCY_INVALID:
return "FREQUENCY_INVALID";
case ObserverErrorType::NO_ENABLED_CHANNELS:
return "NO_ENABLED_CHANNELS";
case ObserverErrorType::GET_FD_FAILED:
return "GET_FD_FAILED";
case ObserverErrorType::READ_FAILED:
return "READ_FAILED";
case ObserverErrorType::READ_TIMEOUT:
return "READ_TIMEOUT";
default:
return nullptr;
}
}
std::string ObserverErrorTypeToString(ObserverErrorType value) {
const char *str = ObserverErrorTypeToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown ObserverErrorType value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, ObserverErrorType value) {
return os << ObserverErrorTypeToString(value);
}
NOINLINE static const char* SensorServiceDisconnectReasonToStringHelper(SensorServiceDisconnectReason value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case SensorServiceDisconnectReason::IIOSERVICE_CRASHED:
return "IIOSERVICE_CRASHED";
case SensorServiceDisconnectReason::IIOSERVICE_SHUTDOWN:
return "IIOSERVICE_SHUTDOWN";
case SensorServiceDisconnectReason::CHROME_STOPPED:
return "CHROME_STOPPED";
default:
return nullptr;
}
}
std::string SensorServiceDisconnectReasonToString(SensorServiceDisconnectReason value) {
const char *str = SensorServiceDisconnectReasonToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown SensorServiceDisconnectReason value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, SensorServiceDisconnectReason value) {
return os << SensorServiceDisconnectReasonToString(value);
}
NOINLINE static const char* SensorDeviceDisconnectReasonToStringHelper(SensorDeviceDisconnectReason value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case SensorDeviceDisconnectReason::IIOSERVICE_CRASHED:
return "IIOSERVICE_CRASHED";
case SensorDeviceDisconnectReason::DEVICE_REMOVED:
return "DEVICE_REMOVED";
default:
return nullptr;
}
}
std::string SensorDeviceDisconnectReasonToString(SensorDeviceDisconnectReason value) {
const char *str = SensorDeviceDisconnectReasonToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown SensorDeviceDisconnectReason value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, SensorDeviceDisconnectReason value) {
return os << SensorDeviceDisconnectReasonToString(value);
}
NOINLINE static const char* IioChanTypeToStringHelper(IioChanType value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case IioChanType::IIO_PROXIMITY:
return "IIO_PROXIMITY";
default:
return nullptr;
}
}
std::string IioChanTypeToString(IioChanType value) {
const char *str = IioChanTypeToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown IioChanType value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, IioChanType value) {
return os << IioChanTypeToString(value);
}
NOINLINE static const char* IioEventTypeToStringHelper(IioEventType value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case IioEventType::IIO_EV_TYPE_THRESH:
return "IIO_EV_TYPE_THRESH";
case IioEventType::IIO_EV_TYPE_MAG:
return "IIO_EV_TYPE_MAG";
case IioEventType::IIO_EV_TYPE_ROC:
return "IIO_EV_TYPE_ROC";
case IioEventType::IIO_EV_TYPE_THRESH_ADAPTIVE:
return "IIO_EV_TYPE_THRESH_ADAPTIVE";
case IioEventType::IIO_EV_TYPE_MAG_ADAPTIVE:
return "IIO_EV_TYPE_MAG_ADAPTIVE";
case IioEventType::IIO_EV_TYPE_CHANGE:
return "IIO_EV_TYPE_CHANGE";
default:
return nullptr;
}
}
std::string IioEventTypeToString(IioEventType value) {
const char *str = IioEventTypeToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown IioEventType value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, IioEventType value) {
return os << IioEventTypeToString(value);
}
NOINLINE static const char* IioEventDirectionToStringHelper(IioEventDirection value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case IioEventDirection::IIO_EV_DIR_EITHER:
return "IIO_EV_DIR_EITHER";
case IioEventDirection::IIO_EV_DIR_RISING:
return "IIO_EV_DIR_RISING";
case IioEventDirection::IIO_EV_DIR_FALLING:
return "IIO_EV_DIR_FALLING";
case IioEventDirection::IIO_EV_DIR_NONE:
return "IIO_EV_DIR_NONE";
default:
return nullptr;
}
}
std::string IioEventDirectionToString(IioEventDirection value) {
const char *str = IioEventDirectionToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown IioEventDirection value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, IioEventDirection value) {
return os << IioEventDirectionToString(value);
}
namespace internal {
// static
bool IioEvent_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 32, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const IioEvent_Data* object =
static_cast<const IioEvent_Data*>(data);
if (!::cros::mojom::internal::IioChanType_Data
::Validate(object->chan_type, validation_context))
return false;
if (!::cros::mojom::internal::IioEventType_Data
::Validate(object->event_type, validation_context))
return false;
if (!::cros::mojom::internal::IioEventDirection_Data
::Validate(object->direction, validation_context))
return false;
return true;
}
IioEvent_Data::IioEvent_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorService_GetDeviceIds_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorService_GetDeviceIds_Params_Data* object =
static_cast<const SensorService_GetDeviceIds_Params_Data*>(data);
if (!::cros::mojom::internal::DeviceType_Data
::Validate(object->type, validation_context))
return false;
return true;
}
SensorService_GetDeviceIds_Params_Data::SensorService_GetDeviceIds_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorService_GetDeviceIds_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorService_GetDeviceIds_ResponseParams_Data* object =
static_cast<const SensorService_GetDeviceIds_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_device_ids, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_device_ids_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->iio_device_ids, validation_context,
&iio_device_ids_validate_params)) {
return false;
}
return true;
}
SensorService_GetDeviceIds_ResponseParams_Data::SensorService_GetDeviceIds_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorService_GetAllDeviceIds_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 8, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorService_GetAllDeviceIds_Params_Data* object =
static_cast<const SensorService_GetAllDeviceIds_Params_Data*>(data);
return true;
}
SensorService_GetAllDeviceIds_Params_Data::SensorService_GetAllDeviceIds_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorService_GetAllDeviceIds_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorService_GetAllDeviceIds_ResponseParams_Data* object =
static_cast<const SensorService_GetAllDeviceIds_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_device_ids_types, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_device_ids_types_validate_params =
mojo::internal::GetMapValidator<*&mojo::internal::GetArrayValidator<0, false, nullptr>(), *&mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayOfEnumsValidator<0, false, ::cros::mojom::internal::DeviceType_Data::Validate>()>()>();
if (!mojo::internal::ValidateContainer(object->iio_device_ids_types, validation_context,
&iio_device_ids_types_validate_params)) {
return false;
}
return true;
}
SensorService_GetAllDeviceIds_ResponseParams_Data::SensorService_GetAllDeviceIds_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorService_GetDevice_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorService_GetDevice_Params_Data* object =
static_cast<const SensorService_GetDevice_Params_Data*>(data);
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->device_request, 2, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->device_request,
validation_context)) {
return false;
}
return true;
}
SensorService_GetDevice_Params_Data::SensorService_GetDevice_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorService_RegisterNewDevicesObserver_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorService_RegisterNewDevicesObserver_Params_Data* object =
static_cast<const SensorService_RegisterNewDevicesObserver_Params_Data*>(data);
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->observer, 1, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->observer,
validation_context)) {
return false;
}
return true;
}
SensorService_RegisterNewDevicesObserver_Params_Data::SensorService_RegisterNewDevicesObserver_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_SetTimeout_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_SetTimeout_Params_Data* object =
static_cast<const SensorDevice_SetTimeout_Params_Data*>(data);
return true;
}
SensorDevice_SetTimeout_Params_Data::SensorDevice_SetTimeout_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetAttributes_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetAttributes_Params_Data* object =
static_cast<const SensorDevice_GetAttributes_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->attr_names, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& attr_names_validate_params =
mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
if (!mojo::internal::ValidateContainer(object->attr_names, validation_context,
&attr_names_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetAttributes_Params_Data::SensorDevice_GetAttributes_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetAttributes_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetAttributes_ResponseParams_Data* object =
static_cast<const SensorDevice_GetAttributes_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->values, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& values_validate_params =
mojo::internal::GetArrayValidator<0, true, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
if (!mojo::internal::ValidateContainer(object->values, validation_context,
&values_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetAttributes_ResponseParams_Data::SensorDevice_GetAttributes_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_SetFrequency_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_SetFrequency_Params_Data* object =
static_cast<const SensorDevice_SetFrequency_Params_Data*>(data);
return true;
}
SensorDevice_SetFrequency_Params_Data::SensorDevice_SetFrequency_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_SetFrequency_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_SetFrequency_ResponseParams_Data* object =
static_cast<const SensorDevice_SetFrequency_ResponseParams_Data*>(data);
return true;
}
SensorDevice_SetFrequency_ResponseParams_Data::SensorDevice_SetFrequency_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_StartReadingSamples_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_StartReadingSamples_Params_Data* object =
static_cast<const SensorDevice_StartReadingSamples_Params_Data*>(data);
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->observer, 1, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->observer,
validation_context)) {
return false;
}
return true;
}
SensorDevice_StartReadingSamples_Params_Data::SensorDevice_StartReadingSamples_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_StopReadingSamples_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 8, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_StopReadingSamples_Params_Data* object =
static_cast<const SensorDevice_StopReadingSamples_Params_Data*>(data);
return true;
}
SensorDevice_StopReadingSamples_Params_Data::SensorDevice_StopReadingSamples_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetAllChannelIds_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 8, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetAllChannelIds_Params_Data* object =
static_cast<const SensorDevice_GetAllChannelIds_Params_Data*>(data);
return true;
}
SensorDevice_GetAllChannelIds_Params_Data::SensorDevice_GetAllChannelIds_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetAllChannelIds_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetAllChannelIds_ResponseParams_Data* object =
static_cast<const SensorDevice_GetAllChannelIds_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_chn_ids, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_chn_ids_validate_params =
mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
if (!mojo::internal::ValidateContainer(object->iio_chn_ids, validation_context,
&iio_chn_ids_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetAllChannelIds_ResponseParams_Data::SensorDevice_GetAllChannelIds_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_SetChannelsEnabled_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 24, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_SetChannelsEnabled_Params_Data* object =
static_cast<const SensorDevice_SetChannelsEnabled_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_chn_indices, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_chn_indices_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->iio_chn_indices, validation_context,
&iio_chn_indices_validate_params)) {
return false;
}
return true;
}
SensorDevice_SetChannelsEnabled_Params_Data::SensorDevice_SetChannelsEnabled_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_SetChannelsEnabled_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_SetChannelsEnabled_ResponseParams_Data* object =
static_cast<const SensorDevice_SetChannelsEnabled_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->failed_indices, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& failed_indices_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->failed_indices, validation_context,
&failed_indices_validate_params)) {
return false;
}
return true;
}
SensorDevice_SetChannelsEnabled_ResponseParams_Data::SensorDevice_SetChannelsEnabled_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetChannelsEnabled_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetChannelsEnabled_Params_Data* object =
static_cast<const SensorDevice_GetChannelsEnabled_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_chn_indices, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_chn_indices_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->iio_chn_indices, validation_context,
&iio_chn_indices_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetChannelsEnabled_Params_Data::SensorDevice_GetChannelsEnabled_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetChannelsEnabled_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetChannelsEnabled_ResponseParams_Data* object =
static_cast<const SensorDevice_GetChannelsEnabled_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->enabled, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& enabled_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->enabled, validation_context,
&enabled_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetChannelsEnabled_ResponseParams_Data::SensorDevice_GetChannelsEnabled_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetChannelsAttributes_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 24, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetChannelsAttributes_Params_Data* object =
static_cast<const SensorDevice_GetChannelsAttributes_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_chn_indices, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_chn_indices_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->iio_chn_indices, validation_context,
&iio_chn_indices_validate_params)) {
return false;
}
if (!mojo::internal::ValidatePointerNonNullable(
object->attr_name, 2, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& attr_name_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->attr_name, validation_context,
&attr_name_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetChannelsAttributes_Params_Data::SensorDevice_GetChannelsAttributes_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetChannelsAttributes_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetChannelsAttributes_ResponseParams_Data* object =
static_cast<const SensorDevice_GetChannelsAttributes_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->values, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& values_validate_params =
mojo::internal::GetArrayValidator<0, true, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
if (!mojo::internal::ValidateContainer(object->values, validation_context,
&values_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetChannelsAttributes_ResponseParams_Data::SensorDevice_GetChannelsAttributes_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetAllEvents_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 8, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetAllEvents_Params_Data* object =
static_cast<const SensorDevice_GetAllEvents_Params_Data*>(data);
return true;
}
SensorDevice_GetAllEvents_Params_Data::SensorDevice_GetAllEvents_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetAllEvents_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetAllEvents_ResponseParams_Data* object =
static_cast<const SensorDevice_GetAllEvents_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_events, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_events_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->iio_events, validation_context,
&iio_events_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetAllEvents_ResponseParams_Data::SensorDevice_GetAllEvents_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetEventsAttributes_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 24, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetEventsAttributes_Params_Data* object =
static_cast<const SensorDevice_GetEventsAttributes_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_event_indices, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_event_indices_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->iio_event_indices, validation_context,
&iio_event_indices_validate_params)) {
return false;
}
if (!mojo::internal::ValidatePointerNonNullable(
object->attr_name, 2, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& attr_name_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->attr_name, validation_context,
&attr_name_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetEventsAttributes_Params_Data::SensorDevice_GetEventsAttributes_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_GetEventsAttributes_ResponseParams_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_GetEventsAttributes_ResponseParams_Data* object =
static_cast<const SensorDevice_GetEventsAttributes_ResponseParams_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->values, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& values_validate_params =
mojo::internal::GetArrayValidator<0, true, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
if (!mojo::internal::ValidateContainer(object->values, validation_context,
&values_validate_params)) {
return false;
}
return true;
}
SensorDevice_GetEventsAttributes_ResponseParams_Data::SensorDevice_GetEventsAttributes_ResponseParams_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDevice_StartReadingEvents_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 24, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDevice_StartReadingEvents_Params_Data* object =
static_cast<const SensorDevice_StartReadingEvents_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_event_indices, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& iio_event_indices_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
if (!mojo::internal::ValidateContainer(object->iio_event_indices, validation_context,
&iio_event_indices_validate_params)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterfaceNonNullable(
object->observer, 2, validation_context)) {
return false;
}
if (!mojo::internal::ValidateHandleOrInterface(object->observer,
validation_context)) {
return false;
}
return true;
}
SensorDevice_StartReadingEvents_Params_Data::SensorDevice_StartReadingEvents_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDeviceSamplesObserver_OnSampleUpdated_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDeviceSamplesObserver_OnSampleUpdated_Params_Data* object =
static_cast<const SensorDeviceSamplesObserver_OnSampleUpdated_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->sample, 1, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& sample_validate_params =
mojo::internal::GetMapValidator<*&mojo::internal::GetArrayValidator<0, false, nullptr>(), *&mojo::internal::GetArrayValidator<0, false, nullptr>()>();
if (!mojo::internal::ValidateContainer(object->sample, validation_context,
&sample_validate_params)) {
return false;
}
return true;
}
SensorDeviceSamplesObserver_OnSampleUpdated_Params_Data::SensorDeviceSamplesObserver_OnSampleUpdated_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDeviceSamplesObserver_OnErrorOccurred_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDeviceSamplesObserver_OnErrorOccurred_Params_Data* object =
static_cast<const SensorDeviceSamplesObserver_OnErrorOccurred_Params_Data*>(data);
if (!::cros::mojom::internal::ObserverErrorType_Data
::Validate(object->type, validation_context))
return false;
return true;
}
SensorDeviceSamplesObserver_OnErrorOccurred_Params_Data::SensorDeviceSamplesObserver_OnErrorOccurred_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorServiceNewDevicesObserver_OnNewDeviceAdded_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 24, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorServiceNewDevicesObserver_OnNewDeviceAdded_Params_Data* object =
static_cast<const SensorServiceNewDevicesObserver_OnNewDeviceAdded_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->types, 2, validation_context)) {
return false;
}
constexpr const mojo::internal::ContainerValidateParams& types_validate_params =
mojo::internal::GetArrayOfEnumsValidator<0, false, ::cros::mojom::internal::DeviceType_Data::Validate>();
if (!mojo::internal::ValidateContainer(object->types, validation_context,
&types_validate_params)) {
return false;
}
return true;
}
SensorServiceNewDevicesObserver_OnNewDeviceAdded_Params_Data::SensorServiceNewDevicesObserver_OnNewDeviceAdded_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorServiceNewDevicesObserver_OnDeviceRemoved_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorServiceNewDevicesObserver_OnDeviceRemoved_Params_Data* object =
static_cast<const SensorServiceNewDevicesObserver_OnDeviceRemoved_Params_Data*>(data);
return true;
}
SensorServiceNewDevicesObserver_OnDeviceRemoved_Params_Data::SensorServiceNewDevicesObserver_OnDeviceRemoved_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDeviceEventsObserver_OnEventUpdated_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDeviceEventsObserver_OnEventUpdated_Params_Data* object =
static_cast<const SensorDeviceEventsObserver_OnEventUpdated_Params_Data*>(data);
if (!mojo::internal::ValidatePointerNonNullable(
object->iio_event, 1, validation_context)) {
return false;
}
if (!mojo::internal::ValidateStruct(object->iio_event, validation_context))
return false;
return true;
}
SensorDeviceEventsObserver_OnEventUpdated_Params_Data::SensorDeviceEventsObserver_OnEventUpdated_Params_Data()
: header_({sizeof(*this), 0}) {}
// static
bool SensorDeviceEventsObserver_OnErrorOccurred_Params_Data::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
if (!data)
return true;
if (!ValidateUnversionedStructHeaderAndSizeAndClaimMemory(
data, 16, validation_context)) {
return false;
}
// NOTE: The memory backing |object| may be smaller than |sizeof(*object)| if
// the message comes from an older version.
[[maybe_unused]] const SensorDeviceEventsObserver_OnErrorOccurred_Params_Data* object =
static_cast<const SensorDeviceEventsObserver_OnErrorOccurred_Params_Data*>(data);
if (!::cros::mojom::internal::ObserverErrorType_Data
::Validate(object->type, validation_context))
return false;
return true;
}
SensorDeviceEventsObserver_OnErrorOccurred_Params_Data::SensorDeviceEventsObserver_OnErrorOccurred_Params_Data()
: header_({sizeof(*this), 0}) {}
} // namespace internal
} // namespace mojom
} // namespace cros
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::DeviceType>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::DeviceType value) {
return std::move(context).WriteString(::cros::mojom::DeviceTypeToString(value));
}
} // namespace perfetto
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::ObserverErrorType>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::ObserverErrorType value) {
return std::move(context).WriteString(::cros::mojom::ObserverErrorTypeToString(value));
}
} // namespace perfetto
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::SensorServiceDisconnectReason>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::SensorServiceDisconnectReason value) {
return std::move(context).WriteString(::cros::mojom::SensorServiceDisconnectReasonToString(value));
}
} // namespace perfetto
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::SensorDeviceDisconnectReason>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::SensorDeviceDisconnectReason value) {
return std::move(context).WriteString(::cros::mojom::SensorDeviceDisconnectReasonToString(value));
}
} // namespace perfetto
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::IioChanType>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::IioChanType value) {
return std::move(context).WriteString(::cros::mojom::IioChanTypeToString(value));
}
} // namespace perfetto
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::IioEventType>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::IioEventType value) {
return std::move(context).WriteString(::cros::mojom::IioEventTypeToString(value));
}
} // namespace perfetto
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::IioEventDirection>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::IioEventDirection value) {
return std::move(context).WriteString(::cros::mojom::IioEventDirectionToString(value));
}
} // namespace perfetto