This is a set of Java libraries for communicating with various types of sensor interfaces that are typically used in schools.
This project uses maven for building. To build the project and install its JARs into the local repository, simply run:
mvn install
This is necessary for other projects that depend on JARs built by this project, such as the SensorConnector application.
Most development is done in Eclipse with the m2e plugin, but you should be able to work on it with just maven at the commandline or any IDE with maven support.
The current place to get started is to look at the ExampleSensorApp class. You can subclass this
and modify the deviceId and possibly openString in order to test out a specific device.
The list of available deviceIds is in the DeviceID interface.
If you don't have any hardware you can start with the PseudoSensorExampleApp which extends ExampleSensorApp.
The code in the sensor sub project provides two APIs
- one for application developers to use sensors without writing vendor- or device-specific code
- one to add support for a new device to the framework
The main interface for both APIs is the org.concord.sensor.device.SensorDevice.
There are javadocs in this interface describing how it is intended to be used.
A summary of one way to use the application API goes like this:
- The Application uses a
DeviceFactoryto get an instance of aSensorDevice - The Application creates an
ExperimentRequestconsisting of one or moreSensorRequests. This describes what sensors and timing the Application wants to use. - The Application calls
SensorDevice#configurewith thisExperimentRequest - The
SensorDeviceimplementation asks the hardware what sensors are actually attached, compares it to the requested sensors, and then returns anExperimentConfigthat contains the set of sensors which theSensorDevicefeels is the best match for the request. ThisExperimentConfigalso indicates if theSensorDevicethinks the config meets the requirements of the request. So, for example, if theExperimentRequestcontains a temperature sensor but no temperature sensor is attached, the returnedExperimentConfigshould indicate the requirements are not met. - The Application then calls
SensorDevice#startto start collecting data from the sensors specified in the most recently returnedExperimentConfig. - The Application calls
SensorDevice#readagain and again to get the resulting data. - The Application calls
SensorDevice#stopwhen it doesn't want to read any more data.
- move
ftdi-serial-wrapperinto its own repository, it isn't used by any of this code and could be a useful independent project for someone - get jars deployed to maven central
- update documentation to make it really easy to try out by pulling jars from central
- remove sensor native
- make sure the native libraries are not loaded multiple times in a single jvm
- make a command line app that lists the available devices, and runs the two tests on whichever device the user selects
- move the matching of current configuration of sensors to a different API layer. This simplifies the implementation for the vendors, and it also provides a simplier API for application developers
- update the API to support checking if a device is attached without actually opening it, also this API
should support opening multiple devices of the same type attached to the same computer. Perhaps it would work to
have the
DeviceFactoryreturn a list of devices which aren't opened. These devices can then be queried to see if they are actually available (they might be in use by us or some other program). And they can be opened. It is also nice though to work without the device factory. So it might be best to introduce a 'Library' style object for each device. So aGoIOLibrarysingleton can be created and this can be used to list the GoIO devices. TheDeviceFactorycan use this. - boil
DeviceServicedown to just logging and user messages, the rest of the methods can be removed or made static, they are legacy for Waba support - Move
DeviceFactoryout of this library and make the creation of devices more likenew SomethingDevice(deviceService, optional_type)