Mobile Sensor API Version 1.2

javax.microedition.sensor
Interface DataAndErrorListener

All Superinterfaces:
DataListener

public interface DataAndErrorListener
extends DataListener

The DataAndErrorListener interface is implemented by the application to receive data and errors from the sensor. This interface was added in the maintenance release phase to fill the gap in reporting errors in a more fine-grained way. Since this interface is inherited from the DataListener interface, the same constraints concern this interface as well. Both registration and the removal of registration also follow the same scheme. Please see the description of the DataListener for more information.

If the property SensorInfo.PROP_IS_REPORTING_ERRORS is not set, a registered DataAndErrorListener behaves exactly the same as a DataListener, which means that no errorReceived() notifications are sent to the listener.

The particular sensor aiming at fine-grained error reporting MUST define the codes and descriptions used. A fingerprint sensor is an example of defining codes, see Appendix E.


Method Summary
 void errorReceived(SensorConnection sensor, int errorCode, long timestamp)
          This method notifies of the occured error during the data fetching from a sensor.
 
Methods inherited from interface javax.microedition.sensor.DataListener
dataReceived
 

Method Detail

errorReceived

void errorReceived(SensorConnection sensor,
                   int errorCode,
                   long timestamp)

This method notifies of the occured error during the data fetching from a sensor. The error MUST be immediately notified with errorReceived() notification even if the error happens during data buffering (buffer size > 1). The subsequent errors with the same error code during the same buffering process MUST NOT be reported. The erroneous data values MUST also be included into the dataReceived() notification as part of the data buffer. The data buffering can continue normally even if there are errors. The validity of the erroneous data values MUST be set to false.

If getting all the error notifications is considered important, the buffering should not be used. The application developer must then set the buffer size to 1.

Parameters:
sensor - SensorConnection, the original sensor where the error occured
errorCode - the code indicating the reason of the error. The error code can be used to get the error description with the method SensorConnection.getErrorText().
timestamp - the timestamp indicating the time when the error occured

Mobile Sensor API Version 1.2

Copyright © 2005-2008 Nokia Corporation. All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.