Class StateReceiverBackend
Backend implementation for the StateReceiver.
Implementations of this class represent connections to actual underlying data sources for vehicle localization etc. These may either we be annotated with StateReceiverBackendAttribute to be automatically added to the StateReceiver, or can be added via the inspector.
Inheritance
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
public abstract class StateReceiverBackend : ScriptableObject
Fields
AllListeners
Declaration
protected readonly HashSet<object> AllListeners
Field Value
Type | Description |
---|---|
HashSet<object> |
LocalizationListeners
Declaration
protected readonly List<IStateReceiverLocalizationEventListener> LocalizationListeners
Field Value
Type | Description |
---|---|
List<IStateReceiverLocalizationEventListener> |
Properties
IsEnabled
Declaration
public bool IsEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Pivot
Gets the pivot, used as reference point for the mapping between real world GeoCoordinate and the coordinate system in Unity.
Declaration
public SharedGeoCoordinate Pivot { get; }
Property Value
Type | Description |
---|---|
SharedGeoCoordinate |
Route
Gets or sets the current route.
Declaration
public virtual Route Route { get; protected set; }
Property Value
Type | Description |
---|---|
Route |
State
Gets or sets the current state of this backend, indicating if it is ready for use.
Declaration
public StateReceiverState State { get; protected set; }
Property Value
Type | Description |
---|---|
StateReceiverState |
TravelInformationState
Gets the travel information based on the current position along the Route.
Declaration
public virtual TravelInformationState TravelInformationState { get; }
Property Value
Type | Description |
---|---|
TravelInformationState |
VehicleSensorState
Gets or sets the most recently received state.
This may be updated from worker threads, so when using the value in conditionals it is recommended to store the value in a local variable.
Declaration
public virtual VehicleSensorState VehicleSensorState { get; protected set; }
Property Value
Type | Description |
---|---|
VehicleSensorState |
Methods
AddListener(IStateReceiverListener)
Declaration
public void AddListener(IStateReceiverListener listener)
Parameters
Type | Name | Description |
---|---|---|
IStateReceiverListener | listener |
Disable()
Called when this backend was the active one and another backend is made the active backend in the StateReceiver.
Backend should dispose underlying connections and state and release unmanaged resources when this is called.
Declaration
public virtual void Disable()
Enable()
Called when this backend is made the active backend in the StateReceiver.
Backend (re)initialization should be started when this is called.
Declaration
public virtual void Enable()
NotifyListenerConfigurationChanged()
Declaration
public virtual void NotifyListenerConfigurationChanged()
OnApplicationResume()
Declaration
public virtual void OnApplicationResume()
OnDestroy()
Declaration
protected virtual void OnDestroy()
OnListenerAdded(IStateReceiverListener)
Declaration
protected virtual void OnListenerAdded(IStateReceiverListener listener)
Parameters
Type | Name | Description |
---|---|---|
IStateReceiverListener | listener |
OnListenerRemoved(IStateReceiverListener)
Declaration
protected virtual void OnListenerRemoved(IStateReceiverListener listener)
Parameters
Type | Name | Description |
---|---|---|
IStateReceiverListener | listener |
OnMapAccessTokenReceived(string)
Declaration
protected void OnMapAccessTokenReceived(string token)
Parameters
Type | Name | Description |
---|---|---|
string | token |
OnRouteChanged()
Notifies the listeners that the route has changed.
Declaration
protected void OnRouteChanged()
OnStateReceivedAsync(VehicleSensorState)
Fires the OnVehicleLocalizationReceivedAsync(VehicleSensorState) event. Should be called directly and as soon as possible whenever new state is received, even if this call happens from a separate thread.
Declaration
protected void OnStateReceivedAsync(VehicleSensorState state)
Parameters
Type | Name | Description |
---|---|---|
VehicleSensorState | state | The received state. |
OnStateUpdated()
Updates the state. Should be called once per physics update.
Declaration
protected void OnStateUpdated()
RemoveListener(IStateReceiverListener)
Declaration
public void RemoveListener(IStateReceiverListener listener)
Parameters
Type | Name | Description |
---|---|---|
IStateReceiverListener | listener |
Update()
Declaration
public virtual void Update()
UpdatePivot(GeoCoordinate)
This method allows us to update the pivot.
Declaration
public virtual void UpdatePivot(GeoCoordinate geoCoordinate)
Parameters
Type | Name | Description |
---|---|---|
GeoCoordinate | geoCoordinate | The new pivot position. |