public class UploaderSink extends ContextualVehicleDataSink
Constructor and Description |
---|
UploaderSink(android.content.Context context,
java.lang.String path) |
UploaderSink(android.content.Context context,
java.net.URI uri)
Initialize and start a new UploaderSink immediately.
|
Modifier and Type | Method and Description |
---|---|
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).
|
java.lang.String |
toString() |
static boolean |
validatePath(java.lang.String path)
Returns true if the path is not null and if it is a valid URI.
|
getContext
public UploaderSink(android.content.Context context, java.net.URI uri)
uri
- the URI to send HTTP POST requests to with the JSON data.public UploaderSink(android.content.Context context, java.lang.String path) throws DataSinkException
DataSinkException
public void stop()
VehicleDataSink
stop
in interface VehicleDataSink
stop
in class ContextualVehicleDataSink
public void receive(VehicleMessage message)
VehicleDataSink
receive
in interface VehicleDataSink
receive
in class ContextualVehicleDataSink
message
- The new measurement.public static boolean validatePath(java.lang.String path)
path
- a URI to validatepublic java.lang.String toString()
toString
in class java.lang.Object