Android-cuttlefish cvd tool
rf_packets.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// File generated from <stdin>, with the command:
18// /mnt/disks/build-disk/src/android/main/out/soong/.temp/sbox/9a296958a3bd30ec1088ce7729bb85fe3b298ceb/tools/out/bin/pdl_cxx_generator
19// --namespace casimir::rf --output ./out/rf_packets.h
20// /!\ Do not edit by hand
21
22/*
23 * TODO: b/416777029 - Stop using this file and generate it at compile time
24 */
25
26#pragma once
27
28#include <cstdint>
29#include <optional>
30#include <string>
31#include <utility>
32#include <vector>
33
35
36#ifndef _ASSERT_VALID
37#ifdef ASSERT
38#define _ASSERT_VALID ASSERT
39#else
40#include <cassert>
41#define _ASSERT_VALID assert
42#endif // ASSERT
43#endif // !_ASSERT_VALID
44
45namespace casimir::rf {
46class RfPacketView;
47class PollCommandView;
48class FieldInfoView;
49class NfcAPollResponseView;
50class T4ATSelectCommandView;
51class T4ATSelectResponseView;
52class NfcDepSelectCommandView;
53class NfcDepSelectResponseView;
54class SelectCommandView;
55class DeactivateNotificationView;
56class DataView;
57
58enum class Technology : uint8_t {
59 NFC_A = 0x0,
60 NFC_B = 0x1,
61 NFC_F = 0x2,
62 NFC_V = 0x3,
63 RAW = 0x7,
64};
65
66inline std::string TechnologyText(Technology tag) {
67 switch (tag) {
69 return "NFC_A";
71 return "NFC_B";
73 return "NFC_F";
75 return "NFC_V";
76 case Technology::RAW:
77 return "RAW";
78 default:
79 return std::string("Unknown Technology: " +
80 std::to_string(static_cast<uint64_t>(tag)));
81 }
82}
83
84enum class BitRate : uint8_t {
92 BIT_RATE_26_KBIT_S = 0x20,
93};
94
95inline std::string BitRateText(BitRate tag) {
96 switch (tag) {
98 return "BIT_RATE_106_KBIT_S";
100 return "BIT_RATE_212_KBIT_S";
102 return "BIT_RATE_424_KBIT_S";
104 return "BIT_RATE_848_KBIT_S";
106 return "BIT_RATE_1695_KBIT_S";
108 return "BIT_RATE_3390_KBIT_S";
110 return "BIT_RATE_6780_KBIT_S";
112 return "BIT_RATE_26_KBIT_S";
113 default:
114 return std::string("Unknown BitRate: " +
115 std::to_string(static_cast<uint64_t>(tag)));
116 }
117}
118
119enum class Protocol : uint8_t {
120 UNDETERMINED = 0x0,
121 T1T = 0x1,
122 T2T = 0x2,
123 T3T = 0x3,
124 ISO_DEP = 0x4,
125 NFC_DEP = 0x5,
126 T5T = 0x6,
127 NDEF = 0x7,
128};
129
130inline std::string ProtocolText(Protocol tag) {
131 switch (tag) {
133 return "UNDETERMINED";
134 case Protocol::T1T:
135 return "T1T";
136 case Protocol::T2T:
137 return "T2T";
138 case Protocol::T3T:
139 return "T3T";
141 return "ISO_DEP";
143 return "NFC_DEP";
144 case Protocol::T5T:
145 return "T5T";
146 case Protocol::NDEF:
147 return "NDEF";
148 default:
149 return std::string("Unknown Protocol: " +
150 std::to_string(static_cast<uint64_t>(tag)));
151 }
152}
153
154enum class RfPacketType : uint8_t {
155 DATA = 0x0,
156 POLL_COMMAND = 0x1,
157 POLL_RESPONSE = 0x2,
158 SELECT_COMMAND = 0x3,
159 SELECT_RESPONSE = 0x4,
161 FIELD_INFO = 0x6,
162};
163
164inline std::string RfPacketTypeText(RfPacketType tag) {
165 switch (tag) {
167 return "DATA";
169 return "POLL_COMMAND";
171 return "POLL_RESPONSE";
173 return "SELECT_COMMAND";
175 return "SELECT_RESPONSE";
177 return "DEACTIVATE_NOTIFICATION";
179 return "FIELD_INFO";
180 default:
181 return std::string("Unknown RfPacketType: " +
182 std::to_string(static_cast<uint64_t>(tag)));
183 }
184}
185
187 public:
189 return RfPacketView(parent);
190 }
191
192 uint16_t GetSender() const {
194 return sender_;
195 }
196
197 uint16_t GetReceiver() const {
199 return receiver_;
200 }
201
204 return technology_;
205 }
206
209 return protocol_;
210 }
211
214 return packet_type_;
215 }
216
219 return bitrate_;
220 }
221
222 uint8_t GetPowerLevel() const {
224 return power_level_;
225 }
226
227 std::vector<uint8_t> GetPayload() const {
229 return payload_.bytes();
230 }
231
232 std::string ToString() const { return ""; }
233
234 bool IsValid() const { return valid_; }
235
236 pdl::packet::slice bytes() const { return bytes_; }
237
238 protected:
241 }
242
244 // Parse packet field values.
246 if (span.size() < 9) {
247 return false;
248 }
249 sender_ = span.read_le<uint16_t, 2>();
250 receiver_ = span.read_le<uint16_t, 2>();
251 technology_ = Technology(span.read_le<uint8_t, 1>());
252 protocol_ = Protocol(span.read_le<uint8_t, 1>());
253 packet_type_ = RfPacketType(span.read_le<uint8_t, 1>());
254 bitrate_ = BitRate(span.read_le<uint8_t, 1>());
255 power_level_ = span.read_le<uint8_t, 1>();
256 payload_ = span;
257 span.clear();
258 return true;
259 }
260
261 bool valid_{false};
263 uint16_t sender_{0};
264 uint16_t receiver_{0};
269 uint8_t power_level_{0};
271
272 friend class PollCommandView;
273 friend class FieldInfoView;
279 friend class SelectCommandView;
281 friend class DataView;
282};
283
285 public:
286 ~RfPacketBuilder() override = default;
287 RfPacketBuilder() = default;
291 RfPacketBuilder(uint16_t sender, uint16_t receiver, Technology technology,
292 Protocol protocol, RfPacketType packet_type, BitRate bitrate,
293 uint8_t power_level, std::vector<uint8_t> payload)
294 : sender_(sender),
295 receiver_(receiver),
296 technology_(technology),
297 protocol_(protocol),
298 packet_type_(packet_type),
299 bitrate_(bitrate),
300 power_level_(power_level),
301 payload_(std::move(payload)) {}
302 static std::unique_ptr<RfPacketBuilder> Create(
303 uint16_t sender, uint16_t receiver, Technology technology,
304 Protocol protocol, RfPacketType packet_type, BitRate bitrate,
305 uint8_t power_level, std::vector<uint8_t> payload) {
306 return std::make_unique<RfPacketBuilder>(sender, receiver, technology,
307 protocol, packet_type, bitrate,
308 power_level, std::move(payload));
309 }
310
311 void Serialize(std::vector<uint8_t>& output) const override {
312 pdl::packet::Builder::write_le<uint16_t, 2>(
313 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
314 pdl::packet::Builder::write_le<uint16_t, 2>(
315 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
316 pdl::packet::Builder::write_le<uint8_t, 1>(
317 output, (static_cast<uint8_t>(technology_) << 0));
318 pdl::packet::Builder::write_le<uint8_t, 1>(
319 output, (static_cast<uint8_t>(protocol_) << 0));
320 pdl::packet::Builder::write_le<uint8_t, 1>(
321 output, (static_cast<uint8_t>(packet_type_) << 0));
322 pdl::packet::Builder::write_le<uint8_t, 1>(
323 output, (static_cast<uint8_t>(bitrate_) << 0));
324 pdl::packet::Builder::write_le<uint8_t, 1>(
325 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
326 output.insert(output.end(), payload_.begin(), payload_.end());
327 }
328
329 size_t GetSize() const override { return payload_.size() + 9; }
330
331 uint16_t sender_{0};
332 uint16_t receiver_{0};
337 uint8_t power_level_{0};
338 std::vector<uint8_t> payload_;
339};
340
341enum class PollingFrameFormat : uint8_t {
342 SHORT = 0x0,
343 LONG = 0x1,
344};
345
347 switch (tag) {
349 return "SHORT";
351 return "LONG";
352 default:
353 return std::string("Unknown PollingFrameFormat: " +
354 std::to_string(static_cast<uint64_t>(tag)));
355 }
356}
357
359 public:
361 return PollCommandView(parent);
362 }
363
364 uint16_t GetSender() const {
366 return sender_;
367 }
368
369 uint16_t GetReceiver() const {
371 return receiver_;
372 }
373
376 return technology_;
377 }
378
381 return protocol_;
382 }
383
386 return bitrate_;
387 }
388
389 uint8_t GetPowerLevel() const {
391 return power_level_;
392 }
393
396 return format_;
397 }
398
399 std::vector<uint8_t> GetPayload() const {
401 return payload_.bytes();
402 }
403
405
406 std::string ToString() const { return ""; }
407
408 bool IsValid() const { return valid_; }
409
410 pdl::packet::slice bytes() const { return bytes_; }
411
412 protected:
415 }
416
417 bool Parse(RfPacketView const& parent) {
418 // Check validity of parent packet.
419 if (!parent.IsValid()) {
420 return false;
421 }
422
423 // Copy parent field values.
424 sender_ = parent.sender_;
425 receiver_ = parent.receiver_;
426 technology_ = parent.technology_;
427 protocol_ = parent.protocol_;
428 bitrate_ = parent.bitrate_;
429 power_level_ = parent.power_level_;
430
431 if (parent.packet_type_ != RfPacketType::POLL_COMMAND) {
432 return false;
433 }
434
435 // Parse packet field values.
436 pdl::packet::slice span = parent.payload_;
437 if (span.size() < 1) {
438 return false;
439 }
440 uint8_t chunk0 = span.read_le<uint8_t, 1>();
441 format_ = PollingFrameFormat((chunk0 >> 0) & 0x1);
442 payload_ = span;
443 span.clear();
444 return true;
445 }
446
447 bool valid_{false};
449 uint16_t sender_{0};
450 uint16_t receiver_{0};
454 uint8_t power_level_{0};
457};
458
460 public:
461 ~PollCommandBuilder() override = default;
466 PollCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology,
467 Protocol protocol, BitRate bitrate, uint8_t power_level,
468 PollingFrameFormat format, std::vector<uint8_t> payload)
469 : RfPacketBuilder(sender, receiver, technology, protocol,
470 RfPacketType::POLL_COMMAND, bitrate, power_level,
471 std::vector<uint8_t>{}),
472 format_(format) {
473 payload_ = std::move(payload);
474 }
475 static std::unique_ptr<PollCommandBuilder> Create(
476 uint16_t sender, uint16_t receiver, Technology technology,
477 Protocol protocol, BitRate bitrate, uint8_t power_level,
478 PollingFrameFormat format, std::vector<uint8_t> payload) {
479 return std::make_unique<PollCommandBuilder>(sender, receiver, technology,
480 protocol, bitrate, power_level,
481 format, std::move(payload));
482 }
483
484 void Serialize(std::vector<uint8_t>& output) const override {
485 pdl::packet::Builder::write_le<uint16_t, 2>(
486 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
487 pdl::packet::Builder::write_le<uint16_t, 2>(
488 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
489 pdl::packet::Builder::write_le<uint8_t, 1>(
490 output, (static_cast<uint8_t>(technology_) << 0));
491 pdl::packet::Builder::write_le<uint8_t, 1>(
492 output, (static_cast<uint8_t>(protocol_) << 0));
493 pdl::packet::Builder::write_le<uint8_t, 1>(
494 output, (static_cast<uint8_t>(RfPacketType::POLL_COMMAND) << 0));
495 pdl::packet::Builder::write_le<uint8_t, 1>(
496 output, (static_cast<uint8_t>(bitrate_) << 0));
497 pdl::packet::Builder::write_le<uint8_t, 1>(
498 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
499 pdl::packet::Builder::write_le<uint8_t, 1>(
500 output, (static_cast<uint8_t>(format_) << 0));
501 output.insert(output.end(), payload_.begin(), payload_.end());
502 }
503
504 size_t GetSize() const override { return payload_.size() + 10; }
505
507};
508
509enum class FieldStatus : uint8_t {
510 FieldOff = 0x0,
511 FieldOn = 0x1,
512};
513
514inline std::string FieldStatusText(FieldStatus tag) {
515 switch (tag) {
517 return "FieldOff";
519 return "FieldOn";
520 default:
521 return std::string("Unknown FieldStatus: " +
522 std::to_string(static_cast<uint64_t>(tag)));
523 }
524}
525
527 public:
529 return FieldInfoView(parent);
530 }
531
532 uint16_t GetSender() const {
534 return sender_;
535 }
536
537 uint16_t GetReceiver() const {
539 return receiver_;
540 }
541
544 return technology_;
545 }
546
549 return protocol_;
550 }
551
554 return bitrate_;
555 }
556
557 uint8_t GetPowerLevel() const {
559 return power_level_;
560 }
561
564 return field_status_;
565 }
566
568
569 std::string ToString() const { return ""; }
570
571 bool IsValid() const { return valid_; }
572
573 pdl::packet::slice bytes() const { return bytes_; }
574
575 protected:
578 }
579
580 bool Parse(RfPacketView const& parent) {
581 // Check validity of parent packet.
582 if (!parent.IsValid()) {
583 return false;
584 }
585
586 // Copy parent field values.
587 sender_ = parent.sender_;
588 receiver_ = parent.receiver_;
589 technology_ = parent.technology_;
590 protocol_ = parent.protocol_;
591 bitrate_ = parent.bitrate_;
592 power_level_ = parent.power_level_;
593
594 if (parent.packet_type_ != RfPacketType::FIELD_INFO) {
595 return false;
596 }
597
598 // Parse packet field values.
599 pdl::packet::slice span = parent.payload_;
600 if (span.size() < 1) {
601 return false;
602 }
603 field_status_ = FieldStatus(span.read_le<uint8_t, 1>());
604 return true;
605 }
606
607 bool valid_{false};
609 uint16_t sender_{0};
610 uint16_t receiver_{0};
614 uint8_t power_level_{0};
616};
617
619 public:
620 ~FieldInfoBuilder() override = default;
621 FieldInfoBuilder() = default;
625 FieldInfoBuilder(uint16_t sender, uint16_t receiver, Technology technology,
626 Protocol protocol, BitRate bitrate, uint8_t power_level,
627 FieldStatus field_status)
628 : RfPacketBuilder(sender, receiver, technology, protocol,
629 RfPacketType::FIELD_INFO, bitrate, power_level,
630 std::vector<uint8_t>{}),
631 field_status_(field_status) {}
632 static std::unique_ptr<FieldInfoBuilder> Create(
633 uint16_t sender, uint16_t receiver, Technology technology,
634 Protocol protocol, BitRate bitrate, uint8_t power_level,
635 FieldStatus field_status) {
636 return std::make_unique<FieldInfoBuilder>(sender, receiver, technology,
637 protocol, bitrate, power_level,
638 field_status);
639 }
640
641 void Serialize(std::vector<uint8_t>& output) const override {
642 pdl::packet::Builder::write_le<uint16_t, 2>(
643 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
644 pdl::packet::Builder::write_le<uint16_t, 2>(
645 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
646 pdl::packet::Builder::write_le<uint8_t, 1>(
647 output, (static_cast<uint8_t>(technology_) << 0));
648 pdl::packet::Builder::write_le<uint8_t, 1>(
649 output, (static_cast<uint8_t>(protocol_) << 0));
650 pdl::packet::Builder::write_le<uint8_t, 1>(
651 output, (static_cast<uint8_t>(RfPacketType::FIELD_INFO) << 0));
652 pdl::packet::Builder::write_le<uint8_t, 1>(
653 output, (static_cast<uint8_t>(bitrate_) << 0));
654 pdl::packet::Builder::write_le<uint8_t, 1>(
655 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
656 pdl::packet::Builder::write_le<uint8_t, 1>(
657 output, (static_cast<uint8_t>(field_status_) << 0));
658 }
659
660 size_t GetSize() const override { return 10; }
661
663};
664
666 public:
669 }
670
671 uint16_t GetSender() const {
673 return sender_;
674 }
675
676 uint16_t GetReceiver() const {
678 return receiver_;
679 }
680
683 return protocol_;
684 }
685
688 return bitrate_;
689 }
690
691 uint8_t GetPowerLevel() const {
693 return power_level_;
694 }
695
696 std::vector<uint8_t> GetNfcid1() const {
699 std::vector<uint8_t> elements;
700 while (span.size() >= 1) {
701 elements.push_back(span.read_le<uint8_t, 1>());
702 }
703 return elements;
704 }
705
706 uint8_t GetIntProtocol() const {
708 return int_protocol_;
709 }
710
711 uint8_t GetBitFrameSdd() const {
713 return bit_frame_sdd_;
714 }
715
717
719
720 std::string ToString() const { return ""; }
721
722 bool IsValid() const { return valid_; }
723
724 pdl::packet::slice bytes() const { return bytes_; }
725
726 protected:
728 : bytes_(parent.bytes_) {
730 }
731
732 bool Parse(RfPacketView const& parent) {
733 // Check validity of parent packet.
734 if (!parent.IsValid()) {
735 return false;
736 }
737
738 // Copy parent field values.
739 sender_ = parent.sender_;
740 receiver_ = parent.receiver_;
741 protocol_ = parent.protocol_;
742 bitrate_ = parent.bitrate_;
743 power_level_ = parent.power_level_;
744
745 if (parent.technology_ != Technology::NFC_A) {
746 return false;
747 }
748
749 if (parent.packet_type_ != RfPacketType::POLL_RESPONSE) {
750 return false;
751 }
752
753 // Parse packet field values.
754 pdl::packet::slice span = parent.payload_;
755 uint8_t nfcid1_size;
756 if (span.size() < 1) {
757 return false;
758 }
759 nfcid1_size = span.read_le<uint8_t, 1>();
760 if (span.size() < nfcid1_size) {
761 return false;
762 }
763 nfcid1_ = span.subrange(0, nfcid1_size);
764 span.skip(nfcid1_size);
765 if (span.size() < 2) {
766 return false;
767 }
768 uint8_t chunk0 = span.read_le<uint8_t, 1>();
769 int_protocol_ = (chunk0 >> 0) & 0x3;
770 bit_frame_sdd_ = span.read_le<uint8_t, 1>();
771 return true;
772 }
773
774 bool valid_{false};
776 uint16_t sender_{0};
777 uint16_t receiver_{0};
780 uint8_t power_level_{0};
782 uint8_t int_protocol_{0};
783 uint8_t bit_frame_sdd_{0};
784};
785
787 public:
788 ~NfcAPollResponseBuilder() override = default;
793 NfcAPollResponseBuilder(uint16_t sender, uint16_t receiver, Protocol protocol,
794 BitRate bitrate, uint8_t power_level,
795 std::vector<uint8_t> nfcid1, uint8_t int_protocol,
796 uint8_t bit_frame_sdd)
797 : RfPacketBuilder(sender, receiver, Technology::NFC_A, protocol,
798 RfPacketType::POLL_RESPONSE, bitrate, power_level,
799 std::vector<uint8_t>{}),
800 nfcid1_(std::move(nfcid1)),
801 int_protocol_(int_protocol),
802 bit_frame_sdd_(bit_frame_sdd) {}
803 static std::unique_ptr<NfcAPollResponseBuilder> Create(
804 uint16_t sender, uint16_t receiver, Protocol protocol, BitRate bitrate,
805 uint8_t power_level, std::vector<uint8_t> nfcid1, uint8_t int_protocol,
806 uint8_t bit_frame_sdd) {
807 return std::make_unique<NfcAPollResponseBuilder>(
808 sender, receiver, protocol, bitrate, power_level, std::move(nfcid1),
809 int_protocol, bit_frame_sdd);
810 }
811
812 void Serialize(std::vector<uint8_t>& output) const override {
813 pdl::packet::Builder::write_le<uint16_t, 2>(
814 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
815 pdl::packet::Builder::write_le<uint16_t, 2>(
816 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
817 pdl::packet::Builder::write_le<uint8_t, 1>(
818 output, (static_cast<uint8_t>(Technology::NFC_A) << 0));
819 pdl::packet::Builder::write_le<uint8_t, 1>(
820 output, (static_cast<uint8_t>(protocol_) << 0));
821 pdl::packet::Builder::write_le<uint8_t, 1>(
822 output, (static_cast<uint8_t>(RfPacketType::POLL_RESPONSE) << 0));
823 pdl::packet::Builder::write_le<uint8_t, 1>(
824 output, (static_cast<uint8_t>(bitrate_) << 0));
825 pdl::packet::Builder::write_le<uint8_t, 1>(
826 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
827 pdl::packet::Builder::write_le<uint8_t, 1>(
828 output, (static_cast<uint8_t>(GetNfcid1Size()) << 0));
829 output.insert(output.end(), nfcid1_.begin(), nfcid1_.end());
830 pdl::packet::Builder::write_le<uint8_t, 1>(
831 output, (static_cast<uint8_t>(int_protocol_ & 0x3) << 0));
832 pdl::packet::Builder::write_le<uint8_t, 1>(
833 output, (static_cast<uint8_t>(bit_frame_sdd_ & 0xff) << 0));
834 }
835
836 size_t GetSize() const override { return GetNfcid1Size() + 12; }
837
838 size_t GetNfcid1Size() const { return nfcid1_.size() * 1; }
839
840 std::vector<uint8_t> nfcid1_;
841 uint8_t int_protocol_{0};
842 uint8_t bit_frame_sdd_{0};
843};
844
846 public:
849 }
850
851 uint16_t GetSender() const {
853 return sender_;
854 }
855
856 uint16_t GetReceiver() const {
858 return receiver_;
859 }
860
863 return bitrate_;
864 }
865
866 uint8_t GetPowerLevel() const {
868 return power_level_;
869 }
870
871 uint8_t GetParam() const {
873 return param_;
874 }
875
877
879
881
882 std::string ToString() const { return ""; }
883
884 bool IsValid() const { return valid_; }
885
886 pdl::packet::slice bytes() const { return bytes_; }
887
888 protected:
890 : bytes_(parent.bytes_) {
892 }
893
894 bool Parse(RfPacketView const& parent) {
895 // Check validity of parent packet.
896 if (!parent.IsValid()) {
897 return false;
898 }
899
900 // Copy parent field values.
901 sender_ = parent.sender_;
902 receiver_ = parent.receiver_;
903 bitrate_ = parent.bitrate_;
904 power_level_ = parent.power_level_;
905
906 if (parent.technology_ != Technology::NFC_A) {
907 return false;
908 }
909
910 if (parent.protocol_ != Protocol::ISO_DEP) {
911 return false;
912 }
913
914 if (parent.packet_type_ != RfPacketType::SELECT_COMMAND) {
915 return false;
916 }
917
918 // Parse packet field values.
919 pdl::packet::slice span = parent.payload_;
920 if (span.size() < 1) {
921 return false;
922 }
923 param_ = span.read_le<uint8_t, 1>();
924 return true;
925 }
926
927 bool valid_{false};
929 uint16_t sender_{0};
930 uint16_t receiver_{0};
932 uint8_t power_level_{0};
933 uint8_t param_{0};
934};
935
937 public:
938 ~T4ATSelectCommandBuilder() override = default;
943 default;
944 T4ATSelectCommandBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate,
945 uint8_t power_level, uint8_t param)
946 : RfPacketBuilder(sender, receiver, Technology::NFC_A, Protocol::ISO_DEP,
947 RfPacketType::SELECT_COMMAND, bitrate, power_level,
948 std::vector<uint8_t>{}),
949 param_(param) {}
950 static std::unique_ptr<T4ATSelectCommandBuilder> Create(uint16_t sender,
951 uint16_t receiver,
952 BitRate bitrate,
953 uint8_t power_level,
954 uint8_t param) {
955 return std::make_unique<T4ATSelectCommandBuilder>(sender, receiver, bitrate,
956 power_level, param);
957 }
958
959 void Serialize(std::vector<uint8_t>& output) const override {
960 pdl::packet::Builder::write_le<uint16_t, 2>(
961 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
962 pdl::packet::Builder::write_le<uint16_t, 2>(
963 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
964 pdl::packet::Builder::write_le<uint8_t, 1>(
965 output, (static_cast<uint8_t>(Technology::NFC_A) << 0));
966 pdl::packet::Builder::write_le<uint8_t, 1>(
967 output, (static_cast<uint8_t>(Protocol::ISO_DEP) << 0));
968 pdl::packet::Builder::write_le<uint8_t, 1>(
969 output, (static_cast<uint8_t>(RfPacketType::SELECT_COMMAND) << 0));
970 pdl::packet::Builder::write_le<uint8_t, 1>(
971 output, (static_cast<uint8_t>(bitrate_) << 0));
972 pdl::packet::Builder::write_le<uint8_t, 1>(
973 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
974 pdl::packet::Builder::write_le<uint8_t, 1>(
975 output, (static_cast<uint8_t>(param_ & 0xff) << 0));
976 }
977
978 size_t GetSize() const override { return 10; }
979
980 uint8_t param_{0};
981};
982
984 public:
987 }
988
989 uint16_t GetSender() const {
991 return sender_;
992 }
993
994 uint16_t GetReceiver() const {
996 return receiver_;
997 }
998
1001 return bitrate_;
1002 }
1003
1004 uint8_t GetPowerLevel() const {
1006 return power_level_;
1007 }
1008
1009 std::vector<uint8_t> GetRatsResponse() const {
1012 std::vector<uint8_t> elements;
1013 while (span.size() >= 1) {
1014 elements.push_back(span.read_le<uint8_t, 1>());
1015 }
1016 return elements;
1017 }
1018
1020
1022
1024
1025 std::string ToString() const { return ""; }
1026
1027 bool IsValid() const { return valid_; }
1028
1029 pdl::packet::slice bytes() const { return bytes_; }
1030
1031 protected:
1033 : bytes_(parent.bytes_) {
1034 valid_ = Parse(parent);
1035 }
1036
1038 // Check validity of parent packet.
1039 if (!parent.IsValid()) {
1040 return false;
1041 }
1042
1043 // Copy parent field values.
1044 sender_ = parent.sender_;
1045 receiver_ = parent.receiver_;
1046 bitrate_ = parent.bitrate_;
1047 power_level_ = parent.power_level_;
1048
1049 if (parent.technology_ != Technology::NFC_A) {
1050 return false;
1051 }
1052
1053 if (parent.protocol_ != Protocol::ISO_DEP) {
1054 return false;
1055 }
1056
1057 if (parent.packet_type_ != RfPacketType::SELECT_RESPONSE) {
1058 return false;
1059 }
1060
1061 // Parse packet field values.
1062 pdl::packet::slice span = parent.payload_;
1063 uint8_t rats_response_size;
1064 if (span.size() < 1) {
1065 return false;
1066 }
1067 rats_response_size = span.read_le<uint8_t, 1>();
1068 if (span.size() < rats_response_size) {
1069 return false;
1070 }
1071 rats_response_ = span.subrange(0, rats_response_size);
1072 span.skip(rats_response_size);
1073 return true;
1074 }
1075
1076 bool valid_{false};
1078 uint16_t sender_{0};
1079 uint16_t receiver_{0};
1081 uint8_t power_level_{0};
1083};
1084
1086 public:
1087 ~T4ATSelectResponseBuilder() override = default;
1092 default;
1093 T4ATSelectResponseBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate,
1094 uint8_t power_level,
1095 std::vector<uint8_t> rats_response)
1096 : RfPacketBuilder(sender, receiver, Technology::NFC_A, Protocol::ISO_DEP,
1097 RfPacketType::SELECT_RESPONSE, bitrate, power_level,
1098 std::vector<uint8_t>{}),
1099 rats_response_(std::move(rats_response)) {}
1100 static std::unique_ptr<T4ATSelectResponseBuilder> Create(
1101 uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level,
1102 std::vector<uint8_t> rats_response) {
1103 return std::make_unique<T4ATSelectResponseBuilder>(
1104 sender, receiver, bitrate, power_level, std::move(rats_response));
1105 }
1106
1107 void Serialize(std::vector<uint8_t>& output) const override {
1108 pdl::packet::Builder::write_le<uint16_t, 2>(
1109 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1110 pdl::packet::Builder::write_le<uint16_t, 2>(
1111 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1112 pdl::packet::Builder::write_le<uint8_t, 1>(
1113 output, (static_cast<uint8_t>(Technology::NFC_A) << 0));
1114 pdl::packet::Builder::write_le<uint8_t, 1>(
1115 output, (static_cast<uint8_t>(Protocol::ISO_DEP) << 0));
1116 pdl::packet::Builder::write_le<uint8_t, 1>(
1117 output, (static_cast<uint8_t>(RfPacketType::SELECT_RESPONSE) << 0));
1118 pdl::packet::Builder::write_le<uint8_t, 1>(
1119 output, (static_cast<uint8_t>(bitrate_) << 0));
1120 pdl::packet::Builder::write_le<uint8_t, 1>(
1121 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1122 pdl::packet::Builder::write_le<uint8_t, 1>(
1123 output, (static_cast<uint8_t>(GetRatsResponseSize()) << 0));
1124 output.insert(output.end(), rats_response_.begin(), rats_response_.end());
1125 }
1126
1127 size_t GetSize() const override { return GetRatsResponseSize() + 10; }
1128
1129 size_t GetRatsResponseSize() const { return rats_response_.size() * 1; }
1130
1131 std::vector<uint8_t> rats_response_;
1132};
1133
1135 public:
1138 }
1139
1140 uint16_t GetSender() const {
1142 return sender_;
1143 }
1144
1145 uint16_t GetReceiver() const {
1147 return receiver_;
1148 }
1149
1152 return technology_;
1153 }
1154
1157 return bitrate_;
1158 }
1159
1160 uint8_t GetPowerLevel() const {
1162 return power_level_;
1163 }
1164
1165 uint8_t GetLr() const {
1167 return lr_;
1168 }
1169
1171
1173
1174 std::string ToString() const { return ""; }
1175
1176 bool IsValid() const { return valid_; }
1177
1178 pdl::packet::slice bytes() const { return bytes_; }
1179
1180 protected:
1182 : bytes_(parent.bytes_) {
1183 valid_ = Parse(parent);
1184 }
1185
1187 // Check validity of parent packet.
1188 if (!parent.IsValid()) {
1189 return false;
1190 }
1191
1192 // Copy parent field values.
1193 sender_ = parent.sender_;
1194 receiver_ = parent.receiver_;
1195 technology_ = parent.technology_;
1196 bitrate_ = parent.bitrate_;
1197 power_level_ = parent.power_level_;
1198
1199 if (parent.protocol_ != Protocol::NFC_DEP) {
1200 return false;
1201 }
1202
1203 if (parent.packet_type_ != RfPacketType::SELECT_COMMAND) {
1204 return false;
1205 }
1206
1207 // Parse packet field values.
1208 pdl::packet::slice span = parent.payload_;
1209 if (span.size() < 1) {
1210 return false;
1211 }
1212 uint8_t chunk0 = span.read_le<uint8_t, 1>();
1213 lr_ = (chunk0 >> 0) & 0x3;
1214 return true;
1215 }
1216
1217 bool valid_{false};
1219 uint16_t sender_{0};
1220 uint16_t receiver_{0};
1223 uint8_t power_level_{0};
1224 uint8_t lr_{0};
1225};
1226
1228 public:
1229 ~NfcDepSelectCommandBuilder() override = default;
1234 default;
1235 NfcDepSelectCommandBuilder(uint16_t sender, uint16_t receiver,
1236 Technology technology, BitRate bitrate,
1237 uint8_t power_level, uint8_t lr)
1238 : RfPacketBuilder(sender, receiver, technology, Protocol::NFC_DEP,
1239 RfPacketType::SELECT_COMMAND, bitrate, power_level,
1240 std::vector<uint8_t>{}),
1241 lr_(lr) {}
1242 static std::unique_ptr<NfcDepSelectCommandBuilder> Create(
1243 uint16_t sender, uint16_t receiver, Technology technology,
1244 BitRate bitrate, uint8_t power_level, uint8_t lr) {
1245 return std::make_unique<NfcDepSelectCommandBuilder>(
1246 sender, receiver, technology, bitrate, power_level, lr);
1247 }
1248
1249 void Serialize(std::vector<uint8_t>& output) const override {
1250 pdl::packet::Builder::write_le<uint16_t, 2>(
1251 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1252 pdl::packet::Builder::write_le<uint16_t, 2>(
1253 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1254 pdl::packet::Builder::write_le<uint8_t, 1>(
1255 output, (static_cast<uint8_t>(technology_) << 0));
1256 pdl::packet::Builder::write_le<uint8_t, 1>(
1257 output, (static_cast<uint8_t>(Protocol::NFC_DEP) << 0));
1258 pdl::packet::Builder::write_le<uint8_t, 1>(
1259 output, (static_cast<uint8_t>(RfPacketType::SELECT_COMMAND) << 0));
1260 pdl::packet::Builder::write_le<uint8_t, 1>(
1261 output, (static_cast<uint8_t>(bitrate_) << 0));
1262 pdl::packet::Builder::write_le<uint8_t, 1>(
1263 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1264 pdl::packet::Builder::write_le<uint8_t, 1>(
1265 output, (static_cast<uint8_t>(lr_ & 0x3) << 0));
1266 }
1267
1268 size_t GetSize() const override { return 10; }
1269
1270 uint8_t lr_{0};
1271};
1272
1274 public:
1277 }
1278
1279 uint16_t GetSender() const {
1281 return sender_;
1282 }
1283
1284 uint16_t GetReceiver() const {
1286 return receiver_;
1287 }
1288
1291 return technology_;
1292 }
1293
1296 return bitrate_;
1297 }
1298
1299 uint8_t GetPowerLevel() const {
1301 return power_level_;
1302 }
1303
1304 std::vector<uint8_t> GetAtrResponse() const {
1307 std::vector<uint8_t> elements;
1308 while (span.size() >= 1) {
1309 elements.push_back(span.read_le<uint8_t, 1>());
1310 }
1311 return elements;
1312 }
1313
1315
1317
1318 std::string ToString() const { return ""; }
1319
1320 bool IsValid() const { return valid_; }
1321
1322 pdl::packet::slice bytes() const { return bytes_; }
1323
1324 protected:
1326 : bytes_(parent.bytes_) {
1327 valid_ = Parse(parent);
1328 }
1329
1331 // Check validity of parent packet.
1332 if (!parent.IsValid()) {
1333 return false;
1334 }
1335
1336 // Copy parent field values.
1337 sender_ = parent.sender_;
1338 receiver_ = parent.receiver_;
1339 technology_ = parent.technology_;
1340 bitrate_ = parent.bitrate_;
1341 power_level_ = parent.power_level_;
1342
1343 if (parent.protocol_ != Protocol::NFC_DEP) {
1344 return false;
1345 }
1346
1347 if (parent.packet_type_ != RfPacketType::SELECT_RESPONSE) {
1348 return false;
1349 }
1350
1351 // Parse packet field values.
1352 pdl::packet::slice span = parent.payload_;
1353 uint8_t atr_response_size;
1354 if (span.size() < 1) {
1355 return false;
1356 }
1357 atr_response_size = span.read_le<uint8_t, 1>();
1358 if (span.size() < atr_response_size) {
1359 return false;
1360 }
1361 atr_response_ = span.subrange(0, atr_response_size);
1362 span.skip(atr_response_size);
1363 return true;
1364 }
1365
1366 bool valid_{false};
1368 uint16_t sender_{0};
1369 uint16_t receiver_{0};
1372 uint8_t power_level_{0};
1374};
1375
1377 public:
1378 ~NfcDepSelectResponseBuilder() override = default;
1383 default;
1384 NfcDepSelectResponseBuilder(uint16_t sender, uint16_t receiver,
1385 Technology technology, BitRate bitrate,
1386 uint8_t power_level,
1387 std::vector<uint8_t> atr_response)
1388 : RfPacketBuilder(sender, receiver, technology, Protocol::NFC_DEP,
1389 RfPacketType::SELECT_RESPONSE, bitrate, power_level,
1390 std::vector<uint8_t>{}),
1391 atr_response_(std::move(atr_response)) {}
1392 static std::unique_ptr<NfcDepSelectResponseBuilder> Create(
1393 uint16_t sender, uint16_t receiver, Technology technology,
1394 BitRate bitrate, uint8_t power_level, std::vector<uint8_t> atr_response) {
1395 return std::make_unique<NfcDepSelectResponseBuilder>(
1396 sender, receiver, technology, bitrate, power_level,
1397 std::move(atr_response));
1398 }
1399
1400 void Serialize(std::vector<uint8_t>& output) const override {
1401 pdl::packet::Builder::write_le<uint16_t, 2>(
1402 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1403 pdl::packet::Builder::write_le<uint16_t, 2>(
1404 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1405 pdl::packet::Builder::write_le<uint8_t, 1>(
1406 output, (static_cast<uint8_t>(technology_) << 0));
1407 pdl::packet::Builder::write_le<uint8_t, 1>(
1408 output, (static_cast<uint8_t>(Protocol::NFC_DEP) << 0));
1409 pdl::packet::Builder::write_le<uint8_t, 1>(
1410 output, (static_cast<uint8_t>(RfPacketType::SELECT_RESPONSE) << 0));
1411 pdl::packet::Builder::write_le<uint8_t, 1>(
1412 output, (static_cast<uint8_t>(bitrate_) << 0));
1413 pdl::packet::Builder::write_le<uint8_t, 1>(
1414 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1415 pdl::packet::Builder::write_le<uint8_t, 1>(
1416 output, (static_cast<uint8_t>(GetAtrResponseSize()) << 0));
1417 output.insert(output.end(), atr_response_.begin(), atr_response_.end());
1418 }
1419
1420 size_t GetSize() const override { return GetAtrResponseSize() + 10; }
1421
1422 size_t GetAtrResponseSize() const { return atr_response_.size() * 1; }
1423
1424 std::vector<uint8_t> atr_response_;
1425};
1426
1428 public:
1430 return SelectCommandView(parent);
1431 }
1432
1433 uint16_t GetSender() const {
1435 return sender_;
1436 }
1437
1438 uint16_t GetReceiver() const {
1440 return receiver_;
1441 }
1442
1445 return technology_;
1446 }
1447
1450 return protocol_;
1451 }
1452
1455 return bitrate_;
1456 }
1457
1458 uint8_t GetPowerLevel() const {
1460 return power_level_;
1461 }
1462
1464
1465 std::string ToString() const { return ""; }
1466
1467 bool IsValid() const { return valid_; }
1468
1469 pdl::packet::slice bytes() const { return bytes_; }
1470
1471 protected:
1473 : bytes_(parent.bytes_) {
1474 valid_ = Parse(parent);
1475 }
1476
1478 // Check validity of parent packet.
1479 if (!parent.IsValid()) {
1480 return false;
1481 }
1482
1483 // Copy parent field values.
1484 sender_ = parent.sender_;
1485 receiver_ = parent.receiver_;
1486 technology_ = parent.technology_;
1487 protocol_ = parent.protocol_;
1488 bitrate_ = parent.bitrate_;
1489 power_level_ = parent.power_level_;
1490
1491 if (parent.packet_type_ != RfPacketType::SELECT_COMMAND) {
1492 return false;
1493 }
1494
1495 return true;
1496 }
1497
1498 bool valid_{false};
1500 uint16_t sender_{0};
1501 uint16_t receiver_{0};
1505 uint8_t power_level_{0};
1506};
1507
1509 public:
1510 ~SelectCommandBuilder() override = default;
1515 SelectCommandBuilder(uint16_t sender, uint16_t receiver,
1516 Technology technology, Protocol protocol,
1517 BitRate bitrate, uint8_t power_level)
1518 : RfPacketBuilder(sender, receiver, technology, protocol,
1519 RfPacketType::SELECT_COMMAND, bitrate, power_level,
1520 std::vector<uint8_t>{}) {}
1521 static std::unique_ptr<SelectCommandBuilder> Create(
1522 uint16_t sender, uint16_t receiver, Technology technology,
1523 Protocol protocol, BitRate bitrate, uint8_t power_level) {
1524 return std::make_unique<SelectCommandBuilder>(
1525 sender, receiver, technology, protocol, bitrate, power_level);
1526 }
1527
1528 void Serialize(std::vector<uint8_t>& output) const override {
1529 pdl::packet::Builder::write_le<uint16_t, 2>(
1530 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1531 pdl::packet::Builder::write_le<uint16_t, 2>(
1532 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1533 pdl::packet::Builder::write_le<uint8_t, 1>(
1534 output, (static_cast<uint8_t>(technology_) << 0));
1535 pdl::packet::Builder::write_le<uint8_t, 1>(
1536 output, (static_cast<uint8_t>(protocol_) << 0));
1537 pdl::packet::Builder::write_le<uint8_t, 1>(
1538 output, (static_cast<uint8_t>(RfPacketType::SELECT_COMMAND) << 0));
1539 pdl::packet::Builder::write_le<uint8_t, 1>(
1540 output, (static_cast<uint8_t>(bitrate_) << 0));
1541 pdl::packet::Builder::write_le<uint8_t, 1>(
1542 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1543 }
1544
1545 size_t GetSize() const override { return 9; }
1546};
1547
1548enum class DeactivateType : uint8_t {
1549 IDLE_MODE = 0x0,
1550 SLEEP_MODE = 0x1,
1551 SLEEP_AF_MODE = 0x2,
1552 DISCOVERY = 0x3,
1553};
1554
1555inline std::string DeactivateTypeText(DeactivateType tag) {
1556 switch (tag) {
1558 return "IDLE_MODE";
1560 return "SLEEP_MODE";
1562 return "SLEEP_AF_MODE";
1564 return "DISCOVERY";
1565 default:
1566 return std::string("Unknown DeactivateType: " +
1567 std::to_string(static_cast<uint64_t>(tag)));
1568 }
1569}
1570
1571enum class DeactivateReason : uint8_t {
1572 DH_REQUEST = 0x0,
1573 ENDPOINT_REQUEST = 0x1,
1574 RF_LINK_LOSS = 0x2,
1575 NFC_B_BAD_AFI = 0x3,
1576 DH_REQUEST_FAILED = 0x4,
1577};
1578
1580 switch (tag) {
1582 return "DH_REQUEST";
1584 return "ENDPOINT_REQUEST";
1586 return "RF_LINK_LOSS";
1588 return "NFC_B_BAD_AFI";
1590 return "DH_REQUEST_FAILED";
1591 default:
1592 return std::string("Unknown DeactivateReason: " +
1593 std::to_string(static_cast<uint64_t>(tag)));
1594 }
1595}
1596
1598 public:
1601 }
1602
1603 uint16_t GetSender() const {
1605 return sender_;
1606 }
1607
1608 uint16_t GetReceiver() const {
1610 return receiver_;
1611 }
1612
1615 return technology_;
1616 }
1617
1620 return protocol_;
1621 }
1622
1625 return bitrate_;
1626 }
1627
1628 uint8_t GetPowerLevel() const {
1630 return power_level_;
1631 }
1632
1635 return type__;
1636 }
1637
1640 return reason_;
1641 }
1642
1645 }
1646
1647 std::string ToString() const { return ""; }
1648
1649 bool IsValid() const { return valid_; }
1650
1651 pdl::packet::slice bytes() const { return bytes_; }
1652
1653 protected:
1655 : bytes_(parent.bytes_) {
1656 valid_ = Parse(parent);
1657 }
1658
1660 // Check validity of parent packet.
1661 if (!parent.IsValid()) {
1662 return false;
1663 }
1664
1665 // Copy parent field values.
1666 sender_ = parent.sender_;
1667 receiver_ = parent.receiver_;
1668 technology_ = parent.technology_;
1669 protocol_ = parent.protocol_;
1670 bitrate_ = parent.bitrate_;
1671 power_level_ = parent.power_level_;
1672
1673 if (parent.packet_type_ != RfPacketType::DEACTIVATE_NOTIFICATION) {
1674 return false;
1675 }
1676
1677 // Parse packet field values.
1678 pdl::packet::slice span = parent.payload_;
1679 if (span.size() < 2) {
1680 return false;
1681 }
1682 type__ = DeactivateType(span.read_le<uint8_t, 1>());
1683 reason_ = DeactivateReason(span.read_le<uint8_t, 1>());
1684 return true;
1685 }
1686
1687 bool valid_{false};
1689 uint16_t sender_{0};
1690 uint16_t receiver_{0};
1694 uint8_t power_level_{0};
1697};
1698
1700 public:
1706 DeactivateNotificationBuilder const&) = default;
1707 DeactivateNotificationBuilder(uint16_t sender, uint16_t receiver,
1708 Technology technology, Protocol protocol,
1709 BitRate bitrate, uint8_t power_level,
1710 DeactivateType type_, DeactivateReason reason)
1711 : RfPacketBuilder(sender, receiver, technology, protocol,
1713 power_level, std::vector<uint8_t>{}),
1714 type__(type_),
1715 reason_(reason) {}
1716 static std::unique_ptr<DeactivateNotificationBuilder> Create(
1717 uint16_t sender, uint16_t receiver, Technology technology,
1718 Protocol protocol, BitRate bitrate, uint8_t power_level,
1719 DeactivateType type_, DeactivateReason reason) {
1720 return std::make_unique<DeactivateNotificationBuilder>(
1721 sender, receiver, technology, protocol, bitrate, power_level, type_,
1722 reason);
1723 }
1724
1725 void Serialize(std::vector<uint8_t>& output) const override {
1726 pdl::packet::Builder::write_le<uint16_t, 2>(
1727 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1728 pdl::packet::Builder::write_le<uint16_t, 2>(
1729 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1730 pdl::packet::Builder::write_le<uint8_t, 1>(
1731 output, (static_cast<uint8_t>(technology_) << 0));
1732 pdl::packet::Builder::write_le<uint8_t, 1>(
1733 output, (static_cast<uint8_t>(protocol_) << 0));
1734 pdl::packet::Builder::write_le<uint8_t, 1>(
1735 output,
1736 (static_cast<uint8_t>(RfPacketType::DEACTIVATE_NOTIFICATION) << 0));
1737 pdl::packet::Builder::write_le<uint8_t, 1>(
1738 output, (static_cast<uint8_t>(bitrate_) << 0));
1739 pdl::packet::Builder::write_le<uint8_t, 1>(
1740 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1741 pdl::packet::Builder::write_le<uint8_t, 1>(
1742 output, (static_cast<uint8_t>(type__) << 0));
1743 pdl::packet::Builder::write_le<uint8_t, 1>(
1744 output, (static_cast<uint8_t>(reason_) << 0));
1745 }
1746
1747 size_t GetSize() const override { return 11; }
1748
1751};
1752
1754 public:
1756 return DataView(parent);
1757 }
1758
1759 uint16_t GetSender() const {
1761 return sender_;
1762 }
1763
1764 uint16_t GetReceiver() const {
1766 return receiver_;
1767 }
1768
1771 return technology_;
1772 }
1773
1776 return protocol_;
1777 }
1778
1781 return bitrate_;
1782 }
1783
1784 uint8_t GetPowerLevel() const {
1786 return power_level_;
1787 }
1788
1789 std::vector<uint8_t> GetData() const {
1792 std::vector<uint8_t> elements;
1793 while (span.size() >= 1) {
1794 elements.push_back(span.read_le<uint8_t, 1>());
1795 }
1796 return elements;
1797 }
1798
1800
1801 std::string ToString() const { return ""; }
1802
1803 bool IsValid() const { return valid_; }
1804
1805 pdl::packet::slice bytes() const { return bytes_; }
1806
1807 protected:
1809 valid_ = Parse(parent);
1810 }
1811
1813 // Check validity of parent packet.
1814 if (!parent.IsValid()) {
1815 return false;
1816 }
1817
1818 // Copy parent field values.
1819 sender_ = parent.sender_;
1820 receiver_ = parent.receiver_;
1821 technology_ = parent.technology_;
1822 protocol_ = parent.protocol_;
1823 bitrate_ = parent.bitrate_;
1824 power_level_ = parent.power_level_;
1825
1826 if (parent.packet_type_ != RfPacketType::DATA) {
1827 return false;
1828 }
1829
1830 // Parse packet field values.
1831 pdl::packet::slice span = parent.payload_;
1832 data_ = span;
1833 span.clear();
1834 return true;
1835 }
1836
1837 bool valid_{false};
1839 uint16_t sender_{0};
1840 uint16_t receiver_{0};
1844 uint8_t power_level_{0};
1846};
1847
1849 public:
1850 ~DataBuilder() override = default;
1851 DataBuilder() = default;
1852 DataBuilder(DataBuilder const&) = default;
1855 DataBuilder(uint16_t sender, uint16_t receiver, Technology technology,
1856 Protocol protocol, BitRate bitrate, uint8_t power_level,
1857 std::vector<uint8_t> data)
1858 : RfPacketBuilder(sender, receiver, technology, protocol,
1859 RfPacketType::DATA, bitrate, power_level,
1860 std::vector<uint8_t>{}),
1861 data_(std::move(data)) {}
1862 static std::unique_ptr<DataBuilder> Create(uint16_t sender, uint16_t receiver,
1863 Technology technology,
1864 Protocol protocol, BitRate bitrate,
1865 uint8_t power_level,
1866 std::vector<uint8_t> data) {
1867 return std::make_unique<DataBuilder>(sender, receiver, technology, protocol,
1868 bitrate, power_level, std::move(data));
1869 }
1870
1871 void Serialize(std::vector<uint8_t>& output) const override {
1872 pdl::packet::Builder::write_le<uint16_t, 2>(
1873 output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1874 pdl::packet::Builder::write_le<uint16_t, 2>(
1875 output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1876 pdl::packet::Builder::write_le<uint8_t, 1>(
1877 output, (static_cast<uint8_t>(technology_) << 0));
1878 pdl::packet::Builder::write_le<uint8_t, 1>(
1879 output, (static_cast<uint8_t>(protocol_) << 0));
1880 pdl::packet::Builder::write_le<uint8_t, 1>(
1881 output, (static_cast<uint8_t>(RfPacketType::DATA) << 0));
1882 pdl::packet::Builder::write_le<uint8_t, 1>(
1883 output, (static_cast<uint8_t>(bitrate_) << 0));
1884 pdl::packet::Builder::write_le<uint8_t, 1>(
1885 output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1886 output.insert(output.end(), data_.begin(), data_.end());
1887 }
1888
1889 size_t GetSize() const override { return GetDataSize() + 9; }
1890
1891 size_t GetDataSize() const { return data_.size() * 1; }
1892
1893 std::vector<uint8_t> data_;
1894};
1895} // namespace casimir::rf
std::string to_string(ConnectionState state)
Definition: adb.cpp:144
Definition: rf_packets.h:1848
static std::unique_ptr< DataBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > data)
Definition: rf_packets.h:1862
DataBuilder & operator=(DataBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:1889
~DataBuilder() override=default
size_t GetDataSize() const
Definition: rf_packets.h:1891
DataBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > data)
Definition: rf_packets.h:1855
DataBuilder(DataBuilder &&)=default
DataBuilder(DataBuilder const &)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1871
std::vector< uint8_t > data_
Definition: rf_packets.h:1893
Definition: rf_packets.h:1753
bool valid_
Definition: rf_packets.h:1837
pdl::packet::slice bytes_
Definition: rf_packets.h:1838
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1784
Protocol GetProtocol() const
Definition: rf_packets.h:1774
Technology GetTechnology() const
Definition: rf_packets.h:1769
Technology technology_
Definition: rf_packets.h:1841
uint16_t GetSender() const
Definition: rf_packets.h:1759
uint16_t receiver_
Definition: rf_packets.h:1840
uint16_t GetReceiver() const
Definition: rf_packets.h:1764
Protocol protocol_
Definition: rf_packets.h:1842
DataView(RfPacketView const &parent)
Definition: rf_packets.h:1808
RfPacketType GetPacketType() const
Definition: rf_packets.h:1799
uint8_t power_level_
Definition: rf_packets.h:1844
BitRate GetBitrate() const
Definition: rf_packets.h:1779
bool IsValid() const
Definition: rf_packets.h:1803
pdl::packet::slice bytes() const
Definition: rf_packets.h:1805
uint16_t sender_
Definition: rf_packets.h:1839
static DataView Create(RfPacketView const &parent)
Definition: rf_packets.h:1755
std::vector< uint8_t > GetData() const
Definition: rf_packets.h:1789
pdl::packet::slice data_
Definition: rf_packets.h:1845
BitRate bitrate_
Definition: rf_packets.h:1843
std::string ToString() const
Definition: rf_packets.h:1801
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1812
Definition: rf_packets.h:1699
DeactivateNotificationBuilder & operator=(DeactivateNotificationBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:1747
DeactivateNotificationBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, DeactivateType type_, DeactivateReason reason)
Definition: rf_packets.h:1707
DeactivateReason reason_
Definition: rf_packets.h:1750
static std::unique_ptr< DeactivateNotificationBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, DeactivateType type_, DeactivateReason reason)
Definition: rf_packets.h:1716
DeactivateNotificationBuilder(DeactivateNotificationBuilder const &)=default
DeactivateNotificationBuilder(DeactivateNotificationBuilder &&)=default
DeactivateType type__
Definition: rf_packets.h:1749
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1725
Definition: rf_packets.h:1597
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1628
static DeactivateNotificationView Create(RfPacketView const &parent)
Definition: rf_packets.h:1599
DeactivateReason GetReason() const
Definition: rf_packets.h:1638
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1659
DeactivateType type__
Definition: rf_packets.h:1695
pdl::packet::slice bytes() const
Definition: rf_packets.h:1651
pdl::packet::slice bytes_
Definition: rf_packets.h:1688
DeactivateReason reason_
Definition: rf_packets.h:1696
BitRate GetBitrate() const
Definition: rf_packets.h:1623
bool IsValid() const
Definition: rf_packets.h:1649
bool valid_
Definition: rf_packets.h:1687
std::string ToString() const
Definition: rf_packets.h:1647
Technology GetTechnology() const
Definition: rf_packets.h:1613
DeactivateType GetType() const
Definition: rf_packets.h:1633
uint16_t receiver_
Definition: rf_packets.h:1690
DeactivateNotificationView(RfPacketView const &parent)
Definition: rf_packets.h:1654
uint16_t GetReceiver() const
Definition: rf_packets.h:1608
Technology technology_
Definition: rf_packets.h:1691
Protocol protocol_
Definition: rf_packets.h:1692
RfPacketType GetPacketType() const
Definition: rf_packets.h:1643
uint16_t sender_
Definition: rf_packets.h:1689
uint16_t GetSender() const
Definition: rf_packets.h:1603
uint8_t power_level_
Definition: rf_packets.h:1694
BitRate bitrate_
Definition: rf_packets.h:1693
Protocol GetProtocol() const
Definition: rf_packets.h:1618
Definition: rf_packets.h:618
FieldInfoBuilder & operator=(FieldInfoBuilder const &)=default
~FieldInfoBuilder() override=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:641
FieldStatus field_status_
Definition: rf_packets.h:662
FieldInfoBuilder(FieldInfoBuilder const &)=default
static std::unique_ptr< FieldInfoBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, FieldStatus field_status)
Definition: rf_packets.h:632
FieldInfoBuilder(FieldInfoBuilder &&)=default
size_t GetSize() const override
Definition: rf_packets.h:660
FieldInfoBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, FieldStatus field_status)
Definition: rf_packets.h:625
Definition: rf_packets.h:526
FieldInfoView(RfPacketView const &parent)
Definition: rf_packets.h:576
BitRate bitrate_
Definition: rf_packets.h:613
FieldStatus GetFieldStatus() const
Definition: rf_packets.h:562
Technology technology_
Definition: rf_packets.h:611
FieldStatus field_status_
Definition: rf_packets.h:615
Technology GetTechnology() const
Definition: rf_packets.h:542
uint8_t GetPowerLevel() const
Definition: rf_packets.h:557
static FieldInfoView Create(RfPacketView const &parent)
Definition: rf_packets.h:528
uint16_t GetSender() const
Definition: rf_packets.h:532
uint16_t GetReceiver() const
Definition: rf_packets.h:537
RfPacketType GetPacketType() const
Definition: rf_packets.h:567
uint16_t receiver_
Definition: rf_packets.h:610
uint16_t sender_
Definition: rf_packets.h:609
pdl::packet::slice bytes() const
Definition: rf_packets.h:573
Protocol protocol_
Definition: rf_packets.h:612
Protocol GetProtocol() const
Definition: rf_packets.h:547
uint8_t power_level_
Definition: rf_packets.h:614
pdl::packet::slice bytes_
Definition: rf_packets.h:608
bool valid_
Definition: rf_packets.h:607
bool IsValid() const
Definition: rf_packets.h:571
BitRate GetBitrate() const
Definition: rf_packets.h:552
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:580
std::string ToString() const
Definition: rf_packets.h:569
Definition: rf_packets.h:786
NfcAPollResponseBuilder(uint16_t sender, uint16_t receiver, Protocol protocol, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > nfcid1, uint8_t int_protocol, uint8_t bit_frame_sdd)
Definition: rf_packets.h:793
static std::unique_ptr< NfcAPollResponseBuilder > Create(uint16_t sender, uint16_t receiver, Protocol protocol, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > nfcid1, uint8_t int_protocol, uint8_t bit_frame_sdd)
Definition: rf_packets.h:803
NfcAPollResponseBuilder & operator=(NfcAPollResponseBuilder const &)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:812
NfcAPollResponseBuilder(NfcAPollResponseBuilder &&)=default
uint8_t bit_frame_sdd_
Definition: rf_packets.h:842
size_t GetSize() const override
Definition: rf_packets.h:836
std::vector< uint8_t > nfcid1_
Definition: rf_packets.h:840
~NfcAPollResponseBuilder() override=default
uint8_t int_protocol_
Definition: rf_packets.h:841
NfcAPollResponseBuilder(NfcAPollResponseBuilder const &)=default
size_t GetNfcid1Size() const
Definition: rf_packets.h:838
Definition: rf_packets.h:665
pdl::packet::slice bytes_
Definition: rf_packets.h:775
NfcAPollResponseView(RfPacketView const &parent)
Definition: rf_packets.h:727
uint8_t GetPowerLevel() const
Definition: rf_packets.h:691
uint16_t GetReceiver() const
Definition: rf_packets.h:676
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:732
uint16_t sender_
Definition: rf_packets.h:776
uint16_t receiver_
Definition: rf_packets.h:777
uint8_t power_level_
Definition: rf_packets.h:780
std::vector< uint8_t > GetNfcid1() const
Definition: rf_packets.h:696
Protocol GetProtocol() const
Definition: rf_packets.h:681
bool valid_
Definition: rf_packets.h:774
pdl::packet::slice bytes() const
Definition: rf_packets.h:724
pdl::packet::slice nfcid1_
Definition: rf_packets.h:781
static NfcAPollResponseView Create(RfPacketView const &parent)
Definition: rf_packets.h:667
uint8_t GetBitFrameSdd() const
Definition: rf_packets.h:711
uint8_t int_protocol_
Definition: rf_packets.h:782
RfPacketType GetPacketType() const
Definition: rf_packets.h:718
BitRate GetBitrate() const
Definition: rf_packets.h:686
Technology GetTechnology() const
Definition: rf_packets.h:716
BitRate bitrate_
Definition: rf_packets.h:779
uint8_t GetIntProtocol() const
Definition: rf_packets.h:706
Protocol protocol_
Definition: rf_packets.h:778
bool IsValid() const
Definition: rf_packets.h:722
std::string ToString() const
Definition: rf_packets.h:720
uint8_t bit_frame_sdd_
Definition: rf_packets.h:783
uint16_t GetSender() const
Definition: rf_packets.h:671
Definition: rf_packets.h:1227
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1249
uint8_t lr_
Definition: rf_packets.h:1270
NfcDepSelectCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, uint8_t lr)
Definition: rf_packets.h:1235
NfcDepSelectCommandBuilder(NfcDepSelectCommandBuilder &&)=default
~NfcDepSelectCommandBuilder() override=default
NfcDepSelectCommandBuilder & operator=(NfcDepSelectCommandBuilder const &)=default
static std::unique_ptr< NfcDepSelectCommandBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, uint8_t lr)
Definition: rf_packets.h:1242
NfcDepSelectCommandBuilder(NfcDepSelectCommandBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:1268
Definition: rf_packets.h:1134
uint8_t GetLr() const
Definition: rf_packets.h:1165
uint8_t lr_
Definition: rf_packets.h:1224
pdl::packet::slice bytes_
Definition: rf_packets.h:1218
std::string ToString() const
Definition: rf_packets.h:1174
Protocol GetProtocol() const
Definition: rf_packets.h:1170
uint16_t GetSender() const
Definition: rf_packets.h:1140
Technology GetTechnology() const
Definition: rf_packets.h:1150
static NfcDepSelectCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:1136
bool valid_
Definition: rf_packets.h:1217
bool IsValid() const
Definition: rf_packets.h:1176
Technology technology_
Definition: rf_packets.h:1221
uint16_t sender_
Definition: rf_packets.h:1219
BitRate GetBitrate() const
Definition: rf_packets.h:1155
RfPacketType GetPacketType() const
Definition: rf_packets.h:1172
uint16_t receiver_
Definition: rf_packets.h:1220
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1186
pdl::packet::slice bytes() const
Definition: rf_packets.h:1178
BitRate bitrate_
Definition: rf_packets.h:1222
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1160
NfcDepSelectCommandView(RfPacketView const &parent)
Definition: rf_packets.h:1181
uint16_t GetReceiver() const
Definition: rf_packets.h:1145
uint8_t power_level_
Definition: rf_packets.h:1223
Definition: rf_packets.h:1376
size_t GetSize() const override
Definition: rf_packets.h:1420
static std::unique_ptr< NfcDepSelectResponseBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > atr_response)
Definition: rf_packets.h:1392
NfcDepSelectResponseBuilder(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > atr_response)
Definition: rf_packets.h:1384
size_t GetAtrResponseSize() const
Definition: rf_packets.h:1422
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1400
NfcDepSelectResponseBuilder(NfcDepSelectResponseBuilder &&)=default
NfcDepSelectResponseBuilder & operator=(NfcDepSelectResponseBuilder const &)=default
~NfcDepSelectResponseBuilder() override=default
NfcDepSelectResponseBuilder(NfcDepSelectResponseBuilder const &)=default
std::vector< uint8_t > atr_response_
Definition: rf_packets.h:1424
Definition: rf_packets.h:1273
pdl::packet::slice bytes() const
Definition: rf_packets.h:1322
RfPacketType GetPacketType() const
Definition: rf_packets.h:1316
BitRate bitrate_
Definition: rf_packets.h:1371
uint16_t receiver_
Definition: rf_packets.h:1369
BitRate GetBitrate() const
Definition: rf_packets.h:1294
uint8_t power_level_
Definition: rf_packets.h:1372
std::string ToString() const
Definition: rf_packets.h:1318
Technology GetTechnology() const
Definition: rf_packets.h:1289
static NfcDepSelectResponseView Create(RfPacketView const &parent)
Definition: rf_packets.h:1275
std::vector< uint8_t > GetAtrResponse() const
Definition: rf_packets.h:1304
uint16_t GetSender() const
Definition: rf_packets.h:1279
Technology technology_
Definition: rf_packets.h:1370
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1299
uint16_t GetReceiver() const
Definition: rf_packets.h:1284
NfcDepSelectResponseView(RfPacketView const &parent)
Definition: rf_packets.h:1325
bool valid_
Definition: rf_packets.h:1366
pdl::packet::slice bytes_
Definition: rf_packets.h:1367
pdl::packet::slice atr_response_
Definition: rf_packets.h:1373
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1330
uint16_t sender_
Definition: rf_packets.h:1368
bool IsValid() const
Definition: rf_packets.h:1320
Protocol GetProtocol() const
Definition: rf_packets.h:1314
Definition: rf_packets.h:459
PollCommandBuilder & operator=(PollCommandBuilder const &)=default
PollCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, PollingFrameFormat format, std::vector< uint8_t > payload)
Definition: rf_packets.h:466
PollCommandBuilder(PollCommandBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:504
PollCommandBuilder(PollCommandBuilder &&)=default
static std::unique_ptr< PollCommandBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, PollingFrameFormat format, std::vector< uint8_t > payload)
Definition: rf_packets.h:475
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:484
PollingFrameFormat format_
Definition: rf_packets.h:506
~PollCommandBuilder() override=default
Definition: rf_packets.h:358
pdl::packet::slice payload_
Definition: rf_packets.h:456
PollingFrameFormat GetFormat() const
Definition: rf_packets.h:394
PollCommandView(RfPacketView const &parent)
Definition: rf_packets.h:413
pdl::packet::slice bytes() const
Definition: rf_packets.h:410
BitRate GetBitrate() const
Definition: rf_packets.h:384
Technology GetTechnology() const
Definition: rf_packets.h:374
uint8_t power_level_
Definition: rf_packets.h:454
uint16_t sender_
Definition: rf_packets.h:449
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:417
std::string ToString() const
Definition: rf_packets.h:406
Technology technology_
Definition: rf_packets.h:451
uint8_t GetPowerLevel() const
Definition: rf_packets.h:389
bool valid_
Definition: rf_packets.h:447
uint16_t receiver_
Definition: rf_packets.h:450
Protocol GetProtocol() const
Definition: rf_packets.h:379
uint16_t GetSender() const
Definition: rf_packets.h:364
pdl::packet::slice bytes_
Definition: rf_packets.h:448
PollingFrameFormat format_
Definition: rf_packets.h:455
Protocol protocol_
Definition: rf_packets.h:452
bool IsValid() const
Definition: rf_packets.h:408
std::vector< uint8_t > GetPayload() const
Definition: rf_packets.h:399
uint16_t GetReceiver() const
Definition: rf_packets.h:369
BitRate bitrate_
Definition: rf_packets.h:453
static PollCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:360
RfPacketType GetPacketType() const
Definition: rf_packets.h:404
Definition: rf_packets.h:284
size_t GetSize() const override
Definition: rf_packets.h:329
uint8_t power_level_
Definition: rf_packets.h:337
RfPacketType packet_type_
Definition: rf_packets.h:335
Technology technology_
Definition: rf_packets.h:333
BitRate bitrate_
Definition: rf_packets.h:336
RfPacketBuilder(RfPacketBuilder const &)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:311
uint16_t receiver_
Definition: rf_packets.h:332
RfPacketBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, RfPacketType packet_type, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > payload)
Definition: rf_packets.h:291
RfPacketBuilder(RfPacketBuilder &&)=default
static std::unique_ptr< RfPacketBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, RfPacketType packet_type, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > payload)
Definition: rf_packets.h:302
~RfPacketBuilder() override=default
uint16_t sender_
Definition: rf_packets.h:331
RfPacketBuilder & operator=(RfPacketBuilder const &)=default
Protocol protocol_
Definition: rf_packets.h:334
std::vector< uint8_t > payload_
Definition: rf_packets.h:338
Definition: rf_packets.h:186
RfPacketView(pdl::packet::slice const &parent)
Definition: rf_packets.h:239
static RfPacketView Create(pdl::packet::slice const &parent)
Definition: rf_packets.h:188
Protocol GetProtocol() const
Definition: rf_packets.h:207
pdl::packet::slice bytes_
Definition: rf_packets.h:262
Protocol protocol_
Definition: rf_packets.h:266
std::string ToString() const
Definition: rf_packets.h:232
uint8_t power_level_
Definition: rf_packets.h:269
Technology technology_
Definition: rf_packets.h:265
uint8_t GetPowerLevel() const
Definition: rf_packets.h:222
BitRate GetBitrate() const
Definition: rf_packets.h:217
Technology GetTechnology() const
Definition: rf_packets.h:202
RfPacketType packet_type_
Definition: rf_packets.h:267
bool valid_
Definition: rf_packets.h:261
BitRate bitrate_
Definition: rf_packets.h:268
std::vector< uint8_t > GetPayload() const
Definition: rf_packets.h:227
uint16_t sender_
Definition: rf_packets.h:263
uint16_t GetReceiver() const
Definition: rf_packets.h:197
uint16_t GetSender() const
Definition: rf_packets.h:192
bool Parse(pdl::packet::slice const &parent)
Definition: rf_packets.h:243
pdl::packet::slice bytes() const
Definition: rf_packets.h:236
RfPacketType GetPacketType() const
Definition: rf_packets.h:212
uint16_t receiver_
Definition: rf_packets.h:264
pdl::packet::slice payload_
Definition: rf_packets.h:270
bool IsValid() const
Definition: rf_packets.h:234
Definition: rf_packets.h:1508
SelectCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level)
Definition: rf_packets.h:1515
SelectCommandBuilder & operator=(SelectCommandBuilder const &)=default
static std::unique_ptr< SelectCommandBuilder > Create(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level)
Definition: rf_packets.h:1521
SelectCommandBuilder(SelectCommandBuilder &&)=default
size_t GetSize() const override
Definition: rf_packets.h:1545
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1528
~SelectCommandBuilder() override=default
SelectCommandBuilder(SelectCommandBuilder const &)=default
Definition: rf_packets.h:1427
BitRate bitrate_
Definition: rf_packets.h:1504
SelectCommandView(RfPacketView const &parent)
Definition: rf_packets.h:1472
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1458
Protocol protocol_
Definition: rf_packets.h:1503
pdl::packet::slice bytes() const
Definition: rf_packets.h:1469
uint16_t GetReceiver() const
Definition: rf_packets.h:1438
uint8_t power_level_
Definition: rf_packets.h:1505
Technology GetTechnology() const
Definition: rf_packets.h:1443
bool IsValid() const
Definition: rf_packets.h:1467
Technology technology_
Definition: rf_packets.h:1502
bool valid_
Definition: rf_packets.h:1498
uint16_t sender_
Definition: rf_packets.h:1500
BitRate GetBitrate() const
Definition: rf_packets.h:1453
std::string ToString() const
Definition: rf_packets.h:1465
RfPacketType GetPacketType() const
Definition: rf_packets.h:1463
static SelectCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:1429
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1477
uint16_t receiver_
Definition: rf_packets.h:1501
pdl::packet::slice bytes_
Definition: rf_packets.h:1499
uint16_t GetSender() const
Definition: rf_packets.h:1433
Protocol GetProtocol() const
Definition: rf_packets.h:1448
Definition: rf_packets.h:936
T4ATSelectCommandBuilder & operator=(T4ATSelectCommandBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:978
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:959
T4ATSelectCommandBuilder(T4ATSelectCommandBuilder const &)=default
~T4ATSelectCommandBuilder() override=default
uint8_t param_
Definition: rf_packets.h:980
static std::unique_ptr< T4ATSelectCommandBuilder > Create(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, uint8_t param)
Definition: rf_packets.h:950
T4ATSelectCommandBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, uint8_t param)
Definition: rf_packets.h:944
T4ATSelectCommandBuilder(T4ATSelectCommandBuilder &&)=default
Definition: rf_packets.h:845
BitRate GetBitrate() const
Definition: rf_packets.h:861
bool valid_
Definition: rf_packets.h:927
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:894
static T4ATSelectCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:847
uint16_t GetSender() const
Definition: rf_packets.h:851
std::string ToString() const
Definition: rf_packets.h:882
uint16_t GetReceiver() const
Definition: rf_packets.h:856
RfPacketType GetPacketType() const
Definition: rf_packets.h:880
bool IsValid() const
Definition: rf_packets.h:884
uint16_t receiver_
Definition: rf_packets.h:930
Protocol GetProtocol() const
Definition: rf_packets.h:878
pdl::packet::slice bytes() const
Definition: rf_packets.h:886
T4ATSelectCommandView(RfPacketView const &parent)
Definition: rf_packets.h:889
Technology GetTechnology() const
Definition: rf_packets.h:876
uint8_t power_level_
Definition: rf_packets.h:932
BitRate bitrate_
Definition: rf_packets.h:931
pdl::packet::slice bytes_
Definition: rf_packets.h:928
uint8_t GetPowerLevel() const
Definition: rf_packets.h:866
uint16_t sender_
Definition: rf_packets.h:929
uint8_t GetParam() const
Definition: rf_packets.h:871
uint8_t param_
Definition: rf_packets.h:933
Definition: rf_packets.h:1085
size_t GetRatsResponseSize() const
Definition: rf_packets.h:1129
T4ATSelectResponseBuilder(T4ATSelectResponseBuilder &&)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1107
T4ATSelectResponseBuilder & operator=(T4ATSelectResponseBuilder const &)=default
~T4ATSelectResponseBuilder() override=default
static std::unique_ptr< T4ATSelectResponseBuilder > Create(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > rats_response)
Definition: rf_packets.h:1100
std::vector< uint8_t > rats_response_
Definition: rf_packets.h:1131
T4ATSelectResponseBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > rats_response)
Definition: rf_packets.h:1093
size_t GetSize() const override
Definition: rf_packets.h:1127
T4ATSelectResponseBuilder(T4ATSelectResponseBuilder const &)=default
Definition: rf_packets.h:983
BitRate GetBitrate() const
Definition: rf_packets.h:999
BitRate bitrate_
Definition: rf_packets.h:1080
pdl::packet::slice bytes() const
Definition: rf_packets.h:1029
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1004
uint16_t GetSender() const
Definition: rf_packets.h:989
uint8_t power_level_
Definition: rf_packets.h:1081
uint16_t sender_
Definition: rf_packets.h:1078
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1037
bool valid_
Definition: rf_packets.h:1076
T4ATSelectResponseView(RfPacketView const &parent)
Definition: rf_packets.h:1032
uint16_t receiver_
Definition: rf_packets.h:1079
std::string ToString() const
Definition: rf_packets.h:1025
RfPacketType GetPacketType() const
Definition: rf_packets.h:1023
static T4ATSelectResponseView Create(RfPacketView const &parent)
Definition: rf_packets.h:985
Protocol GetProtocol() const
Definition: rf_packets.h:1021
std::vector< uint8_t > GetRatsResponse() const
Definition: rf_packets.h:1009
uint16_t GetReceiver() const
Definition: rf_packets.h:994
pdl::packet::slice rats_response_
Definition: rf_packets.h:1082
pdl::packet::slice bytes_
Definition: rf_packets.h:1077
bool IsValid() const
Definition: rf_packets.h:1027
Technology GetTechnology() const
Definition: rf_packets.h:1019
Interface class for generated packet builders.
Definition: packet_runtime.h:126
Definition: packet_runtime.h:34
std::vector< uint8_t > bytes() const
Return the contents of the slice as a byte vector.
Definition: packet_runtime.h:107
T read_le()
Definition: packet_runtime.h:58
slice subrange(size_t offset, size_t size) const
Definition: packet_runtime.h:48
void skip(size_t size)
Definition: packet_runtime.h:94
size_t size() const
Return the size of the slice in bytes.
Definition: packet_runtime.h:104
void clear()
Empty the slice.
Definition: packet_runtime.h:101
#define data
Definition: dict.c:56
#define parent
Definition: dict.c:53
Definition: rf_packets.h:45
std::string PollingFrameFormatText(PollingFrameFormat tag)
Definition: rf_packets.h:346
PollingFrameFormat
Definition: rf_packets.h:341
DeactivateType
Definition: rf_packets.h:1548
std::string ProtocolText(Protocol tag)
Definition: rf_packets.h:130
DeactivateReason
Definition: rf_packets.h:1571
std::string DeactivateTypeText(DeactivateType tag)
Definition: rf_packets.h:1555
FieldStatus
Definition: rf_packets.h:509
std::string TechnologyText(Technology tag)
Definition: rf_packets.h:66
std::string FieldStatusText(FieldStatus tag)
Definition: rf_packets.h:514
std::string DeactivateReasonText(DeactivateReason tag)
Definition: rf_packets.h:1579
Technology
Definition: rf_packets.h:58
BitRate
Definition: rf_packets.h:84
std::string BitRateText(BitRate tag)
Definition: rf_packets.h:95
Protocol
Definition: rf_packets.h:119
std::string RfPacketTypeText(RfPacketType tag)
Definition: rf_packets.h:164
RfPacketType
Definition: rf_packets.h:154
EventFormat format
Definition: kernel_log_server.cc:60
Definition: logging.h:464
uint32_t payload
Definition: pairing_connection.cpp:2
#define _ASSERT_VALID
Definition: rf_packets.h:41