2 #include <swarmio/data/Variant.pb.h> 3 #include <swarmio/data/discovery/Schema.pb.h> 10 : _telemetryService(telemetryService), _firstPoint(firstPoint), _secondPoint(secondPoint), _duration(duration), _shouldStop(false), _name(name)
13 data::discovery::Field field;
14 auto& subfields = *field.mutable_schema()->mutable_fields();
15 subfields[
"longitude"].set_type(data::discovery::Type::DOUBLE);
16 subfields[
"latitude"].set_type(data::discovery::Type::DOUBLE);
17 subfields[
"altitude"].set_type(data::discovery::Type::DOUBLE);
31 double stage = (cycle % unit) / (
double)unit * 2.0;
39 auto& pairs = *value.mutable_map_value()->mutable_pairs();
47 std::this_thread::sleep_for(100ms);
SimulatedLocation _firstPoint
First point.
Telemetry Service can subscribe to receive updates from remote nodes on named values.
std::unique_ptr< std::thread > _thread
Worker thread.
void SetValue(const std::string &key, const data::Variant &value)
Add or update a value in the local telemetry cache.
void SetFieldDefinitionForKey(const std::string &key, const data::discovery::Field &field, bool includeInStatus)
Add field to the schema.
std::atomic< bool > _shouldStop
Stop marker.
double GetLatitude()
Get latitude.
A location described by a latitude, a longitude and an altitude.
void Worker()
Worker thread.
std::string _name
Telemetry key.
services::telemetry::Service & _telemetryService
Telemetry service.
std::chrono::seconds _duration
Time it takes to complete one trip.
double GetLongitude()
Get longitude.
SimulatedLocation _secondPoint
Second point.
double GetAltitude()
Get altitude.
LinearPathTelemetrySimulator(services::telemetry::Service &telemetryService, const std::string &name, SimulatedLocation firstPoint, SimulatedLocation secondPoint, std::chrono::seconds duration)
Constructor.