DynamicEntityDataSource

A dynamic entity data source that streams observations to a client. The DynamicEntityDataSource class is the base class for classes that stream dynamic entity data. The class provides methods and properties that allow:

  • maintenance of a persistent connection for streaming

  • control over the storage of observations in its local data cache

  • notification of received or purged observations

This class is used as the data source for a DynamicEntityLayer.

Since

200.1.0

See also

Inheritors

Properties

Link copied to clipboard

The current network connection status of the DynamicEntityDataSource. This property contains the state of the connection throughout the lifetime of the data source. The initial value of this property is ConnectionStatus.Disconnected.

Link copied to clipboard

Notification that a DynamicEntityObservation was purged. This event is raised when a limit defined in DynamicEntityDataSource.purgeOptions was reached and a dynamic entity observation was purged from the local data cache.

Link copied to clipboard

Notification that a new DynamicEntityObservation was received. This event is raised for every observation received from the stream. To listen to only observations associated with a specific dynamic entity, use DynamicEntity.dynamicEntityChangedEvent.

Link copied to clipboard

Notification that a DynamicEntity was purged. This event is raised whenever the last observation associated with a dynamic entity was purged. When this happens, the DynamicEntity is also purged and will not be associated with any new observations streamed from the data source.

Link copied to clipboard

Notification that a new DynamicEntity was received. This event is raised when an observation was received that was not associated with any current DynamicEntity in the local cache. In this case, a new DynamicEntity is created and this event is raised.

Link copied to clipboard

The maximum number of attempts to reconnect after a connection fails. This property informs the data source to attempt reconnection if a connection is lost. When a connection fails, the data source attempts to reconnect the specified number of times waiting DynamicEntityDataSource.reconnectionInterval between attempts.

Link copied to clipboard

A DynamicEntityDataSourcePurgeOptions that defines when observations are purged from the local data cache. Data received from the DynamicEntityDataSource is stored in memory on the client and can grow quickly depending on the number of dynamic entities and frequency of updates. If purge options are not set appropriately, a data source may store too many observations in its local data cache and cause performance and memory issues for the application. Use the DynamicEntityDataSource.purgeOptions property to control app data storage for the local cache.

Link copied to clipboard

The time (in seconds) to wait between attempts to reconnect. This property sets the amount of time delay between reconnection attempts after a connection fails. The default value is 10 seconds.

Inherited properties

Link copied to clipboard
open override val loadStatus: StateFlow<LoadStatus>

The load status.

Functions

Link copied to clipboard
suspend fun connect(): Result<Unit>

Connects to a service that provides dynamic entity observations. Data does not start streaming from the dynamic entity data source until it's loaded and connected. Once the connection is successfully established, data begins to flow from the stream.

Link copied to clipboard
suspend fun disconnect(): Result<Unit>

Closes the connection to a service. Use this method to explicitly disconnect from a data source. When this method completes, the DynamicEntityDataSource.connectionStatus is set to disconnected or failed.

Link copied to clipboard
suspend fun purgeAll(): Result<Unit>

Removes all dynamic entity observations from the in-memory data cache as well as from the map or scene. Sometimes, a large number of dynamic entity observations can crowd the display and make information hard to interpret. Use this method to clear (purge) all dynamic entity observations to remove stale information and limit the amount of memory consumed. This does not disconnect you from the service, so new dynamic entity observations continue to display as they become available.

Inherited functions

Link copied to clipboard
open override fun cancelLoad()

Cancels loading metadata for the Loadable object.

Link copied to clipboard
open suspend override fun load(): Result<Unit>

Loads the metadata for the object.

Link copied to clipboard
open suspend override fun retryLoad(): Result<Unit>

Loads or retries loading metadata for the object.