YARP
Yet Another Robot Platform
NavSatStatus.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/NavSatStatus" msg definition:
12 // # Navigation Satellite fix status for any Global Navigation Satellite System
13 //
14 // # Whether to output an augmented fix is determined by both the fix
15 // # type and the last time differential corrections were received. A
16 // # fix is valid when status >= STATUS_FIX.
17 //
18 // int8 STATUS_NO_FIX = -1 # unable to fix position
19 // int8 STATUS_FIX = 0 # unaugmented fix
20 // int8 STATUS_SBAS_FIX = 1 # with satellite-based augmentation
21 // int8 STATUS_GBAS_FIX = 2 # with ground-based augmentation
22 //
23 // int8 status
24 //
25 // # Bits defining which Global Navigation Satellite System signals were
26 // # used by the receiver.
27 //
28 // uint16 SERVICE_GPS = 1
29 // uint16 SERVICE_GLONASS = 2
30 // uint16 SERVICE_COMPASS = 4 # includes BeiDou.
31 // uint16 SERVICE_GALILEO = 8
32 //
33 // uint16 service
34 // Instances of this class can be read and written with YARP ports,
35 // using a ROS-compatible format.
36 
37 #ifndef YARP_ROSMSG_sensor_msgs_NavSatStatus_h
38 #define YARP_ROSMSG_sensor_msgs_NavSatStatus_h
39 
40 #include <yarp/os/Wire.h>
41 #include <yarp/os/Type.h>
42 #include <yarp/os/idl/WireTypes.h>
43 #include <string>
44 #include <vector>
45 
46 namespace yarp {
47 namespace rosmsg {
48 namespace sensor_msgs {
49 
51 {
52 public:
53  static const std::int8_t STATUS_NO_FIX = -1;
54  static const std::int8_t STATUS_FIX = 0;
55  static const std::int8_t STATUS_SBAS_FIX = 1;
56  static const std::int8_t STATUS_GBAS_FIX = 2;
57  std::int8_t status;
58  static const std::uint16_t SERVICE_GPS = 1;
59  static const std::uint16_t SERVICE_GLONASS = 2;
60  static const std::uint16_t SERVICE_COMPASS = 4;
61  static const std::uint16_t SERVICE_GALILEO = 8;
62  std::uint16_t service;
63 
65  status(0),
66  service(0)
67  {
68  }
69 
70  void clear()
71  {
72  // *** STATUS_NO_FIX ***
73 
74  // *** STATUS_FIX ***
75 
76  // *** STATUS_SBAS_FIX ***
77 
78  // *** STATUS_GBAS_FIX ***
79 
80  // *** status ***
81  status = 0;
82 
83  // *** SERVICE_GPS ***
84 
85  // *** SERVICE_GLONASS ***
86 
87  // *** SERVICE_COMPASS ***
88 
89  // *** SERVICE_GALILEO ***
90 
91  // *** service ***
92  service = 0;
93  }
94 
95  bool readBare(yarp::os::ConnectionReader& connection) override
96  {
97  // *** status ***
98  status = connection.expectInt8();
99 
100  // *** service ***
101  service = connection.expectInt16();
102 
103  return !connection.isError();
104  }
105 
106  bool readBottle(yarp::os::ConnectionReader& connection) override
107  {
108  connection.convertTextMode();
109  yarp::os::idl::WireReader reader(connection);
110  if (!reader.readListHeader(10)) {
111  return false;
112  }
113 
114  // *** status ***
115  status = reader.expectInt8();
116 
117  // *** service ***
118  service = reader.expectInt16();
119 
120  return !connection.isError();
121  }
122 
124  bool read(yarp::os::ConnectionReader& connection) override
125  {
126  return (connection.isBareMode() ? readBare(connection)
127  : readBottle(connection));
128  }
129 
130  bool writeBare(yarp::os::ConnectionWriter& connection) const override
131  {
132  // *** status ***
133  connection.appendInt8(status);
134 
135  // *** service ***
136  connection.appendInt16(service);
137 
138  return !connection.isError();
139  }
140 
141  bool writeBottle(yarp::os::ConnectionWriter& connection) const override
142  {
143  connection.appendInt32(BOTTLE_TAG_LIST);
144  connection.appendInt32(10);
145 
146  // *** status ***
147  connection.appendInt32(BOTTLE_TAG_INT8);
148  connection.appendInt8(status);
149 
150  // *** service ***
151  connection.appendInt32(BOTTLE_TAG_INT16);
152  connection.appendInt16(service);
153 
154  connection.convertTextMode();
155  return !connection.isError();
156  }
157 
159  bool write(yarp::os::ConnectionWriter& connection) const override
160  {
161  return (connection.isBareMode() ? writeBare(connection)
162  : writeBottle(connection));
163  }
164 
165  // This class will serialize ROS style or YARP style depending on protocol.
166  // If you need to force a serialization style, use one of these classes:
169 
170  // Give source text for class, ROS will need this
171  static std::string typeText()
172  {
173  return std::string("\
174 # Navigation Satellite fix status for any Global Navigation Satellite System\n\
175 \n\
176 # Whether to output an augmented fix is determined by both the fix\n\
177 # type and the last time differential corrections were received. A\n\
178 # fix is valid when status >= STATUS_FIX.\n\
179 \n\
180 int8 STATUS_NO_FIX = -1 # unable to fix position\n\
181 int8 STATUS_FIX = 0 # unaugmented fix\n\
182 int8 STATUS_SBAS_FIX = 1 # with satellite-based augmentation\n\
183 int8 STATUS_GBAS_FIX = 2 # with ground-based augmentation\n\
184 \n\
185 int8 status\n\
186 \n\
187 # Bits defining which Global Navigation Satellite System signals were\n\
188 # used by the receiver.\n\
189 \n\
190 uint16 SERVICE_GPS = 1\n\
191 uint16 SERVICE_GLONASS = 2\n\
192 uint16 SERVICE_COMPASS = 4 # includes BeiDou.\n\
193 uint16 SERVICE_GALILEO = 8\n\
194 \n\
195 uint16 service\n\
196 ");
197  }
198 
199  std::string getTypeText() const
200  {
202  }
203 
204  // Name the class, ROS will need this
205  yarp::os::Type getType() const override
206  {
207  yarp::os::Type typ = yarp::os::Type::byName("sensor_msgs/NavSatStatus", "sensor_msgs/NavSatStatus");
208  typ.addProperty("md5sum", yarp::os::Value("331cdbddfa4bc96ffc3b9ad98900a54c"));
209  typ.addProperty("message_definition", yarp::os::Value(getTypeText()));
210  return typ;
211  }
212 };
213 
214 } // namespace sensor_msgs
215 } // namespace rosmsg
216 } // namespace yarp
217 
218 #endif // YARP_ROSMSG_sensor_msgs_NavSatStatus_h
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: NavSatStatus.h:124
virtual std::int8_t expectInt8()=0
Read a 8-bit integer from the network connection.
yarp::os::idl::BareStyle< yarp::rosmsg::sensor_msgs::NavSatStatus > rosStyle
Definition: NavSatStatus.h:167
#define BOTTLE_TAG_INT8
Definition: Bottle.h:21
static Type byName(const char *name)
Definition: Type.cpp:165
static const std::int8_t STATUS_NO_FIX
Definition: NavSatStatus.h:53
Type & addProperty(const char *key, const Value &val)
Definition: Type.cpp:127
std::int8_t expectInt8()
Definition: WireReader.h:85
static const std::uint16_t SERVICE_COMPASS
Definition: NavSatStatus.h:60
virtual bool isError() const =0
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...
virtual bool isBareMode() const =0
Check if the connection is bare mode.
bool writeBottle(yarp::os::ConnectionWriter &connection) const override
Definition: NavSatStatus.h:141
std::int16_t expectInt16()
Definition: WireReader.h:90
An interface for writing to a network connection.
static const std::int8_t STATUS_FIX
Definition: NavSatStatus.h:54
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::uint16_t SERVICE_GALILEO
Definition: NavSatStatus.h:61
virtual bool read(yarp::os::idl::WireReader &reader)
static const std::uint16_t SERVICE_GLONASS
Definition: NavSatStatus.h:59
virtual bool isError() const =0
static const std::int8_t STATUS_GBAS_FIX
Definition: NavSatStatus.h:56
bool readBottle(yarp::os::ConnectionReader &connection) override
Definition: NavSatStatus.h:106
virtual std::int16_t expectInt16()=0
Read a 16-bit integer from the network connection.
A "tamed" Portable, that promises to serialize itself in an IDL-friendly way.
Definition: WirePortable.h:30
yarp::os::Type getType() const override
Definition: NavSatStatus.h:205
bool readBare(yarp::os::ConnectionReader &connection) override
Definition: NavSatStatus.h:95
An interface for reading from a network connection.
virtual void appendInt16(std::int16_t data)=0
Send a representation of a 16-bit integer to the network connection.
static const std::uint16_t SERVICE_GPS
Definition: NavSatStatus.h:58
static const std::int8_t STATUS_SBAS_FIX
Definition: NavSatStatus.h:55
A single value (typically within a Bottle).
Definition: Value.h:40
bool write(yarp::os::ConnectionWriter &connection) const override
Write this object to a network connection.
Definition: NavSatStatus.h:159
virtual bool isBareMode() const =0
Check if the connection is bare mode.
#define BOTTLE_TAG_INT16
Definition: Bottle.h:22
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
yarp::os::idl::BottleStyle< yarp::rosmsg::sensor_msgs::NavSatStatus > bottleStyle
Definition: NavSatStatus.h:168
#define BOTTLE_TAG_LIST
Definition: Bottle.h:30
bool writeBare(yarp::os::ConnectionWriter &connection) const override
Definition: NavSatStatus.h:130
IDL-friendly connection reader.
Definition: WireReader.h:37
virtual void appendInt8(std::int8_t data)=0
Send a representation of a 8-bit integer to the network connection.