Final commit from marbles
authorJeremy Tan <[email protected]>
Fri, 1 Nov 2013 04:45:02 +0000 (12:45 +0800)
committerJeremy Tan <[email protected]>
Fri, 1 Nov 2013 04:45:02 +0000 (12:45 +0800)
Not the dilatometer mods though

server/image.c
server/sensor.c

index a32ac2c..dcc122d 100644 (file)
@@ -10,6 +10,7 @@ static int g_captureID = -1;
 
 void Image_Handler(FCGIContext * context, char * params)
 {
+
        int num = 0, width = 1600, height = 1200;       // Set Default values
        FCGIValue val[] = {
                {"num", &num, FCGI_INT_T},
@@ -74,18 +75,22 @@ void Image_Handler(FCGIContext * context, char * params)
                g_captureID = num;
        }
 
-       cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_WIDTH, width);
-       cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_HEIGHT, height);
+       if (g_capture != NULL)
+       {
+
+               cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_WIDTH, width);
+               cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_HEIGHT, height);
 
-       *frame = cvQueryFrame(g_capture);
-       result = (*frame != NULL);
+               *frame = cvQueryFrame(g_capture);
+               result = (*frame != NULL);
 
        //cvShowImage("display", *image);
        //cvWaitKey(0); 
        //cvSaveImage("test.jpg",*image,0);
                
-       Log(LOGDEBUG, "At end of mutex");
-       
+               Log(LOGDEBUG, "At end of mutex");
+       }
+
        pthread_mutex_unlock(&mutex);   //Close the mutex
 
        //NOTE: Never have a "return" statement before the mutex is unlocked; it causes deadlocks!
index b934e8f..4e8ac7f 100644 (file)
@@ -76,6 +76,7 @@ int Sensor_Add(const char * name, int user_id, ReadFn read, InitFn init, CleanFn
 #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);   
@@ -84,16 +85,20 @@ void Sensor_Init()
        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_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("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_pos", DIL_POS, Dilatometer_Read, Dilatometer_Init, Dilatometer_Cleanup, NULL);
-       //Sensor_Add("dilatometer_diff",DIL_DIFF, Dilatometer_Read, Dilatometer_Init, Dilatometer_Cleanup, NULL);
+       //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);
 }
 
 /**

UCC git Repository :: git.ucc.asn.au