YARP
Yet Another Robot Platform
BatteryState.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 // This is an automatically generated file.
10 
11 // Generated from the following "sensor_msgs/BatteryState" msg definition:
12 //
13 // # Constants are chosen to match the enums in the linux kernel
14 // # defined in include/linux/power_supply.h as of version 3.7
15 // # The one difference is for style reasons the constants are
16 // # all uppercase not mixed case.
17 //
18 // # Power supply status constants
19 // uint8 POWER_SUPPLY_STATUS_UNKNOWN = 0
20 // uint8 POWER_SUPPLY_STATUS_CHARGING = 1
21 // uint8 POWER_SUPPLY_STATUS_DISCHARGING = 2
22 // uint8 POWER_SUPPLY_STATUS_NOT_CHARGING = 3
23 // uint8 POWER_SUPPLY_STATUS_FULL = 4
24 //
25 // # Power supply health constants
26 // uint8 POWER_SUPPLY_HEALTH_UNKNOWN = 0
27 // uint8 POWER_SUPPLY_HEALTH_GOOD = 1
28 // uint8 POWER_SUPPLY_HEALTH_OVERHEAT = 2
29 // uint8 POWER_SUPPLY_HEALTH_DEAD = 3
30 // uint8 POWER_SUPPLY_HEALTH_OVERVOLTAGE = 4
31 // uint8 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE = 5
32 // uint8 POWER_SUPPLY_HEALTH_COLD = 6
33 // uint8 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE = 7
34 // uint8 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE = 8
35 //
36 // # Power supply technology (chemistry) constants
37 // uint8 POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0
38 // uint8 POWER_SUPPLY_TECHNOLOGY_NIMH = 1
39 // uint8 POWER_SUPPLY_TECHNOLOGY_LION = 2
40 // uint8 POWER_SUPPLY_TECHNOLOGY_LIPO = 3
41 // uint8 POWER_SUPPLY_TECHNOLOGY_LIFE = 4
42 // uint8 POWER_SUPPLY_TECHNOLOGY_NICD = 5
43 // uint8 POWER_SUPPLY_TECHNOLOGY_LIMN = 6
44 //
45 // Header header
46 // float32 voltage # Voltage in Volts (Mandatory)
47 // float32 current # Negative when discharging (A) (If unmeasured NaN)
48 // float32 charge # Current charge in Ah (If unmeasured NaN)
49 // float32 capacity # Capacity in Ah (last full capacity) (If unmeasured NaN)
50 // float32 design_capacity # Capacity in Ah (design capacity) (If unmeasured NaN)
51 // float32 percentage # Charge percentage on 0 to 1 range (If unmeasured NaN)
52 // uint8 power_supply_status # The charging status as reported. Values defined above
53 // uint8 power_supply_health # The battery health metric. Values defined above
54 // uint8 power_supply_technology # The battery chemistry. Values defined above
55 // bool present # True if the battery is present
56 //
57 // float32[] cell_voltage # An array of individual cell voltages for each cell in the pack
58 // # If individual voltages unknown but number of cells known set each to NaN
59 // string location # The location into which the battery is inserted. (slot number or plug)
60 // string serial_number # The best approximation of the battery serial number
61 // Instances of this class can be read and written with YARP ports,
62 // using a ROS-compatible format.
63 
64 #ifndef YARP_ROSMSG_sensor_msgs_BatteryState_h
65 #define YARP_ROSMSG_sensor_msgs_BatteryState_h
66 
67 #include <yarp/os/Wire.h>
68 #include <yarp/os/Type.h>
69 #include <yarp/os/idl/WireTypes.h>
70 #include <string>
71 #include <vector>
73 
74 namespace yarp {
75 namespace rosmsg {
76 namespace sensor_msgs {
77 
79 {
80 public:
81  static const std::uint8_t POWER_SUPPLY_STATUS_UNKNOWN = 0;
82  static const std::uint8_t POWER_SUPPLY_STATUS_CHARGING = 1;
83  static const std::uint8_t POWER_SUPPLY_STATUS_DISCHARGING = 2;
84  static const std::uint8_t POWER_SUPPLY_STATUS_NOT_CHARGING = 3;
85  static const std::uint8_t POWER_SUPPLY_STATUS_FULL = 4;
86  static const std::uint8_t POWER_SUPPLY_HEALTH_UNKNOWN = 0;
87  static const std::uint8_t POWER_SUPPLY_HEALTH_GOOD = 1;
88  static const std::uint8_t POWER_SUPPLY_HEALTH_OVERHEAT = 2;
89  static const std::uint8_t POWER_SUPPLY_HEALTH_DEAD = 3;
90  static const std::uint8_t POWER_SUPPLY_HEALTH_OVERVOLTAGE = 4;
91  static const std::uint8_t POWER_SUPPLY_HEALTH_UNSPEC_FAILURE = 5;
92  static const std::uint8_t POWER_SUPPLY_HEALTH_COLD = 6;
93  static const std::uint8_t POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE = 7;
94  static const std::uint8_t POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE = 8;
95  static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0;
96  static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_NIMH = 1;
97  static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LION = 2;
98  static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LIPO = 3;
99  static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LIFE = 4;
100  static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_NICD = 5;
101  static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LIMN = 6;
109  std::uint8_t power_supply_status;
110  std::uint8_t power_supply_health;
112  bool present;
113  std::vector<yarp::conf::float32_t> cell_voltage;
114  std::string location;
115  std::string serial_number;
116 
118  header(),
119  voltage(0.0f),
120  current(0.0f),
121  charge(0.0f),
122  capacity(0.0f),
123  design_capacity(0.0f),
124  percentage(0.0f),
125  power_supply_status(0),
126  power_supply_health(0),
127  power_supply_technology(0),
128  present(false),
129  cell_voltage(),
130  location(""),
131  serial_number("")
132  {
133  }
134 
135  void clear()
136  {
137  // *** POWER_SUPPLY_STATUS_UNKNOWN ***
138 
139  // *** POWER_SUPPLY_STATUS_CHARGING ***
140 
141  // *** POWER_SUPPLY_STATUS_DISCHARGING ***
142 
143  // *** POWER_SUPPLY_STATUS_NOT_CHARGING ***
144 
145  // *** POWER_SUPPLY_STATUS_FULL ***
146 
147  // *** POWER_SUPPLY_HEALTH_UNKNOWN ***
148 
149  // *** POWER_SUPPLY_HEALTH_GOOD ***
150 
151  // *** POWER_SUPPLY_HEALTH_OVERHEAT ***
152 
153  // *** POWER_SUPPLY_HEALTH_DEAD ***
154 
155  // *** POWER_SUPPLY_HEALTH_OVERVOLTAGE ***
156 
157  // *** POWER_SUPPLY_HEALTH_UNSPEC_FAILURE ***
158 
159  // *** POWER_SUPPLY_HEALTH_COLD ***
160 
161  // *** POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE ***
162 
163  // *** POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE ***
164 
165  // *** POWER_SUPPLY_TECHNOLOGY_UNKNOWN ***
166 
167  // *** POWER_SUPPLY_TECHNOLOGY_NIMH ***
168 
169  // *** POWER_SUPPLY_TECHNOLOGY_LION ***
170 
171  // *** POWER_SUPPLY_TECHNOLOGY_LIPO ***
172 
173  // *** POWER_SUPPLY_TECHNOLOGY_LIFE ***
174 
175  // *** POWER_SUPPLY_TECHNOLOGY_NICD ***
176 
177  // *** POWER_SUPPLY_TECHNOLOGY_LIMN ***
178 
179  // *** header ***
180  header.clear();
181 
182  // *** voltage ***
183  voltage = 0.0f;
184 
185  // *** current ***
186  current = 0.0f;
187 
188  // *** charge ***
189  charge = 0.0f;
190 
191  // *** capacity ***
192  capacity = 0.0f;
193 
194  // *** design_capacity ***
195  design_capacity = 0.0f;
196 
197  // *** percentage ***
198  percentage = 0.0f;
199 
200  // *** power_supply_status ***
201  power_supply_status = 0;
202 
203  // *** power_supply_health ***
204  power_supply_health = 0;
205 
206  // *** power_supply_technology ***
207  power_supply_technology = 0;
208 
209  // *** present ***
210  present = false;
211 
212  // *** cell_voltage ***
213  cell_voltage.clear();
214 
215  // *** location ***
216  location = "";
217 
218  // *** serial_number ***
219  serial_number = "";
220  }
221 
222  bool readBare(yarp::os::ConnectionReader& connection) override
223  {
224  // *** header ***
225  if (!header.read(connection)) {
226  return false;
227  }
228 
229  // *** voltage ***
230  voltage = connection.expectFloat32();
231 
232  // *** current ***
233  current = connection.expectFloat32();
234 
235  // *** charge ***
236  charge = connection.expectFloat32();
237 
238  // *** capacity ***
239  capacity = connection.expectFloat32();
240 
241  // *** design_capacity ***
242  design_capacity = connection.expectFloat32();
243 
244  // *** percentage ***
245  percentage = connection.expectFloat32();
246 
247  // *** power_supply_status ***
248  power_supply_status = connection.expectInt8();
249 
250  // *** power_supply_health ***
251  power_supply_health = connection.expectInt8();
252 
253  // *** power_supply_technology ***
254  power_supply_technology = connection.expectInt8();
255 
256  // *** present ***
257  if (!connection.expectBlock((char*)&present, 1)) {
258  return false;
259  }
260 
261  // *** cell_voltage ***
262  int len = connection.expectInt32();
263  cell_voltage.resize(len);
264  if (len > 0 && !connection.expectBlock((char*)&cell_voltage[0], sizeof(yarp::conf::float32_t)*len)) {
265  return false;
266  }
267 
268  // *** location ***
269  len = connection.expectInt32();
270  location.resize(len);
271  if (!connection.expectBlock((char*)location.c_str(), len)) {
272  return false;
273  }
274 
275  // *** serial_number ***
276  len = connection.expectInt32();
277  serial_number.resize(len);
278  if (!connection.expectBlock((char*)serial_number.c_str(), len)) {
279  return false;
280  }
281 
282  return !connection.isError();
283  }
284 
285  bool readBottle(yarp::os::ConnectionReader& connection) override
286  {
287  connection.convertTextMode();
288  yarp::os::idl::WireReader reader(connection);
289  if (!reader.readListHeader(35)) {
290  return false;
291  }
292 
293  // *** header ***
294  if (!header.read(connection)) {
295  return false;
296  }
297 
298  // *** voltage ***
299  voltage = reader.expectFloat32();
300 
301  // *** current ***
302  current = reader.expectFloat32();
303 
304  // *** charge ***
305  charge = reader.expectFloat32();
306 
307  // *** capacity ***
308  capacity = reader.expectFloat32();
309 
310  // *** design_capacity ***
311  design_capacity = reader.expectFloat32();
312 
313  // *** percentage ***
314  percentage = reader.expectFloat32();
315 
316  // *** power_supply_status ***
317  power_supply_status = reader.expectInt8();
318 
319  // *** power_supply_health ***
320  power_supply_health = reader.expectInt8();
321 
322  // *** power_supply_technology ***
323  power_supply_technology = reader.expectInt8();
324 
325  // *** present ***
326  present = reader.expectInt8();
327 
328  // *** cell_voltage ***
329  if (connection.expectInt32() != (BOTTLE_TAG_LIST|BOTTLE_TAG_FLOAT32)) {
330  return false;
331  }
332  int len = connection.expectInt32();
333  cell_voltage.resize(len);
334  for (int i=0; i<len; i++) {
335  cell_voltage[i] = (yarp::conf::float32_t)connection.expectFloat32();
336  }
337 
338  // *** location ***
339  if (!reader.readString(location)) {
340  return false;
341  }
342 
343  // *** serial_number ***
344  if (!reader.readString(serial_number)) {
345  return false;
346  }
347 
348  return !connection.isError();
349  }
350 
352  bool read(yarp::os::ConnectionReader& connection) override
353  {
354  return (connection.isBareMode() ? readBare(connection)
355  : readBottle(connection));
356  }
357 
358  bool writeBare(yarp::os::ConnectionWriter& connection) const override
359  {
360  // *** header ***
361  if (!header.write(connection)) {
362  return false;
363  }
364 
365  // *** voltage ***
366  connection.appendFloat32(voltage);
367 
368  // *** current ***
369  connection.appendFloat32(current);
370 
371  // *** charge ***
372  connection.appendFloat32(charge);
373 
374  // *** capacity ***
375  connection.appendFloat32(capacity);
376 
377  // *** design_capacity ***
378  connection.appendFloat32(design_capacity);
379 
380  // *** percentage ***
381  connection.appendFloat32(percentage);
382 
383  // *** power_supply_status ***
384  connection.appendInt8(power_supply_status);
385 
386  // *** power_supply_health ***
387  connection.appendInt8(power_supply_health);
388 
389  // *** power_supply_technology ***
390  connection.appendInt8(power_supply_technology);
391 
392  // *** present ***
393  connection.appendBlock((char*)&present, 1);
394 
395  // *** cell_voltage ***
396  connection.appendInt32(cell_voltage.size());
397  if (cell_voltage.size()>0) {
398  connection.appendExternalBlock((char*)&cell_voltage[0], sizeof(yarp::conf::float32_t)*cell_voltage.size());
399  }
400 
401  // *** location ***
402  connection.appendInt32(location.length());
403  connection.appendExternalBlock((char*)location.c_str(), location.length());
404 
405  // *** serial_number ***
406  connection.appendInt32(serial_number.length());
407  connection.appendExternalBlock((char*)serial_number.c_str(), serial_number.length());
408 
409  return !connection.isError();
410  }
411 
412  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
413  {
414  connection.appendInt32(BOTTLE_TAG_LIST);
415  connection.appendInt32(35);
416 
417  // *** header ***
418  if (!header.write(connection)) {
419  return false;
420  }
421 
422  // *** voltage ***
423  connection.appendInt32(BOTTLE_TAG_FLOAT32);
424  connection.appendFloat32(voltage);
425 
426  // *** current ***
427  connection.appendInt32(BOTTLE_TAG_FLOAT32);
428  connection.appendFloat32(current);
429 
430  // *** charge ***
431  connection.appendInt32(BOTTLE_TAG_FLOAT32);
432  connection.appendFloat32(charge);
433 
434  // *** capacity ***
435  connection.appendInt32(BOTTLE_TAG_FLOAT32);
436  connection.appendFloat32(capacity);
437 
438  // *** design_capacity ***
439  connection.appendInt32(BOTTLE_TAG_FLOAT32);
440  connection.appendFloat32(design_capacity);
441 
442  // *** percentage ***
443  connection.appendInt32(BOTTLE_TAG_FLOAT32);
444  connection.appendFloat32(percentage);
445 
446  // *** power_supply_status ***
447  connection.appendInt32(BOTTLE_TAG_INT8);
448  connection.appendInt8(power_supply_status);
449 
450  // *** power_supply_health ***
451  connection.appendInt32(BOTTLE_TAG_INT8);
452  connection.appendInt8(power_supply_health);
453 
454  // *** power_supply_technology ***
455  connection.appendInt32(BOTTLE_TAG_INT8);
456  connection.appendInt8(power_supply_technology);
457 
458  // *** present ***
459  connection.appendInt32(BOTTLE_TAG_INT8);
460  connection.appendInt8(present);
461 
462  // *** cell_voltage ***
464  connection.appendInt32(cell_voltage.size());
465  for (size_t i=0; i<cell_voltage.size(); i++) {
466  connection.appendFloat32(cell_voltage[i]);
467  }
468 
469  // *** location ***
470  connection.appendInt32(BOTTLE_TAG_STRING);
471  connection.appendInt32(location.length());
472  connection.appendExternalBlock((char*)location.c_str(), location.length());
473 
474  // *** serial_number ***
475  connection.appendInt32(BOTTLE_TAG_STRING);
476  connection.appendInt32(serial_number.length());
477  connection.appendExternalBlock((char*)serial_number.c_str(), serial_number.length());
478 
479  connection.convertTextMode();
480  return !connection.isError();
481  }
482 
484  bool write(yarp::os::ConnectionWriter& connection) const override
485  {
486  return (connection.isBareMode() ? writeBare(connection)
487  : writeBottle(connection));
488  }
489 
490  // This class will serialize ROS style or YARP style depending on protocol.
491  // If you need to force a serialization style, use one of these classes:
494 
495  // The name for this message, ROS will need this
496  static constexpr const char* typeName = "sensor_msgs/BatteryState";
497 
498  // The checksum for this message, ROS will need this
499  static constexpr const char* typeChecksum = "476f837fa6771f6e16e3bf4ef96f8770";
500 
501  // The source text for this message, ROS will need this
502  static constexpr const char* typeText = "\
503 \n\
504 # Constants are chosen to match the enums in the linux kernel\n\
505 # defined in include/linux/power_supply.h as of version 3.7\n\
506 # The one difference is for style reasons the constants are\n\
507 # all uppercase not mixed case.\n\
508 \n\
509 # Power supply status constants\n\
510 uint8 POWER_SUPPLY_STATUS_UNKNOWN = 0\n\
511 uint8 POWER_SUPPLY_STATUS_CHARGING = 1\n\
512 uint8 POWER_SUPPLY_STATUS_DISCHARGING = 2\n\
513 uint8 POWER_SUPPLY_STATUS_NOT_CHARGING = 3\n\
514 uint8 POWER_SUPPLY_STATUS_FULL = 4\n\
515 \n\
516 # Power supply health constants\n\
517 uint8 POWER_SUPPLY_HEALTH_UNKNOWN = 0\n\
518 uint8 POWER_SUPPLY_HEALTH_GOOD = 1\n\
519 uint8 POWER_SUPPLY_HEALTH_OVERHEAT = 2\n\
520 uint8 POWER_SUPPLY_HEALTH_DEAD = 3\n\
521 uint8 POWER_SUPPLY_HEALTH_OVERVOLTAGE = 4\n\
522 uint8 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE = 5\n\
523 uint8 POWER_SUPPLY_HEALTH_COLD = 6\n\
524 uint8 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE = 7\n\
525 uint8 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE = 8\n\
526 \n\
527 # Power supply technology (chemistry) constants\n\
528 uint8 POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0\n\
529 uint8 POWER_SUPPLY_TECHNOLOGY_NIMH = 1\n\
530 uint8 POWER_SUPPLY_TECHNOLOGY_LION = 2\n\
531 uint8 POWER_SUPPLY_TECHNOLOGY_LIPO = 3\n\
532 uint8 POWER_SUPPLY_TECHNOLOGY_LIFE = 4\n\
533 uint8 POWER_SUPPLY_TECHNOLOGY_NICD = 5\n\
534 uint8 POWER_SUPPLY_TECHNOLOGY_LIMN = 6\n\
535 \n\
536 Header header\n\
537 float32 voltage # Voltage in Volts (Mandatory)\n\
538 float32 current # Negative when discharging (A) (If unmeasured NaN)\n\
539 float32 charge # Current charge in Ah (If unmeasured NaN)\n\
540 float32 capacity # Capacity in Ah (last full capacity) (If unmeasured NaN)\n\
541 float32 design_capacity # Capacity in Ah (design capacity) (If unmeasured NaN)\n\
542 float32 percentage # Charge percentage on 0 to 1 range (If unmeasured NaN)\n\
543 uint8 power_supply_status # The charging status as reported. Values defined above\n\
544 uint8 power_supply_health # The battery health metric. Values defined above\n\
545 uint8 power_supply_technology # The battery chemistry. Values defined above\n\
546 bool present # True if the battery is present\n\
547 \n\
548 float32[] cell_voltage # An array of individual cell voltages for each cell in the pack\n\
549  # If individual voltages unknown but number of cells known set each to NaN\n\
550 string location # The location into which the battery is inserted. (slot number or plug)\n\
551 string serial_number # The best approximation of the battery serial number\n\
552 \n\
553 ================================================================================\n\
554 MSG: std_msgs/Header\n\
555 # Standard metadata for higher-level stamped data types.\n\
556 # This is generally used to communicate timestamped data \n\
557 # in a particular coordinate frame.\n\
558 # \n\
559 # sequence ID: consecutively increasing ID \n\
560 uint32 seq\n\
561 #Two-integer timestamp that is expressed as:\n\
562 # * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
563 # * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
564 # time-handling sugar is provided by the client library\n\
565 time stamp\n\
566 #Frame this data is associated with\n\
567 # 0: no frame\n\
568 # 1: global frame\n\
569 string frame_id\n\
570 ";
571 
572  yarp::os::Type getType() const override
573  {
574  yarp::os::Type typ = yarp::os::Type::byName(typeName, typeName);
575  typ.addProperty("md5sum", yarp::os::Value(typeChecksum));
576  typ.addProperty("message_definition", yarp::os::Value(typeText));
577  return typ;
578  }
579 };
580 
581 } // namespace sensor_msgs
582 } // namespace rosmsg
583 } // namespace yarp
584 
585 #endif // YARP_ROSMSG_sensor_msgs_BatteryState_h
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
#define BOTTLE_TAG_STRING
Definition: Bottle.h:28
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
static const std::uint8_t POWER_SUPPLY_STATUS_CHARGING
Definition: BatteryState.h:82
static const std::uint8_t POWER_SUPPLY_HEALTH_DEAD
Definition: BatteryState.h:89
static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LIPO
Definition: BatteryState.h:98
static const std::uint8_t POWER_SUPPLY_STATUS_UNKNOWN
Definition: BatteryState.h:81
#define BOTTLE_TAG_INT8
Definition: Bottle.h:21
virtual void appendBlock(const char *data, size_t len)=0
Send a block of data to the network connection.
static Type byName(const char *name)
Definition: Type.cpp:176
virtual void appendFloat32(yarp::conf::float32_t data)=0
Send a representation of a 32-bit floating point number to the network connection.
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:138
std::int8_t expectInt8()
Definition: WireReader.h:87
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: BatteryState.h:484
static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_NICD
Definition: BatteryState.h:100
static const std::uint8_t POWER_SUPPLY_HEALTH_OVERVOLTAGE
Definition: BatteryState.h:90
static const std::uint8_t POWER_SUPPLY_HEALTH_GOOD
Definition: BatteryState.h:87
static const std::uint8_t POWER_SUPPLY_STATUS_FULL
Definition: BatteryState.h:85
#define BOTTLE_TAG_FLOAT32
Definition: Bottle.h:26
virtual bool isError() const =0
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: BatteryState.h:222
The main, catch-all namespace for YARP.
Definition: numeric.h:47
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary...
static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LIMN
Definition: BatteryState.h:101
static constexpr const char * typeName
Definition: BatteryState.h:496
static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_NIMH
Definition: BatteryState.h:96
virtual bool isBareMode() const =0
Check if the connection is bare mode.
static const std::uint8_t POWER_SUPPLY_STATUS_DISCHARGING
Definition: BatteryState.h:83
An interface for writing to a network connection.
static const std::uint8_t POWER_SUPPLY_STATUS_NOT_CHARGING
Definition: BatteryState.h:84
std::vector< yarp::conf::float32_t > cell_voltage
Definition: BatteryState.h:113
virtual bool write(const yarp::os::idl::WireWriter &writer) const
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
static const std::uint8_t POWER_SUPPLY_HEALTH_OVERHEAT
Definition: BatteryState.h:88
static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LIFE
Definition: BatteryState.h:99
virtual bool read(yarp::os::idl::WireReader &reader)
static const std::uint8_t POWER_SUPPLY_HEALTH_UNKNOWN
Definition: BatteryState.h:86
yarp::rosmsg::std_msgs::Header header
Definition: BatteryState.h:102
static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_UNKNOWN
Definition: BatteryState.h:95
virtual bool isError() const =0
static const std::uint8_t POWER_SUPPLY_HEALTH_COLD
Definition: BatteryState.h:92
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: Header.h:162
static constexpr const char * typeChecksum
Definition: BatteryState.h:499
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:33
virtual yarp::conf::float32_t expectFloat32()=0
Read a 32-bit floating point number from the network connection.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
yarp::os::idl::BareStyle< yarp::rosmsg::sensor_msgs::BatteryState > rosStyle
Definition: BatteryState.h:492
An interface for reading from a network connection.
static const std::uint8_t POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE
Definition: BatteryState.h:93
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: BatteryState.h:358
float float32_t
Definition: numeric.h:50
A single value (typically within a Bottle).
Definition: Value.h:46
yarp::conf::float32_t expectFloat32()
Definition: WireReader.h:113
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: BatteryState.h:412
static const std::uint8_t POWER_SUPPLY_HEALTH_UNSPEC_FAILURE
Definition: BatteryState.h:91
bool readString(std::string &str, bool *is_vocab=nullptr)
Definition: WireReader.cpp:330
virtual bool isBareMode() const =0
Check if the connection is bare mode.
static constexpr const char * typeText
Definition: BatteryState.h:502
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
yarp::os::Type getType() const override
Definition: BatteryState.h:572
static const std::uint8_t POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE
Definition: BatteryState.h:94
IDL-friendly connection reader.
Definition: WireReader.h:32
yarp::os::idl::BottleStyle< yarp::rosmsg::sensor_msgs::BatteryState > bottleStyle
Definition: BatteryState.h:493
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: Header.h:115
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: BatteryState.h:285
static const std::uint8_t POWER_SUPPLY_TECHNOLOGY_LION
Definition: BatteryState.h:97
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: BatteryState.h:352