| // services/device/public/mojom/nfc.mojom-shared.h 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. |
| |
| #ifndef SERVICES_DEVICE_PUBLIC_MOJOM_NFC_MOJOM_SHARED_H_ |
| #define SERVICES_DEVICE_PUBLIC_MOJOM_NFC_MOJOM_SHARED_H_ |
| |
| #include <stdint.h> |
| |
| #include <functional> |
| #include <iosfwd> |
| #include <type_traits> |
| #include <utility> |
| #include "mojo/public/cpp/bindings/array_data_view.h" |
| #include "mojo/public/cpp/bindings/enum_traits.h" |
| #include "mojo/public/cpp/bindings/interface_data_view.h" |
| #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| #include "mojo/public/cpp/bindings/lib/serialization.h" |
| #include "mojo/public/cpp/bindings/map_data_view.h" |
| #include "mojo/public/cpp/bindings/string_data_view.h" |
| |
| #include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h" |
| |
| #include "services/device/public/mojom/nfc.mojom-shared-internal.h" |
| #include "mojo/public/cpp/bindings/lib/interface_serialization.h" |
| #include "mojo/public/cpp/system/data_pipe.h" |
| |
| |
| |
| #ifdef KYTHE_IS_RUNNING |
| #pragma kythe_inline_metadata "Metadata comment" |
| #endif |
| |
| |
| namespace device::mojom { |
| class NDEFErrorDataView; |
| |
| class NDEFRecordDataView; |
| |
| class NDEFMessageDataView; |
| |
| class NDEFWriteOptionsDataView; |
| |
| |
| |
| } // device::mojom |
| |
| namespace mojo { |
| namespace internal { |
| |
| template <> |
| struct MojomTypeTraits<::device::mojom::NDEFErrorDataView> { |
| using Data = ::device::mojom::internal::NDEFError_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::device::mojom::NDEFRecordDataView> { |
| using Data = ::device::mojom::internal::NDEFRecord_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::device::mojom::NDEFMessageDataView> { |
| using Data = ::device::mojom::internal::NDEFMessage_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| template <> |
| struct MojomTypeTraits<::device::mojom::NDEFWriteOptionsDataView> { |
| using Data = ::device::mojom::internal::NDEFWriteOptions_Data; |
| using DataAsArrayElement = Pointer<Data>; |
| static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct; |
| }; |
| |
| } // namespace internal |
| } // namespace mojo |
| |
| |
| namespace device::mojom { |
| |
| |
| // @generated_from: device.mojom.NDEFErrorType |
| enum class NDEFErrorType : int32_t { |
| |
| // @generated_from: device.mojom.NDEFErrorType.NOT_ALLOWED |
| NOT_ALLOWED = 0, |
| |
| // @generated_from: device.mojom.NDEFErrorType.NOT_SUPPORTED |
| NOT_SUPPORTED = 1, |
| |
| // @generated_from: device.mojom.NDEFErrorType.NOT_READABLE |
| NOT_READABLE = 2, |
| |
| // @generated_from: device.mojom.NDEFErrorType.INVALID_MESSAGE |
| INVALID_MESSAGE = 3, |
| |
| // @generated_from: device.mojom.NDEFErrorType.OPERATION_CANCELLED |
| OPERATION_CANCELLED = 4, |
| |
| // @generated_from: device.mojom.NDEFErrorType.IO_ERROR |
| IO_ERROR = 5, |
| kMinValue = 0, |
| kMaxValue = 5, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, NDEFErrorType value); |
| inline bool IsKnownEnumValue(NDEFErrorType value) { |
| return internal::NDEFErrorType_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| |
| |
| // @generated_from: device.mojom.NDEFRecordTypeCategory |
| enum class NDEFRecordTypeCategory : int32_t { |
| |
| // @generated_from: device.mojom.NDEFRecordTypeCategory.kStandardized |
| kStandardized = 0, |
| |
| // @generated_from: device.mojom.NDEFRecordTypeCategory.kExternal |
| kExternal = 1, |
| |
| // @generated_from: device.mojom.NDEFRecordTypeCategory.kLocal |
| kLocal = 2, |
| kMinValue = 0, |
| kMaxValue = 2, |
| }; |
| |
| std::ostream& operator<<(std::ostream& os, NDEFRecordTypeCategory value); |
| inline bool IsKnownEnumValue(NDEFRecordTypeCategory value) { |
| return internal::NDEFRecordTypeCategory_Data::IsKnownValue( |
| static_cast<int32_t>(value)); |
| } |
| // Interface base classes. They are used for type safety check. |
| class NFCInterfaceBase {}; |
| |
| using NFCPtrDataView = |
| mojo::InterfacePtrDataView<NFCInterfaceBase>; |
| using NFCRequestDataView = |
| mojo::InterfaceRequestDataView<NFCInterfaceBase>; |
| using NFCAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<NFCInterfaceBase>; |
| using NFCAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<NFCInterfaceBase>; |
| class NFCClientInterfaceBase {}; |
| |
| using NFCClientPtrDataView = |
| mojo::InterfacePtrDataView<NFCClientInterfaceBase>; |
| using NFCClientRequestDataView = |
| mojo::InterfaceRequestDataView<NFCClientInterfaceBase>; |
| using NFCClientAssociatedPtrInfoDataView = |
| mojo::AssociatedInterfacePtrInfoDataView<NFCClientInterfaceBase>; |
| using NFCClientAssociatedRequestDataView = |
| mojo::AssociatedInterfaceRequestDataView<NFCClientInterfaceBase>; |
| |
| |
| class NDEFErrorDataView { |
| public: |
| NDEFErrorDataView() = default; |
| |
| NDEFErrorDataView( |
| internal::NDEFError_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| template <typename UserType> |
| [[nodiscard]] bool ReadErrorType(UserType* output) const { |
| auto data_value = data_->error_type; |
| return mojo::internal::Deserialize<::device::mojom::NDEFErrorType>( |
| data_value, output); |
| } |
| NDEFErrorType error_type() const { |
| return ::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::device::mojom::NDEFErrorType>(data_->error_type)); |
| } |
| inline void GetErrorMessageDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadErrorMessage(UserType* output) { |
| |
| auto* pointer = data_->error_message.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::NDEFError_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class NDEFRecordDataView { |
| public: |
| NDEFRecordDataView() = default; |
| |
| NDEFRecordDataView( |
| internal::NDEFRecord_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| template <typename UserType> |
| [[nodiscard]] bool ReadCategory(UserType* output) const { |
| auto data_value = data_->category; |
| return mojo::internal::Deserialize<::device::mojom::NDEFRecordTypeCategory>( |
| data_value, output); |
| } |
| NDEFRecordTypeCategory category() const { |
| return ::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::device::mojom::NDEFRecordTypeCategory>(data_->category)); |
| } |
| inline void GetRecordTypeDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadRecordType(UserType* output) { |
| |
| auto* pointer = data_->record_type.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetMediaTypeDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadMediaType(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| mojo::StringDataView, UserType>(), |
| "Attempting to read the optional `media_type` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadMediaType` instead " |
| "of `ReadMediaType if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->media_type.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetIdDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadId(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| mojo::StringDataView, UserType>(), |
| "Attempting to read the optional `id` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadId` instead " |
| "of `ReadId if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->id.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetEncodingDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadEncoding(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| mojo::StringDataView, UserType>(), |
| "Attempting to read the optional `encoding` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadEncoding` instead " |
| "of `ReadEncoding if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->encoding.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetLangDataView( |
| mojo::StringDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadLang(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| mojo::StringDataView, UserType>(), |
| "Attempting to read the optional `lang` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadLang` instead " |
| "of `ReadLang if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->lang.Get(); |
| return mojo::internal::Deserialize<mojo::StringDataView>( |
| pointer, output, message_); |
| } |
| inline void GetDataDataView( |
| mojo::ArrayDataView<uint8_t>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadData(UserType* output) { |
| |
| auto* pointer = data_->data.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>( |
| pointer, output, message_); |
| } |
| inline void GetPayloadMessageDataView( |
| NDEFMessageDataView* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadPayloadMessage(UserType* output) { |
| |
| static_assert( |
| mojo::internal::IsValidUserTypeForOptionalValue< |
| ::device::mojom::NDEFMessageDataView, UserType>(), |
| "Attempting to read the optional `payload_message` field into a type which " |
| "cannot represent a null value. Either wrap the destination object " |
| "with std::optional, ensure that any corresponding " |
| "{Struct/Union/Array/String}Traits define the necessary IsNull and " |
| "SetToNull methods, or use `MaybeReadPayloadMessage` instead " |
| "of `ReadPayloadMessage if you're fine with null values being " |
| "silently ignored in this case."); |
| auto* pointer = data_->payload_message.Get(); |
| return mojo::internal::Deserialize<::device::mojom::NDEFMessageDataView>( |
| pointer, output, message_); |
| } |
| private: |
| internal::NDEFRecord_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class NDEFMessageDataView { |
| public: |
| NDEFMessageDataView() = default; |
| |
| NDEFMessageDataView( |
| internal::NDEFMessage_Data* data, |
| mojo::Message* message) |
| : data_(data), message_(message) {} |
| |
| bool is_null() const { return !data_; } |
| inline void GetDataDataView( |
| mojo::ArrayDataView<NDEFRecordDataView>* output); |
| |
| template <typename UserType> |
| [[nodiscard]] bool ReadData(UserType* output) { |
| |
| auto* pointer = data_->data.Get(); |
| return mojo::internal::Deserialize<mojo::ArrayDataView<::device::mojom::NDEFRecordDataView>>( |
| pointer, output, message_); |
| } |
| private: |
| internal::NDEFMessage_Data* data_ = nullptr; |
| mojo::Message* message_ = nullptr; |
| }; |
| |
| |
| class NDEFWriteOptionsDataView { |
| public: |
| NDEFWriteOptionsDataView() = default; |
| |
| NDEFWriteOptionsDataView( |
| internal::NDEFWriteOptions_Data* data, |
| mojo::Message* message) |
| : data_(data) {} |
| |
| bool is_null() const { return !data_; } |
| bool overwrite() const { |
| return data_->overwrite; |
| } |
| private: |
| internal::NDEFWriteOptions_Data* data_ = nullptr; |
| }; |
| |
| |
| } // device::mojom |
| |
| namespace std { |
| |
| template <> |
| struct hash<::device::mojom::NDEFErrorType> |
| : public mojo::internal::EnumHashImpl<::device::mojom::NDEFErrorType> {}; |
| |
| template <> |
| struct hash<::device::mojom::NDEFRecordTypeCategory> |
| : public mojo::internal::EnumHashImpl<::device::mojom::NDEFRecordTypeCategory> {}; |
| |
| } // namespace std |
| |
| namespace mojo { |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::device::mojom::NDEFErrorType, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::device::mojom::NDEFErrorType, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::device::mojom::NDEFErrorType>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::device::mojom::NDEFRecordTypeCategory, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = EnumTraits<::device::mojom::NDEFRecordTypeCategory, UserType>; |
| |
| static void Serialize(UserType input, int32_t* output) { |
| *output = static_cast<int32_t>(Traits::ToMojom(input)); |
| } |
| |
| static bool Deserialize(int32_t input, UserType* output) { |
| return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper( |
| static_cast<::device::mojom::NDEFRecordTypeCategory>(input)), output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::device::mojom::NDEFErrorDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::device::mojom::NDEFErrorDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::device::mojom::internal::NDEFError_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| mojo::internal::Serialize<::device::mojom::NDEFErrorType>( |
| Traits::error_type(input), &fragment->error_type); |
| decltype(Traits::error_message(input)) in_error_message = Traits::error_message(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->error_message)::BaseType> error_message_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_error_message, error_message_fragment); |
| fragment->error_message.Set( |
| error_message_fragment.is_null() ? nullptr : error_message_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->error_message.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null error_message in NDEFError struct"); |
| } |
| |
| static bool Deserialize(::device::mojom::internal::NDEFError_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::device::mojom::NDEFErrorDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::device::mojom::NDEFRecordDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::device::mojom::NDEFRecordDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::device::mojom::internal::NDEFRecord_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| mojo::internal::Serialize<::device::mojom::NDEFRecordTypeCategory>( |
| Traits::category(input), &fragment->category); |
| decltype(Traits::record_type(input)) in_record_type = Traits::record_type(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->record_type)::BaseType> record_type_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_record_type, record_type_fragment); |
| fragment->record_type.Set( |
| record_type_fragment.is_null() ? nullptr : record_type_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->record_type.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null record_type in NDEFRecord struct"); |
| decltype(Traits::media_type(input)) in_media_type = Traits::media_type(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->media_type)::BaseType> media_type_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_media_type, media_type_fragment); |
| fragment->media_type.Set( |
| media_type_fragment.is_null() ? nullptr : media_type_fragment.data()); |
| decltype(Traits::id(input)) in_id = Traits::id(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->id)::BaseType> id_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_id, id_fragment); |
| fragment->id.Set( |
| id_fragment.is_null() ? nullptr : id_fragment.data()); |
| decltype(Traits::encoding(input)) in_encoding = Traits::encoding(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->encoding)::BaseType> encoding_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_encoding, encoding_fragment); |
| fragment->encoding.Set( |
| encoding_fragment.is_null() ? nullptr : encoding_fragment.data()); |
| decltype(Traits::lang(input)) in_lang = Traits::lang(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->lang)::BaseType> lang_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<mojo::StringDataView>( |
| in_lang, lang_fragment); |
| fragment->lang.Set( |
| lang_fragment.is_null() ? nullptr : lang_fragment.data()); |
| decltype(Traits::data(input)) in_data = Traits::data(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->data)::BaseType> |
| data_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& data_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>>( |
| in_data, data_fragment, &data_validate_params); |
| fragment->data.Set( |
| data_fragment.is_null() ? nullptr : data_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->data.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null data in NDEFRecord struct"); |
| decltype(Traits::payload_message(input)) in_payload_message = Traits::payload_message(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->payload_message)::BaseType> payload_message_fragment( |
| fragment.message()); |
| mojo::internal::Serialize<::device::mojom::NDEFMessageDataView>( |
| in_payload_message, payload_message_fragment); |
| fragment->payload_message.Set( |
| payload_message_fragment.is_null() ? nullptr : payload_message_fragment.data()); |
| } |
| |
| static bool Deserialize(::device::mojom::internal::NDEFRecord_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::device::mojom::NDEFRecordDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::device::mojom::NDEFMessageDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::device::mojom::NDEFMessageDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::device::mojom::internal::NDEFMessage_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| decltype(Traits::data(input)) in_data = Traits::data(input); |
| mojo::internal::MessageFragment< |
| typename decltype(fragment->data)::BaseType> |
| data_fragment(fragment.message()); |
| constexpr const mojo::internal::ContainerValidateParams& data_validate_params = |
| mojo::internal::GetArrayValidator<0, false, nullptr>(); |
| mojo::internal::Serialize<mojo::ArrayDataView<::device::mojom::NDEFRecordDataView>>( |
| in_data, data_fragment, &data_validate_params); |
| fragment->data.Set( |
| data_fragment.is_null() ? nullptr : data_fragment.data()); |
| MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING( |
| fragment->data.is_null(), |
| mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER, |
| "null data in NDEFMessage struct"); |
| } |
| |
| static bool Deserialize(::device::mojom::internal::NDEFMessage_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::device::mojom::NDEFMessageDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| |
| namespace internal { |
| |
| template <typename MaybeConstUserType> |
| struct Serializer<::device::mojom::NDEFWriteOptionsDataView, MaybeConstUserType> { |
| using UserType = typename std::remove_const<MaybeConstUserType>::type; |
| using Traits = StructTraits<::device::mojom::NDEFWriteOptionsDataView, UserType>; |
| |
| static void Serialize( |
| MaybeConstUserType& input, |
| mojo::internal::MessageFragment<::device::mojom::internal::NDEFWriteOptions_Data>& fragment) { |
| if (CallIsNullIfExists<Traits>(input)) |
| return; |
| fragment.Allocate(); |
| fragment->overwrite = Traits::overwrite(input); |
| } |
| |
| static bool Deserialize(::device::mojom::internal::NDEFWriteOptions_Data* input, |
| UserType* output, |
| Message* message) { |
| if (!input) |
| return CallSetToNullIfExists<Traits>(output); |
| |
| ::device::mojom::NDEFWriteOptionsDataView data_view(input, message); |
| return Traits::Read(data_view, output); |
| } |
| }; |
| |
| } // namespace internal |
| |
| } // namespace mojo |
| |
| |
| namespace device::mojom { |
| |
| inline void NDEFErrorDataView::GetErrorMessageDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->error_message.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| |
| |
| inline void NDEFRecordDataView::GetRecordTypeDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->record_type.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void NDEFRecordDataView::GetMediaTypeDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->media_type.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void NDEFRecordDataView::GetIdDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->id.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void NDEFRecordDataView::GetEncodingDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->encoding.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void NDEFRecordDataView::GetLangDataView( |
| mojo::StringDataView* output) { |
| auto pointer = data_->lang.Get(); |
| *output = mojo::StringDataView(pointer, message_); |
| } |
| inline void NDEFRecordDataView::GetDataDataView( |
| mojo::ArrayDataView<uint8_t>* output) { |
| auto pointer = data_->data.Get(); |
| *output = mojo::ArrayDataView<uint8_t>(pointer, message_); |
| } |
| inline void NDEFRecordDataView::GetPayloadMessageDataView( |
| NDEFMessageDataView* output) { |
| auto pointer = data_->payload_message.Get(); |
| *output = NDEFMessageDataView(pointer, message_); |
| } |
| |
| |
| inline void NDEFMessageDataView::GetDataDataView( |
| mojo::ArrayDataView<NDEFRecordDataView>* output) { |
| auto pointer = data_->data.Get(); |
| *output = mojo::ArrayDataView<NDEFRecordDataView>(pointer, message_); |
| } |
| |
| |
| |
| |
| |
| } // device::mojom |
| |
| // Declare TraceFormatTraits for enums, which should be defined in ::perfetto |
| // namespace. |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::device::mojom::NDEFErrorType> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::device::mojom::NDEFErrorType value); |
| }; |
| |
| } // namespace perfetto |
| |
| namespace perfetto { |
| |
| template <> |
| struct TraceFormatTraits<::device::mojom::NDEFRecordTypeCategory> { |
| static void WriteIntoTrace(perfetto::TracedValue context, ::device::mojom::NDEFRecordTypeCategory value); |
| }; |
| |
| } // namespace perfetto |
| |
| #endif // SERVICES_DEVICE_PUBLIC_MOJOM_NFC_MOJOM_SHARED_H_
|
| /* Metadata comment
|
| eyJ0eXBlIjogImt5dGhlMCIsICJtZXRhIjogW3sidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJi
|
| ZWdpbiI6IDI1ODQsICJlbmQiOiAyNTk3LCAidm5hbWUiOiB7Imxhbmd1YWdlIjogIm1vam9tIiwg
|
| ImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2UuY29tL2NvZGVzZWFyY2gvY2hyb21pdW0v
|
| c3JjLy9tYWluIiwgInNpZ25hdHVyZSI6ICJkZXZpY2UubW9qb20uTkRFRkVycm9yVHlwZSJ9LCAi
|
| ZWRnZSI6ICIlL2t5dGhlL2VkZ2UvZ2VuZXJhdGVzIn0sIHsidHlwZSI6ICJhbmNob3JfZGVmaW5l
|
| cyIsICJiZWdpbiI6IDI2NzQsICJlbmQiOiAyNjg1LCAidm5hbWUiOiB7Imxhbmd1YWdlIjogIm1v
|
| am9tIiwgImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2UuY29tL2NvZGVzZWFyY2gvY2hy
|
| b21pdW0vc3JjLy9tYWluIiwgInNpZ25hdHVyZSI6ICJkZXZpY2UubW9qb20uTkRFRkVycm9yVHlw
|
| ZS5OT1RfQUxMT1dFRCJ9LCAiZWRnZSI6ICIlL2t5dGhlL2VkZ2UvZ2VuZXJhdGVzIn0sIHsidHlw
|
| ZSI6ICJhbmNob3JfZGVmaW5lcyIsICJiZWdpbiI6IDI3NTcsICJlbmQiOiAyNzcwLCAidm5hbWUi
|
| OiB7Imxhbmd1YWdlIjogIm1vam9tIiwgImNvcnB1cyI6ICJjaHJvbWl1bS5nb29nbGVzb3VyY2Uu
|
| Y29tL2NvZGVzZWFyY2gvY2hyb21pdW0vc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