lejos.hardware.sensor.CodeTemplate Maven / Gradle / Ivy
Show all versions of lejos-ev3-api Show documentation
package lejos.hardware.sensor;
import lejos.hardware.port.Port;
import lejos.hardware.port.UARTPort;
import lejos.robotics.SampleProvider;
/**
* Sensor name
* Description
*
*
* The code for this sensor has not been tested. Please report test results to
* the leJOS forum.
*
*
*
*
*
* Supported modes
*
*
* Mode name
* Description
* unit(s)
* Getter
*
*
* Some
*
*
* {@link #getSomeMode() }
*
*
*
*
*
* Sensor configuration
* Description of default sensor configuration (when that matters). Description
* of available methods for configuration.
*
*
*
* See Sensor datasheet
* See Sensor Product page
* See The
* leJOS sensor framework
* See {@link lejos.robotics.SampleProvider leJOS conventions for
* SampleProviders}
*
*
*
*
* @author Your name
*
*/
public class CodeTemplate extends UARTSensor {
/**
* Constructor using a unopened port
*
* @param port
*/
public CodeTemplate(Port port) {
super(port);
init();
}
/**
* Constructor using a opened and configured port
*
* @param port
*/
public CodeTemplate(UARTPort port) {
super(port);
init();
}
/**
* Configures the sensor for first use and registers the supported modes
*
*/
protected void init() {
setModes(new SensorMode[] { new SomeMode() });
}
/**
* Sensor name, mode
* Mode description
*
*
* Size and content of the sample
* The sample contains # elements. Each element gives Something (in some
* unit).
*
*
* Configuration
* The sensor is configured for.... . Currently there are no configurable
* settings.
*
* @return A sampleProvider
* See {@link lejos.robotics.SampleProvider leJOS conventions for
* SampleProviders}
* See Sensor datasheet
*/
public SampleProvider getSomeMode() {
return getMode(0);
}
private class SomeMode implements SensorMode {
@Override
public int sampleSize() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void fetchSample(float[] sample, int offset) {
// TODO Auto-generated method stub
}
@Override
public String getName() {
// TODO Auto-generated method stub
return "Some";
}
}
}