public class

UploaderSink

extends ContextualVehicleDataSink
java.lang.Object
   ↳ com.openxc.sinks.ContextualVehicleDataSink
     ↳ com.openxc.sinks.UploaderSink

Class Overview

Upload a stream of all incoming vehicle data to a remote HTTP server. The remote HTTP server specified should be expecting POST requests with the data being a JSON array of OpenXC JSON message objects, e.g.: [{"name": "steering_wheel_angle", "value": 42}, {"name": "parking_brake_status", "value": false}] The UploaderSink has a small buffer to preserve records across short network outages, but do not expect it to be especially reliable. No guarantee is provided about the preservation of records - to do that, a subclass would need to write the data to a file when no network connection is available.

Summary

Public Constructors
UploaderSink(Context context, URI uri)
Initialize and start a new UploaderSink immediately.
UploaderSink(Context context, String path)
Public Methods
void receive(VehicleMessage message)
Receive a data point with a name, a value and a event value.
void stop()
Release any acquired resources and either stop sending measurements (if a source) or stop expecting to receive them (if a sink).
String toString()
static boolean validatePath(String path)
Returns true if the path is not null and if it is a valid URI.
[Expand]
Inherited Methods
From class com.openxc.sinks.ContextualVehicleDataSink
From class java.lang.Object
From interface com.openxc.sinks.VehicleDataSink

Public Constructors

public UploaderSink (Context context, URI uri)

Initialize and start a new UploaderSink immediately.

Parameters
uri the URI to send HTTP POST requests to with the JSON data.

public UploaderSink (Context context, String path)

Public Methods

public void receive (VehicleMessage message)

Receive a data point with a name, a value and a event value. The implementation of this method should not block, lest the vehicle data source get behind in processing data from a source potentially external to the system.

Parameters
message The new measurement.

public void stop ()

Release any acquired resources and either stop sending measurements (if a source) or stop expecting to receive them (if a sink).

public String toString ()

public static boolean validatePath (String path)

Returns true if the path is not null and if it is a valid URI.

Parameters
path a URI to validate
Returns
  • true if path is a valid URI.