* @param user_id - User identifier
* @param read - Function to call whenever the sensor should be read
* @param init - Function to call to initialise the sensor (may be NULL)
- * @param max_error - Maximum error threshold; program will exit if this is exceeded for the sensor reading
- * @param min_error - Minimum error threshold; program will exit if the sensor reading falls below this value
- * @param max_warn - Maximum warning threshold; program will log warnings if the value exceeds this threshold
- * @param min_warn - Minimum warning threshold; program will log warnings if the value falls below this threshold
+ * @param cleanup - Function to call whenever to deinitialise the sensor (may be NULL)
+ * @param sanity - Function to call to check that the sensor value is sane (may be NULL)
* @returns Number of actuators added so far
*/
int Sensor_Add(const char * name, int user_id, ReadFn read, InitFn init, CleanFn cleanup, SanityFn sanity)
#include "sensors/resource.h"
#include "sensors/strain.h"
#include "sensors/pressure.h"
+#include "sensors/dilatometer.h"
+#include "sensors/microphone.h"
void Sensor_Init()
{
//Sensor_Add("cpu_stime", RESOURCE_CPU_SYS, Resource_Read, NULL, NULL, NULL);
Sensor_Add("pressure_high1", PRES_HIGH1, Pressure_Read, Pressure_Init, Pressure_Cleanup, NULL);
Sensor_Add("pressure_low0", PRES_LOW0, Pressure_Read, Pressure_Init, Pressure_Cleanup, NULL);
//Sensor_Add("../testing/count.py", 0, Piped_Read, Piped_Init, Piped_Cleanup, 1e50,-1e50,1e50,-1e50);
- Sensor_Add("strain0", STRAIN0, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
- Sensor_Add("strain1", STRAIN1, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
- Sensor_Add("strain2", STRAIN2, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
- Sensor_Add("strain3", STRAIN3, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
+ //Sensor_Add("strain0_endhoop", STRAIN0, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
+ //Sensor_Add("strain1_endlong", STRAIN1, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
+ //Sensor_Add("strain2_midhoop", STRAIN2, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
+ //Sensor_Add("strain3_midlong", STRAIN3, Strain_Read, Strain_Init, Strain_Cleanup, Strain_Sanity);
+
+ //Sensor_Add("microphone", 0, Microphone_Read, Microphone_Init, Microphone_Cleanup, Microphone_Sanity);
//Sensor_Add("pressure0", PRESSURE0, Pressure_Read, Pressure_Init, 5000,0,5000,0);
//Sensor_Add("pressure1", PRESSURE1, Pressure_Read, Pressure_Init, 5000,0,5000,0);
//Sensor_Add("pressure_feedback", PRESSURE_FEEDBACK, Pressure_Read, Pressure_Init, 5000,0,5000,0);
- //Sensor_Add("enclosure", ENCLOSURE, Enclosure_Read, Enclosure_Init, 1,1,1,1);
- //Sensor_Add("dilatometer", DILATOMETER, Dilatometer_Read, Dilatometer_Init, -1,-1,-1,-1);
+ //Sensor_Add("enclosure", ENCLOSURE, Enclosure_Read, Enclosure_Init, 1,1,1,1); // Does not exist...
+
+ //NOTE: DO NOT ENABLE DILATOMETER WITHOUT FURTHER TESTING; CAUSES SEGFAULTS
+ //Sensor_Add("dilatometer0", 0, Dilatometer_Read, Dilatometer_Init, Dilatometer_Cleanup, NULL);
+ //Sensor_Add("dilatometer1",1, Dilatometer_Read, Dilatometer_Init, Dilatometer_Cleanup, NULL);
}
/**
/**
* Helper: Begin sensor response in a given format
* @param context - the FCGIContext
- * @param id - ID of sensor
+ * @param s - Sensor to begin the response for
* @param format - Format
*/
void Sensor_BeginResponse(FCGIContext * context, Sensor * s, DataFormat format)
/**
* Helper: End sensor response in a given format
* @param context - the FCGIContext
- * @param id - ID of the sensor
+ * @param s - Sensor to end the response for
* @param format - Format
*/
void Sensor_EndResponse(FCGIContext * context, Sensor * s, DataFormat format)
return g_sensors[id].name;
}
+/**
+ * Returns the last DataPoint that is currently available.
+ * @param id - The sensor ID for which to retrieve data from
+ * @return The last DataPoint
+ */
DataPoint Sensor_LastData(int id)
{
Sensor * s = &(g_sensors[id]);