Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.LoggerWrite.nc

Interface: LoggerWrite

Implements a circular log interface. Allows a line at a time to be written, automatically maintaining a current line pointer. The pointer wraps around to the beginning of the log.

Components providing this interface:
tos.system.Logger
tos.system.LoggerM

Components requiring this interface:
apps.Ident.AppM
apps.SenseLightToLog.SenseLightToLogM

Commands

Events

Commands - Details

append

result_t append(uint8_t *data)

Writes data to the current line in the EEPROM. If the call does not return FAIL, the next call to append will write to (current line + 1).

writeDone() will be signaled if result is not FAIL

Parameters:

data - the data to be appended to the log

Returns: FAIL if the write cannot occur, SUCCESS otherwise


resetPointer

result_t resetPointer(void)

Reset the current line pointer to the beginning of the log.
Returns: SUCCESS if the line pointer can be moved and no other operations are pending.

setPointer

result_t setPointer(uint16_t line)

Set the current line pointer to the value of 'line'. Not all line values are valid.

Parameters:

line - The address of the line to set the current pointer to.

Returns: FAIL if the line is invalid, SUCCESS otherwise.

write

result_t write(uint16_t line, uint8_t *data)

Write a specified line to the log.

Sets the current line to the input line and then behaves as append(data).

Equivalent to calling setPointer(line) followed by append(data)

Parameters:

line - the address of the line

data - the data to be written to the log

Returns: FAIL if the write cannot occur, SUCCESS otherwise

Events - Details

writeDone

result_t writeDone(result_t success)

Notification that a write command has been completed. Signaled by both write() and append().

Parameters:

success - SUCCESS if the write was successfully written to the log

Returns: SUCCESS to notify the logger to keep its bookmark (current line) in the log