SLProject  4.3.020
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SENSSimulatedGps Class Reference

#include <SENSSimulated.h>

Inheritance diagram for SENSSimulatedGps:
[legend]

Public Member Functions

 ~SENSSimulatedGps ()
 
bool start () override
 
void stop () override
 
- Public Member Functions inherited from SENSGps
virtual ~SENSGps ()
 
Location getLocation () const
 
bool isRunning ()
 
bool permissionGranted () const
 
void registerListener (SENSGpsListener *listener)
 
void unregisterListener (SENSGpsListener *listener)
 
void registerPermissionListener (std::function< void(void)> listener)
 
void updatePermission (bool granted)
 
- Public Member Functions inherited from SENSSimulated< SENSGps::Location >
virtual ~SENSSimulated ()
 
- Public Member Functions inherited from SENSSimulatedBase
virtual ~SENSSimulatedBase ()
 

Private Member Functions

 SENSSimulatedGps (StartSimCB startSimCB, SensorSimStoppedCB sensorSimStoppedCB, std::vector< std::pair< SENSTimePt, SENSGps::Location >> &&data, const SENSSimClock &clock)
 
void feedSensorData (const int counter) override
 feed new sensor data to sensor More...
 

Friends

class SENSSimulator
 

Additional Inherited Members

- Protected Types inherited from SENSSimulated< SENSGps::Location >
using StartSimCB = std::function< void(void)>
 
using SensorSimStoppedCB = std::function< void(void)>
 
- Protected Member Functions inherited from SENSGps
void setLocation (SENSGps::Location location)
 
void informPermissionListeners ()
 
- Protected Member Functions inherited from SENSSimulated< SENSGps::Location >
 SENSSimulated (const std::string name, StartSimCB startSimCB, SensorSimStoppedCB sensorSimStoppedCB, std::vector< std::pair< SENSTimePt, SENSGps::Location >> &&data, const SENSSimClock &clock)
 
void startSim ()
 start the sensor simulation thread More...
 
void stopSim ()
 stop the sensor simulation thread More...
 
bool getErrorMsg (std::string &msg) override
 get error msg (valid if function returns true) More...
 
bool isThreadRunning () const override
 indicates if simulation thread is running More...
 
virtual void prepareSensorData (const int counter)
 
virtual void onLatencyProblem (int &counter)
 special treatment when there is latency (e.g. when feeding camera frames from cv::videocapture updating the frame pos may take ages) More...
 
- Protected Attributes inherited from SENSGps
bool _running = false
 
std::atomic_bool _permissionGranted {false}
 
- Protected Attributes inherited from SENSSimulated< SENSGps::Location >
std::vector< std::pair< SENSTimePt, SENSGps::Location > > _data
 
SensorSimStoppedCB _sensorSimStoppedCB
 
StartSimCB _startSimCB
 
std::thread _thread
 
std::condition_variable _condVar
 
std::mutex _mutex
 
bool _stop
 
SENSTimePt _commonSimStartTimePt
 
bool _threadIsRunning
 
const SENSSimClock_clock
 
std::string _name
 
std::mutex _msgMutex
 
std::string _errorMsg
 

Detailed Description

SENSSimulatedGps SENSSimulated implementation for GPS sensor simulation. Implements the SENSGps interface to make it a full gps sensor and the SENSSimulated interface for the sensor simulation backend.

Definition at line 107 of file SENSSimulated.h.

Constructor & Destructor Documentation

◆ ~SENSSimulatedGps()

SENSSimulatedGps::~SENSSimulatedGps ( )

Definition at line 154 of file SENSSimulated.cpp.

155 {
156  stop();
157 }
void stop() override

◆ SENSSimulatedGps()

SENSSimulatedGps::SENSSimulatedGps ( StartSimCB  startSimCB,
SensorSimStoppedCB  sensorSimStoppedCB,
std::vector< std::pair< SENSTimePt, SENSGps::Location >> &&  data,
const SENSSimClock clock 
)
private

Definition at line 180 of file SENSSimulated.cpp.

184  : SENSSimulated("gps", startSimCB, sensorSimStoppedCB, std::move(data), clock)
185 {
186  _permissionGranted = true;
187 }
std::atomic_bool _permissionGranted
Definition: SENSGps.h:47
SENSSimulated(const std::string name, StartSimCB startSimCB, SensorSimStoppedCB sensorSimStoppedCB, std::vector< std::pair< SENSTimePt, SENSGps::Location >> &&data, const SENSSimClock &clock)

Member Function Documentation

◆ feedSensorData()

void SENSSimulatedGps::feedSensorData ( const int  counter)
overrideprivatevirtual

feed new sensor data to sensor

Implements SENSSimulated< SENSGps::Location >.

Definition at line 189 of file SENSSimulated.cpp.

190 {
191  setLocation(_data[counter].second);
192 }
void setLocation(SENSGps::Location location)
Definition: SENSGps.cpp:11
std::vector< std::pair< SENSTimePt, SENSGps::Location > > _data
Definition: SENSSimulated.h:79

◆ start()

bool SENSSimulatedGps::start ( )
overridevirtual

Implements SENSGps.

Definition at line 159 of file SENSSimulated.cpp.

160 {
161  if (!_running)
162  {
163  startSim();
164  _running = true;
165  }
166 
167  return _running;
168 }
bool _running
Definition: SENSGps.h:46
void startSim()
start the sensor simulation thread

◆ stop()

void SENSSimulatedGps::stop ( )
overridevirtual

Implements SENSGps.

Definition at line 170 of file SENSSimulated.cpp.

171 {
172  if (_running)
173  {
174  stopSim();
175  _running = false;
176  }
177 }
void stopSim()
stop the sensor simulation thread

Friends And Related Function Documentation

◆ SENSSimulator

friend class SENSSimulator
friend

Definition at line 110 of file SENSSimulated.h.


The documentation for this class was generated from the following files: