Package org.orekit.gnss.metric.ntrip
Class PythonMessageObserver
- java.lang.Object
-
- org.orekit.gnss.metric.ntrip.PythonMessageObserver
-
- All Implemented Interfaces:
MessageObserver
public class PythonMessageObserver extends Object implements MessageObserver
-
-
Constructor Summary
Constructors Constructor Description PythonMessageObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
Part of JCC Python interface to objectvoid
messageAvailable(String mountPoint, ParsedMessage message)
Notify that an encoded message is available.void
pythonDecRef()
Part of JCC Python interface to objectlong
pythonExtension()
Part of JCC Python interface to objectvoid
pythonExtension(long pythonObject)
Part of JCC Python interface to object
-
-
-
Method Detail
-
pythonExtension
public void pythonExtension(long pythonObject)
Part of JCC Python interface to object
-
pythonExtension
public long pythonExtension()
Part of JCC Python interface to object
-
finalize
public void finalize() throws Throwable
Part of JCC Python interface to object
-
pythonDecRef
public void pythonDecRef()
Part of JCC Python interface to object
-
messageAvailable
public void messageAvailable(String mountPoint, ParsedMessage message)
Notify that an encoded message is available.Beware that this method will be called from an internal dedicated stream-reading thread. Implementations must take to:
- not perform long processing there to avoid blocking the stream-reading thread
- take care of thread-safety when extracting data from the message
The only filtering that can be specified when
adding
an observer to aNtripClient
is based on message type and mount point. If additional filtering is needed (for example on message content like satellites ids, it must be performed by the observer itself when notified (see example below).The recommended way to implement this method is to simply build a domain object from the message fields (for example a gnss propagator) and to store it in the observer class as an instance field using a
AtomicReference
as follows:public class GPSProvider implements PVCoordinatesProvider, RTCMMessageObserver { private final int filteringId; private final AtomicReference<GPSPropagator> propagator; public void messageAvailable(String mountPoint, ParsedMessage message) { MessageXXX msg = (MessageXXX) message; GPSPropagator oldPropagator = propagator.get(); if (msg.getSatId() == filteringId) { GPSPropagator newPropagator = new GPSPropagator(msg.get...(), msg.get...(), msg.get...()); // only set propagator if no other observer was notified // while we were asleep propagator.compareAndSet(oldPropagator, newPropagator); } } public TimeStampedPVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame) { GPSPropagator lastAvailablePropagator = propagator.get(); // use the retrieved propagator to compute position-velocity } }
- Specified by:
messageAvailable
in interfaceMessageObserver
- Parameters:
mountPoint
- mount point from which the message comesmessage
- last available message
-
-