Contributing Code
There are a number of steps that you need to take to add to these open-source libraries. First, review Github's guide to contributing to an open-source project.
Adding a Sensor
To add a new sensor, you need to edit the SensorManager and SensorDataManager libraries. To implement your sensor, you'll need to:
- Decide whether your sensor is best implemented as a push (AbstractPushSensor), pull (AbstractPullSensor), or environment (AbstractEnvironmentSensor) sensor. This will determine where your code will be implemented and what AbstractSensor type it will inherit from.
- Implement the data structure that will store your sensor's data, in the data package. Implement a processor that creates an instance of your sensor's data in the process package.
- Implement a default configuration for your sensor in the config package. You will also need to add an entry to
getDefaultConfig()
in SensorConfig.
- The ES Sensor Manager needs to be able to find your sensor. Add an int SENSOR_TYPE and String SENSOR_NAME to SensorUtils. Add an entry for your sensor in SensorEnum.
- Add a data formatter to convert your sensor data instance into JSON in the data manager data formatter package.
- The data formatter needs to be able to find your formatter. Add an entry in
getJSONFormatter()
in DataFormatter.java.
- Test your sensor. You may want to modify and use the Demo App.
- Update the sensors documentation.