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 --namespace casimir::rf --output ./out/rf_packets.h
19// /!\ Do not edit by hand
20
21/*
22* TODO: b/416777029 - Stop using this file and generate it at compile time
23*/
24
25#pragma once
26
27#include <cstdint>
28#include <string>
29#include <optional>
30#include <utility>
31#include <vector>
32
34
35#ifndef _ASSERT_VALID
36#ifdef ASSERT
37#define _ASSERT_VALID ASSERT
38#else
39#include <cassert>
40#define _ASSERT_VALID assert
41#endif // ASSERT
42#endif // !_ASSERT_VALID
43
44namespace casimir::rf {
45class RfPacketView;
46class PollCommandView;
47class FieldInfoView;
48class NfcAPollResponseView;
49class T4ATSelectCommandView;
50class T4ATSelectResponseView;
51class NfcDepSelectCommandView;
52class NfcDepSelectResponseView;
53class SelectCommandView;
54class DeactivateNotificationView;
55class DataView;
56
57enum class Technology : uint8_t {
58 NFC_A = 0x0,
59 NFC_B = 0x1,
60 NFC_F = 0x2,
61 NFC_V = 0x3,
62 RAW = 0x7,
63};
64
65inline std::string TechnologyText(Technology tag) {
66 switch (tag) {
67 case Technology::NFC_A: return "NFC_A";
68 case Technology::NFC_B: return "NFC_B";
69 case Technology::NFC_F: return "NFC_F";
70 case Technology::NFC_V: return "NFC_V";
71 case Technology::RAW: return "RAW";
72 default:
73 return std::string("Unknown Technology: " +
74 std::to_string(static_cast<uint64_t>(tag)));
75 }
76}
77
78enum class BitRate : uint8_t {
86 BIT_RATE_26_KBIT_S = 0x20,
87};
88
89inline std::string BitRateText(BitRate tag) {
90 switch (tag) {
91 case BitRate::BIT_RATE_106_KBIT_S: return "BIT_RATE_106_KBIT_S";
92 case BitRate::BIT_RATE_212_KBIT_S: return "BIT_RATE_212_KBIT_S";
93 case BitRate::BIT_RATE_424_KBIT_S: return "BIT_RATE_424_KBIT_S";
94 case BitRate::BIT_RATE_848_KBIT_S: return "BIT_RATE_848_KBIT_S";
95 case BitRate::BIT_RATE_1695_KBIT_S: return "BIT_RATE_1695_KBIT_S";
96 case BitRate::BIT_RATE_3390_KBIT_S: return "BIT_RATE_3390_KBIT_S";
97 case BitRate::BIT_RATE_6780_KBIT_S: return "BIT_RATE_6780_KBIT_S";
98 case BitRate::BIT_RATE_26_KBIT_S: return "BIT_RATE_26_KBIT_S";
99 default:
100 return std::string("Unknown BitRate: " +
101 std::to_string(static_cast<uint64_t>(tag)));
102 }
103}
104
105enum class Protocol : uint8_t {
106 UNDETERMINED = 0x0,
107 T1T = 0x1,
108 T2T = 0x2,
109 T3T = 0x3,
110 ISO_DEP = 0x4,
111 NFC_DEP = 0x5,
112 T5T = 0x6,
113 NDEF = 0x7,
114};
115
116inline std::string ProtocolText(Protocol tag) {
117 switch (tag) {
118 case Protocol::UNDETERMINED: return "UNDETERMINED";
119 case Protocol::T1T: return "T1T";
120 case Protocol::T2T: return "T2T";
121 case Protocol::T3T: return "T3T";
122 case Protocol::ISO_DEP: return "ISO_DEP";
123 case Protocol::NFC_DEP: return "NFC_DEP";
124 case Protocol::T5T: return "T5T";
125 case Protocol::NDEF: return "NDEF";
126 default:
127 return std::string("Unknown Protocol: " +
128 std::to_string(static_cast<uint64_t>(tag)));
129 }
130}
131
132enum class RfPacketType : uint8_t {
133 DATA = 0x0,
134 POLL_COMMAND = 0x1,
135 POLL_RESPONSE = 0x2,
136 SELECT_COMMAND = 0x3,
137 SELECT_RESPONSE = 0x4,
139 FIELD_INFO = 0x6,
140};
141
142inline std::string RfPacketTypeText(RfPacketType tag) {
143 switch (tag) {
144 case RfPacketType::DATA: return "DATA";
145 case RfPacketType::POLL_COMMAND: return "POLL_COMMAND";
146 case RfPacketType::POLL_RESPONSE: return "POLL_RESPONSE";
147 case RfPacketType::SELECT_COMMAND: return "SELECT_COMMAND";
148 case RfPacketType::SELECT_RESPONSE: return "SELECT_RESPONSE";
149 case RfPacketType::DEACTIVATE_NOTIFICATION: return "DEACTIVATE_NOTIFICATION";
150 case RfPacketType::FIELD_INFO: return "FIELD_INFO";
151 default:
152 return std::string("Unknown RfPacketType: " +
153 std::to_string(static_cast<uint64_t>(tag)));
154 }
155}
156
158public:
159 static RfPacketView Create(pdl::packet::slice const& parent) {
160 return RfPacketView(parent);
161 }
162
163 uint16_t GetSender() const {
165 return sender_;
166 }
167
168 uint16_t GetReceiver() const {
170 return receiver_;
171 }
172
175 return technology_;
176 }
177
180 return protocol_;
181 }
182
185 return packet_type_;
186 }
187
190 return bitrate_;
191 }
192
193 uint8_t GetPowerLevel() const {
195 return power_level_;
196 }
197
198 std::vector<uint8_t> GetPayload() const {
200 return payload_.bytes();
201 }
202
203
204 std::string ToString() const {
205 return "";
206 }
207
208
209 bool IsValid() const {
210 return valid_;
211 }
212
214 return bytes_;
215 }
216
217protected:
218 explicit RfPacketView(pdl::packet::slice const& parent)
219 : bytes_(parent) {
220 valid_ = Parse(parent);
221 }
222
223 bool Parse(pdl::packet::slice const& parent) {
224 // Parse packet field values.
225 pdl::packet::slice span = parent;
226 if (span.size() < 9) {
227 return false;
228 }
229 sender_ = span.read_le<uint16_t, 2>();
230 receiver_ = span.read_le<uint16_t, 2>();
231 technology_ = Technology(span.read_le<uint8_t, 1>());
232 protocol_ = Protocol(span.read_le<uint8_t, 1>());
233 packet_type_ = RfPacketType(span.read_le<uint8_t, 1>());
234 bitrate_ = BitRate(span.read_le<uint8_t, 1>());
235 power_level_ = span.read_le<uint8_t, 1>();
236 payload_ = span;
237 span.clear();
238 return true;
239 }
240
241 bool valid_{false};
243 uint16_t sender_{0};
244 uint16_t receiver_{0};
249 uint8_t power_level_{0};
251
252 friend class PollCommandView;
253 friend class FieldInfoView;
259 friend class SelectCommandView;
261 friend class DataView;
262};
263
265public:
266 ~RfPacketBuilder() override = default;
267 RfPacketBuilder() = default;
271 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)
272 : sender_(sender), receiver_(receiver), technology_(technology), protocol_(protocol), packet_type_(packet_type), bitrate_(bitrate), power_level_(power_level), payload_(std::move(payload)) {
273
274}
275 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) {
276 return std::make_unique<RfPacketBuilder>(sender, receiver, technology, protocol, packet_type, bitrate, power_level, std::move(payload));
277}
278
279 void Serialize(std::vector<uint8_t>& output) const override {
280 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
281 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
282 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
283 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(protocol_) << 0));
284 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(packet_type_) << 0));
285 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
286 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
287 output.insert(output.end(), payload_.begin(), payload_.end());
288 }
289
290 size_t GetSize() const override {
291 return payload_.size() + 9;
292 }
293
294
295 uint16_t sender_{0};
296 uint16_t receiver_{0};
301 uint8_t power_level_{0};
302 std::vector<uint8_t> payload_;
303};
304
305enum class PollingFrameFormat : uint8_t {
306 SHORT = 0x0,
307 LONG = 0x1,
308};
309
311 switch (tag) {
312 case PollingFrameFormat::SHORT: return "SHORT";
313 case PollingFrameFormat::LONG: return "LONG";
314 default:
315 return std::string("Unknown PollingFrameFormat: " +
316 std::to_string(static_cast<uint64_t>(tag)));
317 }
318}
319
321public:
322 static PollCommandView Create(RfPacketView const& parent) {
323 return PollCommandView(parent);
324 }
325
326 uint16_t GetSender() const {
328 return sender_;
329 }
330
331 uint16_t GetReceiver() const {
333 return receiver_;
334 }
335
338 return technology_;
339 }
340
343 return protocol_;
344 }
345
348 return bitrate_;
349 }
350
351 uint8_t GetPowerLevel() const {
353 return power_level_;
354 }
355
358 return format_;
359 }
360
361 std::vector<uint8_t> GetPayload() const {
363 return payload_.bytes();
364 }
365
368 }
369
370
371 std::string ToString() const {
372 return "";
373 }
374
375
376 bool IsValid() const {
377 return valid_;
378 }
379
381 return bytes_;
382 }
383
384protected:
385 explicit PollCommandView(RfPacketView const& parent)
386 : bytes_(parent.bytes_) {
387 valid_ = Parse(parent);
388 }
389
390 bool Parse(RfPacketView const& parent) {
391 // Check validity of parent packet.
392 if (!parent.IsValid()) {
393 return false;
394 }
395
396 // Copy parent field values.
397 sender_ = parent.sender_;
398 receiver_ = parent.receiver_;
399 technology_ = parent.technology_;
400 protocol_ = parent.protocol_;
401 bitrate_ = parent.bitrate_;
402 power_level_ = parent.power_level_;
403
405 return false;
406 }
407
408 // Parse packet field values.
409 pdl::packet::slice span = parent.payload_;
410 if (span.size() < 1) {
411 return false;
412 }
413 uint8_t chunk0 = span.read_le<uint8_t, 1>();
414 format_ = PollingFrameFormat((chunk0 >> 0) & 0x1);
415 payload_ = span;
416 span.clear();
417 return true;
418 }
419
420 bool valid_{false};
422 uint16_t sender_{0};
423 uint16_t receiver_{0};
427 uint8_t power_level_{0};
430
431
432};
433
435public:
436 ~PollCommandBuilder() override = default;
441 PollCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, PollingFrameFormat format, std::vector<uint8_t> payload)
442 : RfPacketBuilder(sender, receiver, technology, protocol, RfPacketType::POLL_COMMAND, bitrate, power_level, std::vector<uint8_t>{}), format_(format) {
443 payload_ = std::move(payload);
444}
445 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) {
446 return std::make_unique<PollCommandBuilder>(sender, receiver, technology, protocol, bitrate, power_level, format, std::move(payload));
447}
448
449 void Serialize(std::vector<uint8_t>& output) const override {
450 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
451 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
452 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
453 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(protocol_) << 0));
454 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::POLL_COMMAND) << 0));
455 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
456 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
457 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(format_) << 0));
458 output.insert(output.end(), payload_.begin(), payload_.end());
459 }
460
461 size_t GetSize() const override {
462 return payload_.size() + 10;
463 }
464
465
467};
468
469enum class FieldStatus : uint8_t {
470 FieldOff = 0x0,
471 FieldOn = 0x1,
472};
473
474inline std::string FieldStatusText(FieldStatus tag) {
475 switch (tag) {
476 case FieldStatus::FieldOff: return "FieldOff";
477 case FieldStatus::FieldOn: return "FieldOn";
478 default:
479 return std::string("Unknown FieldStatus: " +
480 std::to_string(static_cast<uint64_t>(tag)));
481 }
482}
483
485public:
486 static FieldInfoView Create(RfPacketView const& parent) {
487 return FieldInfoView(parent);
488 }
489
490 uint16_t GetSender() const {
492 return sender_;
493 }
494
495 uint16_t GetReceiver() const {
497 return receiver_;
498 }
499
502 return technology_;
503 }
504
507 return protocol_;
508 }
509
512 return bitrate_;
513 }
514
515 uint8_t GetPowerLevel() const {
517 return power_level_;
518 }
519
522 return field_status_;
523 }
524
527 }
528
529
530 std::string ToString() const {
531 return "";
532 }
533
534
535 bool IsValid() const {
536 return valid_;
537 }
538
540 return bytes_;
541 }
542
543protected:
544 explicit FieldInfoView(RfPacketView const& parent)
545 : bytes_(parent.bytes_) {
546 valid_ = Parse(parent);
547 }
548
549 bool Parse(RfPacketView const& parent) {
550 // Check validity of parent packet.
551 if (!parent.IsValid()) {
552 return false;
553 }
554
555 // Copy parent field values.
556 sender_ = parent.sender_;
557 receiver_ = parent.receiver_;
558 technology_ = parent.technology_;
559 protocol_ = parent.protocol_;
560 bitrate_ = parent.bitrate_;
561 power_level_ = parent.power_level_;
562
564 return false;
565 }
566
567 // Parse packet field values.
568 pdl::packet::slice span = parent.payload_;
569 if (span.size() < 1) {
570 return false;
571 }
572 field_status_ = FieldStatus(span.read_le<uint8_t, 1>());
573 return true;
574 }
575
576 bool valid_{false};
578 uint16_t sender_{0};
579 uint16_t receiver_{0};
583 uint8_t power_level_{0};
585
586
587};
588
590public:
591 ~FieldInfoBuilder() override = default;
592 FieldInfoBuilder() = default;
596 FieldInfoBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, FieldStatus field_status)
597 : RfPacketBuilder(sender, receiver, technology, protocol, RfPacketType::FIELD_INFO, bitrate, power_level, std::vector<uint8_t>{}), field_status_(field_status) {
598
599}
600 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) {
601 return std::make_unique<FieldInfoBuilder>(sender, receiver, technology, protocol, bitrate, power_level, field_status);
602}
603
604 void Serialize(std::vector<uint8_t>& output) const override {
605 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
606 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
607 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
608 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(protocol_) << 0));
609 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::FIELD_INFO) << 0));
610 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
611 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
612 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(field_status_) << 0));
613 }
614
615 size_t GetSize() const override {
616 return 10;
617 }
618
619
621};
622
624public:
626 return NfcAPollResponseView(parent);
627 }
628
629 uint16_t GetSender() const {
631 return sender_;
632 }
633
634 uint16_t GetReceiver() const {
636 return receiver_;
637 }
638
641 return protocol_;
642 }
643
646 return bitrate_;
647 }
648
649 uint8_t GetPowerLevel() const {
651 return power_level_;
652 }
653
654 std::vector<uint8_t> GetNfcid1() const {
657 std::vector<uint8_t> elements;
658 while (span.size() >= 1) {
659 elements.push_back(span.read_le<uint8_t, 1>());
660 }
661 return elements;
662 }
663
664 uint8_t GetIntProtocol() const {
666 return int_protocol_;
667 }
668
669 uint8_t GetBitFrameSdd() const {
671 return bit_frame_sdd_;
672 }
673
675 return Technology::NFC_A;
676 }
677
680 }
681
682
683 std::string ToString() const {
684 return "";
685 }
686
687
688 bool IsValid() const {
689 return valid_;
690 }
691
693 return bytes_;
694 }
695
696protected:
697 explicit NfcAPollResponseView(RfPacketView const& parent)
698 : bytes_(parent.bytes_) {
699 valid_ = Parse(parent);
700 }
701
702 bool Parse(RfPacketView const& parent) {
703 // Check validity of parent packet.
704 if (!parent.IsValid()) {
705 return false;
706 }
707
708 // Copy parent field values.
709 sender_ = parent.sender_;
710 receiver_ = parent.receiver_;
711 protocol_ = parent.protocol_;
712 bitrate_ = parent.bitrate_;
713 power_level_ = parent.power_level_;
714
715 if (parent.technology_ != Technology::NFC_A) {
716 return false;
717 }
718
720 return false;
721 }
722
723 // Parse packet field values.
724 pdl::packet::slice span = parent.payload_;
725 uint8_t nfcid1_size;
726 if (span.size() < 1) {
727 return false;
728 }
729 nfcid1_size = span.read_le<uint8_t, 1>();
730 if (span.size() < nfcid1_size) {
731 return false;
732 }
733 nfcid1_ = span.subrange(0, nfcid1_size);
734 span.skip(nfcid1_size);
735 if (span.size() < 2) {
736 return false;
737 }
738 uint8_t chunk0 = span.read_le<uint8_t, 1>();
739 int_protocol_ = (chunk0 >> 0) & 0x3;
740 bit_frame_sdd_ = span.read_le<uint8_t, 1>();
741 return true;
742 }
743
744 bool valid_{false};
746 uint16_t sender_{0};
747 uint16_t receiver_{0};
750 uint8_t power_level_{0};
752 uint8_t int_protocol_{0};
753 uint8_t bit_frame_sdd_{0};
754
755
756};
757
759public:
760 ~NfcAPollResponseBuilder() override = default;
765 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)
766 : RfPacketBuilder(sender, receiver, Technology::NFC_A, protocol, RfPacketType::POLL_RESPONSE, bitrate, power_level, std::vector<uint8_t>{}), nfcid1_(std::move(nfcid1)), int_protocol_(int_protocol), bit_frame_sdd_(bit_frame_sdd) {
767
768}
769 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) {
770 return std::make_unique<NfcAPollResponseBuilder>(sender, receiver, protocol, bitrate, power_level, std::move(nfcid1), int_protocol, bit_frame_sdd);
771}
772
773 void Serialize(std::vector<uint8_t>& output) const override {
774 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
775 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
776 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(Technology::NFC_A) << 0));
777 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(protocol_) << 0));
778 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::POLL_RESPONSE) << 0));
779 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
780 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
781 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(GetNfcid1Size()) << 0));
782 output.insert(output.end(), nfcid1_.begin(), nfcid1_.end());
783 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(int_protocol_ & 0x3) << 0));
784 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bit_frame_sdd_ & 0xff) << 0));
785 }
786
787 size_t GetSize() const override {
788 return GetNfcid1Size() + 12;
789 }
790
791 size_t GetNfcid1Size() const {
792 return nfcid1_.size() * 1;
793 }
794
795 std::vector<uint8_t> nfcid1_;
796 uint8_t int_protocol_{0};
797 uint8_t bit_frame_sdd_{0};
798};
799
801public:
803 return T4ATSelectCommandView(parent);
804 }
805
806 uint16_t GetSender() const {
808 return sender_;
809 }
810
811 uint16_t GetReceiver() const {
813 return receiver_;
814 }
815
818 return bitrate_;
819 }
820
821 uint8_t GetPowerLevel() const {
823 return power_level_;
824 }
825
826 uint8_t GetParam() const {
828 return param_;
829 }
830
832 return Technology::NFC_A;
833 }
834
836 return Protocol::ISO_DEP;
837 }
838
841 }
842
843
844 std::string ToString() const {
845 return "";
846 }
847
848
849 bool IsValid() const {
850 return valid_;
851 }
852
854 return bytes_;
855 }
856
857protected:
858 explicit T4ATSelectCommandView(RfPacketView const& parent)
859 : bytes_(parent.bytes_) {
860 valid_ = Parse(parent);
861 }
862
863 bool Parse(RfPacketView const& parent) {
864 // Check validity of parent packet.
865 if (!parent.IsValid()) {
866 return false;
867 }
868
869 // Copy parent field values.
870 sender_ = parent.sender_;
871 receiver_ = parent.receiver_;
872 bitrate_ = parent.bitrate_;
873 power_level_ = parent.power_level_;
874
875 if (parent.technology_ != Technology::NFC_A) {
876 return false;
877 }
878
879 if (parent.protocol_ != Protocol::ISO_DEP) {
880 return false;
881 }
882
884 return false;
885 }
886
887 // Parse packet field values.
888 pdl::packet::slice span = parent.payload_;
889 if (span.size() < 1) {
890 return false;
891 }
892 param_ = span.read_le<uint8_t, 1>();
893 return true;
894 }
895
896 bool valid_{false};
898 uint16_t sender_{0};
899 uint16_t receiver_{0};
901 uint8_t power_level_{0};
902 uint8_t param_{0};
903
904
905};
906
908public:
909 ~T4ATSelectCommandBuilder() override = default;
914 T4ATSelectCommandBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, uint8_t param)
915 : RfPacketBuilder(sender, receiver, Technology::NFC_A, Protocol::ISO_DEP, RfPacketType::SELECT_COMMAND, bitrate, power_level, std::vector<uint8_t>{}), param_(param) {
916
917}
918 static std::unique_ptr<T4ATSelectCommandBuilder> Create(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, uint8_t param) {
919 return std::make_unique<T4ATSelectCommandBuilder>(sender, receiver, bitrate, power_level, param);
920}
921
922 void Serialize(std::vector<uint8_t>& output) const override {
923 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
924 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
925 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(Technology::NFC_A) << 0));
926 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(Protocol::ISO_DEP) << 0));
927 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::SELECT_COMMAND) << 0));
928 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
929 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
930 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(param_ & 0xff) << 0));
931 }
932
933 size_t GetSize() const override {
934 return 10;
935 }
936
937
938 uint8_t param_{0};
939};
940
942public:
944 return T4ATSelectResponseView(parent);
945 }
946
947 uint16_t GetSender() const {
949 return sender_;
950 }
951
952 uint16_t GetReceiver() const {
954 return receiver_;
955 }
956
959 return bitrate_;
960 }
961
962 uint8_t GetPowerLevel() const {
964 return power_level_;
965 }
966
967 std::vector<uint8_t> GetRatsResponse() const {
970 std::vector<uint8_t> elements;
971 while (span.size() >= 1) {
972 elements.push_back(span.read_le<uint8_t, 1>());
973 }
974 return elements;
975 }
976
978 return Technology::NFC_A;
979 }
980
982 return Protocol::ISO_DEP;
983 }
984
987 }
988
989
990 std::string ToString() const {
991 return "";
992 }
993
994
995 bool IsValid() const {
996 return valid_;
997 }
998
1000 return bytes_;
1001 }
1002
1003protected:
1004 explicit T4ATSelectResponseView(RfPacketView const& parent)
1005 : bytes_(parent.bytes_) {
1006 valid_ = Parse(parent);
1007 }
1008
1009 bool Parse(RfPacketView const& parent) {
1010 // Check validity of parent packet.
1011 if (!parent.IsValid()) {
1012 return false;
1013 }
1014
1015 // Copy parent field values.
1016 sender_ = parent.sender_;
1017 receiver_ = parent.receiver_;
1018 bitrate_ = parent.bitrate_;
1019 power_level_ = parent.power_level_;
1020
1021 if (parent.technology_ != Technology::NFC_A) {
1022 return false;
1023 }
1024
1025 if (parent.protocol_ != Protocol::ISO_DEP) {
1026 return false;
1027 }
1028
1030 return false;
1031 }
1032
1033 // Parse packet field values.
1034 pdl::packet::slice span = parent.payload_;
1035 uint8_t rats_response_size;
1036 if (span.size() < 1) {
1037 return false;
1038 }
1039 rats_response_size = span.read_le<uint8_t, 1>();
1040 if (span.size() < rats_response_size) {
1041 return false;
1042 }
1043 rats_response_ = span.subrange(0, rats_response_size);
1044 span.skip(rats_response_size);
1045 return true;
1046 }
1047
1048 bool valid_{false};
1050 uint16_t sender_{0};
1051 uint16_t receiver_{0};
1053 uint8_t power_level_{0};
1055
1056
1057};
1058
1060public:
1061 ~T4ATSelectResponseBuilder() override = default;
1066 T4ATSelectResponseBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, std::vector<uint8_t> rats_response)
1067 : RfPacketBuilder(sender, receiver, Technology::NFC_A, Protocol::ISO_DEP, RfPacketType::SELECT_RESPONSE, bitrate, power_level, std::vector<uint8_t>{}), rats_response_(std::move(rats_response)) {
1068
1069}
1070 static std::unique_ptr<T4ATSelectResponseBuilder> Create(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, std::vector<uint8_t> rats_response) {
1071 return std::make_unique<T4ATSelectResponseBuilder>(sender, receiver, bitrate, power_level, std::move(rats_response));
1072}
1073
1074 void Serialize(std::vector<uint8_t>& output) const override {
1075 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1076 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1077 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(Technology::NFC_A) << 0));
1078 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(Protocol::ISO_DEP) << 0));
1079 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::SELECT_RESPONSE) << 0));
1080 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
1081 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1082 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(GetRatsResponseSize()) << 0));
1083 output.insert(output.end(), rats_response_.begin(), rats_response_.end());
1084 }
1085
1086 size_t GetSize() const override {
1087 return GetRatsResponseSize() + 10;
1088 }
1089
1090 size_t GetRatsResponseSize() const {
1091 return rats_response_.size() * 1;
1092 }
1093
1094 std::vector<uint8_t> rats_response_;
1095};
1096
1098public:
1100 return NfcDepSelectCommandView(parent);
1101 }
1102
1103 uint16_t GetSender() const {
1105 return sender_;
1106 }
1107
1108 uint16_t GetReceiver() const {
1110 return receiver_;
1111 }
1112
1115 return technology_;
1116 }
1117
1120 return bitrate_;
1121 }
1122
1123 uint8_t GetPowerLevel() const {
1125 return power_level_;
1126 }
1127
1128 uint8_t GetLr() const {
1130 return lr_;
1131 }
1132
1134 return Protocol::NFC_DEP;
1135 }
1136
1139 }
1140
1141
1142 std::string ToString() const {
1143 return "";
1144 }
1145
1146
1147 bool IsValid() const {
1148 return valid_;
1149 }
1150
1152 return bytes_;
1153 }
1154
1155protected:
1157 : bytes_(parent.bytes_) {
1158 valid_ = Parse(parent);
1159 }
1160
1161 bool Parse(RfPacketView const& parent) {
1162 // Check validity of parent packet.
1163 if (!parent.IsValid()) {
1164 return false;
1165 }
1166
1167 // Copy parent field values.
1168 sender_ = parent.sender_;
1169 receiver_ = parent.receiver_;
1170 technology_ = parent.technology_;
1171 bitrate_ = parent.bitrate_;
1172 power_level_ = parent.power_level_;
1173
1174 if (parent.protocol_ != Protocol::NFC_DEP) {
1175 return false;
1176 }
1177
1179 return false;
1180 }
1181
1182 // Parse packet field values.
1183 pdl::packet::slice span = parent.payload_;
1184 if (span.size() < 1) {
1185 return false;
1186 }
1187 uint8_t chunk0 = span.read_le<uint8_t, 1>();
1188 lr_ = (chunk0 >> 0) & 0x3;
1189 return true;
1190 }
1191
1192 bool valid_{false};
1194 uint16_t sender_{0};
1195 uint16_t receiver_{0};
1198 uint8_t power_level_{0};
1199 uint8_t lr_{0};
1200
1201
1202};
1203
1205public:
1206 ~NfcDepSelectCommandBuilder() override = default;
1211 NfcDepSelectCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, uint8_t lr)
1212 : RfPacketBuilder(sender, receiver, technology, Protocol::NFC_DEP, RfPacketType::SELECT_COMMAND, bitrate, power_level, std::vector<uint8_t>{}), lr_(lr) {
1213
1214}
1215 static std::unique_ptr<NfcDepSelectCommandBuilder> Create(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, uint8_t lr) {
1216 return std::make_unique<NfcDepSelectCommandBuilder>(sender, receiver, technology, bitrate, power_level, lr);
1217}
1218
1219 void Serialize(std::vector<uint8_t>& output) const override {
1220 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1221 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1222 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
1223 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(Protocol::NFC_DEP) << 0));
1224 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::SELECT_COMMAND) << 0));
1225 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
1226 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1227 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(lr_ & 0x3) << 0));
1228 }
1229
1230 size_t GetSize() const override {
1231 return 10;
1232 }
1233
1234
1235 uint8_t lr_{0};
1236};
1237
1239public:
1241 return NfcDepSelectResponseView(parent);
1242 }
1243
1244 uint16_t GetSender() const {
1246 return sender_;
1247 }
1248
1249 uint16_t GetReceiver() const {
1251 return receiver_;
1252 }
1253
1256 return technology_;
1257 }
1258
1261 return bitrate_;
1262 }
1263
1264 uint8_t GetPowerLevel() const {
1266 return power_level_;
1267 }
1268
1269 std::vector<uint8_t> GetAtrResponse() const {
1272 std::vector<uint8_t> elements;
1273 while (span.size() >= 1) {
1274 elements.push_back(span.read_le<uint8_t, 1>());
1275 }
1276 return elements;
1277 }
1278
1280 return Protocol::NFC_DEP;
1281 }
1282
1285 }
1286
1287
1288 std::string ToString() const {
1289 return "";
1290 }
1291
1292
1293 bool IsValid() const {
1294 return valid_;
1295 }
1296
1298 return bytes_;
1299 }
1300
1301protected:
1303 : bytes_(parent.bytes_) {
1304 valid_ = Parse(parent);
1305 }
1306
1307 bool Parse(RfPacketView const& parent) {
1308 // Check validity of parent packet.
1309 if (!parent.IsValid()) {
1310 return false;
1311 }
1312
1313 // Copy parent field values.
1314 sender_ = parent.sender_;
1315 receiver_ = parent.receiver_;
1316 technology_ = parent.technology_;
1317 bitrate_ = parent.bitrate_;
1318 power_level_ = parent.power_level_;
1319
1320 if (parent.protocol_ != Protocol::NFC_DEP) {
1321 return false;
1322 }
1323
1325 return false;
1326 }
1327
1328 // Parse packet field values.
1329 pdl::packet::slice span = parent.payload_;
1330 uint8_t atr_response_size;
1331 if (span.size() < 1) {
1332 return false;
1333 }
1334 atr_response_size = span.read_le<uint8_t, 1>();
1335 if (span.size() < atr_response_size) {
1336 return false;
1337 }
1338 atr_response_ = span.subrange(0, atr_response_size);
1339 span.skip(atr_response_size);
1340 return true;
1341 }
1342
1343 bool valid_{false};
1345 uint16_t sender_{0};
1346 uint16_t receiver_{0};
1349 uint8_t power_level_{0};
1351
1352
1353};
1354
1356public:
1357 ~NfcDepSelectResponseBuilder() override = default;
1362 NfcDepSelectResponseBuilder(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, std::vector<uint8_t> atr_response)
1363 : RfPacketBuilder(sender, receiver, technology, Protocol::NFC_DEP, RfPacketType::SELECT_RESPONSE, bitrate, power_level, std::vector<uint8_t>{}), atr_response_(std::move(atr_response)) {
1364
1365}
1366 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) {
1367 return std::make_unique<NfcDepSelectResponseBuilder>(sender, receiver, technology, bitrate, power_level, std::move(atr_response));
1368}
1369
1370 void Serialize(std::vector<uint8_t>& output) const override {
1371 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1372 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1373 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
1374 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(Protocol::NFC_DEP) << 0));
1375 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::SELECT_RESPONSE) << 0));
1376 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
1377 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1378 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(GetAtrResponseSize()) << 0));
1379 output.insert(output.end(), atr_response_.begin(), atr_response_.end());
1380 }
1381
1382 size_t GetSize() const override {
1383 return GetAtrResponseSize() + 10;
1384 }
1385
1386 size_t GetAtrResponseSize() const {
1387 return atr_response_.size() * 1;
1388 }
1389
1390 std::vector<uint8_t> atr_response_;
1391};
1392
1394public:
1395 static SelectCommandView Create(RfPacketView const& parent) {
1396 return SelectCommandView(parent);
1397 }
1398
1399 uint16_t GetSender() const {
1401 return sender_;
1402 }
1403
1404 uint16_t GetReceiver() const {
1406 return receiver_;
1407 }
1408
1411 return technology_;
1412 }
1413
1416 return protocol_;
1417 }
1418
1421 return bitrate_;
1422 }
1423
1424 uint8_t GetPowerLevel() const {
1426 return power_level_;
1427 }
1428
1431 }
1432
1433
1434 std::string ToString() const {
1435 return "";
1436 }
1437
1438
1439 bool IsValid() const {
1440 return valid_;
1441 }
1442
1444 return bytes_;
1445 }
1446
1447protected:
1448 explicit SelectCommandView(RfPacketView const& parent)
1449 : bytes_(parent.bytes_) {
1450 valid_ = Parse(parent);
1451 }
1452
1453 bool Parse(RfPacketView const& parent) {
1454 // Check validity of parent packet.
1455 if (!parent.IsValid()) {
1456 return false;
1457 }
1458
1459 // Copy parent field values.
1460 sender_ = parent.sender_;
1461 receiver_ = parent.receiver_;
1462 technology_ = parent.technology_;
1463 protocol_ = parent.protocol_;
1464 bitrate_ = parent.bitrate_;
1465 power_level_ = parent.power_level_;
1466
1468 return false;
1469 }
1470
1471 return true;
1472 }
1473
1474 bool valid_{false};
1476 uint16_t sender_{0};
1477 uint16_t receiver_{0};
1481 uint8_t power_level_{0};
1482
1483
1484};
1485
1487public:
1488 ~SelectCommandBuilder() override = default;
1493 SelectCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level)
1494 : RfPacketBuilder(sender, receiver, technology, protocol, RfPacketType::SELECT_COMMAND, bitrate, power_level, std::vector<uint8_t>{}) {
1495
1496}
1497 static std::unique_ptr<SelectCommandBuilder> Create(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level) {
1498 return std::make_unique<SelectCommandBuilder>(sender, receiver, technology, protocol, bitrate, power_level);
1499}
1500
1501 void Serialize(std::vector<uint8_t>& output) const override {
1502 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1503 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1504 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
1505 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(protocol_) << 0));
1506 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::SELECT_COMMAND) << 0));
1507 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
1508 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1509 }
1510
1511 size_t GetSize() const override {
1512 return 9;
1513 }
1514
1515
1516
1517};
1518
1519enum class DeactivateType : uint8_t {
1520 IDLE_MODE = 0x0,
1521 SLEEP_MODE = 0x1,
1522 SLEEP_AF_MODE = 0x2,
1523 DISCOVERY = 0x3,
1524};
1525
1526inline std::string DeactivateTypeText(DeactivateType tag) {
1527 switch (tag) {
1528 case DeactivateType::IDLE_MODE: return "IDLE_MODE";
1529 case DeactivateType::SLEEP_MODE: return "SLEEP_MODE";
1530 case DeactivateType::SLEEP_AF_MODE: return "SLEEP_AF_MODE";
1531 case DeactivateType::DISCOVERY: return "DISCOVERY";
1532 default:
1533 return std::string("Unknown DeactivateType: " +
1534 std::to_string(static_cast<uint64_t>(tag)));
1535 }
1536}
1537
1538enum class DeactivateReason : uint8_t {
1539 DH_REQUEST = 0x0,
1540 ENDPOINT_REQUEST = 0x1,
1541 RF_LINK_LOSS = 0x2,
1542 NFC_B_BAD_AFI = 0x3,
1543 DH_REQUEST_FAILED = 0x4,
1544};
1545
1547 switch (tag) {
1548 case DeactivateReason::DH_REQUEST: return "DH_REQUEST";
1549 case DeactivateReason::ENDPOINT_REQUEST: return "ENDPOINT_REQUEST";
1550 case DeactivateReason::RF_LINK_LOSS: return "RF_LINK_LOSS";
1551 case DeactivateReason::NFC_B_BAD_AFI: return "NFC_B_BAD_AFI";
1552 case DeactivateReason::DH_REQUEST_FAILED: return "DH_REQUEST_FAILED";
1553 default:
1554 return std::string("Unknown DeactivateReason: " +
1555 std::to_string(static_cast<uint64_t>(tag)));
1556 }
1557}
1558
1560public:
1562 return DeactivateNotificationView(parent);
1563 }
1564
1565 uint16_t GetSender() const {
1567 return sender_;
1568 }
1569
1570 uint16_t GetReceiver() const {
1572 return receiver_;
1573 }
1574
1577 return technology_;
1578 }
1579
1582 return protocol_;
1583 }
1584
1587 return bitrate_;
1588 }
1589
1590 uint8_t GetPowerLevel() const {
1592 return power_level_;
1593 }
1594
1597 return type__;
1598 }
1599
1602 return reason_;
1603 }
1604
1607 }
1608
1609
1610 std::string ToString() const {
1611 return "";
1612 }
1613
1614
1615 bool IsValid() const {
1616 return valid_;
1617 }
1618
1620 return bytes_;
1621 }
1622
1623protected:
1625 : bytes_(parent.bytes_) {
1626 valid_ = Parse(parent);
1627 }
1628
1629 bool Parse(RfPacketView const& parent) {
1630 // Check validity of parent packet.
1631 if (!parent.IsValid()) {
1632 return false;
1633 }
1634
1635 // Copy parent field values.
1636 sender_ = parent.sender_;
1637 receiver_ = parent.receiver_;
1638 technology_ = parent.technology_;
1639 protocol_ = parent.protocol_;
1640 bitrate_ = parent.bitrate_;
1641 power_level_ = parent.power_level_;
1642
1644 return false;
1645 }
1646
1647 // Parse packet field values.
1648 pdl::packet::slice span = parent.payload_;
1649 if (span.size() < 2) {
1650 return false;
1651 }
1652 type__ = DeactivateType(span.read_le<uint8_t, 1>());
1653 reason_ = DeactivateReason(span.read_le<uint8_t, 1>());
1654 return true;
1655 }
1656
1657 bool valid_{false};
1659 uint16_t sender_{0};
1660 uint16_t receiver_{0};
1664 uint8_t power_level_{0};
1667
1668
1669};
1670
1672public:
1678 DeactivateNotificationBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, DeactivateType type_, DeactivateReason reason)
1679 : RfPacketBuilder(sender, receiver, technology, protocol, RfPacketType::DEACTIVATE_NOTIFICATION, bitrate, power_level, std::vector<uint8_t>{}), type__(type_), reason_(reason) {
1680
1681}
1682 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) {
1683 return std::make_unique<DeactivateNotificationBuilder>(sender, receiver, technology, protocol, bitrate, power_level, type_, reason);
1684}
1685
1686 void Serialize(std::vector<uint8_t>& output) const override {
1687 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1688 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1689 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
1690 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(protocol_) << 0));
1691 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::DEACTIVATE_NOTIFICATION) << 0));
1692 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
1693 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1694 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(type__) << 0));
1695 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(reason_) << 0));
1696 }
1697
1698 size_t GetSize() const override {
1699 return 11;
1700 }
1701
1702
1705};
1706
1708public:
1709 static DataView Create(RfPacketView const& parent) {
1710 return DataView(parent);
1711 }
1712
1713 uint16_t GetSender() const {
1715 return sender_;
1716 }
1717
1718 uint16_t GetReceiver() const {
1720 return receiver_;
1721 }
1722
1725 return technology_;
1726 }
1727
1730 return protocol_;
1731 }
1732
1735 return bitrate_;
1736 }
1737
1738 uint8_t GetPowerLevel() const {
1740 return power_level_;
1741 }
1742
1743 std::vector<uint8_t> GetData() const {
1746 std::vector<uint8_t> elements;
1747 while (span.size() >= 1) {
1748 elements.push_back(span.read_le<uint8_t, 1>());
1749 }
1750 return elements;
1751 }
1752
1754 return RfPacketType::DATA;
1755 }
1756
1757
1758 std::string ToString() const {
1759 return "";
1760 }
1761
1762
1763 bool IsValid() const {
1764 return valid_;
1765 }
1766
1768 return bytes_;
1769 }
1770
1771protected:
1772 explicit DataView(RfPacketView const& parent)
1773 : bytes_(parent.bytes_) {
1774 valid_ = Parse(parent);
1775 }
1776
1777 bool Parse(RfPacketView const& parent) {
1778 // Check validity of parent packet.
1779 if (!parent.IsValid()) {
1780 return false;
1781 }
1782
1783 // Copy parent field values.
1784 sender_ = parent.sender_;
1785 receiver_ = parent.receiver_;
1786 technology_ = parent.technology_;
1787 protocol_ = parent.protocol_;
1788 bitrate_ = parent.bitrate_;
1789 power_level_ = parent.power_level_;
1790
1791 if (parent.packet_type_ != RfPacketType::DATA) {
1792 return false;
1793 }
1794
1795 // Parse packet field values.
1796 pdl::packet::slice span = parent.payload_;
1797 data_ = span;
1798 span.clear();
1799 return true;
1800 }
1801
1802 bool valid_{false};
1804 uint16_t sender_{0};
1805 uint16_t receiver_{0};
1809 uint8_t power_level_{0};
1811
1812
1813};
1814
1816public:
1817 ~DataBuilder() override = default;
1818 DataBuilder() = default;
1819 DataBuilder(DataBuilder const&) = default;
1822 DataBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, std::vector<uint8_t> data)
1823 : RfPacketBuilder(sender, receiver, technology, protocol, RfPacketType::DATA, bitrate, power_level, std::vector<uint8_t>{}), data_(std::move(data)) {
1824
1825}
1826 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) {
1827 return std::make_unique<DataBuilder>(sender, receiver, technology, protocol, bitrate, power_level, std::move(data));
1828}
1829
1830 void Serialize(std::vector<uint8_t>& output) const override {
1831 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(sender_ & 0xffff) << 0));
1832 pdl::packet::Builder::write_le<uint16_t, 2>(output, (static_cast<uint16_t>(receiver_ & 0xffff) << 0));
1833 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(technology_) << 0));
1834 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(protocol_) << 0));
1835 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(RfPacketType::DATA) << 0));
1836 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(bitrate_) << 0));
1837 pdl::packet::Builder::write_le<uint8_t, 1>(output, (static_cast<uint8_t>(power_level_ & 0xff) << 0));
1838 output.insert(output.end(), data_.begin(), data_.end());
1839 }
1840
1841 size_t GetSize() const override {
1842 return GetDataSize() + 9;
1843 }
1844
1845 size_t GetDataSize() const {
1846 return data_.size() * 1;
1847 }
1848
1849 std::vector<uint8_t> data_;
1850};
1851} // casimir::rf
std::string to_string(ConnectionState state)
Definition: adb.cpp:144
Definition: rf_packets.h:1815
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:1826
DataBuilder & operator=(DataBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:1841
~DataBuilder() override=default
size_t GetDataSize() const
Definition: rf_packets.h:1845
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:1822
DataBuilder(DataBuilder &&)=default
DataBuilder(DataBuilder const &)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1830
std::vector< uint8_t > data_
Definition: rf_packets.h:1849
Definition: rf_packets.h:1707
bool valid_
Definition: rf_packets.h:1802
pdl::packet::slice bytes_
Definition: rf_packets.h:1803
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1738
Protocol GetProtocol() const
Definition: rf_packets.h:1728
Technology GetTechnology() const
Definition: rf_packets.h:1723
Technology technology_
Definition: rf_packets.h:1806
uint16_t GetSender() const
Definition: rf_packets.h:1713
uint16_t receiver_
Definition: rf_packets.h:1805
uint16_t GetReceiver() const
Definition: rf_packets.h:1718
Protocol protocol_
Definition: rf_packets.h:1807
DataView(RfPacketView const &parent)
Definition: rf_packets.h:1772
RfPacketType GetPacketType() const
Definition: rf_packets.h:1753
uint8_t power_level_
Definition: rf_packets.h:1809
BitRate GetBitrate() const
Definition: rf_packets.h:1733
bool IsValid() const
Definition: rf_packets.h:1763
pdl::packet::slice bytes() const
Definition: rf_packets.h:1767
uint16_t sender_
Definition: rf_packets.h:1804
static DataView Create(RfPacketView const &parent)
Definition: rf_packets.h:1709
std::vector< uint8_t > GetData() const
Definition: rf_packets.h:1743
pdl::packet::slice data_
Definition: rf_packets.h:1810
BitRate bitrate_
Definition: rf_packets.h:1808
std::string ToString() const
Definition: rf_packets.h:1758
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1777
Definition: rf_packets.h:1671
DeactivateNotificationBuilder & operator=(DeactivateNotificationBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:1698
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:1678
DeactivateReason reason_
Definition: rf_packets.h:1704
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:1682
DeactivateNotificationBuilder(DeactivateNotificationBuilder const &)=default
DeactivateNotificationBuilder(DeactivateNotificationBuilder &&)=default
DeactivateType type__
Definition: rf_packets.h:1703
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1686
Definition: rf_packets.h:1559
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1590
static DeactivateNotificationView Create(RfPacketView const &parent)
Definition: rf_packets.h:1561
DeactivateReason GetReason() const
Definition: rf_packets.h:1600
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1629
DeactivateType type__
Definition: rf_packets.h:1665
pdl::packet::slice bytes() const
Definition: rf_packets.h:1619
pdl::packet::slice bytes_
Definition: rf_packets.h:1658
DeactivateReason reason_
Definition: rf_packets.h:1666
BitRate GetBitrate() const
Definition: rf_packets.h:1585
bool IsValid() const
Definition: rf_packets.h:1615
bool valid_
Definition: rf_packets.h:1657
std::string ToString() const
Definition: rf_packets.h:1610
Technology GetTechnology() const
Definition: rf_packets.h:1575
DeactivateType GetType() const
Definition: rf_packets.h:1595
uint16_t receiver_
Definition: rf_packets.h:1660
DeactivateNotificationView(RfPacketView const &parent)
Definition: rf_packets.h:1624
uint16_t GetReceiver() const
Definition: rf_packets.h:1570
Technology technology_
Definition: rf_packets.h:1661
Protocol protocol_
Definition: rf_packets.h:1662
RfPacketType GetPacketType() const
Definition: rf_packets.h:1605
uint16_t sender_
Definition: rf_packets.h:1659
uint16_t GetSender() const
Definition: rf_packets.h:1565
uint8_t power_level_
Definition: rf_packets.h:1664
BitRate bitrate_
Definition: rf_packets.h:1663
Protocol GetProtocol() const
Definition: rf_packets.h:1580
Definition: rf_packets.h:589
FieldInfoBuilder & operator=(FieldInfoBuilder const &)=default
~FieldInfoBuilder() override=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:604
FieldStatus field_status_
Definition: rf_packets.h:620
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:600
FieldInfoBuilder(FieldInfoBuilder &&)=default
size_t GetSize() const override
Definition: rf_packets.h:615
FieldInfoBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level, FieldStatus field_status)
Definition: rf_packets.h:596
Definition: rf_packets.h:484
FieldInfoView(RfPacketView const &parent)
Definition: rf_packets.h:544
BitRate bitrate_
Definition: rf_packets.h:582
FieldStatus GetFieldStatus() const
Definition: rf_packets.h:520
Technology technology_
Definition: rf_packets.h:580
FieldStatus field_status_
Definition: rf_packets.h:584
Technology GetTechnology() const
Definition: rf_packets.h:500
uint8_t GetPowerLevel() const
Definition: rf_packets.h:515
static FieldInfoView Create(RfPacketView const &parent)
Definition: rf_packets.h:486
uint16_t GetSender() const
Definition: rf_packets.h:490
uint16_t GetReceiver() const
Definition: rf_packets.h:495
RfPacketType GetPacketType() const
Definition: rf_packets.h:525
uint16_t receiver_
Definition: rf_packets.h:579
uint16_t sender_
Definition: rf_packets.h:578
pdl::packet::slice bytes() const
Definition: rf_packets.h:539
Protocol protocol_
Definition: rf_packets.h:581
Protocol GetProtocol() const
Definition: rf_packets.h:505
uint8_t power_level_
Definition: rf_packets.h:583
pdl::packet::slice bytes_
Definition: rf_packets.h:577
bool valid_
Definition: rf_packets.h:576
bool IsValid() const
Definition: rf_packets.h:535
BitRate GetBitrate() const
Definition: rf_packets.h:510
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:549
std::string ToString() const
Definition: rf_packets.h:530
Definition: rf_packets.h:758
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:765
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:769
NfcAPollResponseBuilder & operator=(NfcAPollResponseBuilder const &)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:773
NfcAPollResponseBuilder(NfcAPollResponseBuilder &&)=default
uint8_t bit_frame_sdd_
Definition: rf_packets.h:797
size_t GetSize() const override
Definition: rf_packets.h:787
std::vector< uint8_t > nfcid1_
Definition: rf_packets.h:795
~NfcAPollResponseBuilder() override=default
uint8_t int_protocol_
Definition: rf_packets.h:796
NfcAPollResponseBuilder(NfcAPollResponseBuilder const &)=default
size_t GetNfcid1Size() const
Definition: rf_packets.h:791
Definition: rf_packets.h:623
pdl::packet::slice bytes_
Definition: rf_packets.h:745
NfcAPollResponseView(RfPacketView const &parent)
Definition: rf_packets.h:697
uint8_t GetPowerLevel() const
Definition: rf_packets.h:649
uint16_t GetReceiver() const
Definition: rf_packets.h:634
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:702
uint16_t sender_
Definition: rf_packets.h:746
uint16_t receiver_
Definition: rf_packets.h:747
uint8_t power_level_
Definition: rf_packets.h:750
std::vector< uint8_t > GetNfcid1() const
Definition: rf_packets.h:654
Protocol GetProtocol() const
Definition: rf_packets.h:639
bool valid_
Definition: rf_packets.h:744
pdl::packet::slice bytes() const
Definition: rf_packets.h:692
pdl::packet::slice nfcid1_
Definition: rf_packets.h:751
static NfcAPollResponseView Create(RfPacketView const &parent)
Definition: rf_packets.h:625
uint8_t GetBitFrameSdd() const
Definition: rf_packets.h:669
uint8_t int_protocol_
Definition: rf_packets.h:752
RfPacketType GetPacketType() const
Definition: rf_packets.h:678
BitRate GetBitrate() const
Definition: rf_packets.h:644
Technology GetTechnology() const
Definition: rf_packets.h:674
BitRate bitrate_
Definition: rf_packets.h:749
uint8_t GetIntProtocol() const
Definition: rf_packets.h:664
Protocol protocol_
Definition: rf_packets.h:748
bool IsValid() const
Definition: rf_packets.h:688
std::string ToString() const
Definition: rf_packets.h:683
uint8_t bit_frame_sdd_
Definition: rf_packets.h:753
uint16_t GetSender() const
Definition: rf_packets.h:629
Definition: rf_packets.h:1204
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1219
uint8_t lr_
Definition: rf_packets.h:1235
NfcDepSelectCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, BitRate bitrate, uint8_t power_level, uint8_t lr)
Definition: rf_packets.h:1211
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:1215
NfcDepSelectCommandBuilder(NfcDepSelectCommandBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:1230
Definition: rf_packets.h:1097
uint8_t GetLr() const
Definition: rf_packets.h:1128
uint8_t lr_
Definition: rf_packets.h:1199
pdl::packet::slice bytes_
Definition: rf_packets.h:1193
std::string ToString() const
Definition: rf_packets.h:1142
Protocol GetProtocol() const
Definition: rf_packets.h:1133
uint16_t GetSender() const
Definition: rf_packets.h:1103
Technology GetTechnology() const
Definition: rf_packets.h:1113
static NfcDepSelectCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:1099
bool valid_
Definition: rf_packets.h:1192
bool IsValid() const
Definition: rf_packets.h:1147
Technology technology_
Definition: rf_packets.h:1196
uint16_t sender_
Definition: rf_packets.h:1194
BitRate GetBitrate() const
Definition: rf_packets.h:1118
RfPacketType GetPacketType() const
Definition: rf_packets.h:1137
uint16_t receiver_
Definition: rf_packets.h:1195
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1161
pdl::packet::slice bytes() const
Definition: rf_packets.h:1151
BitRate bitrate_
Definition: rf_packets.h:1197
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1123
NfcDepSelectCommandView(RfPacketView const &parent)
Definition: rf_packets.h:1156
uint16_t GetReceiver() const
Definition: rf_packets.h:1108
uint8_t power_level_
Definition: rf_packets.h:1198
Definition: rf_packets.h:1355
size_t GetSize() const override
Definition: rf_packets.h:1382
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:1366
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:1362
size_t GetAtrResponseSize() const
Definition: rf_packets.h:1386
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1370
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:1390
Definition: rf_packets.h:1238
pdl::packet::slice bytes() const
Definition: rf_packets.h:1297
RfPacketType GetPacketType() const
Definition: rf_packets.h:1283
BitRate bitrate_
Definition: rf_packets.h:1348
uint16_t receiver_
Definition: rf_packets.h:1346
BitRate GetBitrate() const
Definition: rf_packets.h:1259
uint8_t power_level_
Definition: rf_packets.h:1349
std::string ToString() const
Definition: rf_packets.h:1288
Technology GetTechnology() const
Definition: rf_packets.h:1254
static NfcDepSelectResponseView Create(RfPacketView const &parent)
Definition: rf_packets.h:1240
std::vector< uint8_t > GetAtrResponse() const
Definition: rf_packets.h:1269
uint16_t GetSender() const
Definition: rf_packets.h:1244
Technology technology_
Definition: rf_packets.h:1347
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1264
uint16_t GetReceiver() const
Definition: rf_packets.h:1249
NfcDepSelectResponseView(RfPacketView const &parent)
Definition: rf_packets.h:1302
bool valid_
Definition: rf_packets.h:1343
pdl::packet::slice bytes_
Definition: rf_packets.h:1344
pdl::packet::slice atr_response_
Definition: rf_packets.h:1350
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1307
uint16_t sender_
Definition: rf_packets.h:1345
bool IsValid() const
Definition: rf_packets.h:1293
Protocol GetProtocol() const
Definition: rf_packets.h:1279
Definition: rf_packets.h:434
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:441
PollCommandBuilder(PollCommandBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:461
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:445
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:449
PollingFrameFormat format_
Definition: rf_packets.h:466
~PollCommandBuilder() override=default
Definition: rf_packets.h:320
pdl::packet::slice payload_
Definition: rf_packets.h:429
PollingFrameFormat GetFormat() const
Definition: rf_packets.h:356
PollCommandView(RfPacketView const &parent)
Definition: rf_packets.h:385
pdl::packet::slice bytes() const
Definition: rf_packets.h:380
BitRate GetBitrate() const
Definition: rf_packets.h:346
Technology GetTechnology() const
Definition: rf_packets.h:336
uint8_t power_level_
Definition: rf_packets.h:427
uint16_t sender_
Definition: rf_packets.h:422
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:390
std::string ToString() const
Definition: rf_packets.h:371
Technology technology_
Definition: rf_packets.h:424
uint8_t GetPowerLevel() const
Definition: rf_packets.h:351
bool valid_
Definition: rf_packets.h:420
uint16_t receiver_
Definition: rf_packets.h:423
Protocol GetProtocol() const
Definition: rf_packets.h:341
uint16_t GetSender() const
Definition: rf_packets.h:326
pdl::packet::slice bytes_
Definition: rf_packets.h:421
PollingFrameFormat format_
Definition: rf_packets.h:428
Protocol protocol_
Definition: rf_packets.h:425
bool IsValid() const
Definition: rf_packets.h:376
std::vector< uint8_t > GetPayload() const
Definition: rf_packets.h:361
uint16_t GetReceiver() const
Definition: rf_packets.h:331
BitRate bitrate_
Definition: rf_packets.h:426
static PollCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:322
RfPacketType GetPacketType() const
Definition: rf_packets.h:366
Definition: rf_packets.h:264
size_t GetSize() const override
Definition: rf_packets.h:290
uint8_t power_level_
Definition: rf_packets.h:301
RfPacketType packet_type_
Definition: rf_packets.h:299
Technology technology_
Definition: rf_packets.h:297
BitRate bitrate_
Definition: rf_packets.h:300
RfPacketBuilder(RfPacketBuilder const &)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:279
uint16_t receiver_
Definition: rf_packets.h:296
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:271
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:275
~RfPacketBuilder() override=default
uint16_t sender_
Definition: rf_packets.h:295
RfPacketBuilder & operator=(RfPacketBuilder const &)=default
Protocol protocol_
Definition: rf_packets.h:298
std::vector< uint8_t > payload_
Definition: rf_packets.h:302
Definition: rf_packets.h:157
RfPacketView(pdl::packet::slice const &parent)
Definition: rf_packets.h:218
static RfPacketView Create(pdl::packet::slice const &parent)
Definition: rf_packets.h:159
Protocol GetProtocol() const
Definition: rf_packets.h:178
pdl::packet::slice bytes_
Definition: rf_packets.h:242
Protocol protocol_
Definition: rf_packets.h:246
std::string ToString() const
Definition: rf_packets.h:204
uint8_t power_level_
Definition: rf_packets.h:249
Technology technology_
Definition: rf_packets.h:245
uint8_t GetPowerLevel() const
Definition: rf_packets.h:193
BitRate GetBitrate() const
Definition: rf_packets.h:188
Technology GetTechnology() const
Definition: rf_packets.h:173
RfPacketType packet_type_
Definition: rf_packets.h:247
bool valid_
Definition: rf_packets.h:241
BitRate bitrate_
Definition: rf_packets.h:248
std::vector< uint8_t > GetPayload() const
Definition: rf_packets.h:198
uint16_t sender_
Definition: rf_packets.h:243
uint16_t GetReceiver() const
Definition: rf_packets.h:168
uint16_t GetSender() const
Definition: rf_packets.h:163
bool Parse(pdl::packet::slice const &parent)
Definition: rf_packets.h:223
pdl::packet::slice bytes() const
Definition: rf_packets.h:213
RfPacketType GetPacketType() const
Definition: rf_packets.h:183
uint16_t receiver_
Definition: rf_packets.h:244
pdl::packet::slice payload_
Definition: rf_packets.h:250
bool IsValid() const
Definition: rf_packets.h:209
Definition: rf_packets.h:1486
SelectCommandBuilder(uint16_t sender, uint16_t receiver, Technology technology, Protocol protocol, BitRate bitrate, uint8_t power_level)
Definition: rf_packets.h:1493
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:1497
SelectCommandBuilder(SelectCommandBuilder &&)=default
size_t GetSize() const override
Definition: rf_packets.h:1511
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1501
~SelectCommandBuilder() override=default
SelectCommandBuilder(SelectCommandBuilder const &)=default
Definition: rf_packets.h:1393
BitRate bitrate_
Definition: rf_packets.h:1480
SelectCommandView(RfPacketView const &parent)
Definition: rf_packets.h:1448
uint8_t GetPowerLevel() const
Definition: rf_packets.h:1424
Protocol protocol_
Definition: rf_packets.h:1479
pdl::packet::slice bytes() const
Definition: rf_packets.h:1443
uint16_t GetReceiver() const
Definition: rf_packets.h:1404
uint8_t power_level_
Definition: rf_packets.h:1481
Technology GetTechnology() const
Definition: rf_packets.h:1409
bool IsValid() const
Definition: rf_packets.h:1439
Technology technology_
Definition: rf_packets.h:1478
bool valid_
Definition: rf_packets.h:1474
uint16_t sender_
Definition: rf_packets.h:1476
BitRate GetBitrate() const
Definition: rf_packets.h:1419
std::string ToString() const
Definition: rf_packets.h:1434
RfPacketType GetPacketType() const
Definition: rf_packets.h:1429
static SelectCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:1395
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1453
uint16_t receiver_
Definition: rf_packets.h:1477
pdl::packet::slice bytes_
Definition: rf_packets.h:1475
uint16_t GetSender() const
Definition: rf_packets.h:1399
Protocol GetProtocol() const
Definition: rf_packets.h:1414
Definition: rf_packets.h:907
T4ATSelectCommandBuilder & operator=(T4ATSelectCommandBuilder const &)=default
size_t GetSize() const override
Definition: rf_packets.h:933
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:922
T4ATSelectCommandBuilder(T4ATSelectCommandBuilder const &)=default
~T4ATSelectCommandBuilder() override=default
uint8_t param_
Definition: rf_packets.h:938
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:918
T4ATSelectCommandBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, uint8_t param)
Definition: rf_packets.h:914
T4ATSelectCommandBuilder(T4ATSelectCommandBuilder &&)=default
Definition: rf_packets.h:800
BitRate GetBitrate() const
Definition: rf_packets.h:816
bool valid_
Definition: rf_packets.h:896
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:863
static T4ATSelectCommandView Create(RfPacketView const &parent)
Definition: rf_packets.h:802
uint16_t GetSender() const
Definition: rf_packets.h:806
std::string ToString() const
Definition: rf_packets.h:844
uint16_t GetReceiver() const
Definition: rf_packets.h:811
RfPacketType GetPacketType() const
Definition: rf_packets.h:839
bool IsValid() const
Definition: rf_packets.h:849
uint16_t receiver_
Definition: rf_packets.h:899
Protocol GetProtocol() const
Definition: rf_packets.h:835
pdl::packet::slice bytes() const
Definition: rf_packets.h:853
T4ATSelectCommandView(RfPacketView const &parent)
Definition: rf_packets.h:858
Technology GetTechnology() const
Definition: rf_packets.h:831
uint8_t power_level_
Definition: rf_packets.h:901
BitRate bitrate_
Definition: rf_packets.h:900
pdl::packet::slice bytes_
Definition: rf_packets.h:897
uint8_t GetPowerLevel() const
Definition: rf_packets.h:821
uint16_t sender_
Definition: rf_packets.h:898
uint8_t GetParam() const
Definition: rf_packets.h:826
uint8_t param_
Definition: rf_packets.h:902
Definition: rf_packets.h:1059
size_t GetRatsResponseSize() const
Definition: rf_packets.h:1090
T4ATSelectResponseBuilder(T4ATSelectResponseBuilder &&)=default
void Serialize(std::vector< uint8_t > &output) const override
Definition: rf_packets.h:1074
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:1070
std::vector< uint8_t > rats_response_
Definition: rf_packets.h:1094
T4ATSelectResponseBuilder(uint16_t sender, uint16_t receiver, BitRate bitrate, uint8_t power_level, std::vector< uint8_t > rats_response)
Definition: rf_packets.h:1066
size_t GetSize() const override
Definition: rf_packets.h:1086
T4ATSelectResponseBuilder(T4ATSelectResponseBuilder const &)=default
Definition: rf_packets.h:941
BitRate GetBitrate() const
Definition: rf_packets.h:957
BitRate bitrate_
Definition: rf_packets.h:1052
pdl::packet::slice bytes() const
Definition: rf_packets.h:999
uint8_t GetPowerLevel() const
Definition: rf_packets.h:962
uint16_t GetSender() const
Definition: rf_packets.h:947
uint8_t power_level_
Definition: rf_packets.h:1053
uint16_t sender_
Definition: rf_packets.h:1050
bool Parse(RfPacketView const &parent)
Definition: rf_packets.h:1009
bool valid_
Definition: rf_packets.h:1048
T4ATSelectResponseView(RfPacketView const &parent)
Definition: rf_packets.h:1004
uint16_t receiver_
Definition: rf_packets.h:1051
std::string ToString() const
Definition: rf_packets.h:990
RfPacketType GetPacketType() const
Definition: rf_packets.h:985
static T4ATSelectResponseView Create(RfPacketView const &parent)
Definition: rf_packets.h:943
Protocol GetProtocol() const
Definition: rf_packets.h:981
std::vector< uint8_t > GetRatsResponse() const
Definition: rf_packets.h:967
uint16_t GetReceiver() const
Definition: rf_packets.h:952
pdl::packet::slice rats_response_
Definition: rf_packets.h:1054
pdl::packet::slice bytes_
Definition: rf_packets.h:1049
bool IsValid() const
Definition: rf_packets.h:995
Technology GetTechnology() const
Definition: rf_packets.h:977
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
char data[Size]
Definition: incremental_server.cpp:1
Definition: rf_packets.h:44
std::string PollingFrameFormatText(PollingFrameFormat tag)
Definition: rf_packets.h:310
PollingFrameFormat
Definition: rf_packets.h:305
DeactivateType
Definition: rf_packets.h:1519
std::string ProtocolText(Protocol tag)
Definition: rf_packets.h:116
DeactivateReason
Definition: rf_packets.h:1538
std::string DeactivateTypeText(DeactivateType tag)
Definition: rf_packets.h:1526
FieldStatus
Definition: rf_packets.h:469
std::string TechnologyText(Technology tag)
Definition: rf_packets.h:65
std::string FieldStatusText(FieldStatus tag)
Definition: rf_packets.h:474
std::string DeactivateReasonText(DeactivateReason tag)
Definition: rf_packets.h:1546
Technology
Definition: rf_packets.h:57
BitRate
Definition: rf_packets.h:78
std::string BitRateText(BitRate tag)
Definition: rf_packets.h:89
Protocol
Definition: rf_packets.h:105
std::string RfPacketTypeText(RfPacketType tag)
Definition: rf_packets.h:142
RfPacketType
Definition: rf_packets.h:132
EventFormat format
Definition: kernel_log_server.cc:57
Definition: logging.h:464
uint32_t payload
Definition: pairing_connection.cpp:2
#define _ASSERT_VALID
Definition: rf_packets.h:40