YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeBatteryService.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6// Autogenerated by Thrift Compiler (0.14.1-yarped)
7//
8// This is an automatically generated file.
9// It could get re-generated if the ALLOW_IDL_GENERATION flag is on.
10
11#include <FakeBatteryService.h>
12
14
15#include <algorithm>
16
17// setBatteryVoltage helper class declaration
20{
21public:
23 explicit FakeBatteryService_setBatteryVoltage_helper(const double voltage);
24 bool write(yarp::os::ConnectionWriter& connection) const override;
25 bool read(yarp::os::ConnectionReader& connection) override;
26
27 class Command :
29 {
30 public:
31 Command() = default;
32 explicit Command(const double voltage);
33
34 ~Command() override = default;
35
36 bool write(yarp::os::ConnectionWriter& connection) const override;
37 bool read(yarp::os::ConnectionReader& connection) override;
38
39 bool write(const yarp::os::idl::WireWriter& writer) const override;
40 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
41 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
42
43 bool read(yarp::os::idl::WireReader& reader) override;
46
47 double voltage{0.0};
48 };
49
50 class Reply :
52 {
53 public:
54 Reply() = default;
55 ~Reply() override = default;
56
57 bool write(yarp::os::ConnectionWriter& connection) const override;
58 bool read(yarp::os::ConnectionReader& connection) override;
59
60 bool write(const yarp::os::idl::WireWriter& writer) const override;
61 bool read(yarp::os::idl::WireReader& reader) override;
62 };
63
64 using funcptr_t = void (*)(const double);
65 void call(FakeBatteryService* ptr) const;
66
69
70 static constexpr const char* s_tag{"setBatteryVoltage"};
71 static constexpr size_t s_tag_len{1};
72 static constexpr size_t s_cmd_len{2};
73 static constexpr size_t s_reply_len{0};
74 static constexpr const char* s_prototype{"void FakeBatteryService::setBatteryVoltage(const double voltage)"};
75 static constexpr const char* s_help{""};
76};
77
78// setBatteryCurrent helper class declaration
81{
82public:
84 explicit FakeBatteryService_setBatteryCurrent_helper(const double current);
85 bool write(yarp::os::ConnectionWriter& connection) const override;
86 bool read(yarp::os::ConnectionReader& connection) override;
87
88 class Command :
90 {
91 public:
92 Command() = default;
93 explicit Command(const double current);
94
95 ~Command() override = default;
96
97 bool write(yarp::os::ConnectionWriter& connection) const override;
98 bool read(yarp::os::ConnectionReader& connection) override;
99
100 bool write(const yarp::os::idl::WireWriter& writer) const override;
101 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
102 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
103
104 bool read(yarp::os::idl::WireReader& reader) override;
107
108 double current{0.0};
109 };
110
111 class Reply :
113 {
114 public:
115 Reply() = default;
116 ~Reply() override = default;
117
118 bool write(yarp::os::ConnectionWriter& connection) const override;
119 bool read(yarp::os::ConnectionReader& connection) override;
120
121 bool write(const yarp::os::idl::WireWriter& writer) const override;
122 bool read(yarp::os::idl::WireReader& reader) override;
123 };
124
125 using funcptr_t = void (*)(const double);
126 void call(FakeBatteryService* ptr) const;
127
130
131 static constexpr const char* s_tag{"setBatteryCurrent"};
132 static constexpr size_t s_tag_len{1};
133 static constexpr size_t s_cmd_len{2};
134 static constexpr size_t s_reply_len{0};
135 static constexpr const char* s_prototype{"void FakeBatteryService::setBatteryCurrent(const double current)"};
136 static constexpr const char* s_help{""};
137};
138
139// setBatteryCharge helper class declaration
141 public yarp::os::Portable
142{
143public:
145 explicit FakeBatteryService_setBatteryCharge_helper(const double charge);
146 bool write(yarp::os::ConnectionWriter& connection) const override;
147 bool read(yarp::os::ConnectionReader& connection) override;
148
149 class Command :
151 {
152 public:
153 Command() = default;
154 explicit Command(const double charge);
155
156 ~Command() override = default;
157
158 bool write(yarp::os::ConnectionWriter& connection) const override;
159 bool read(yarp::os::ConnectionReader& connection) override;
160
161 bool write(const yarp::os::idl::WireWriter& writer) const override;
162 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
163 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
164
165 bool read(yarp::os::idl::WireReader& reader) override;
168
169 double charge{0.0};
170 };
171
172 class Reply :
174 {
175 public:
176 Reply() = default;
177 ~Reply() override = default;
178
179 bool write(yarp::os::ConnectionWriter& connection) const override;
180 bool read(yarp::os::ConnectionReader& connection) override;
181
182 bool write(const yarp::os::idl::WireWriter& writer) const override;
183 bool read(yarp::os::idl::WireReader& reader) override;
184 };
185
186 using funcptr_t = void (*)(const double);
187 void call(FakeBatteryService* ptr) const;
188
191
192 static constexpr const char* s_tag{"setBatteryCharge"};
193 static constexpr size_t s_tag_len{1};
194 static constexpr size_t s_cmd_len{2};
195 static constexpr size_t s_reply_len{0};
196 static constexpr const char* s_prototype{"void FakeBatteryService::setBatteryCharge(const double charge)"};
197 static constexpr const char* s_help{""};
198};
199
200// setBatteryStatus helper class declaration
202 public yarp::os::Portable
203{
204public:
207 bool write(yarp::os::ConnectionWriter& connection) const override;
208 bool read(yarp::os::ConnectionReader& connection) override;
209
210 class Command :
212 {
213 public:
214 Command() = default;
216
217 ~Command() override = default;
218
219 bool write(yarp::os::ConnectionWriter& connection) const override;
220 bool read(yarp::os::ConnectionReader& connection) override;
221
222 bool write(const yarp::os::idl::WireWriter& writer) const override;
223 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
224 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
225
226 bool read(yarp::os::idl::WireReader& reader) override;
229
231 };
232
233 class Reply :
235 {
236 public:
237 Reply() = default;
238 ~Reply() override = default;
239
240 bool write(yarp::os::ConnectionWriter& connection) const override;
241 bool read(yarp::os::ConnectionReader& connection) override;
242
243 bool write(const yarp::os::idl::WireWriter& writer) const override;
244 bool read(yarp::os::idl::WireReader& reader) override;
245 };
246
248 void call(FakeBatteryService* ptr) const;
249
252
253 static constexpr const char* s_tag{"setBatteryStatus"};
254 static constexpr size_t s_tag_len{1};
255 static constexpr size_t s_cmd_len{2};
256 static constexpr size_t s_reply_len{0};
257 static constexpr const char* s_prototype{"void FakeBatteryService::setBatteryStatus(const yarp::dev::IBattery::Battery_status status)"};
258 static constexpr const char* s_help{""};
259};
260
261// setBatteryInfo helper class declaration
263 public yarp::os::Portable
264{
265public:
267 explicit FakeBatteryService_setBatteryInfo_helper(const std::string& info);
268 bool write(yarp::os::ConnectionWriter& connection) const override;
269 bool read(yarp::os::ConnectionReader& connection) override;
270
271 class Command :
273 {
274 public:
275 Command() = default;
276 explicit Command(const std::string& info);
277
278 ~Command() override = default;
279
280 bool write(yarp::os::ConnectionWriter& connection) const override;
281 bool read(yarp::os::ConnectionReader& connection) override;
282
283 bool write(const yarp::os::idl::WireWriter& writer) const override;
284 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
285 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
286
287 bool read(yarp::os::idl::WireReader& reader) override;
290
291 std::string info{};
292 };
293
294 class Reply :
296 {
297 public:
298 Reply() = default;
299 ~Reply() override = default;
300
301 bool write(yarp::os::ConnectionWriter& connection) const override;
302 bool read(yarp::os::ConnectionReader& connection) override;
303
304 bool write(const yarp::os::idl::WireWriter& writer) const override;
305 bool read(yarp::os::idl::WireReader& reader) override;
306 };
307
308 using funcptr_t = void (*)(const std::string&);
309 void call(FakeBatteryService* ptr) const;
310
313
314 static constexpr const char* s_tag{"setBatteryInfo"};
315 static constexpr size_t s_tag_len{1};
316 static constexpr size_t s_cmd_len{2};
317 static constexpr size_t s_reply_len{0};
318 static constexpr const char* s_prototype{"void FakeBatteryService::setBatteryInfo(const std::string& info)"};
319 static constexpr const char* s_help{""};
320};
321
322// setBatteryTemperature helper class declaration
324 public yarp::os::Portable
325{
326public:
328 explicit FakeBatteryService_setBatteryTemperature_helper(const double temperature);
329 bool write(yarp::os::ConnectionWriter& connection) const override;
330 bool read(yarp::os::ConnectionReader& connection) override;
331
332 class Command :
334 {
335 public:
336 Command() = default;
337 explicit Command(const double temperature);
338
339 ~Command() override = default;
340
341 bool write(yarp::os::ConnectionWriter& connection) const override;
342 bool read(yarp::os::ConnectionReader& connection) override;
343
344 bool write(const yarp::os::idl::WireWriter& writer) const override;
345 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
346 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
347
348 bool read(yarp::os::idl::WireReader& reader) override;
351
352 double temperature{0.0};
353 };
354
355 class Reply :
357 {
358 public:
359 Reply() = default;
360 ~Reply() override = default;
361
362 bool write(yarp::os::ConnectionWriter& connection) const override;
363 bool read(yarp::os::ConnectionReader& connection) override;
364
365 bool write(const yarp::os::idl::WireWriter& writer) const override;
366 bool read(yarp::os::idl::WireReader& reader) override;
367 };
368
369 using funcptr_t = void (*)(const double);
370 void call(FakeBatteryService* ptr) const;
371
374
375 static constexpr const char* s_tag{"setBatteryTemperature"};
376 static constexpr size_t s_tag_len{1};
377 static constexpr size_t s_cmd_len{2};
378 static constexpr size_t s_reply_len{0};
379 static constexpr const char* s_prototype{"void FakeBatteryService::setBatteryTemperature(const double temperature)"};
380 static constexpr const char* s_help{""};
381};
382
383// getBatteryVoltage helper class declaration
385 public yarp::os::Portable
386{
387public:
389 bool write(yarp::os::ConnectionWriter& connection) const override;
390 bool read(yarp::os::ConnectionReader& connection) override;
391
392 class Command :
394 {
395 public:
396 Command() = default;
397 ~Command() override = default;
398
399 bool write(yarp::os::ConnectionWriter& connection) const override;
400 bool read(yarp::os::ConnectionReader& connection) override;
401
402 bool write(const yarp::os::idl::WireWriter& writer) const override;
403 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
404 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
405
406 bool read(yarp::os::idl::WireReader& reader) override;
409 };
410
411 class Reply :
413 {
414 public:
415 Reply() = default;
416 ~Reply() override = default;
417
418 bool write(yarp::os::ConnectionWriter& connection) const override;
419 bool read(yarp::os::ConnectionReader& connection) override;
420
421 bool write(const yarp::os::idl::WireWriter& writer) const override;
422 bool read(yarp::os::idl::WireReader& reader) override;
423
424 double return_helper{0.0};
425 };
426
427 using funcptr_t = double (*)();
428 void call(FakeBatteryService* ptr);
429
432
433 static constexpr const char* s_tag{"getBatteryVoltage"};
434 static constexpr size_t s_tag_len{1};
435 static constexpr size_t s_cmd_len{1};
436 static constexpr size_t s_reply_len{1};
437 static constexpr const char* s_prototype{"double FakeBatteryService::getBatteryVoltage()"};
438 static constexpr const char* s_help{""};
439};
440
441// getBatteryCurrent helper class declaration
443 public yarp::os::Portable
444{
445public:
447 bool write(yarp::os::ConnectionWriter& connection) const override;
448 bool read(yarp::os::ConnectionReader& connection) override;
449
450 class Command :
452 {
453 public:
454 Command() = default;
455 ~Command() override = default;
456
457 bool write(yarp::os::ConnectionWriter& connection) const override;
458 bool read(yarp::os::ConnectionReader& connection) override;
459
460 bool write(const yarp::os::idl::WireWriter& writer) const override;
461 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
462 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
463
464 bool read(yarp::os::idl::WireReader& reader) override;
467 };
468
469 class Reply :
471 {
472 public:
473 Reply() = default;
474 ~Reply() override = default;
475
476 bool write(yarp::os::ConnectionWriter& connection) const override;
477 bool read(yarp::os::ConnectionReader& connection) override;
478
479 bool write(const yarp::os::idl::WireWriter& writer) const override;
480 bool read(yarp::os::idl::WireReader& reader) override;
481
482 double return_helper{0.0};
483 };
484
485 using funcptr_t = double (*)();
486 void call(FakeBatteryService* ptr);
487
490
491 static constexpr const char* s_tag{"getBatteryCurrent"};
492 static constexpr size_t s_tag_len{1};
493 static constexpr size_t s_cmd_len{1};
494 static constexpr size_t s_reply_len{1};
495 static constexpr const char* s_prototype{"double FakeBatteryService::getBatteryCurrent()"};
496 static constexpr const char* s_help{""};
497};
498
499// getBatteryCharge helper class declaration
501 public yarp::os::Portable
502{
503public:
505 bool write(yarp::os::ConnectionWriter& connection) const override;
506 bool read(yarp::os::ConnectionReader& connection) override;
507
508 class Command :
510 {
511 public:
512 Command() = default;
513 ~Command() override = default;
514
515 bool write(yarp::os::ConnectionWriter& connection) const override;
516 bool read(yarp::os::ConnectionReader& connection) override;
517
518 bool write(const yarp::os::idl::WireWriter& writer) const override;
519 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
520 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
521
522 bool read(yarp::os::idl::WireReader& reader) override;
525 };
526
527 class Reply :
529 {
530 public:
531 Reply() = default;
532 ~Reply() override = default;
533
534 bool write(yarp::os::ConnectionWriter& connection) const override;
535 bool read(yarp::os::ConnectionReader& connection) override;
536
537 bool write(const yarp::os::idl::WireWriter& writer) const override;
538 bool read(yarp::os::idl::WireReader& reader) override;
539
540 double return_helper{0.0};
541 };
542
543 using funcptr_t = double (*)();
544 void call(FakeBatteryService* ptr);
545
548
549 static constexpr const char* s_tag{"getBatteryCharge"};
550 static constexpr size_t s_tag_len{1};
551 static constexpr size_t s_cmd_len{1};
552 static constexpr size_t s_reply_len{1};
553 static constexpr const char* s_prototype{"double FakeBatteryService::getBatteryCharge()"};
554 static constexpr const char* s_help{""};
555};
556
557// getBatteryStatus helper class declaration
559 public yarp::os::Portable
560{
561public:
563 bool write(yarp::os::ConnectionWriter& connection) const override;
564 bool read(yarp::os::ConnectionReader& connection) override;
565
566 class Command :
568 {
569 public:
570 Command() = default;
571 ~Command() override = default;
572
573 bool write(yarp::os::ConnectionWriter& connection) const override;
574 bool read(yarp::os::ConnectionReader& connection) override;
575
576 bool write(const yarp::os::idl::WireWriter& writer) const override;
577 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
578 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
579
580 bool read(yarp::os::idl::WireReader& reader) override;
583 };
584
585 class Reply :
587 {
588 public:
589 Reply() = default;
590 ~Reply() override = default;
591
592 bool write(yarp::os::ConnectionWriter& connection) const override;
593 bool read(yarp::os::ConnectionReader& connection) override;
594
595 bool write(const yarp::os::idl::WireWriter& writer) const override;
596 bool read(yarp::os::idl::WireReader& reader) override;
597
599 };
600
602 void call(FakeBatteryService* ptr);
603
606
607 static constexpr const char* s_tag{"getBatteryStatus"};
608 static constexpr size_t s_tag_len{1};
609 static constexpr size_t s_cmd_len{1};
610 static constexpr size_t s_reply_len{1};
611 static constexpr const char* s_prototype{"yarp::dev::IBattery::Battery_status FakeBatteryService::getBatteryStatus()"};
612 static constexpr const char* s_help{""};
613};
614
615// getBatteryStatusString helper class declaration
617 public yarp::os::Portable
618{
619public:
621 bool write(yarp::os::ConnectionWriter& connection) const override;
622 bool read(yarp::os::ConnectionReader& connection) override;
623
624 class Command :
626 {
627 public:
628 Command() = default;
629 ~Command() override = default;
630
631 bool write(yarp::os::ConnectionWriter& connection) const override;
632 bool read(yarp::os::ConnectionReader& connection) override;
633
634 bool write(const yarp::os::idl::WireWriter& writer) const override;
635 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
636 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
637
638 bool read(yarp::os::idl::WireReader& reader) override;
641 };
642
643 class Reply :
645 {
646 public:
647 Reply() = default;
648 ~Reply() override = default;
649
650 bool write(yarp::os::ConnectionWriter& connection) const override;
651 bool read(yarp::os::ConnectionReader& connection) override;
652
653 bool write(const yarp::os::idl::WireWriter& writer) const override;
654 bool read(yarp::os::idl::WireReader& reader) override;
655
656 std::string return_helper{};
657 };
658
659 using funcptr_t = std::string (*)();
660 void call(FakeBatteryService* ptr);
661
664
665 static constexpr const char* s_tag{"getBatteryStatusString"};
666 static constexpr size_t s_tag_len{1};
667 static constexpr size_t s_cmd_len{1};
668 static constexpr size_t s_reply_len{1};
669 static constexpr const char* s_prototype{"std::string FakeBatteryService::getBatteryStatusString()"};
670 static constexpr const char* s_help{""};
671};
672
673// getBatteryInfo helper class declaration
675 public yarp::os::Portable
676{
677public:
679 bool write(yarp::os::ConnectionWriter& connection) const override;
680 bool read(yarp::os::ConnectionReader& connection) override;
681
682 class Command :
684 {
685 public:
686 Command() = default;
687 ~Command() override = default;
688
689 bool write(yarp::os::ConnectionWriter& connection) const override;
690 bool read(yarp::os::ConnectionReader& connection) override;
691
692 bool write(const yarp::os::idl::WireWriter& writer) const override;
693 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
694 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
695
696 bool read(yarp::os::idl::WireReader& reader) override;
699 };
700
701 class Reply :
703 {
704 public:
705 Reply() = default;
706 ~Reply() override = default;
707
708 bool write(yarp::os::ConnectionWriter& connection) const override;
709 bool read(yarp::os::ConnectionReader& connection) override;
710
711 bool write(const yarp::os::idl::WireWriter& writer) const override;
712 bool read(yarp::os::idl::WireReader& reader) override;
713
714 std::string return_helper{};
715 };
716
717 using funcptr_t = std::string (*)();
718 void call(FakeBatteryService* ptr);
719
722
723 static constexpr const char* s_tag{"getBatteryInfo"};
724 static constexpr size_t s_tag_len{1};
725 static constexpr size_t s_cmd_len{1};
726 static constexpr size_t s_reply_len{1};
727 static constexpr const char* s_prototype{"std::string FakeBatteryService::getBatteryInfo()"};
728 static constexpr const char* s_help{""};
729};
730
731// getBatteryTemperature helper class declaration
733 public yarp::os::Portable
734{
735public:
737 bool write(yarp::os::ConnectionWriter& connection) const override;
738 bool read(yarp::os::ConnectionReader& connection) override;
739
740 class Command :
742 {
743 public:
744 Command() = default;
745 ~Command() override = default;
746
747 bool write(yarp::os::ConnectionWriter& connection) const override;
748 bool read(yarp::os::ConnectionReader& connection) override;
749
750 bool write(const yarp::os::idl::WireWriter& writer) const override;
751 bool writeTag(const yarp::os::idl::WireWriter& writer) const;
752 bool writeArgs(const yarp::os::idl::WireWriter& writer) const;
753
754 bool read(yarp::os::idl::WireReader& reader) override;
757 };
758
759 class Reply :
761 {
762 public:
763 Reply() = default;
764 ~Reply() override = default;
765
766 bool write(yarp::os::ConnectionWriter& connection) const override;
767 bool read(yarp::os::ConnectionReader& connection) override;
768
769 bool write(const yarp::os::idl::WireWriter& writer) const override;
770 bool read(yarp::os::idl::WireReader& reader) override;
771
772 double return_helper{0.0};
773 };
774
775 using funcptr_t = double (*)();
776 void call(FakeBatteryService* ptr);
777
780
781 static constexpr const char* s_tag{"getBatteryTemperature"};
782 static constexpr size_t s_tag_len{1};
783 static constexpr size_t s_cmd_len{1};
784 static constexpr size_t s_reply_len{1};
785 static constexpr const char* s_prototype{"double FakeBatteryService::getBatteryTemperature()"};
786 static constexpr const char* s_help{""};
787};
788
789// setBatteryVoltage helper class implementation
794
796{
797 return cmd.write(connection);
798}
799
804
806 voltage{voltage}
807{
808}
809
811{
812 yarp::os::idl::WireWriter writer(connection);
813 if (!writer.writeListHeader(s_cmd_len)) {
814 return false;
815 }
816 return write(writer);
817}
818
820{
821 yarp::os::idl::WireReader reader(connection);
822 if (!reader.readListHeader()) {
823 reader.fail();
824 return false;
825 }
826 return read(reader);
827}
828
830{
831 if (!writeTag(writer)) {
832 return false;
833 }
834 if (!writeArgs(writer)) {
835 return false;
836 }
837 return true;
838}
839
841{
842 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
843 return false;
844 }
845 return true;
846}
847
849{
850 if (!writer.writeFloat64(voltage)) {
851 return false;
852 }
853 return true;
854}
855
857{
858 if (!readTag(reader)) {
859 return false;
860 }
861 if (!readArgs(reader)) {
862 return false;
863 }
864 return true;
865}
866
868{
869 std::string tag = reader.readTag(s_tag_len);
870 if (reader.isError()) {
871 return false;
872 }
873 if (tag != s_tag) {
874 reader.fail();
875 return false;
876 }
877 return true;
878}
879
881{
882 if (reader.noMore()) {
883 reader.fail();
884 return false;
885 }
886 if (!reader.readFloat64(voltage)) {
887 reader.fail();
888 return false;
889 }
890 if (!reader.noMore()) {
891 reader.fail();
892 return false;
893 }
894 return true;
895}
896
898{
899 yarp::os::idl::WireWriter writer(connection);
900 return write(writer);
901}
902
908
910{
911 if (!writer.isNull()) {
912 if (!writer.writeOnewayResponse()) {
913 return false;
914 }
915 }
916 return true;
917}
918
920{
921 return true;
922}
923
928
929// setBatteryCurrent helper class implementation
934
936{
937 return cmd.write(connection);
938}
939
944
946 current{current}
947{
948}
949
951{
952 yarp::os::idl::WireWriter writer(connection);
953 if (!writer.writeListHeader(s_cmd_len)) {
954 return false;
955 }
956 return write(writer);
957}
958
960{
961 yarp::os::idl::WireReader reader(connection);
962 if (!reader.readListHeader()) {
963 reader.fail();
964 return false;
965 }
966 return read(reader);
967}
968
970{
971 if (!writeTag(writer)) {
972 return false;
973 }
974 if (!writeArgs(writer)) {
975 return false;
976 }
977 return true;
978}
979
981{
982 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
983 return false;
984 }
985 return true;
986}
987
989{
990 if (!writer.writeFloat64(current)) {
991 return false;
992 }
993 return true;
994}
995
997{
998 if (!readTag(reader)) {
999 return false;
1000 }
1001 if (!readArgs(reader)) {
1002 return false;
1003 }
1004 return true;
1005}
1006
1008{
1009 std::string tag = reader.readTag(s_tag_len);
1010 if (reader.isError()) {
1011 return false;
1012 }
1013 if (tag != s_tag) {
1014 reader.fail();
1015 return false;
1016 }
1017 return true;
1018}
1019
1021{
1022 if (reader.noMore()) {
1023 reader.fail();
1024 return false;
1025 }
1026 if (!reader.readFloat64(current)) {
1027 reader.fail();
1028 return false;
1029 }
1030 if (!reader.noMore()) {
1031 reader.fail();
1032 return false;
1033 }
1034 return true;
1035}
1036
1038{
1039 yarp::os::idl::WireWriter writer(connection);
1040 return write(writer);
1041}
1042
1044{
1045 yarp::os::idl::WireReader reader(connection);
1046 return read(reader);
1047}
1048
1050{
1051 if (!writer.isNull()) {
1052 if (!writer.writeOnewayResponse()) {
1053 return false;
1054 }
1055 }
1056 return true;
1057}
1058
1060{
1061 return true;
1062}
1063
1068
1069// setBatteryCharge helper class implementation
1074
1076{
1077 return cmd.write(connection);
1078}
1079
1081{
1082 return reply.read(connection);
1083}
1084
1086 charge{charge}
1087{
1088}
1089
1091{
1092 yarp::os::idl::WireWriter writer(connection);
1093 if (!writer.writeListHeader(s_cmd_len)) {
1094 return false;
1095 }
1096 return write(writer);
1097}
1098
1100{
1101 yarp::os::idl::WireReader reader(connection);
1102 if (!reader.readListHeader()) {
1103 reader.fail();
1104 return false;
1105 }
1106 return read(reader);
1107}
1108
1110{
1111 if (!writeTag(writer)) {
1112 return false;
1113 }
1114 if (!writeArgs(writer)) {
1115 return false;
1116 }
1117 return true;
1118}
1119
1121{
1122 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1123 return false;
1124 }
1125 return true;
1126}
1127
1129{
1130 if (!writer.writeFloat64(charge)) {
1131 return false;
1132 }
1133 return true;
1134}
1135
1137{
1138 if (!readTag(reader)) {
1139 return false;
1140 }
1141 if (!readArgs(reader)) {
1142 return false;
1143 }
1144 return true;
1145}
1146
1148{
1149 std::string tag = reader.readTag(s_tag_len);
1150 if (reader.isError()) {
1151 return false;
1152 }
1153 if (tag != s_tag) {
1154 reader.fail();
1155 return false;
1156 }
1157 return true;
1158}
1159
1161{
1162 if (reader.noMore()) {
1163 reader.fail();
1164 return false;
1165 }
1166 if (!reader.readFloat64(charge)) {
1167 reader.fail();
1168 return false;
1169 }
1170 if (!reader.noMore()) {
1171 reader.fail();
1172 return false;
1173 }
1174 return true;
1175}
1176
1178{
1179 yarp::os::idl::WireWriter writer(connection);
1180 return write(writer);
1181}
1182
1184{
1185 yarp::os::idl::WireReader reader(connection);
1186 return read(reader);
1187}
1188
1190{
1191 if (!writer.isNull()) {
1192 if (!writer.writeOnewayResponse()) {
1193 return false;
1194 }
1195 }
1196 return true;
1197}
1198
1200{
1201 return true;
1202}
1203
1208
1209// setBatteryStatus helper class implementation
1214
1216{
1217 return cmd.write(connection);
1218}
1219
1221{
1222 return reply.read(connection);
1223}
1224
1229
1231{
1232 yarp::os::idl::WireWriter writer(connection);
1233 if (!writer.writeListHeader(s_cmd_len)) {
1234 return false;
1235 }
1236 return write(writer);
1237}
1238
1240{
1241 yarp::os::idl::WireReader reader(connection);
1242 if (!reader.readListHeader()) {
1243 reader.fail();
1244 return false;
1245 }
1246 return read(reader);
1247}
1248
1250{
1251 if (!writeTag(writer)) {
1252 return false;
1253 }
1254 if (!writeArgs(writer)) {
1255 return false;
1256 }
1257 return true;
1258}
1259
1261{
1262 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1263 return false;
1264 }
1265 return true;
1266}
1267
1269{
1270 if (!writer.writeVocab32(static_cast<yarp::conf::vocab32_t>(status))) {
1271 return false;
1272 }
1273 return true;
1274}
1275
1277{
1278 if (!readTag(reader)) {
1279 return false;
1280 }
1281 if (!readArgs(reader)) {
1282 return false;
1283 }
1284 return true;
1285}
1286
1288{
1289 std::string tag = reader.readTag(s_tag_len);
1290 if (reader.isError()) {
1291 return false;
1292 }
1293 if (tag != s_tag) {
1294 reader.fail();
1295 return false;
1296 }
1297 return true;
1298}
1299
1301{
1302 if (reader.noMore()) {
1303 reader.fail();
1304 return false;
1305 }
1306 yarp::conf::vocab32_t _ecast;
1307 if (!reader.readVocab32(_ecast)) {
1308 reader.fail();
1309 return false;
1310 }
1311 status = static_cast<yarp::dev::IBattery::Battery_status>(_ecast);
1312 if (!reader.noMore()) {
1313 reader.fail();
1314 return false;
1315 }
1316 return true;
1317}
1318
1320{
1321 yarp::os::idl::WireWriter writer(connection);
1322 return write(writer);
1323}
1324
1326{
1327 yarp::os::idl::WireReader reader(connection);
1328 return read(reader);
1329}
1330
1332{
1333 if (!writer.isNull()) {
1334 if (!writer.writeOnewayResponse()) {
1335 return false;
1336 }
1337 }
1338 return true;
1339}
1340
1342{
1343 return true;
1344}
1345
1350
1351// setBatteryInfo helper class implementation
1356
1358{
1359 return cmd.write(connection);
1360}
1361
1363{
1364 return reply.read(connection);
1365}
1366
1371
1373{
1374 yarp::os::idl::WireWriter writer(connection);
1375 if (!writer.writeListHeader(s_cmd_len)) {
1376 return false;
1377 }
1378 return write(writer);
1379}
1380
1382{
1383 yarp::os::idl::WireReader reader(connection);
1384 if (!reader.readListHeader()) {
1385 reader.fail();
1386 return false;
1387 }
1388 return read(reader);
1389}
1390
1392{
1393 if (!writeTag(writer)) {
1394 return false;
1395 }
1396 if (!writeArgs(writer)) {
1397 return false;
1398 }
1399 return true;
1400}
1401
1403{
1404 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1405 return false;
1406 }
1407 return true;
1408}
1409
1411{
1412 if (!writer.writeString(info)) {
1413 return false;
1414 }
1415 return true;
1416}
1417
1419{
1420 if (!readTag(reader)) {
1421 return false;
1422 }
1423 if (!readArgs(reader)) {
1424 return false;
1425 }
1426 return true;
1427}
1428
1430{
1431 std::string tag = reader.readTag(s_tag_len);
1432 if (reader.isError()) {
1433 return false;
1434 }
1435 if (tag != s_tag) {
1436 reader.fail();
1437 return false;
1438 }
1439 return true;
1440}
1441
1443{
1444 if (reader.noMore()) {
1445 reader.fail();
1446 return false;
1447 }
1448 if (!reader.readString(info)) {
1449 reader.fail();
1450 return false;
1451 }
1452 if (!reader.noMore()) {
1453 reader.fail();
1454 return false;
1455 }
1456 return true;
1457}
1458
1460{
1461 yarp::os::idl::WireWriter writer(connection);
1462 return write(writer);
1463}
1464
1466{
1467 yarp::os::idl::WireReader reader(connection);
1468 return read(reader);
1469}
1470
1472{
1473 if (!writer.isNull()) {
1474 if (!writer.writeOnewayResponse()) {
1475 return false;
1476 }
1477 }
1478 return true;
1479}
1480
1482{
1483 return true;
1484}
1485
1490
1491// setBatteryTemperature helper class implementation
1496
1498{
1499 return cmd.write(connection);
1500}
1501
1506
1508 temperature{temperature}
1509{
1510}
1511
1513{
1514 yarp::os::idl::WireWriter writer(connection);
1515 if (!writer.writeListHeader(s_cmd_len)) {
1516 return false;
1517 }
1518 return write(writer);
1519}
1520
1522{
1523 yarp::os::idl::WireReader reader(connection);
1524 if (!reader.readListHeader()) {
1525 reader.fail();
1526 return false;
1527 }
1528 return read(reader);
1529}
1530
1532{
1533 if (!writeTag(writer)) {
1534 return false;
1535 }
1536 if (!writeArgs(writer)) {
1537 return false;
1538 }
1539 return true;
1540}
1541
1543{
1544 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1545 return false;
1546 }
1547 return true;
1548}
1549
1551{
1552 if (!writer.writeFloat64(temperature)) {
1553 return false;
1554 }
1555 return true;
1556}
1557
1559{
1560 if (!readTag(reader)) {
1561 return false;
1562 }
1563 if (!readArgs(reader)) {
1564 return false;
1565 }
1566 return true;
1567}
1568
1570{
1571 std::string tag = reader.readTag(s_tag_len);
1572 if (reader.isError()) {
1573 return false;
1574 }
1575 if (tag != s_tag) {
1576 reader.fail();
1577 return false;
1578 }
1579 return true;
1580}
1581
1583{
1584 if (reader.noMore()) {
1585 reader.fail();
1586 return false;
1587 }
1588 if (!reader.readFloat64(temperature)) {
1589 reader.fail();
1590 return false;
1591 }
1592 if (!reader.noMore()) {
1593 reader.fail();
1594 return false;
1595 }
1596 return true;
1597}
1598
1600{
1601 yarp::os::idl::WireWriter writer(connection);
1602 return write(writer);
1603}
1604
1606{
1607 yarp::os::idl::WireReader reader(connection);
1608 return read(reader);
1609}
1610
1612{
1613 if (!writer.isNull()) {
1614 if (!writer.writeOnewayResponse()) {
1615 return false;
1616 }
1617 }
1618 return true;
1619}
1620
1622{
1623 return true;
1624}
1625
1630
1631// getBatteryVoltage helper class implementation
1633{
1634 return cmd.write(connection);
1635}
1636
1641
1643{
1644 yarp::os::idl::WireWriter writer(connection);
1645 if (!writer.writeListHeader(s_cmd_len)) {
1646 return false;
1647 }
1648 return write(writer);
1649}
1650
1652{
1653 yarp::os::idl::WireReader reader(connection);
1654 if (!reader.readListHeader()) {
1655 reader.fail();
1656 return false;
1657 }
1658 return read(reader);
1659}
1660
1662{
1663 if (!writeTag(writer)) {
1664 return false;
1665 }
1666 if (!writeArgs(writer)) {
1667 return false;
1668 }
1669 return true;
1670}
1671
1673{
1674 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1675 return false;
1676 }
1677 return true;
1678}
1679
1681{
1682 return true;
1683}
1684
1686{
1687 if (!readTag(reader)) {
1688 return false;
1689 }
1690 if (!readArgs(reader)) {
1691 return false;
1692 }
1693 return true;
1694}
1695
1697{
1698 std::string tag = reader.readTag(s_tag_len);
1699 if (reader.isError()) {
1700 return false;
1701 }
1702 if (tag != s_tag) {
1703 reader.fail();
1704 return false;
1705 }
1706 return true;
1707}
1708
1710{
1711 if (!reader.noMore()) {
1712 reader.fail();
1713 return false;
1714 }
1715 return true;
1716}
1717
1719{
1720 yarp::os::idl::WireWriter writer(connection);
1721 return write(writer);
1722}
1723
1725{
1726 yarp::os::idl::WireReader reader(connection);
1727 return read(reader);
1728}
1729
1731{
1732 if (!writer.isNull()) {
1733 if (!writer.writeListHeader(s_reply_len)) {
1734 return false;
1735 }
1736 if (!writer.writeFloat64(return_helper)) {
1737 return false;
1738 }
1739 }
1740 return true;
1741}
1742
1744{
1745 if (!reader.readListReturn()) {
1746 return false;
1747 }
1748 if (reader.noMore()) {
1749 reader.fail();
1750 return false;
1751 }
1752 if (!reader.readFloat64(return_helper)) {
1753 reader.fail();
1754 return false;
1755 }
1756 return true;
1757}
1758
1763
1764// getBatteryCurrent helper class implementation
1766{
1767 return cmd.write(connection);
1768}
1769
1774
1776{
1777 yarp::os::idl::WireWriter writer(connection);
1778 if (!writer.writeListHeader(s_cmd_len)) {
1779 return false;
1780 }
1781 return write(writer);
1782}
1783
1785{
1786 yarp::os::idl::WireReader reader(connection);
1787 if (!reader.readListHeader()) {
1788 reader.fail();
1789 return false;
1790 }
1791 return read(reader);
1792}
1793
1795{
1796 if (!writeTag(writer)) {
1797 return false;
1798 }
1799 if (!writeArgs(writer)) {
1800 return false;
1801 }
1802 return true;
1803}
1804
1806{
1807 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1808 return false;
1809 }
1810 return true;
1811}
1812
1814{
1815 return true;
1816}
1817
1819{
1820 if (!readTag(reader)) {
1821 return false;
1822 }
1823 if (!readArgs(reader)) {
1824 return false;
1825 }
1826 return true;
1827}
1828
1830{
1831 std::string tag = reader.readTag(s_tag_len);
1832 if (reader.isError()) {
1833 return false;
1834 }
1835 if (tag != s_tag) {
1836 reader.fail();
1837 return false;
1838 }
1839 return true;
1840}
1841
1843{
1844 if (!reader.noMore()) {
1845 reader.fail();
1846 return false;
1847 }
1848 return true;
1849}
1850
1852{
1853 yarp::os::idl::WireWriter writer(connection);
1854 return write(writer);
1855}
1856
1858{
1859 yarp::os::idl::WireReader reader(connection);
1860 return read(reader);
1861}
1862
1864{
1865 if (!writer.isNull()) {
1866 if (!writer.writeListHeader(s_reply_len)) {
1867 return false;
1868 }
1869 if (!writer.writeFloat64(return_helper)) {
1870 return false;
1871 }
1872 }
1873 return true;
1874}
1875
1877{
1878 if (!reader.readListReturn()) {
1879 return false;
1880 }
1881 if (reader.noMore()) {
1882 reader.fail();
1883 return false;
1884 }
1885 if (!reader.readFloat64(return_helper)) {
1886 reader.fail();
1887 return false;
1888 }
1889 return true;
1890}
1891
1896
1897// getBatteryCharge helper class implementation
1899{
1900 return cmd.write(connection);
1901}
1902
1904{
1905 return reply.read(connection);
1906}
1907
1909{
1910 yarp::os::idl::WireWriter writer(connection);
1911 if (!writer.writeListHeader(s_cmd_len)) {
1912 return false;
1913 }
1914 return write(writer);
1915}
1916
1918{
1919 yarp::os::idl::WireReader reader(connection);
1920 if (!reader.readListHeader()) {
1921 reader.fail();
1922 return false;
1923 }
1924 return read(reader);
1925}
1926
1928{
1929 if (!writeTag(writer)) {
1930 return false;
1931 }
1932 if (!writeArgs(writer)) {
1933 return false;
1934 }
1935 return true;
1936}
1937
1939{
1940 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
1941 return false;
1942 }
1943 return true;
1944}
1945
1947{
1948 return true;
1949}
1950
1952{
1953 if (!readTag(reader)) {
1954 return false;
1955 }
1956 if (!readArgs(reader)) {
1957 return false;
1958 }
1959 return true;
1960}
1961
1963{
1964 std::string tag = reader.readTag(s_tag_len);
1965 if (reader.isError()) {
1966 return false;
1967 }
1968 if (tag != s_tag) {
1969 reader.fail();
1970 return false;
1971 }
1972 return true;
1973}
1974
1976{
1977 if (!reader.noMore()) {
1978 reader.fail();
1979 return false;
1980 }
1981 return true;
1982}
1983
1985{
1986 yarp::os::idl::WireWriter writer(connection);
1987 return write(writer);
1988}
1989
1991{
1992 yarp::os::idl::WireReader reader(connection);
1993 return read(reader);
1994}
1995
1997{
1998 if (!writer.isNull()) {
1999 if (!writer.writeListHeader(s_reply_len)) {
2000 return false;
2001 }
2002 if (!writer.writeFloat64(return_helper)) {
2003 return false;
2004 }
2005 }
2006 return true;
2007}
2008
2010{
2011 if (!reader.readListReturn()) {
2012 return false;
2013 }
2014 if (reader.noMore()) {
2015 reader.fail();
2016 return false;
2017 }
2018 if (!reader.readFloat64(return_helper)) {
2019 reader.fail();
2020 return false;
2021 }
2022 return true;
2023}
2024
2029
2030// getBatteryStatus helper class implementation
2032{
2033 return cmd.write(connection);
2034}
2035
2037{
2038 return reply.read(connection);
2039}
2040
2042{
2043 yarp::os::idl::WireWriter writer(connection);
2044 if (!writer.writeListHeader(s_cmd_len)) {
2045 return false;
2046 }
2047 return write(writer);
2048}
2049
2051{
2052 yarp::os::idl::WireReader reader(connection);
2053 if (!reader.readListHeader()) {
2054 reader.fail();
2055 return false;
2056 }
2057 return read(reader);
2058}
2059
2061{
2062 if (!writeTag(writer)) {
2063 return false;
2064 }
2065 if (!writeArgs(writer)) {
2066 return false;
2067 }
2068 return true;
2069}
2070
2072{
2073 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
2074 return false;
2075 }
2076 return true;
2077}
2078
2080{
2081 return true;
2082}
2083
2085{
2086 if (!readTag(reader)) {
2087 return false;
2088 }
2089 if (!readArgs(reader)) {
2090 return false;
2091 }
2092 return true;
2093}
2094
2096{
2097 std::string tag = reader.readTag(s_tag_len);
2098 if (reader.isError()) {
2099 return false;
2100 }
2101 if (tag != s_tag) {
2102 reader.fail();
2103 return false;
2104 }
2105 return true;
2106}
2107
2109{
2110 if (!reader.noMore()) {
2111 reader.fail();
2112 return false;
2113 }
2114 return true;
2115}
2116
2118{
2119 yarp::os::idl::WireWriter writer(connection);
2120 return write(writer);
2121}
2122
2124{
2125 yarp::os::idl::WireReader reader(connection);
2126 return read(reader);
2127}
2128
2130{
2131 if (!writer.isNull()) {
2132 if (!writer.writeListHeader(s_reply_len)) {
2133 return false;
2134 }
2135 if (!writer.writeVocab32(static_cast<yarp::conf::vocab32_t>(return_helper))) {
2136 return false;
2137 }
2138 }
2139 return true;
2140}
2141
2143{
2144 if (!reader.readListReturn()) {
2145 return false;
2146 }
2147 if (reader.noMore()) {
2148 reader.fail();
2149 return false;
2150 }
2151 yarp::conf::vocab32_t _ecast;
2152 if (!reader.readVocab32(_ecast)) {
2153 reader.fail();
2154 return false;
2155 }
2156 return_helper = static_cast<yarp::dev::IBattery::Battery_status>(_ecast);
2157 return true;
2158}
2159
2164
2165// getBatteryStatusString helper class implementation
2167{
2168 return cmd.write(connection);
2169}
2170
2175
2177{
2178 yarp::os::idl::WireWriter writer(connection);
2179 if (!writer.writeListHeader(s_cmd_len)) {
2180 return false;
2181 }
2182 return write(writer);
2183}
2184
2186{
2187 yarp::os::idl::WireReader reader(connection);
2188 if (!reader.readListHeader()) {
2189 reader.fail();
2190 return false;
2191 }
2192 return read(reader);
2193}
2194
2196{
2197 if (!writeTag(writer)) {
2198 return false;
2199 }
2200 if (!writeArgs(writer)) {
2201 return false;
2202 }
2203 return true;
2204}
2205
2207{
2208 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
2209 return false;
2210 }
2211 return true;
2212}
2213
2215{
2216 return true;
2217}
2218
2220{
2221 if (!readTag(reader)) {
2222 return false;
2223 }
2224 if (!readArgs(reader)) {
2225 return false;
2226 }
2227 return true;
2228}
2229
2231{
2232 std::string tag = reader.readTag(s_tag_len);
2233 if (reader.isError()) {
2234 return false;
2235 }
2236 if (tag != s_tag) {
2237 reader.fail();
2238 return false;
2239 }
2240 return true;
2241}
2242
2244{
2245 if (!reader.noMore()) {
2246 reader.fail();
2247 return false;
2248 }
2249 return true;
2250}
2251
2253{
2254 yarp::os::idl::WireWriter writer(connection);
2255 return write(writer);
2256}
2257
2263
2265{
2266 if (!writer.isNull()) {
2267 if (!writer.writeListHeader(s_reply_len)) {
2268 return false;
2269 }
2270 if (!writer.writeString(return_helper)) {
2271 return false;
2272 }
2273 }
2274 return true;
2275}
2276
2278{
2279 if (!reader.readListReturn()) {
2280 return false;
2281 }
2282 if (reader.noMore()) {
2283 reader.fail();
2284 return false;
2285 }
2286 if (!reader.readString(return_helper)) {
2287 reader.fail();
2288 return false;
2289 }
2290 return true;
2291}
2292
2297
2298// getBatteryInfo helper class implementation
2300{
2301 return cmd.write(connection);
2302}
2303
2305{
2306 return reply.read(connection);
2307}
2308
2310{
2311 yarp::os::idl::WireWriter writer(connection);
2312 if (!writer.writeListHeader(s_cmd_len)) {
2313 return false;
2314 }
2315 return write(writer);
2316}
2317
2319{
2320 yarp::os::idl::WireReader reader(connection);
2321 if (!reader.readListHeader()) {
2322 reader.fail();
2323 return false;
2324 }
2325 return read(reader);
2326}
2327
2329{
2330 if (!writeTag(writer)) {
2331 return false;
2332 }
2333 if (!writeArgs(writer)) {
2334 return false;
2335 }
2336 return true;
2337}
2338
2340{
2341 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
2342 return false;
2343 }
2344 return true;
2345}
2346
2348{
2349 return true;
2350}
2351
2353{
2354 if (!readTag(reader)) {
2355 return false;
2356 }
2357 if (!readArgs(reader)) {
2358 return false;
2359 }
2360 return true;
2361}
2362
2364{
2365 std::string tag = reader.readTag(s_tag_len);
2366 if (reader.isError()) {
2367 return false;
2368 }
2369 if (tag != s_tag) {
2370 reader.fail();
2371 return false;
2372 }
2373 return true;
2374}
2375
2377{
2378 if (!reader.noMore()) {
2379 reader.fail();
2380 return false;
2381 }
2382 return true;
2383}
2384
2386{
2387 yarp::os::idl::WireWriter writer(connection);
2388 return write(writer);
2389}
2390
2392{
2393 yarp::os::idl::WireReader reader(connection);
2394 return read(reader);
2395}
2396
2398{
2399 if (!writer.isNull()) {
2400 if (!writer.writeListHeader(s_reply_len)) {
2401 return false;
2402 }
2403 if (!writer.writeString(return_helper)) {
2404 return false;
2405 }
2406 }
2407 return true;
2408}
2409
2411{
2412 if (!reader.readListReturn()) {
2413 return false;
2414 }
2415 if (reader.noMore()) {
2416 reader.fail();
2417 return false;
2418 }
2419 if (!reader.readString(return_helper)) {
2420 reader.fail();
2421 return false;
2422 }
2423 return true;
2424}
2425
2430
2431// getBatteryTemperature helper class implementation
2433{
2434 return cmd.write(connection);
2435}
2436
2441
2443{
2444 yarp::os::idl::WireWriter writer(connection);
2445 if (!writer.writeListHeader(s_cmd_len)) {
2446 return false;
2447 }
2448 return write(writer);
2449}
2450
2452{
2453 yarp::os::idl::WireReader reader(connection);
2454 if (!reader.readListHeader()) {
2455 reader.fail();
2456 return false;
2457 }
2458 return read(reader);
2459}
2460
2462{
2463 if (!writeTag(writer)) {
2464 return false;
2465 }
2466 if (!writeArgs(writer)) {
2467 return false;
2468 }
2469 return true;
2470}
2471
2473{
2474 if (!writer.writeTag(s_tag, 1, s_tag_len)) {
2475 return false;
2476 }
2477 return true;
2478}
2479
2481{
2482 return true;
2483}
2484
2486{
2487 if (!readTag(reader)) {
2488 return false;
2489 }
2490 if (!readArgs(reader)) {
2491 return false;
2492 }
2493 return true;
2494}
2495
2497{
2498 std::string tag = reader.readTag(s_tag_len);
2499 if (reader.isError()) {
2500 return false;
2501 }
2502 if (tag != s_tag) {
2503 reader.fail();
2504 return false;
2505 }
2506 return true;
2507}
2508
2510{
2511 if (!reader.noMore()) {
2512 reader.fail();
2513 return false;
2514 }
2515 return true;
2516}
2517
2519{
2520 yarp::os::idl::WireWriter writer(connection);
2521 return write(writer);
2522}
2523
2525{
2526 yarp::os::idl::WireReader reader(connection);
2527 return read(reader);
2528}
2529
2531{
2532 if (!writer.isNull()) {
2533 if (!writer.writeListHeader(s_reply_len)) {
2534 return false;
2535 }
2536 if (!writer.writeFloat64(return_helper)) {
2537 return false;
2538 }
2539 }
2540 return true;
2541}
2542
2544{
2545 if (!reader.readListReturn()) {
2546 return false;
2547 }
2548 if (reader.noMore()) {
2549 reader.fail();
2550 return false;
2551 }
2552 if (!reader.readFloat64(return_helper)) {
2553 reader.fail();
2554 return false;
2555 }
2556 return true;
2557}
2558
2563
2564// Constructor
2566{
2567 yarp().setOwner(*this);
2568}
2569
2571{
2572 if (!yarp().canWrite()) {
2574 }
2576 yarp().write(helper);
2577}
2578
2580{
2581 if (!yarp().canWrite()) {
2583 }
2585 yarp().write(helper);
2586}
2587
2589{
2590 if (!yarp().canWrite()) {
2592 }
2594 yarp().write(helper);
2595}
2596
2598{
2599 if (!yarp().canWrite()) {
2601 }
2603 yarp().write(helper);
2604}
2605
2607{
2608 if (!yarp().canWrite()) {
2609 yError("Missing server method '%s'?", FakeBatteryService_setBatteryInfo_helper::s_prototype);
2610 }
2612 yarp().write(helper);
2613}
2614
2615void FakeBatteryService::setBatteryTemperature(const double temperature)
2616{
2617 if (!yarp().canWrite()) {
2619 }
2621 yarp().write(helper);
2622}
2623
2625{
2626 if (!yarp().canWrite()) {
2628 }
2630 bool ok = yarp().write(helper, helper);
2631 return ok ? helper.reply.return_helper : double{};
2632}
2633
2635{
2636 if (!yarp().canWrite()) {
2638 }
2640 bool ok = yarp().write(helper, helper);
2641 return ok ? helper.reply.return_helper : double{};
2642}
2643
2645{
2646 if (!yarp().canWrite()) {
2648 }
2650 bool ok = yarp().write(helper, helper);
2651 return ok ? helper.reply.return_helper : double{};
2652}
2653
2655{
2656 if (!yarp().canWrite()) {
2658 }
2660 bool ok = yarp().write(helper, helper);
2661 return ok ? helper.reply.return_helper : yarp::dev::IBattery::Battery_status{};
2662}
2663
2665{
2666 if (!yarp().canWrite()) {
2668 }
2670 bool ok = yarp().write(helper, helper);
2671 return ok ? helper.reply.return_helper : std::string{};
2672}
2673
2675{
2676 if (!yarp().canWrite()) {
2677 yError("Missing server method '%s'?", FakeBatteryService_getBatteryInfo_helper::s_prototype);
2678 }
2680 bool ok = yarp().write(helper, helper);
2681 return ok ? helper.reply.return_helper : std::string{};
2682}
2683
2685{
2686 if (!yarp().canWrite()) {
2688 }
2690 bool ok = yarp().write(helper, helper);
2691 return ok ? helper.reply.return_helper : double{};
2692}
2693
2694// help method
2695std::vector<std::string> FakeBatteryService::help(const std::string& functionName)
2696{
2697 bool showAll = (functionName == "--all");
2698 std::vector<std::string> helpString;
2699 if (showAll) {
2700 helpString.emplace_back("*** Available commands:");
2705 helpString.emplace_back(FakeBatteryService_setBatteryInfo_helper::s_tag);
2712 helpString.emplace_back(FakeBatteryService_getBatteryInfo_helper::s_tag);
2714 helpString.emplace_back("help");
2715 } else {
2718 }
2721 }
2724 }
2727 }
2730 }
2733 }
2736 }
2739 }
2742 }
2745 }
2748 }
2751 }
2754 }
2755 if (functionName == "help") {
2756 helpString.emplace_back("std::vector<std::string> help(const std::string& functionName = \"--all\")");
2757 helpString.emplace_back("Return list of available commands, or help message for a specific function");
2758 helpString.emplace_back("@param functionName name of command for which to get a detailed description. If none or '--all' is provided, print list of available commands");
2759 helpString.emplace_back("@return list of strings (one string per line)");
2760 }
2761 }
2762 if (helpString.empty()) {
2763 helpString.emplace_back("Command not found");
2764 }
2765 return helpString;
2766}
2767
2768// read from ConnectionReader
2770{
2771 constexpr size_t max_tag_len = 1;
2772 size_t tag_len = 1;
2773
2774 yarp::os::idl::WireReader reader(connection);
2775 reader.expectAccept();
2776 if (!reader.readListHeader()) {
2777 reader.fail();
2778 return false;
2779 }
2780
2781 std::string tag = reader.readTag(1);
2782 bool direct = (tag == "__direct__");
2783 if (direct) {
2784 tag = reader.readTag(1);
2785 }
2786 while (tag_len <= max_tag_len && !reader.isError()) {
2789 if (!helper.cmd.readArgs(reader)) {
2790 return false;
2791 }
2792
2793 if (!direct) {
2794 yarp().callback(helper, *this, "__direct__");
2795 } else {
2796 helper.call(this);
2797 }
2798
2799 yarp::os::idl::WireWriter writer(reader);
2800 if (!helper.reply.write(writer)) {
2801 return false;
2802 }
2803 reader.accept();
2804 return true;
2805 }
2808 if (!helper.cmd.readArgs(reader)) {
2809 return false;
2810 }
2811
2812 if (!direct) {
2813 yarp().callback(helper, *this, "__direct__");
2814 } else {
2815 helper.call(this);
2816 }
2817
2818 yarp::os::idl::WireWriter writer(reader);
2819 if (!helper.reply.write(writer)) {
2820 return false;
2821 }
2822 reader.accept();
2823 return true;
2824 }
2827 if (!helper.cmd.readArgs(reader)) {
2828 return false;
2829 }
2830
2831 if (!direct) {
2832 yarp().callback(helper, *this, "__direct__");
2833 } else {
2834 helper.call(this);
2835 }
2836
2837 yarp::os::idl::WireWriter writer(reader);
2838 if (!helper.reply.write(writer)) {
2839 return false;
2840 }
2841 reader.accept();
2842 return true;
2843 }
2846 if (!helper.cmd.readArgs(reader)) {
2847 return false;
2848 }
2849
2850 if (!direct) {
2851 yarp().callback(helper, *this, "__direct__");
2852 } else {
2853 helper.call(this);
2854 }
2855
2856 yarp::os::idl::WireWriter writer(reader);
2857 if (!helper.reply.write(writer)) {
2858 return false;
2859 }
2860 reader.accept();
2861 return true;
2862 }
2865 if (!helper.cmd.readArgs(reader)) {
2866 return false;
2867 }
2868
2869 if (!direct) {
2870 yarp().callback(helper, *this, "__direct__");
2871 } else {
2872 helper.call(this);
2873 }
2874
2875 yarp::os::idl::WireWriter writer(reader);
2876 if (!helper.reply.write(writer)) {
2877 return false;
2878 }
2879 reader.accept();
2880 return true;
2881 }
2884 if (!helper.cmd.readArgs(reader)) {
2885 return false;
2886 }
2887
2888 if (!direct) {
2889 yarp().callback(helper, *this, "__direct__");
2890 } else {
2891 helper.call(this);
2892 }
2893
2894 yarp::os::idl::WireWriter writer(reader);
2895 if (!helper.reply.write(writer)) {
2896 return false;
2897 }
2898 reader.accept();
2899 return true;
2900 }
2903 if (!helper.cmd.readArgs(reader)) {
2904 return false;
2905 }
2906
2907 helper.call(this);
2908
2909 yarp::os::idl::WireWriter writer(reader);
2910 if (!helper.reply.write(writer)) {
2911 return false;
2912 }
2913 reader.accept();
2914 return true;
2915 }
2918 if (!helper.cmd.readArgs(reader)) {
2919 return false;
2920 }
2921
2922 helper.call(this);
2923
2924 yarp::os::idl::WireWriter writer(reader);
2925 if (!helper.reply.write(writer)) {
2926 return false;
2927 }
2928 reader.accept();
2929 return true;
2930 }
2933 if (!helper.cmd.readArgs(reader)) {
2934 return false;
2935 }
2936
2937 helper.call(this);
2938
2939 yarp::os::idl::WireWriter writer(reader);
2940 if (!helper.reply.write(writer)) {
2941 return false;
2942 }
2943 reader.accept();
2944 return true;
2945 }
2948 if (!helper.cmd.readArgs(reader)) {
2949 return false;
2950 }
2951
2952 helper.call(this);
2953
2954 yarp::os::idl::WireWriter writer(reader);
2955 if (!helper.reply.write(writer)) {
2956 return false;
2957 }
2958 reader.accept();
2959 return true;
2960 }
2963 if (!helper.cmd.readArgs(reader)) {
2964 return false;
2965 }
2966
2967 helper.call(this);
2968
2969 yarp::os::idl::WireWriter writer(reader);
2970 if (!helper.reply.write(writer)) {
2971 return false;
2972 }
2973 reader.accept();
2974 return true;
2975 }
2978 if (!helper.cmd.readArgs(reader)) {
2979 return false;
2980 }
2981
2982 helper.call(this);
2983
2984 yarp::os::idl::WireWriter writer(reader);
2985 if (!helper.reply.write(writer)) {
2986 return false;
2987 }
2988 reader.accept();
2989 return true;
2990 }
2993 if (!helper.cmd.readArgs(reader)) {
2994 return false;
2995 }
2996
2997 helper.call(this);
2998
2999 yarp::os::idl::WireWriter writer(reader);
3000 if (!helper.reply.write(writer)) {
3001 return false;
3002 }
3003 reader.accept();
3004 return true;
3005 }
3006 if (tag == "help") {
3007 std::string functionName;
3008 if (!reader.readString(functionName)) {
3009 functionName = "--all";
3010 }
3011 auto help_strings = help(functionName);
3012 yarp::os::idl::WireWriter writer(reader);
3013 if (!writer.isNull()) {
3014 if (!writer.writeListHeader(2)) {
3015 return false;
3016 }
3017 if (!writer.writeTag("many", 1, 0)) {
3018 return false;
3019 }
3020 if (!writer.writeListBegin(0, help_strings.size())) {
3021 return false;
3022 }
3023 for (const auto& help_string : help_strings) {
3024 if (!writer.writeString(help_string)) {
3025 return false;
3026 }
3027 }
3028 if (!writer.writeListEnd()) {
3029 return false;
3030 }
3031 }
3032 reader.accept();
3033 return true;
3034 }
3035 if (reader.noMore()) {
3036 reader.fail();
3037 return false;
3038 }
3039 std::string next_tag = reader.readTag(1);
3040 if (next_tag.empty()) {
3041 break;
3042 }
3043 tag.append("_").append(next_tag);
3044 tag_len = std::count(tag.begin(), tag.end(), '_') + 1;
3045 }
3046 return false;
3047}
#define yError(...)
Definition Log.h:361
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
yarp::dev::IBattery::Battery_status return_helper
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
yarp::dev::IBattery::Battery_status(*)() funcptr_t
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(FakeBatteryService *ptr) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(FakeBatteryService *ptr) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readArgs(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(FakeBatteryService *ptr) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool readArgs(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void call(FakeBatteryService *ptr) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void(*)(const yarp::dev::IBattery::Battery_status) funcptr_t
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool readTag(yarp::os::idl::WireReader &reader)
bool readArgs(yarp::os::idl::WireReader &reader)
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool writeTag(const yarp::os::idl::WireWriter &writer) const
bool writeArgs(const yarp::os::idl::WireWriter &writer) const
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
void call(FakeBatteryService *ptr) const
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual std::string getBatteryInfo()
virtual void setBatteryStatus(const yarp::dev::IBattery::Battery_status status)
virtual double getBatteryVoltage()
virtual void setBatteryInfo(const std::string &info)
virtual void setBatteryTemperature(const double temperature)
virtual double getBatteryCharge()
virtual yarp::dev::IBattery::Battery_status getBatteryStatus()
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual void setBatteryCharge(const double charge)
virtual std::string getBatteryStatusString()
virtual void setBatteryVoltage(const double voltage)
virtual double getBatteryCurrent()
virtual std::vector< std::string > help(const std::string &functionName="--all")
virtual void setBatteryCurrent(const double current)
virtual double getBatteryTemperature()
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
Definition Portable.h:25
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
IDL-friendly connection reader.
Definition WireReader.h:27
bool readVocab32(yarp::conf::vocab32_t &x)
bool readString(std::string &str, bool *is_vocab=nullptr)
std::string readTag(size_t len=static_cast< size_t >(-1))
bool readFloat64(yarp::conf::float64_t &x)
IDL-friendly connection writer.
Definition WireWriter.h:28
bool writeVocab32(yarp::conf::vocab32_t x, bool skip_tag=false) const
bool writeListHeader(int len) const
bool writeTag(const char *tag, int split, int len) const
bool writeFloat64(yarp::conf::float64_t x, bool skip_tag=false) const
bool writeOnewayResponse() const
bool writeString(const std::string &str, bool skip_tag=false) const
bool writeListBegin(int tag, size_t len) const
std::int32_t vocab32_t
Definition numeric.h:78
The main, catch-all namespace for YARP.
Definition dirs.h:16