| // WARNING: This file is machine generated by fidlgen. |
| |
| #pragma once |
| |
| #include <lib/fidl/internal.h> |
| #include <lib/fidl/txn_header.h> |
| #include <lib/fidl/llcpp/array.h> |
| #include <lib/fidl/llcpp/coding.h> |
| #include <lib/fidl/llcpp/connect_service.h> |
| #include <lib/fidl/llcpp/service_handler_interface.h> |
| #include <lib/fidl/llcpp/string_view.h> |
| #include <lib/fidl/llcpp/sync_call.h> |
| #include <lib/fidl/llcpp/traits.h> |
| #include <lib/fidl/llcpp/transaction.h> |
| #include <lib/fidl/llcpp/vector_view.h> |
| #include <lib/fit/function.h> |
| #include <lib/zx/channel.h> |
| #include <lib/zx/event.h> |
| #include <zircon/fidl.h> |
| |
| namespace llcpp { |
| |
| namespace fuchsia { |
| namespace input { |
| namespace report { |
| |
| enum class Unit : uint32_t { |
| NONE = 0u, |
| OTHER = 1u, |
| DISTANCE = 2u, |
| WEIGHT = 3u, |
| ROTATION = 4u, |
| ANGULAR_VELOCITY = 5u, |
| LINEAR_VELOCITY = 6u, |
| ACCELERATION = 7u, |
| MAGNETIC_FLUX = 8u, |
| LUMINOUS_FLUX = 9u, |
| PRESSURE = 10u, |
| LUX = 11u, |
| }; |
| |
| |
| enum class TouchType : uint32_t { |
| TOUCHSCREEN = 1u, |
| }; |
| |
| |
| enum class SensorType : uint32_t { |
| ACCELEROMETER_X = 1u, |
| ACCELEROMETER_Y = 2u, |
| ACCELEROMETER_Z = 3u, |
| MAGNETOMETER_X = 4u, |
| MAGNETOMETER_Y = 5u, |
| MAGNETOMETER_Z = 6u, |
| GYROSCOPE_X = 7u, |
| GYROSCOPE_Y = 8u, |
| GYROSCOPE_Z = 9u, |
| LIGHT_ILLUMINANCE = 10u, |
| LIGHT_RED = 11u, |
| LIGHT_GREEN = 12u, |
| LIGHT_BLUE = 13u, |
| }; |
| |
| |
| struct SensorReport; |
| struct Range; |
| struct Axis; |
| struct SensorAxis; |
| struct SensorDescriptor; |
| struct MouseDescriptor; |
| struct ContactDescriptor; |
| struct TouchDescriptor; |
| struct MouseReport; |
| struct DeviceInfo; |
| struct DeviceDescriptor; |
| struct ContactReport; |
| struct TouchReport; |
| struct InputReport; |
| class InputDevice; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_SensorReportTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_SensorReportTable; |
| |
| // |SensorReport| gives the values measured by a sensor at a given point in time. |
| struct SensorReport final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // The ordering of |values| will always directly correspond to the ordering of |
| // the values in |SensorDescriptor|. |
| const ::fidl::VectorView<int64_t>& values() const { |
| ZX_ASSERT(has_values()); |
| return *reinterpret_cast<const ::fidl::VectorView<int64_t>*>(EnvelopesView::at(1 - 1).data); |
| } |
| ::fidl::VectorView<int64_t>& values() { |
| ZX_ASSERT(has_values()); |
| return *reinterpret_cast<::fidl::VectorView<int64_t>*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_values() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| SensorReport() = default; |
| ~SensorReport() = default; |
| SensorReport(SensorReport&& other) noexcept = default; |
| SensorReport& operator=(SensorReport&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_SensorReportTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_SensorReportTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 832; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 832; |
| |
| private: |
| SensorReport(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class SensorReport::Builder { |
| public: |
| SensorReport view() { return SensorReport(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // The ordering of |values| will always directly correspond to the ordering of |
| // the values in |SensorDescriptor|. |
| Builder&& set_values(::fidl::VectorView<int64_t>* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder SensorReport::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 1> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_SensorDescriptorTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_SensorDescriptorTable; |
| |
| // |SensorDescriptor| describes the capabilities of a sensor. |
| struct SensorDescriptor final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // Each |SensorAxis| in |values| describes what a sensor is measuring and its range. |
| // These will directly correspond to the values in |SensorReport|. |
| const ::fidl::VectorView<::llcpp::fuchsia::input::report::SensorAxis>& values() const { |
| ZX_ASSERT(has_values()); |
| return *reinterpret_cast<const ::fidl::VectorView<::llcpp::fuchsia::input::report::SensorAxis>*>(EnvelopesView::at(1 - 1).data); |
| } |
| ::fidl::VectorView<::llcpp::fuchsia::input::report::SensorAxis>& values() { |
| ZX_ASSERT(has_values()); |
| return *reinterpret_cast<::fidl::VectorView<::llcpp::fuchsia::input::report::SensorAxis>*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_values() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| SensorDescriptor() = default; |
| ~SensorDescriptor() = default; |
| SensorDescriptor(SensorDescriptor&& other) noexcept = default; |
| SensorDescriptor& operator=(SensorDescriptor&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_SensorDescriptorTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_SensorDescriptorTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 3232; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 3232; |
| |
| private: |
| SensorDescriptor(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class SensorDescriptor::Builder { |
| public: |
| SensorDescriptor view() { return SensorDescriptor(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // Each |SensorAxis| in |values| describes what a sensor is measuring and its range. |
| // These will directly correspond to the values in |SensorReport|. |
| Builder&& set_values(::fidl::VectorView<::llcpp::fuchsia::input::report::SensorAxis>* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder SensorDescriptor::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 1> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_MouseDescriptorTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_MouseDescriptorTable; |
| |
| // |MouseDescriptor| describes the capabilities of a mouse. |
| struct MouseDescriptor final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // The range of relative X movement. |
| const ::llcpp::fuchsia::input::report::Axis& movement_x() const { |
| ZX_ASSERT(has_movement_x()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(1 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& movement_x() { |
| ZX_ASSERT(has_movement_x()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_movement_x() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| // The range of relative Y movement. |
| const ::llcpp::fuchsia::input::report::Axis& movement_y() const { |
| ZX_ASSERT(has_movement_y()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(2 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& movement_y() { |
| ZX_ASSERT(has_movement_y()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(2 - 1).data); |
| } |
| bool has_movement_y() const { |
| return EnvelopesView::count() >= 2 && EnvelopesView::at(2 - 1).data != nullptr; |
| } |
| |
| // The range of relative vertical scroll. |
| const ::llcpp::fuchsia::input::report::Axis& scroll_v() const { |
| ZX_ASSERT(has_scroll_v()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(3 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& scroll_v() { |
| ZX_ASSERT(has_scroll_v()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(3 - 1).data); |
| } |
| bool has_scroll_v() const { |
| return EnvelopesView::count() >= 3 && EnvelopesView::at(3 - 1).data != nullptr; |
| } |
| |
| // The range of relative horizontal scroll. |
| const ::llcpp::fuchsia::input::report::Axis& scroll_h() const { |
| ZX_ASSERT(has_scroll_h()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(4 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& scroll_h() { |
| ZX_ASSERT(has_scroll_h()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(4 - 1).data); |
| } |
| bool has_scroll_h() const { |
| return EnvelopesView::count() >= 4 && EnvelopesView::at(4 - 1).data != nullptr; |
| } |
| |
| // This is a vector of id's for the mouse buttons. |
| const ::fidl::VectorView<uint8_t>& buttons() const { |
| ZX_ASSERT(has_buttons()); |
| return *reinterpret_cast<const ::fidl::VectorView<uint8_t>*>(EnvelopesView::at(5 - 1).data); |
| } |
| ::fidl::VectorView<uint8_t>& buttons() { |
| ZX_ASSERT(has_buttons()); |
| return *reinterpret_cast<::fidl::VectorView<uint8_t>*>(EnvelopesView::at(5 - 1).data); |
| } |
| bool has_buttons() const { |
| return EnvelopesView::count() >= 5 && EnvelopesView::at(5 - 1).data != nullptr; |
| } |
| |
| MouseDescriptor() = default; |
| ~MouseDescriptor() = default; |
| MouseDescriptor(MouseDescriptor&& other) noexcept = default; |
| MouseDescriptor& operator=(MouseDescriptor&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_MouseDescriptorTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_MouseDescriptorTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 224; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 224; |
| |
| private: |
| MouseDescriptor(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class MouseDescriptor::Builder { |
| public: |
| MouseDescriptor view() { return MouseDescriptor(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // The range of relative X movement. |
| Builder&& set_movement_x(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // The range of relative Y movement. |
| Builder&& set_movement_y(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // The range of relative vertical scroll. |
| Builder&& set_scroll_v(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // The range of relative horizontal scroll. |
| Builder&& set_scroll_h(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // This is a vector of id's for the mouse buttons. |
| Builder&& set_buttons(::fidl::VectorView<uint8_t>* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder MouseDescriptor::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 5> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_ContactDescriptorTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_ContactDescriptorTable; |
| |
| // `ContactDescriptor` describes the fields associated with a touch on a touch device. |
| struct ContactDescriptor final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // Describes the reporting of the x-axis. |
| const ::llcpp::fuchsia::input::report::Axis& position_x() const { |
| ZX_ASSERT(has_position_x()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(1 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& position_x() { |
| ZX_ASSERT(has_position_x()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_position_x() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| // Describes the reporting of the y-axis. |
| const ::llcpp::fuchsia::input::report::Axis& position_y() const { |
| ZX_ASSERT(has_position_y()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(2 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& position_y() { |
| ZX_ASSERT(has_position_y()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(2 - 1).data); |
| } |
| bool has_position_y() const { |
| return EnvelopesView::count() >= 2 && EnvelopesView::at(2 - 1).data != nullptr; |
| } |
| |
| // Pressure of the contact. |
| const ::llcpp::fuchsia::input::report::Axis& pressure() const { |
| ZX_ASSERT(has_pressure()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(3 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& pressure() { |
| ZX_ASSERT(has_pressure()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(3 - 1).data); |
| } |
| bool has_pressure() const { |
| return EnvelopesView::count() >= 3 && EnvelopesView::at(3 - 1).data != nullptr; |
| } |
| |
| // Width of the area of contact. |
| const ::llcpp::fuchsia::input::report::Axis& contact_width() const { |
| ZX_ASSERT(has_contact_width()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(4 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& contact_width() { |
| ZX_ASSERT(has_contact_width()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(4 - 1).data); |
| } |
| bool has_contact_width() const { |
| return EnvelopesView::count() >= 4 && EnvelopesView::at(4 - 1).data != nullptr; |
| } |
| |
| // Height of the area of contact. |
| const ::llcpp::fuchsia::input::report::Axis& contact_height() const { |
| ZX_ASSERT(has_contact_height()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(5 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::Axis& contact_height() { |
| ZX_ASSERT(has_contact_height()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::Axis*>(EnvelopesView::at(5 - 1).data); |
| } |
| bool has_contact_height() const { |
| return EnvelopesView::count() >= 5 && EnvelopesView::at(5 - 1).data != nullptr; |
| } |
| |
| ContactDescriptor() = default; |
| ~ContactDescriptor() = default; |
| ContactDescriptor(ContactDescriptor&& other) noexcept = default; |
| ContactDescriptor& operator=(ContactDescriptor&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_ContactDescriptorTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_ContactDescriptorTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 200; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 200; |
| |
| private: |
| ContactDescriptor(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class ContactDescriptor::Builder { |
| public: |
| ContactDescriptor view() { return ContactDescriptor(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // Describes the reporting of the x-axis. |
| Builder&& set_position_x(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // Describes the reporting of the y-axis. |
| Builder&& set_position_y(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // Pressure of the contact. |
| Builder&& set_pressure(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // Width of the area of contact. |
| Builder&& set_contact_width(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| // Height of the area of contact. |
| Builder&& set_contact_height(::llcpp::fuchsia::input::report::Axis* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder ContactDescriptor::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 5> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_TouchDescriptorTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_TouchDescriptorTable; |
| |
| // `TouchDescriptor` describes the fields associated with an individual touch device. |
| struct TouchDescriptor final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // The contact descriptors associated with this touch descriptor. |
| const ::fidl::VectorView<::llcpp::fuchsia::input::report::ContactDescriptor>& contacts() const { |
| ZX_ASSERT(has_contacts()); |
| return *reinterpret_cast<const ::fidl::VectorView<::llcpp::fuchsia::input::report::ContactDescriptor>*>(EnvelopesView::at(1 - 1).data); |
| } |
| ::fidl::VectorView<::llcpp::fuchsia::input::report::ContactDescriptor>& contacts() { |
| ZX_ASSERT(has_contacts()); |
| return *reinterpret_cast<::fidl::VectorView<::llcpp::fuchsia::input::report::ContactDescriptor>*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_contacts() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| // The max number of contacts that this touch device can report at once. |
| const uint32_t& max_contacts() const { |
| ZX_ASSERT(has_max_contacts()); |
| return *reinterpret_cast<const uint32_t*>(EnvelopesView::at(2 - 1).data); |
| } |
| uint32_t& max_contacts() { |
| ZX_ASSERT(has_max_contacts()); |
| return *reinterpret_cast<uint32_t*>(EnvelopesView::at(2 - 1).data); |
| } |
| bool has_max_contacts() const { |
| return EnvelopesView::count() >= 2 && EnvelopesView::at(2 - 1).data != nullptr; |
| } |
| |
| // The type of touch device being used. |
| const ::llcpp::fuchsia::input::report::TouchType& touch_type() const { |
| ZX_ASSERT(has_touch_type()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::TouchType*>(EnvelopesView::at(3 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::TouchType& touch_type() { |
| ZX_ASSERT(has_touch_type()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::TouchType*>(EnvelopesView::at(3 - 1).data); |
| } |
| bool has_touch_type() const { |
| return EnvelopesView::count() >= 3 && EnvelopesView::at(3 - 1).data != nullptr; |
| } |
| |
| TouchDescriptor() = default; |
| ~TouchDescriptor() = default; |
| TouchDescriptor(TouchDescriptor&& other) noexcept = default; |
| TouchDescriptor& operator=(TouchDescriptor&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_TouchDescriptorTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_TouchDescriptorTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 2240; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 2240; |
| |
| private: |
| TouchDescriptor(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class TouchDescriptor::Builder { |
| public: |
| TouchDescriptor view() { return TouchDescriptor(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // The contact descriptors associated with this touch descriptor. |
| Builder&& set_contacts(::fidl::VectorView<::llcpp::fuchsia::input::report::ContactDescriptor>* elem); |
| |
| // The max number of contacts that this touch device can report at once. |
| Builder&& set_max_contacts(uint32_t* elem); |
| |
| // The type of touch device being used. |
| Builder&& set_touch_type(::llcpp::fuchsia::input::report::TouchType* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder TouchDescriptor::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 3> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_MouseReportTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_MouseReportTable; |
| |
| // |MouseReport| gives the relative movement of the mouse and currently |
| // pressed buttons. Relative means the movement seen between the previous |
| // report and this report. The client is responsble for tracking this and |
| // converting it to absolute movement. |
| struct MouseReport final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // Relative X positional displacement. |
| const int64_t& movement_x() const { |
| ZX_ASSERT(has_movement_x()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(1 - 1).data); |
| } |
| int64_t& movement_x() { |
| ZX_ASSERT(has_movement_x()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_movement_x() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| // Relative Y positional displacement. |
| const int64_t& movement_y() const { |
| ZX_ASSERT(has_movement_y()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(2 - 1).data); |
| } |
| int64_t& movement_y() { |
| ZX_ASSERT(has_movement_y()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(2 - 1).data); |
| } |
| bool has_movement_y() const { |
| return EnvelopesView::count() >= 2 && EnvelopesView::at(2 - 1).data != nullptr; |
| } |
| |
| // Relative vertical scrolling displacement. |
| const int64_t& scroll_v() const { |
| ZX_ASSERT(has_scroll_v()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(3 - 1).data); |
| } |
| int64_t& scroll_v() { |
| ZX_ASSERT(has_scroll_v()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(3 - 1).data); |
| } |
| bool has_scroll_v() const { |
| return EnvelopesView::count() >= 3 && EnvelopesView::at(3 - 1).data != nullptr; |
| } |
| |
| // Relative horizontal scrolling displacement. |
| const int64_t& scroll_h() const { |
| ZX_ASSERT(has_scroll_h()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(4 - 1).data); |
| } |
| int64_t& scroll_h() { |
| ZX_ASSERT(has_scroll_h()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(4 - 1).data); |
| } |
| bool has_scroll_h() const { |
| return EnvelopesView::count() >= 4 && EnvelopesView::at(4 - 1).data != nullptr; |
| } |
| |
| // A list of currently pressed buttons. |
| const ::fidl::VectorView<uint8_t>& pressed_buttons() const { |
| ZX_ASSERT(has_pressed_buttons()); |
| return *reinterpret_cast<const ::fidl::VectorView<uint8_t>*>(EnvelopesView::at(5 - 1).data); |
| } |
| ::fidl::VectorView<uint8_t>& pressed_buttons() { |
| ZX_ASSERT(has_pressed_buttons()); |
| return *reinterpret_cast<::fidl::VectorView<uint8_t>*>(EnvelopesView::at(5 - 1).data); |
| } |
| bool has_pressed_buttons() const { |
| return EnvelopesView::count() >= 5 && EnvelopesView::at(5 - 1).data != nullptr; |
| } |
| |
| MouseReport() = default; |
| ~MouseReport() = default; |
| MouseReport(MouseReport&& other) noexcept = default; |
| MouseReport& operator=(MouseReport&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_MouseReportTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_MouseReportTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 160; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 160; |
| |
| private: |
| MouseReport(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class MouseReport::Builder { |
| public: |
| MouseReport view() { return MouseReport(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // Relative X positional displacement. |
| Builder&& set_movement_x(int64_t* elem); |
| |
| // Relative Y positional displacement. |
| Builder&& set_movement_y(int64_t* elem); |
| |
| // Relative vertical scrolling displacement. |
| Builder&& set_scroll_v(int64_t* elem); |
| |
| // Relative horizontal scrolling displacement. |
| Builder&& set_scroll_h(int64_t* elem); |
| |
| // A list of currently pressed buttons. |
| Builder&& set_pressed_buttons(::fidl::VectorView<uint8_t>* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder MouseReport::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 5> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_DeviceDescriptorTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_DeviceDescriptorTable; |
| |
| // |DeviceDescriptor| describes a physical input device. Some physical devices may |
| // send multiple types of reports (E.g: a physical touchscreen can send touch and |
| // stylus reports, so it will have both a TouchDescriptor and a StylusDescriptor). |
| struct DeviceDescriptor final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // |device_info| should always be present to help distinguish between physical devices. |
| const ::llcpp::fuchsia::input::report::DeviceInfo& device_info() const { |
| ZX_ASSERT(has_device_info()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::DeviceInfo*>(EnvelopesView::at(1 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::DeviceInfo& device_info() { |
| ZX_ASSERT(has_device_info()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::DeviceInfo*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_device_info() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| // When |mouse| is present the device has a mouse. |
| const ::llcpp::fuchsia::input::report::MouseDescriptor& mouse() const { |
| ZX_ASSERT(has_mouse()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::MouseDescriptor*>(EnvelopesView::at(2 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::MouseDescriptor& mouse() { |
| ZX_ASSERT(has_mouse()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::MouseDescriptor*>(EnvelopesView::at(2 - 1).data); |
| } |
| bool has_mouse() const { |
| return EnvelopesView::count() >= 2 && EnvelopesView::at(2 - 1).data != nullptr; |
| } |
| |
| // When |sensor| is present the device has a sensor. |
| const ::llcpp::fuchsia::input::report::SensorDescriptor& sensor() const { |
| ZX_ASSERT(has_sensor()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::SensorDescriptor*>(EnvelopesView::at(3 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::SensorDescriptor& sensor() { |
| ZX_ASSERT(has_sensor()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::SensorDescriptor*>(EnvelopesView::at(3 - 1).data); |
| } |
| bool has_sensor() const { |
| return EnvelopesView::count() >= 3 && EnvelopesView::at(3 - 1).data != nullptr; |
| } |
| |
| // When |touch| is present the device has a touch device. |
| // (E.g: Touchscreen, touchpad). |
| const ::llcpp::fuchsia::input::report::TouchDescriptor& touch() const { |
| ZX_ASSERT(has_touch()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::TouchDescriptor*>(EnvelopesView::at(4 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::TouchDescriptor& touch() { |
| ZX_ASSERT(has_touch()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::TouchDescriptor*>(EnvelopesView::at(4 - 1).data); |
| } |
| bool has_touch() const { |
| return EnvelopesView::count() >= 4 && EnvelopesView::at(4 - 1).data != nullptr; |
| } |
| |
| DeviceDescriptor() = default; |
| ~DeviceDescriptor() = default; |
| DeviceDescriptor(DeviceDescriptor&& other) noexcept = default; |
| DeviceDescriptor& operator=(DeviceDescriptor&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_DeviceDescriptorTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_DeviceDescriptorTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 6096; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 6096; |
| |
| private: |
| DeviceDescriptor(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class DeviceDescriptor::Builder { |
| public: |
| DeviceDescriptor view() { return DeviceDescriptor(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // |device_info| should always be present to help distinguish between physical devices. |
| Builder&& set_device_info(::llcpp::fuchsia::input::report::DeviceInfo* elem); |
| |
| // When |mouse| is present the device has a mouse. |
| Builder&& set_mouse(::llcpp::fuchsia::input::report::MouseDescriptor* elem); |
| |
| // When |sensor| is present the device has a sensor. |
| Builder&& set_sensor(::llcpp::fuchsia::input::report::SensorDescriptor* elem); |
| |
| // When |touch| is present the device has a touch device. |
| // (E.g: Touchscreen, touchpad). |
| Builder&& set_touch(::llcpp::fuchsia::input::report::TouchDescriptor* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder DeviceDescriptor::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 4> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_ContactReportTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_ContactReportTable; |
| |
| // `Contact` describes one touch on a touch device. |
| struct ContactReport final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // Identifier for this contact. |
| const uint32_t& contact_id() const { |
| ZX_ASSERT(has_contact_id()); |
| return *reinterpret_cast<const uint32_t*>(EnvelopesView::at(1 - 1).data); |
| } |
| uint32_t& contact_id() { |
| ZX_ASSERT(has_contact_id()); |
| return *reinterpret_cast<uint32_t*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_contact_id() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| // A contact's position on the x axis. |
| const int64_t& position_x() const { |
| ZX_ASSERT(has_position_x()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(2 - 1).data); |
| } |
| int64_t& position_x() { |
| ZX_ASSERT(has_position_x()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(2 - 1).data); |
| } |
| bool has_position_x() const { |
| return EnvelopesView::count() >= 2 && EnvelopesView::at(2 - 1).data != nullptr; |
| } |
| |
| // A contact's position on the y axis. |
| const int64_t& position_y() const { |
| ZX_ASSERT(has_position_y()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(3 - 1).data); |
| } |
| int64_t& position_y() { |
| ZX_ASSERT(has_position_y()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(3 - 1).data); |
| } |
| bool has_position_y() const { |
| return EnvelopesView::count() >= 3 && EnvelopesView::at(3 - 1).data != nullptr; |
| } |
| |
| // Pressure of the contact. |
| const int64_t& pressure() const { |
| ZX_ASSERT(has_pressure()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(4 - 1).data); |
| } |
| int64_t& pressure() { |
| ZX_ASSERT(has_pressure()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(4 - 1).data); |
| } |
| bool has_pressure() const { |
| return EnvelopesView::count() >= 4 && EnvelopesView::at(4 - 1).data != nullptr; |
| } |
| |
| // Width of the bounding box around the touch contact. Combined with |
| // `contact_height`, this describes the area of the touch contact. |
| // `contact_width` and `contact_height` should both have units of distance, |
| // and they should be in the same units as `position_x` and `position_y`. |
| const int64_t& contact_width() const { |
| ZX_ASSERT(has_contact_width()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(5 - 1).data); |
| } |
| int64_t& contact_width() { |
| ZX_ASSERT(has_contact_width()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(5 - 1).data); |
| } |
| bool has_contact_width() const { |
| return EnvelopesView::count() >= 5 && EnvelopesView::at(5 - 1).data != nullptr; |
| } |
| |
| // Height of the bounding box around the touch contact. Combined with |
| // `contact_width`, this describes the area of the touch contact. |
| // `contact_width` and `contact_height` should both have units of distance, |
| // and they should be in the same units as `position_x` and `position_y`. |
| const int64_t& contact_height() const { |
| ZX_ASSERT(has_contact_height()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(6 - 1).data); |
| } |
| int64_t& contact_height() { |
| ZX_ASSERT(has_contact_height()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(6 - 1).data); |
| } |
| bool has_contact_height() const { |
| return EnvelopesView::count() >= 6 && EnvelopesView::at(6 - 1).data != nullptr; |
| } |
| |
| ContactReport() = default; |
| ~ContactReport() = default; |
| ContactReport(ContactReport&& other) noexcept = default; |
| ContactReport& operator=(ContactReport&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_ContactReportTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_ContactReportTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 144; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 144; |
| |
| private: |
| ContactReport(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class ContactReport::Builder { |
| public: |
| ContactReport view() { return ContactReport(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // Identifier for this contact. |
| Builder&& set_contact_id(uint32_t* elem); |
| |
| // A contact's position on the x axis. |
| Builder&& set_position_x(int64_t* elem); |
| |
| // A contact's position on the y axis. |
| Builder&& set_position_y(int64_t* elem); |
| |
| // Pressure of the contact. |
| Builder&& set_pressure(int64_t* elem); |
| |
| // Width of the bounding box around the touch contact. Combined with |
| // `contact_height`, this describes the area of the touch contact. |
| // `contact_width` and `contact_height` should both have units of distance, |
| // and they should be in the same units as `position_x` and `position_y`. |
| Builder&& set_contact_width(int64_t* elem); |
| |
| // Height of the bounding box around the touch contact. Combined with |
| // `contact_width`, this describes the area of the touch contact. |
| // `contact_width` and `contact_height` should both have units of distance, |
| // and they should be in the same units as `position_x` and `position_y`. |
| Builder&& set_contact_height(int64_t* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder ContactReport::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 6> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_TouchReportTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_TouchReportTable; |
| |
| // `TouchscreenReport` describes the current contacts recorded by the touchscreen. |
| struct TouchReport final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // The contacts currently being reported by the device. |
| const ::fidl::VectorView<::llcpp::fuchsia::input::report::ContactReport>& contacts() const { |
| ZX_ASSERT(has_contacts()); |
| return *reinterpret_cast<const ::fidl::VectorView<::llcpp::fuchsia::input::report::ContactReport>*>(EnvelopesView::at(1 - 1).data); |
| } |
| ::fidl::VectorView<::llcpp::fuchsia::input::report::ContactReport>& contacts() { |
| ZX_ASSERT(has_contacts()); |
| return *reinterpret_cast<::fidl::VectorView<::llcpp::fuchsia::input::report::ContactReport>*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_contacts() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| TouchReport() = default; |
| ~TouchReport() = default; |
| TouchReport(TouchReport&& other) noexcept = default; |
| TouchReport& operator=(TouchReport&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_TouchReportTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_TouchReportTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 1632; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 1632; |
| |
| private: |
| TouchReport(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class TouchReport::Builder { |
| public: |
| TouchReport view() { return TouchReport(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // The contacts currently being reported by the device. |
| Builder&& set_contacts(::fidl::VectorView<::llcpp::fuchsia::input::report::ContactReport>* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder TouchReport::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 1> envelopes_ = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_InputReportTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_InputReportTable; |
| |
| // |InputReport| is a single report that is created by an input device. |
| struct InputReport final : private ::fidl::VectorView<fidl_envelope_t> { |
| using EnvelopesView = ::fidl::VectorView<fidl_envelope_t>; |
| public: |
| // Returns whether no field is set. |
| bool IsEmpty() const { return EnvelopesView::empty(); } |
| |
| // |event_time| is in nanoseconds when the event was recorded. |
| const int64_t& event_time() const { |
| ZX_ASSERT(has_event_time()); |
| return *reinterpret_cast<const int64_t*>(EnvelopesView::at(1 - 1).data); |
| } |
| int64_t& event_time() { |
| ZX_ASSERT(has_event_time()); |
| return *reinterpret_cast<int64_t*>(EnvelopesView::at(1 - 1).data); |
| } |
| bool has_event_time() const { |
| return EnvelopesView::count() >= 1 && EnvelopesView::at(1 - 1).data != nullptr; |
| } |
| |
| // |mouse| is the report generated if the device contains a mouse. |
| const ::llcpp::fuchsia::input::report::MouseReport& mouse() const { |
| ZX_ASSERT(has_mouse()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::MouseReport*>(EnvelopesView::at(2 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::MouseReport& mouse() { |
| ZX_ASSERT(has_mouse()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::MouseReport*>(EnvelopesView::at(2 - 1).data); |
| } |
| bool has_mouse() const { |
| return EnvelopesView::count() >= 2 && EnvelopesView::at(2 - 1).data != nullptr; |
| } |
| |
| // Unique ID to connect trace async begin/end events. |
| const uint64_t& trace_id() const { |
| ZX_ASSERT(has_trace_id()); |
| return *reinterpret_cast<const uint64_t*>(EnvelopesView::at(3 - 1).data); |
| } |
| uint64_t& trace_id() { |
| ZX_ASSERT(has_trace_id()); |
| return *reinterpret_cast<uint64_t*>(EnvelopesView::at(3 - 1).data); |
| } |
| bool has_trace_id() const { |
| return EnvelopesView::count() >= 3 && EnvelopesView::at(3 - 1).data != nullptr; |
| } |
| |
| // |sensor| is the report generated if the device contains a sensor. |
| const ::llcpp::fuchsia::input::report::SensorReport& sensor() const { |
| ZX_ASSERT(has_sensor()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::SensorReport*>(EnvelopesView::at(4 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::SensorReport& sensor() { |
| ZX_ASSERT(has_sensor()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::SensorReport*>(EnvelopesView::at(4 - 1).data); |
| } |
| bool has_sensor() const { |
| return EnvelopesView::count() >= 4 && EnvelopesView::at(4 - 1).data != nullptr; |
| } |
| |
| // |touch| is the report generated if the device contains a touch device. |
| const ::llcpp::fuchsia::input::report::TouchReport& touch() const { |
| ZX_ASSERT(has_touch()); |
| return *reinterpret_cast<const ::llcpp::fuchsia::input::report::TouchReport*>(EnvelopesView::at(5 - 1).data); |
| } |
| ::llcpp::fuchsia::input::report::TouchReport& touch() { |
| ZX_ASSERT(has_touch()); |
| return *reinterpret_cast<::llcpp::fuchsia::input::report::TouchReport*>(EnvelopesView::at(5 - 1).data); |
| } |
| bool has_touch() const { |
| return EnvelopesView::count() >= 5 && EnvelopesView::at(5 - 1).data != nullptr; |
| } |
| |
| InputReport() = default; |
| ~InputReport() = default; |
| InputReport(InputReport&& other) noexcept = default; |
| InputReport& operator=(InputReport&& other) noexcept = default; |
| |
| class Builder; |
| friend class Builder; |
| static Builder Build(); |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_InputReportTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_InputReportTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 2768; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 2768; |
| |
| private: |
| InputReport(uint64_t max_ordinal, fidl_envelope_t* data) : EnvelopesView(data, max_ordinal) {} |
| }; |
| |
| class InputReport::Builder { |
| public: |
| InputReport view() { return InputReport(max_ordinal_, envelopes_.data_); } |
| ~Builder() = default; |
| Builder(Builder&& other) noexcept = default; |
| Builder& operator=(Builder&& other) noexcept = default; |
| |
| // |event_time| is in nanoseconds when the event was recorded. |
| Builder&& set_event_time(int64_t* elem); |
| |
| // |mouse| is the report generated if the device contains a mouse. |
| Builder&& set_mouse(::llcpp::fuchsia::input::report::MouseReport* elem); |
| |
| // Unique ID to connect trace async begin/end events. |
| Builder&& set_trace_id(uint64_t* elem); |
| |
| // |sensor| is the report generated if the device contains a sensor. |
| Builder&& set_sensor(::llcpp::fuchsia::input::report::SensorReport* elem); |
| |
| // |touch| is the report generated if the device contains a touch device. |
| Builder&& set_touch(::llcpp::fuchsia::input::report::TouchReport* elem); |
| |
| private: |
| Builder() = default; |
| friend Builder InputReport::Build(); |
| |
| uint64_t max_ordinal_ = 0; |
| ::fidl::Array<fidl_envelope_t, 5> envelopes_ = {}; |
| }; |
| |
| // A hardcoded number of max contacts per report. This should be increased in the future if |
| // we see devices with more than the max amount. |
| constexpr uint32_t TOUCH_MAX_CONTACTS = 10u; |
| |
| // A hardcoded number of max sensor values. This should be increased in the future |
| // if we ever see a sensor with more values. |
| constexpr uint32_t SENSOR_MAX_VALUES = 100u; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_RangeTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_RangeTable; |
| |
| // Describe a |Range| of values. |
| struct Range { |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_RangeTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_RangeTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 16; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| |
| int64_t min = {}; |
| |
| int64_t max = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_AxisTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_AxisTable; |
| |
| // An |Axis| is defined as a |range| and a |unit|. |
| struct Axis { |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_AxisTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_AxisTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 24; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 24; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| |
| ::llcpp::fuchsia::input::report::Range range = {}; |
| |
| ::llcpp::fuchsia::input::report::Unit unit = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_SensorAxisTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_SensorAxisTable; |
| |
| // A |SensorAxis| is a normal |Axis| with an additional |SensorType| to describe what the |
| // axis is measuring. |
| struct SensorAxis { |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_SensorAxisTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_SensorAxisTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 32; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| |
| ::llcpp::fuchsia::input::report::Axis axis = {}; |
| |
| ::llcpp::fuchsia::input::report::SensorType type = {}; |
| }; |
| |
| // A hardcoded number of max mouse buttons. This should be increased in the future |
| // if we ever see mice with more buttons. |
| constexpr uint32_t MOUSE_MAX_NUM_BUTTONS = 32u; |
| |
| constexpr uint32_t MAX_DEVICE_REPORT_COUNT = 50u; |
| |
| constexpr uint32_t MAX_DEVICE_NAME_LENGTH = 256u; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_DeviceInfoTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_DeviceInfoTable; |
| |
| // DeviceInfo provides more information about the device and lets a client |
| // distinguish between devices (e.g between two touchscreens that come from |
| // different vendors). If the device is a HID device, then the id information |
| // will come from the device itself. Other, non-HID devices may assign the |
| // ids in the driver, so it will be the driver author's responsibility to |
| // assign sensible ids. |
| struct DeviceInfo { |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_DeviceInfoTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_DeviceInfoTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| [[maybe_unused]] |
| static constexpr uint32_t MaxOutOfLine = 256; |
| static constexpr uint32_t AltPrimarySize = 32; |
| [[maybe_unused]] |
| static constexpr uint32_t AltMaxOutOfLine = 256; |
| |
| uint32_t vendor_id = {}; |
| |
| uint32_t product_id = {}; |
| |
| uint32_t version = {}; |
| |
| ::fidl::StringView name = {}; |
| }; |
| |
| extern "C" const fidl_type_t fuchsia_input_report_InputDeviceGetReportsEventRequestTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_InputDeviceGetReportsEventRequestTable; |
| extern "C" const fidl_type_t fuchsia_input_report_InputDeviceGetReportsEventResponseTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_InputDeviceGetReportsEventResponseTable; |
| extern "C" const fidl_type_t fuchsia_input_report_InputDeviceGetReportsRequestTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_InputDeviceGetReportsRequestTable; |
| extern "C" const fidl_type_t fuchsia_input_report_InputDeviceGetReportsResponseTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_InputDeviceGetReportsResponseTable; |
| extern "C" const fidl_type_t fuchsia_input_report_InputDeviceGetDescriptorRequestTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_InputDeviceGetDescriptorRequestTable; |
| extern "C" const fidl_type_t fuchsia_input_report_InputDeviceGetDescriptorResponseTable; |
| extern "C" const fidl_type_t v1_fuchsia_input_report_InputDeviceGetDescriptorResponseTable; |
| |
| // An |InputDevice| driver represents a single physical input device. |
| // The InputDevice maintains an internal FIFO of |MAX_DEVICE_REPORT_COUNT| |
| // reports for each client that connects. Reports are removed from the FIFO |
| // once they are read by the client. If the FIFO is full, it will drop the |
| // oldest report to make room for an incoming report. |
| class InputDevice final { |
| InputDevice() = delete; |
| public: |
| |
| struct GetReportsEventResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| int32_t status; |
| ::zx::event event; |
| |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_InputDeviceGetReportsEventResponseTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_InputDeviceGetReportsEventResponseTable; |
| static constexpr uint32_t MaxNumHandles = 1; |
| static constexpr uint32_t PrimarySize = 24; |
| static constexpr uint32_t MaxOutOfLine = 0; |
| static constexpr uint32_t AltPrimarySize = 24; |
| static constexpr uint32_t AltMaxOutOfLine = 0; |
| static constexpr bool HasFlexibleEnvelope = false; |
| static constexpr bool ContainsUnion = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| }; |
| using GetReportsEventRequest = ::fidl::AnyZeroArgMessage; |
| |
| struct GetReportsResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::fidl::VectorView<::llcpp::fuchsia::input::report::InputReport> reports; |
| |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_InputDeviceGetReportsResponseTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_InputDeviceGetReportsResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 139200; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 139200; |
| static constexpr bool HasFlexibleEnvelope = true; |
| static constexpr bool ContainsUnion = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| }; |
| using GetReportsRequest = ::fidl::AnyZeroArgMessage; |
| |
| struct GetDescriptorResponse final { |
| FIDL_ALIGNDECL |
| fidl_message_header_t _hdr; |
| ::llcpp::fuchsia::input::report::DeviceDescriptor descriptor; |
| |
| static constexpr const fidl_type_t* Type = &fuchsia_input_report_InputDeviceGetDescriptorResponseTable; |
| static constexpr const fidl_type_t* AltType = &v1_fuchsia_input_report_InputDeviceGetDescriptorResponseTable; |
| static constexpr uint32_t MaxNumHandles = 0; |
| static constexpr uint32_t PrimarySize = 32; |
| static constexpr uint32_t MaxOutOfLine = 6096; |
| static constexpr uint32_t AltPrimarySize = 32; |
| static constexpr uint32_t AltMaxOutOfLine = 6096; |
| static constexpr bool HasFlexibleEnvelope = true; |
| static constexpr bool ContainsUnion = false; |
| static constexpr ::fidl::internal::TransactionalMessageKind MessageKind = |
| ::fidl::internal::TransactionalMessageKind::kResponse; |
| }; |
| using GetDescriptorRequest = ::fidl::AnyZeroArgMessage; |
| |
| |
| // Collection of return types of FIDL calls in this interface. |
| class ResultOf final { |
| ResultOf() = delete; |
| private: |
| template <typename ResponseType> |
| class GetReportsEvent_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| public: |
| GetReportsEvent_Impl(zx::unowned_channel _client_end); |
| ~GetReportsEvent_Impl() = default; |
| GetReportsEvent_Impl(GetReportsEvent_Impl&& other) = default; |
| GetReportsEvent_Impl& operator=(GetReportsEvent_Impl&& other) = default; |
| using Super::status; |
| using Super::error; |
| using Super::ok; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class GetReports_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| public: |
| GetReports_Impl(zx::unowned_channel _client_end); |
| ~GetReports_Impl() = default; |
| GetReports_Impl(GetReports_Impl&& other) = default; |
| GetReports_Impl& operator=(GetReports_Impl&& other) = default; |
| using Super::status; |
| using Super::error; |
| using Super::ok; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class GetDescriptor_Impl final : private ::fidl::internal::OwnedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::OwnedSyncCallBase<ResponseType>; |
| public: |
| GetDescriptor_Impl(zx::unowned_channel _client_end); |
| ~GetDescriptor_Impl() = default; |
| GetDescriptor_Impl(GetDescriptor_Impl&& other) = default; |
| GetDescriptor_Impl& operator=(GetDescriptor_Impl&& other) = default; |
| using Super::status; |
| using Super::error; |
| using Super::ok; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using GetReportsEvent = GetReportsEvent_Impl<GetReportsEventResponse>; |
| using GetReports = GetReports_Impl<GetReportsResponse>; |
| using GetDescriptor = GetDescriptor_Impl<GetDescriptorResponse>; |
| }; |
| |
| // Collection of return types of FIDL calls in this interface, |
| // when the caller-allocate flavor or in-place call is used. |
| class UnownedResultOf final { |
| UnownedResultOf() = delete; |
| private: |
| template <typename ResponseType> |
| class GetReportsEvent_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| public: |
| GetReportsEvent_Impl(zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| ~GetReportsEvent_Impl() = default; |
| GetReportsEvent_Impl(GetReportsEvent_Impl&& other) = default; |
| GetReportsEvent_Impl& operator=(GetReportsEvent_Impl&& other) = default; |
| using Super::status; |
| using Super::error; |
| using Super::ok; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class GetReports_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| public: |
| GetReports_Impl(zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| ~GetReports_Impl() = default; |
| GetReports_Impl(GetReports_Impl&& other) = default; |
| GetReports_Impl& operator=(GetReports_Impl&& other) = default; |
| using Super::status; |
| using Super::error; |
| using Super::ok; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| template <typename ResponseType> |
| class GetDescriptor_Impl final : private ::fidl::internal::UnownedSyncCallBase<ResponseType> { |
| using Super = ::fidl::internal::UnownedSyncCallBase<ResponseType>; |
| public: |
| GetDescriptor_Impl(zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| ~GetDescriptor_Impl() = default; |
| GetDescriptor_Impl(GetDescriptor_Impl&& other) = default; |
| GetDescriptor_Impl& operator=(GetDescriptor_Impl&& other) = default; |
| using Super::status; |
| using Super::error; |
| using Super::ok; |
| using Super::Unwrap; |
| using Super::value; |
| using Super::operator->; |
| using Super::operator*; |
| }; |
| |
| public: |
| using GetReportsEvent = GetReportsEvent_Impl<GetReportsEventResponse>; |
| using GetReports = GetReports_Impl<GetReportsResponse>; |
| using GetDescriptor = GetDescriptor_Impl<GetDescriptorResponse>; |
| }; |
| |
| class SyncClient final { |
| public: |
| explicit SyncClient(::zx::channel channel) : channel_(std::move(channel)) {} |
| ~SyncClient() = default; |
| SyncClient(SyncClient&&) = default; |
| SyncClient& operator=(SyncClient&&) = default; |
| |
| const ::zx::channel& channel() const { return channel_; } |
| |
| ::zx::channel* mutable_channel() { return &channel_; } |
| |
| // Receive an event that will be signalled when there are reports in the |
| // Device's report FIFO. When there are events in the FIFO, |event| will have |
| // |DEV_STATE_READABLE| triggered. When the client has read all of the events, |
| // |DEV_STATE_READABLE| will be cleared. |
| // Allocates 40 bytes of message buffer on the stack. No heap allocation necessary. |
| ResultOf::GetReportsEvent GetReportsEvent(); |
| |
| // Receive an event that will be signalled when there are reports in the |
| // Device's report FIFO. When there are events in the FIFO, |event| will have |
| // |DEV_STATE_READABLE| triggered. When the client has read all of the events, |
| // |DEV_STATE_READABLE| will be cleared. |
| // Caller provides the backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::GetReportsEvent GetReportsEvent(::fidl::BytePart _response_buffer); |
| |
| // Get all of the reports that have been seen since the last time this method was called. |
| // If this returns 0 reports, please wait on the report event. |
| // Allocates 16 bytes of request buffer on the stack. Response is heap-allocated. |
| ResultOf::GetReports GetReports(); |
| |
| // Get all of the reports that have been seen since the last time this method was called. |
| // If this returns 0 reports, please wait on the report event. |
| // Caller provides the backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::GetReports GetReports(::fidl::BytePart _response_buffer); |
| |
| // Gets the device descriptor for this device. |
| // Allocates 16 bytes of request buffer on the stack. Response is heap-allocated. |
| ResultOf::GetDescriptor GetDescriptor(); |
| |
| // Gets the device descriptor for this device. |
| // Caller provides the backing storage for FIDL message via request and response buffers. |
| UnownedResultOf::GetDescriptor GetDescriptor(::fidl::BytePart _response_buffer); |
| |
| private: |
| ::zx::channel channel_; |
| }; |
| |
| // Methods to make a sync FIDL call directly on an unowned channel, avoiding setting up a client. |
| class Call final { |
| Call() = delete; |
| public: |
| |
| // Receive an event that will be signalled when there are reports in the |
| // Device's report FIFO. When there are events in the FIFO, |event| will have |
| // |DEV_STATE_READABLE| triggered. When the client has read all of the events, |
| // |DEV_STATE_READABLE| will be cleared. |
| // Allocates 40 bytes of message buffer on the stack. No heap allocation necessary. |
| static ResultOf::GetReportsEvent GetReportsEvent(zx::unowned_channel _client_end); |
| |
| // Receive an event that will be signalled when there are reports in the |
| // Device's report FIFO. When there are events in the FIFO, |event| will have |
| // |DEV_STATE_READABLE| triggered. When the client has read all of the events, |
| // |DEV_STATE_READABLE| will be cleared. |
| // Caller provides the backing storage for FIDL message via request and response buffers. |
| static UnownedResultOf::GetReportsEvent GetReportsEvent(zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| // Get all of the reports that have been seen since the last time this method was called. |
| // If this returns 0 reports, please wait on the report event. |
| // Allocates 16 bytes of request buffer on the stack. Response is heap-allocated. |
| static ResultOf::GetReports GetReports(zx::unowned_channel _client_end); |
| |
| // Get all of the reports that have been seen since the last time this method was called. |
| // If this returns 0 reports, please wait on the report event. |
| // Caller provides the backing storage for FIDL message via request and response buffers. |
| static UnownedResultOf::GetReports GetReports(zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| // Gets the device descriptor for this device. |
| // Allocates 16 bytes of request buffer on the stack. Response is heap-allocated. |
| static ResultOf::GetDescriptor GetDescriptor(zx::unowned_channel _client_end); |
| |
| // Gets the device descriptor for this device. |
| // Caller provides the backing storage for FIDL message via request and response buffers. |
| static UnownedResultOf::GetDescriptor GetDescriptor(zx::unowned_channel _client_end, ::fidl::BytePart _response_buffer); |
| |
| }; |
| |
| // Messages are encoded and decoded in-place when these methods are used. |
| // Additionally, requests must be already laid-out according to the FIDL wire-format. |
| class InPlace final { |
| InPlace() = delete; |
| public: |
| |
| // Receive an event that will be signalled when there are reports in the |
| // Device's report FIFO. When there are events in the FIFO, |event| will have |
| // |DEV_STATE_READABLE| triggered. When the client has read all of the events, |
| // |DEV_STATE_READABLE| will be cleared. |
| static ::fidl::DecodeResult<GetReportsEventResponse> GetReportsEvent(zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| |
| // Get all of the reports that have been seen since the last time this method was called. |
| // If this returns 0 reports, please wait on the report event. |
| static ::fidl::DecodeResult<GetReportsResponse> GetReports(zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| |
| // Gets the device descriptor for this device. |
| static ::fidl::DecodeResult<GetDescriptorResponse> GetDescriptor(zx::unowned_channel _client_end, ::fidl::BytePart response_buffer); |
| |
| }; |
| |
| // Pure-virtual interface to be implemented by a server. |
| class Interface { |
| public: |
| Interface() = default; |
| virtual ~Interface() = default; |
| using _Outer = InputDevice; |
| using _Base = ::fidl::CompleterBase; |
| |
| class GetReportsEventCompleterBase : public _Base { |
| public: |
| void Reply(int32_t status, ::zx::event event); |
| void Reply(::fidl::BytePart _buffer, int32_t status, ::zx::event event); |
| void Reply(::fidl::DecodedMessage<GetReportsEventResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using GetReportsEventCompleter = ::fidl::Completer<GetReportsEventCompleterBase>; |
| |
| virtual void GetReportsEvent(GetReportsEventCompleter::Sync _completer) = 0; |
| |
| class GetReportsCompleterBase : public _Base { |
| public: |
| void Reply(::fidl::VectorView<::llcpp::fuchsia::input::report::InputReport> reports); |
| void Reply(::fidl::BytePart _buffer, ::fidl::VectorView<::llcpp::fuchsia::input::report::InputReport> reports); |
| void Reply(::fidl::DecodedMessage<GetReportsResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using GetReportsCompleter = ::fidl::Completer<GetReportsCompleterBase>; |
| |
| virtual void GetReports(GetReportsCompleter::Sync _completer) = 0; |
| |
| class GetDescriptorCompleterBase : public _Base { |
| public: |
| void Reply(::llcpp::fuchsia::input::report::DeviceDescriptor descriptor); |
| void Reply(::fidl::BytePart _buffer, ::llcpp::fuchsia::input::report::DeviceDescriptor descriptor); |
| void Reply(::fidl::DecodedMessage<GetDescriptorResponse> params); |
| |
| protected: |
| using ::fidl::CompleterBase::CompleterBase; |
| }; |
| |
| using GetDescriptorCompleter = ::fidl::Completer<GetDescriptorCompleterBase>; |
| |
| virtual void GetDescriptor(GetDescriptorCompleter::Sync _completer) = 0; |
| |
| }; |
| |
| // Attempts to dispatch the incoming message to a handler function in the server implementation. |
| // If there is no matching handler, it returns false, leaving the message and transaction intact. |
| // In all other cases, it consumes the message and returns true. |
| // It is possible to chain multiple TryDispatch functions in this manner. |
| static bool TryDispatch(Interface* impl, fidl_msg_t* msg, ::fidl::Transaction* txn); |
| |
| // Dispatches the incoming message to one of the handlers functions in the interface. |
| // If there is no matching handler, it closes all the handles in |msg| and closes the channel with |
| // a |ZX_ERR_NOT_SUPPORTED| epitaph, before returning false. The message should then be discarded. |
| static bool Dispatch(Interface* impl, fidl_msg_t* msg, ::fidl::Transaction* txn); |
| |
| // Same as |Dispatch|, but takes a |void*| instead of |Interface*|. Only used with |fidl::Bind| |
| // to reduce template expansion. |
| // Do not call this method manually. Use |Dispatch| instead. |
| static bool TypeErasedDispatch(void* impl, fidl_msg_t* msg, ::fidl::Transaction* txn) { |
| return Dispatch(static_cast<Interface*>(impl), msg, txn); |
| } |
| |
| |
| // Helper functions to fill in the transaction header in a |DecodedMessage<TransactionalMessage>|. |
| class SetTransactionHeaderFor final { |
| SetTransactionHeaderFor() = delete; |
| public: |
| static void GetReportsEventRequest(const ::fidl::DecodedMessage<InputDevice::GetReportsEventRequest>& _msg); |
| static void GetReportsEventResponse(const ::fidl::DecodedMessage<InputDevice::GetReportsEventResponse>& _msg); |
| static void GetReportsRequest(const ::fidl::DecodedMessage<InputDevice::GetReportsRequest>& _msg); |
| static void GetReportsResponse(const ::fidl::DecodedMessage<InputDevice::GetReportsResponse>& _msg); |
| static void GetDescriptorRequest(const ::fidl::DecodedMessage<InputDevice::GetDescriptorRequest>& _msg); |
| static void GetDescriptorResponse(const ::fidl::DecodedMessage<InputDevice::GetDescriptorResponse>& _msg); |
| }; |
| }; |
| |
| } // namespace report |
| } // namespace input |
| } // namespace fuchsia |
| } // namespace llcpp |
| |
| namespace fidl { |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::SensorReport> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::SensorReport>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::Range> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::Range>); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::Range, min) == 0); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::Range, max) == 8); |
| static_assert(sizeof(::llcpp::fuchsia::input::report::Range) == ::llcpp::fuchsia::input::report::Range::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::Axis> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::Axis>); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::Axis, range) == 0); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::Axis, unit) == 16); |
| static_assert(sizeof(::llcpp::fuchsia::input::report::Axis) == ::llcpp::fuchsia::input::report::Axis::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::SensorAxis> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::SensorAxis>); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::SensorAxis, axis) == 0); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::SensorAxis, type) == 24); |
| static_assert(sizeof(::llcpp::fuchsia::input::report::SensorAxis) == ::llcpp::fuchsia::input::report::SensorAxis::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::SensorDescriptor> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::SensorDescriptor>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::MouseDescriptor> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::MouseDescriptor>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::ContactDescriptor> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::ContactDescriptor>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::TouchDescriptor> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::TouchDescriptor>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::MouseReport> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::MouseReport>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::DeviceInfo> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::DeviceInfo>); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::DeviceInfo, vendor_id) == 0); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::DeviceInfo, product_id) == 4); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::DeviceInfo, version) == 8); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::DeviceInfo, name) == 16); |
| static_assert(sizeof(::llcpp::fuchsia::input::report::DeviceInfo) == ::llcpp::fuchsia::input::report::DeviceInfo::PrimarySize); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::DeviceDescriptor> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::DeviceDescriptor>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::ContactReport> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::ContactReport>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::TouchReport> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::TouchReport>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::InputReport> : public std::true_type {}; |
| static_assert(std::is_standard_layout_v<::llcpp::fuchsia::input::report::InputReport>); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::InputDevice::GetReportsEventResponse> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::fuchsia::input::report::InputDevice::GetReportsEventResponse> : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fuchsia::input::report::InputDevice::GetReportsEventResponse) |
| == ::llcpp::fuchsia::input::report::InputDevice::GetReportsEventResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::InputDevice::GetReportsEventResponse, status) == 16); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::InputDevice::GetReportsEventResponse, event) == 20); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::InputDevice::GetReportsResponse> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::fuchsia::input::report::InputDevice::GetReportsResponse> : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fuchsia::input::report::InputDevice::GetReportsResponse) |
| == ::llcpp::fuchsia::input::report::InputDevice::GetReportsResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::InputDevice::GetReportsResponse, reports) == 16); |
| |
| template <> |
| struct IsFidlType<::llcpp::fuchsia::input::report::InputDevice::GetDescriptorResponse> : public std::true_type {}; |
| template <> |
| struct IsFidlMessage<::llcpp::fuchsia::input::report::InputDevice::GetDescriptorResponse> : public std::true_type {}; |
| static_assert(sizeof(::llcpp::fuchsia::input::report::InputDevice::GetDescriptorResponse) |
| == ::llcpp::fuchsia::input::report::InputDevice::GetDescriptorResponse::PrimarySize); |
| static_assert(offsetof(::llcpp::fuchsia::input::report::InputDevice::GetDescriptorResponse, descriptor) == 16); |
| |
| } // namespace fidl |