public class DataService
extends java.lang.Object
It is implemented as a singleton, where the all you have to do is call the static method getJSON(String)
with the sessionid.
This method returns a JSON formatted string with all the data that has changed since the last call.
Other configuration options are available and must be called before your first call to getJSON().
Constructor and Description |
---|
DataService() |
Modifier and Type | Method and Description |
---|---|
static void |
deleteSession(java.lang.String sessionid)
Used by the servlets to delete a session from the cache.
|
static Data |
getData(java.lang.String datapath)
Used by the servlets to return a data from the SIM directly, bypassing the cache.
|
static java.lang.StringBuffer |
getJSON(java.lang.String sessionid)
Returns the results as a JSON String.
|
static java.lang.StringBuffer |
getJSON(java.lang.String sessionid,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>> data)
This method is called to subscribe to the data and return the results as a JSON string.
|
static Data |
getRecord() |
static Data |
getSIMName() |
static Data |
getSIMVersion() |
static void |
setEndingVersion(java.lang.String endingVersion)
If playing back a recorded file, this sets the position to stop playing it at.
|
static void |
setPlay(java.lang.String playfile)
Sets the file to use to play back a recorded session.
|
static void |
setRecord(java.lang.String recordfile)
Sets the file to record the session to.
|
static void |
setSIMname(java.lang.String SIMName)
Sets the name of the SIM to connect to.
|
static void |
setStartingVersion(java.lang.String startingVersion)
If playing back a recorded file, this sets the position to start playing it at.
|
static void |
start()
starts the background thread to wait for events from the SIM.
|
static void |
stop() |
public static void stop()
public static void setSIMname(java.lang.String SIMName)
SIMName
- The name of the SIM. Defaults to iRacing.public static void setStartingVersion(java.lang.String startingVersion)
startingVersion
- The SIM specific version to start at.public static void setEndingVersion(java.lang.String endingVersion)
endingVersion
- The SIM specific version to end at.public static void setPlay(java.lang.String playfile)
playfile
- The filename to use.public static Data getRecord()
public static void setRecord(java.lang.String recordfile)
recordfile
- The file to record to. Can be null or blank to stop recording.public static void deleteSession(java.lang.String sessionid)
sessionid
- The session to delete.public static Data getData(java.lang.String datapath) throws SIMPlugin.SIMPluginException
datapath
- The path to the data.Data
object.SIMPlugin.SIMPluginException
- If there's an error during the call.public static java.lang.StringBuffer getJSON(java.lang.String sessionid, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>> data)
sessionid
- The session identifier.data
- The data to subscribe to.public static java.lang.StringBuffer getJSON(java.lang.String sessionid)
sessionid
- The session identifierpublic static Data getSIMName() throws SIMPlugin.SIMPluginException
SIMPlugin.SIMPluginException
public static Data getSIMVersion() throws SIMPlugin.SIMPluginException
SIMPlugin.SIMPluginException
public static void start()