|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Logger
Defines the [minimum] required functionality for a data logger implementation.
Method Summary | |
---|---|
void |
finishLine()
Finish the row and start a new one. |
void |
sendCache(DataOutputStream out,
DataInputStream in)
Sends the log cache. |
void |
sendCache(NXTConnection connection)
Sends the log cache using passed NXTConnection to retrieve the data streams. |
void |
setColumns(LogColumn[] columnDefs)
Set the data set header information for the data log and chart series. |
void |
startCachingLog()
Sets caching (deferred) logging. |
void |
startRealtimeLog(DataOutputStream out,
DataInputStream in)
Start a realtime logging session using passed data streams. |
void |
startRealtimeLog(NXTConnection connection)
Start a realtime logging session using passed NXTConnection to retrieve the data streams. |
void |
stopLogging()
Stop the logging session and close down the connection and data streams. |
void |
writeComment(String comment)
Log a text comment to the data log. |
void |
writeLog(boolean datapoint)
Write a boolean value as an int 1 (true ) or 0 (false ) to the log. |
void |
writeLog(byte datapoint)
Write a byte value to the log. |
void |
writeLog(double datapoint)
Write an double to the log. |
void |
writeLog(float datapoint)
Write an float to the log. |
void |
writeLog(int datapoint)
Write an int to the log. |
void |
writeLog(long datapoint)
Write an long to the log. |
void |
writeLog(short datapoint)
Write a short value to the log. |
Method Detail |
---|
void startRealtimeLog(DataOutputStream out, DataInputStream in) throws IOException
setColumns()
method must be called after this method is called and before the first
writeLog()
method is called.
The use of this method is mutually exclusive with startCachingLog()
and will reset internal state
to realtime mode.
out
- A valid DataOutputStream
in
- A valid DataInputStream
IOException
- if the data streams are not validstopLogging()
,
startRealtimeLog(NXTConnection)
,
setColumns(lejos.util.LogColumn[])
void startRealtimeLog(NXTConnection connection) throws IOException
NXTConnection
to retrieve the data streams. The
connection must already be established.
The setColumns()
method must be called after this method is called and before the first
writeLog()
method is called.
The use of this method is mutually exclusive with startCachingLog()
and will reset internal state
to realtime mode.
connection
- A connected NXTConnection
instance
IOException
- if the data streams are not validstopLogging()
,
startRealtimeLog(DataOutputStream, DataInputStream)
,
setColumns(lejos.util.LogColumn[])
void startCachingLog()
setColumns()
method must be called after this method is called and before the first
writeLog()
method is called.
The use of this method is mutually exclusive with the startRealtimeLog()
methods and will reset internal state
to caching mode.
stopLogging()
,
sendCache(NXTConnection)
,
startRealtimeLog(NXTConnection)
void sendCache(DataOutputStream out, DataInputStream in) throws IOException
out
- A valid DataOutputStream
in
- A valid DataInputStream
IOException
- if the data streams are not valid
IllegalStateException
- if startCachingLog()
has not been calledvoid sendCache(NXTConnection connection) throws IOException
NXTConnection
to retrieve the data streams. The
connection must already be established. Valid only for caching (deferred) logging using startCachingLog()
.
connection
- A connected NXTConnection
instance
IOException
- if the data streams are not valid
IllegalStateException
- if startCachingLog()
has not been calledvoid setColumns(LogColumn[] columnDefs) throws IllegalArgumentException
writeLog()
item would be column 1, element 2 is column 2, so on and so forth.
The items per log row
must match the number of headers you define in this method.
This method must be called after the startCachingLog()
or either of the startRealtimeLog()
methods is called or an IllegalStateException
will be
thrown in the writeLog()
methods.
The number and datatype of writeLog()
calls per log row must match the number of columns and the datatypes
you define here. You must
end each log row with finishLine()
or an IllegalStateException
will be thrown on the
next writeLog()
call. If using the NXT ChartingLogger tool, the chart
will only reflect the new data sent after this call since the series are redefined.
In realtime mode, if headers are set during logging with the writeLog()
methods, the log will reflect
the changes from that point on. In cached mode, if headers are set during logging with the writeLog()
methods, an UnsupportedOperationException
is thrown.
If length of the passed array is zero or if length > 255, the method does nothing and returns immediately.
columnDefs
- The array of LogColumn
instances to use for the data log column definitions
UnsupportedOperationException
- if setColumns
is called more than once in cached mode.
IllegalArgumentException
LogColumn
,
finishLine()
,
startCachingLog()
,
startRealtimeLog(NXTConnection)
void writeComment(String comment)
finishLine()
is called)
comment
- The commentvoid writeLog(boolean datapoint)
boolean
value as an int
1 (true
) or 0 (false
) to the log.
In realtime logging mode, if an IOException
occurs, the connection
and data streams are silently closed down and no exception is thrown from this method.
datapoint
- The boolean
value to log.
IllegalStateException
- if the column datatype for the column position this method was called for does not match
the datatype that was set in setColumns()
, the column position exceeds the total column count (i.e.
finishLine()
was not called after last column logged), or the column
definitions have not been set with setColumns()
.
OutOfMemoryError
- if in cache mode and memory is exhausted.setColumns(lejos.util.LogColumn[])
,
finishLine()
void writeLog(byte datapoint)
byte
value to the log.
In realtime logging mode, if an IOException
occurs, the connection
and data streams are silently closed down and no exception is thrown from this method.
datapoint
- The byte
value to log.
IllegalStateException
- if the column datatype for the column position this method was called for does not match
the datatype that was set in setColumns()
, the column position exceeds the total column count (i.e.
finishLine()
was not called after last column logged), or the column
definitions have not been set with setColumns()
.
OutOfMemoryError
- if in cache mode and memory is exhausted.setColumns(lejos.util.LogColumn[])
,
finishLine()
void writeLog(short datapoint)
short
value to the log.
In realtime logging mode, if an IOException
occurs, the connection
and data streams are silently closed down and no exception is thrown from this method.
datapoint
- The short
value to log.
IllegalStateException
- if the column datatype for the column position this method was called for does not match
the datatype that was set in setColumns()
, the column position exceeds the total column count (i.e.
finishLine()
was not called after last column logged), or the column
definitions have not been set with setColumns()
.
OutOfMemoryError
- if in cache mode and memory is exhausted.setColumns(lejos.util.LogColumn[])
,
finishLine()
void writeLog(int datapoint)
int
to the log. In realtime logging mode, if an IOException
occurs, the connection
and data streams are silently closed down and no exception is thrown from this method.
datapoint
- The int
value to log.
IllegalStateException
- if the column datatype for the column position this method was called for does not match
the datatype that was set in setColumns()
, the column position exceeds the total column count (i.e.
finishLine()
was not called after last column logged), or the column
definitions have not been set with setColumns()
.setColumns(lejos.util.LogColumn[])
,
finishLine()
void writeLog(long datapoint)
long
to the log. In realtime logging mode, if an IOException
occurs, the connection
and data streams are silently closed down and no exception is thrown from this method.
datapoint
- The long
value to log.
IllegalStateException
- if the column datatype for the column position this method was called for does not match
the datatype that was set in setColumns()
, the column position exceeds the total column count (i.e.
finishLine()
was not called after last column logged), or the column
definitions have not been set with setColumns()
.setColumns(lejos.util.LogColumn[])
,
finishLine()
void writeLog(float datapoint)
float
to the log. In realtime logging mode, if an IOException
occurs, the connection
and data streams are silently closed down and no exception is thrown from this method.
datapoint
- The float
value to log.
IllegalStateException
- if the column datatype for the column position this method was called for does not match
the datatype that was set in setColumns()
, the column position exceeds the total column count (i.e.
finishLine()
was not called after last column logged), or the column
definitions have not been set with setColumns()
.setColumns(lejos.util.LogColumn[])
,
finishLine()
void writeLog(double datapoint)
double
to the log. In realtime logging mode, if an IOException
occurs, the connection
and data streams are silently closed down and no exception is thrown from this method.
datapoint
- The double
value to log.
IllegalStateException
- if the column datatype for the column position this method was called for does not match
the datatype that was set in setColumns()
, the column position exceeds the total column count (i.e.
finishLine()
was not called after last column logged), or the column
definitions have not been set with setColumns()
.setColumns(lejos.util.LogColumn[])
,
finishLine()
void finishLine() throws IllegalStateException
The Column count is set by calling
setColumns()
and you must ensure that you call the appropriate writeLog()
method the same number of
times as that column count before this method is called.
IllegalStateException
- if all the columns defined with setColumns()
per row have not been logged.setColumns(lejos.util.LogColumn[])
void stopLogging()
startRealtimeLog(NXTConnection)
,
startCachingLog()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |