Code Search for Developers
 
 
  

toolsPagePutConfig.c from EmStar at Krugle


Show toolsPagePutConfig.c syntax highlighted

/*
 *
 * Copyright (c) 2003 The Regents of the University of California.  All 
 * rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 * - Neither the name of the University nor the names of its
 *   contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

char cgi_template_c_cvsid[] = "$Id: toolsPagePutConfig.c,v 1.1 2005/12/15 18:30:26 karenyc Exp $";

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libdev/status_client.h>
#include <libmisc/misc_buf.h>
#include <libmisc/misc_init.h>

#include <devel/http/cgic.h>
#include <devel/http/html.h>
#include <string.h>


void http_header(FILE* output_stream) {
  cgiHeaderContentType("text/html");
  fflush(output_stream);
}



int process_cgi(FILE* output_stream) {

  html_banner(cgiOut, "TOOLS", "Put a Configuration onto a Mote" ,"#FF3399");

  fprintf(cgiOut, "<FORM ACTION=\"/cgi-bin/toolsPagePutConfig.cgi\" METHOD=\"POST\"> ");
  
  char node_id[100];
  int measure_choice=0;
  char measure_value[5];
  char *measure_names[]={
    "humidity",
    "temperature",
    "dewPoint",
    "windSpeed",
    "solarRadiation",
    "leafWetness",
    "windDirection",
    "barometer",
    "rain",
    "lightning",
    "enclosureHumidity",
    "gust",
    "messageLossAtCH1",
    "messageSent",
    "hopsToCH1",
    "moteBattery",
    "insideTemperature",
    "insideHumidity",
    "parCurrent",
    "insideThermopile",
    "analog0",
    "analog1",
    "soilMoistureAt15cm",
    "soilMoistureAt50cm",
    "soilTemperatureAt100cm",
    "soilTemperatureAt30cm",
    "enclosureTemperature",
    "soilTemperatureAt15cm",
    "soilTemperatureAt50cm",
    "analog2",
    "analog3",
    "analog4",
    "analog5",
    "analog6",
    "analog7",
    "parL11905A",
    "parNT53373",
    "parNT53373_2",
    "thermister",
    "humidity_1500_33_JR",
    "thermistor_NTC_25_JR",
    "Select Name"};
   
  int sensor_id_choice =0;
  char sensor_value[5];
  char *sensor_id[]= {
    "sensor_unknown",
    "sensor_mpxa6115a",
    "sensor_windSpeedDavis",
    "sensor_windSpeedCsMett034B",
    "sensor_windDirectionDavis",
    "sensor_windDirectionCsMett034B",
    "sensor_echo20_2_5V",
    "sensor_echo10_2_5V",
    "sensor_echo20_5V",
    "sensor_echo10_5V",
    "sensor_parCurrent",
    "sensor_adcVoltage",
    "sensor_instAmpVoltage",
    "sensor_thermopile",
    "sensor_irTemperatureMelexisMlx90601KzaBka",
    "sensor_humirelHm1500_3_3V",
    "sensor_humirelHm1500_5V",
    "sensor_temperatureBcThermistor",
    "sensor_leafWetnessDavis",
    "sensor_rainGaugeDavis",
    "sensor_sht15_humidity",
    "sensor_sht15_temperature",
    "sensor_parL11905A", 
    "sensor_parNT53373", 
    "sensor_parNT53373_2", 
    "sensor_thermister",
    "sensor_humidity_1500_33_JR",
    "sensor_thermistor_NTC_25_JR",
    "Select Type"};
  
  
  char *hardware_addr[]= {
    "ADC0_HARDWARE_ADDRESS",
    "ADC1_HARDWARE_ADDRESS",
    "ADC2_HARDWARE_ADDRESS",
    "ADC3_HARDWARE_ADDRESS",
    "ADC4_HARDWARE_ADDRESS",
    "ADC5_HARDWARE_ADDRESS",
    "ADC6_HARDWARE_ADDRESS",
    "ADC7_HARDWARE_ADDRESS",
    "ADC8_HARDWARE_ADDRESS",
    "ADC9_HARDWARE_ADDRESS",
    "ADC10_HARDWARE_ADDRESS",
    "ADC11_HARDWARE_ADDRESS",
    "ADC12_HARDWARE_ADDRESS",
    "ADC13_HARDWARE_ADDRESS",
    "COUNTER_HARDWARE_ADDRESS",
    "TEMP_HARDWARE_ADDRESS",
    "HUM_HARDWARE_ADDRESS",
    "BATTEREY_HARDWARE_ADDRESS",
    "DIG0_HARDWARE_ADDRESS",
    "DIG1_HARDWARE_ADDRESS",
    "DIG2_HARDWARE_ADDRESS",
    "DIG3_HARDWARE_ADDRESS",
    "DIG4_HARDWARE_ADDRESS",
    "DIG5_HARDWARE_ADDRESS",
    "NO_HARDWARE_ADDRESS",
    "Select Address"};
  
  int hardware_addr_choice;
  char hardware_value[5];

  char *analogue_param[]={
    "SAMPLER_DEFAULT",
    "AVERAGE_FOUR",
    "AVERAGE_EIGHT",
    "AVERAGE_SIXTEEN",
    "EXCITATION_25",
    "EXCITATION_33",
    "EXCITATION_50",
    "EXCITATION_ALWAYS_ON",
    "DELAY_BEFORE_MEASUREMENT",
    "Select Parameter"};
  
  int analogue_param_choice;

  char *digital_param[]={
    "RISING_EDGE",
    "FALLING_EDGE",
    "EVENT",
    "EEPROM_TOTALIZER",
    "RESET_ZERO_AFTER_READ",
    "DIG_OUTPUT",
    "DIG_FILTER",
    "COUNTER_FREE_RUN",
    "Select Parameter"};

  int digital_param_choice;
 
  char qid[5];
  char command[256]="put:";
  int valid=1;
 

  
  fprintf(cgiOut, "<br>Enter the Query ID (qid): ");
  fprintf(cgiOut, " <INPUT TYPE=\"text\" NAME=\"query_id\" VALUE=\"0\" size=\"6\" maxlength =\"4\"> ");
  if(cgiFormString( "query_id", qid, sizeof(qid))== cgiFormSuccess){
    fprintf( cgiOut, "<br> <font color=#FF3399>Query ID is set to %s.</font>",qid);  
    strcat(command, "qid=");
    strcat(command, qid);
  }

  
  if( my_sim_group != 0){
    fprintf(cgiOut, "<br>Enter the Node ID (0 if in non sim mode): ");
    fprintf(cgiOut, " <INPUT TYPE=\"text\" NAME=\"my_node_id\" VALUE=\"0\" size=\"6\" maxlength =\"4\"> ");
    if(cgiFormString( "my_node_id", node_id, sizeof(node_id))== cgiFormSuccess){
      fprintf( cgiOut, "<br> <font color=#FF3399>Node ID is set to %s.</font>", node_id);
      strcat(command, ":id=");
      strcat(command, node_id);
    }
  }
  else if( my_sim_group == 0){
    strcat(command, ":id=0");
  }

  my_node_id = atoi(node_id);


  //allows user to enter measurement name
  fprintf(cgiOut, "<br><br>Choose from the Following Measurement Names (mn): ");
  fprintf(cgiOut, "<SELECT NAME= \"measurement\" >");
  fprintf(cgiOut, " <OPTION SELECTED >humidity ");
  fprintf(cgiOut, " <OPTION SELECTED > temperature ");
  fprintf(cgiOut, " <OPTION SELECTED > dewPoint ");
  fprintf(cgiOut, " <OPTION SELECTED > windSpeed ");
  fprintf(cgiOut, " <OPTION SELECTED > solarRadiation ");
  fprintf(cgiOut, " <OPTION SELECTED > leafWetness ");
  fprintf(cgiOut, " <OPTION SELECTED > windDirection ");
  fprintf(cgiOut, " <OPTION SELECTED > barometer ");
  fprintf(cgiOut, " <OPTION SELECTED > rain ");
  fprintf(cgiOut, " <OPTION SELECTED > lightning ");
  fprintf(cgiOut, " <OPTION SELECTED > enclosureHumidity ");
  fprintf(cgiOut, " <OPTION SELECTED > gust ");
  fprintf(cgiOut, " <OPTION SELECTED > messageLossAtCH1 ");
  fprintf(cgiOut, " <OPTION SELECTED > messageSent ");
  fprintf(cgiOut, " <OPTION SELECTED > hopsToCH1 ");
  fprintf(cgiOut, " <OPTION SELECTED > moteBattery ");
  fprintf(cgiOut, " <OPTION SELECTED > insideTemperature ");
  fprintf(cgiOut, " <OPTION SELECTED > insideHumidity ");
  fprintf(cgiOut, " <OPTION SELECTED > parCurrent ");
  fprintf(cgiOut, " <OPTION SELECTED > insideThermopile ");
  fprintf(cgiOut, " <OPTION SELECTED > analog0 ");
  fprintf(cgiOut, " <OPTION SELECTED > analog1 ");
  fprintf(cgiOut, " <OPTION SELECTED > soilMoistureAt15cm ");
  fprintf(cgiOut, " <OPTION SELECTED > soilMoistureAt50cm ");
  fprintf(cgiOut, " <OPTION SELECTED > soilTemperatureAt100cm ");
  fprintf(cgiOut, " <OPTION SELECTED > soilTemperatureAt30cm ");
  fprintf(cgiOut, " <OPTION SELECTED > enclosureTemperature ");
  fprintf(cgiOut, " <OPTION SELECTED > soilTemperatureAt15cm ");
  fprintf(cgiOut, " <OPTION SELECTED > soilTemperatureAt50cm ");
  fprintf(cgiOut, " <OPTION SELECTED > analog2 ");
  fprintf(cgiOut, " <OPTION SELECTED > analog3 ");
  fprintf(cgiOut, " <OPTION SELECTED > analog4 ");
  fprintf(cgiOut, " <OPTION SELECTED > analog5 ");
  fprintf(cgiOut, " <OPTION SELECTED > analog6 ");
  fprintf(cgiOut, " <OPTION SELECTED > analog7 "); 
  fprintf(cgiOut, " <OPTION SELECTED > parL11905A ");
  fprintf(cgiOut, " <OPTION SELECTED > parNT53373 ");
  fprintf(cgiOut, " <OPTION SELECTED > parNT53373_2 ");
  fprintf(cgiOut, " <OPTION SELECTED > thermister ");
  fprintf(cgiOut, " <OPTION SELECTED > humidity_1500_33_JR ");
  fprintf(cgiOut, " <OPTION SELECTED > thermistor_NTC_25_JR ");
  fprintf(cgiOut, " <OPTION SELECTED > Select Name");
  fprintf(cgiOut, " </SELECT>");
  
  if(cgiFormSelectSingle("measurement", measure_names, 42, &measure_choice, 0) == cgiFormSuccess){ 
    if(measure_choice<35){
      sprintf(measure_value ,"%i", measure_choice+33);
      fprintf(cgiOut, "<br><font color=#FF3399>mn is set to %s.</font><br>", measure_names[measure_choice]);
      strcat(command, ":mn=");
      strcat(command, measure_value);
	  
    }
    else if((measure_choice>=35) && (measure_choice<41)){
      sprintf(measure_value, "%i", (measure_choice-35)+128);
      fprintf( cgiOut, "<br><font color=#FF3399>mn is set to %s.</font><br>", measure_names[measure_choice]);
      strcat(command, ":mn=");
      strcat(command, measure_value);
    }
    else{
      fprintf(cgiOut, "<br><font color=#FF3399>Please select a Name</font><br>");
      valid =0;
    }
  }
  
  //allows users to chose sensor type
   fprintf(cgiOut, "<br><br>Choose from the Following Sensor Types (stid): ");
   fprintf(cgiOut, "<SELECT NAME= \"sensor_id\" >");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_unknown");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_mpxa6115a");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_windSpeedDavis");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_windSpeedCsMett034B");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_windDirectionDavis");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_windDirectionCsMett034B");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_echo20_2_5V");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_echo10_2_5V");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_echo20_5V");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_echo10_5V");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_parCurrent");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_adcVoltage");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_instAmpVoltage");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_thermopile");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_irTemperatureMelexisMlx90601KzaBka");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_humirelHm1500_3_3V");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_humirelHm1500_5V");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_temperatureBcThermistor");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_leafWetnessDavis");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_rainGaugeDavis");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_sht15_humidity");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_sht15_temperature");	
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_parL11905A");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_parNT53373");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_parNT53373_2");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_thermister");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_humidity_1500_33_JR");
   fprintf(cgiOut, " <OPTION SELECTED >  sensor_thermistor_NTC_25_JR");
   fprintf(cgiOut, " <OPTION SELECTED >  Select Type");
   fprintf(cgiOut, " </SELECT>");
   
   if(cgiFormSelectSingle("sensor_id", sensor_id, 29, &sensor_id_choice, 0) == cgiFormSuccess){
     if(sensor_id_choice<28){
       fprintf( cgiOut, "<br> <font color=#FF3399>stid is set to %s.</font><br>", sensor_id[sensor_id_choice]);
       sprintf(sensor_value ,"%i", sensor_id_choice+2);
       strcat(command, ":stid=");
       strcat(command, sensor_value);
     } 
     else{
      fprintf(cgiOut, "<br><font color=#FF3399>Please select a Type</font><br>");
      valid=0;
    }
   }

   
   //allows user to choose hardware address
   fprintf(cgiOut, "<br><br>Choose from the Following Hardware Addresses (hwaddr): ");
   fprintf(cgiOut, "<SELECT NAME= \"hardware_addr\" >");
   fprintf(cgiOut, "<OPTION SELECTED > ADC0_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC1_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > ADC2_HARDWARE_ADDRESS");  
   fprintf(cgiOut, "<OPTION SELECTED > ADC3_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC4_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC5_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC6_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC7_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC8_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC9_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC10_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC11_HARDWARE_ADDRESS");  
   fprintf(cgiOut, "<OPTION SELECTED > ADC12_HARDWARE_ADDRESS"); 
   fprintf(cgiOut, "<OPTION SELECTED > ADC13_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > COUNTER_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > TEMP_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > HUM_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > BATTEREY_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > DIG0_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > DIG1_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > DIG2_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > DIG3_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > DIG4_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > DIG5_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > NO_HARDWARE_ADDRESS");
   fprintf(cgiOut, "<OPTION SELECTED > Select Address");
   fprintf(cgiOut, " </SELECT>");
  
 
  if(cgiFormSelectSingle("hardware_addr", hardware_addr, 26, &hardware_addr_choice, 0) == cgiFormSuccess){
    if(hardware_addr_choice<25){
      fprintf( cgiOut, "<br> <font color=#FF3399>hwaddr is set to %s.</font><br>", hardware_addr[hardware_addr_choice]);
      sprintf(hardware_value ,"%i", hardware_addr_choice);
      strcat(command, ":hwaddr=");
      strcat(command, hardware_value);
    }
    else if(hardware_addr_choice == 25){
      fprintf(cgiOut, "<br><font color=#FF3399>Please select an Address</font><br>");
      valid=0;
    }
  }
  
  //allows users to choose analogue parameter if they had selected analogue hardware address
   fprintf(cgiOut, "<br><br>Choose from the Following Analogue Parameters if Analogue Hardware was Chosen (param): ");
   fprintf(cgiOut, "<SELECT NAME= \"analogue_param\" >");
   fprintf(cgiOut, "<OPTION SELECTED > SAMPLER_DEFAULT");
   fprintf(cgiOut, "<OPTION SELECTED > AVERAGE_FOUR");
   fprintf(cgiOut, "<OPTION SELECTED > AVERAGE_EIGHT");
   fprintf(cgiOut, "<OPTION SELECTED > AVERAGE_SIXTEEN");
   fprintf(cgiOut, "<OPTION SELECTED > EXCITATION_25");
   fprintf(cgiOut, "<OPTION SELECTED > EXCITATION_33");
   fprintf(cgiOut, "<OPTION SELECTED > EXCITATION_50");
   fprintf(cgiOut, "<OPTION SELECTED > EXCITATION_ALWAYS_ON");
   fprintf(cgiOut, "<OPTION SELECTED > DELAY_BEFORE_MEASUREMENT");
   fprintf(cgiOut, " <OPTION SELECTED >Select Parameter");
   fprintf(cgiOut, " </SELECT>");
 
   if(cgiFormSelectSingle("analogue_param", analogue_param, 10, &analogue_param_choice, 0) == cgiFormSuccess){
     if(analogue_param_choice<9){
       strcat(command, ":param=");
       if(analogue_param_choice == 8)
	 strcat(command, "0x80");
       else if(analogue_param_choice == 7)
	 strcat(command, "0x40");
       else if(analogue_param_choice == 6)
	 strcat(command, "0x20");
       else if(analogue_param_choice == 5)
	 strcat(command,"0x10");
       else if(analogue_param_choice == 4)
	 strcat(command,"0x08");
       else if(analogue_param_choice == 3)
	 strcat(command,"0x04");
       else if(analogue_param_choice == 2)
	 strcat(command,"0x02");
       else if(analogue_param_choice == 1)
	 strcat(command,"0x01");
       else if(analogue_param_choice == 0)
	 strcat(command,"0x00");  
       fprintf( cgiOut, "<br> <font color=#FF3399>param is set to %s.</font><br>", analogue_param[analogue_param_choice]); 
        }
     else if(analogue_param_choice == 9){
      fprintf(cgiOut, "<br><font color=#FF3399>Please select a Parameter</font><br>");
    }
   }
   
  //allows users to choose digital parameter if they had selected digital hardware address
   fprintf(cgiOut, "<br><br>Choose from the Following Digital Parameters if Digital Hardware was Chosen (param): ");
   fprintf(cgiOut, "<SELECT NAME= \"digital_param\" >");
   fprintf(cgiOut, "<OPTION SELECTED > RISING_EDGE");
   fprintf(cgiOut, "<OPTION SELECTED > FALLING_EDGE");
   fprintf(cgiOut, "<OPTION SELECTED > EVENT");
   fprintf(cgiOut, "<OPTION SELECTED > EEPROM_TOTALIZER");
   fprintf(cgiOut, "<OPTION SELECTED > RESET_ZERO_AFTER_READ");
   fprintf(cgiOut, "<OPTION SELECTED > DIG_OUTPUT");
   fprintf(cgiOut, "<OPTION SELECTED > DIG_FILTER");
   fprintf(cgiOut, "<OPTION SELECTED > COUNTER_FREE_RUN");
   fprintf(cgiOut, " <OPTION SELECTED >Select Parameter");
   fprintf(cgiOut, " </SELECT>");
   
   if(cgiFormSelectSingle("digital_param", digital_param, 9, &digital_param_choice, 0) == cgiFormSuccess){
     
     if(digital_param_choice<8){
       strcat(command, ":param=");
       if(digital_param_choice == 7)
	 strcat(command, "0x80");
       else if(digital_param_choice == 6)
	 strcat(command, "0x80");
       else if(digital_param_choice == 5)
	 strcat(command, "0x40");
       else if(digital_param_choice == 4)
	 strcat(command, "0x30");
       else if(digital_param_choice == 3)
	 strcat(command, "0x08");
       else if(digital_param_choice == 2)
	 strcat(command, "0x04");
       else if(digital_param_choice == 1)
	 strcat(command, "0x02");
       else if(digital_param_choice == 0)
	 strcat(command, "0x01");
       fprintf( cgiOut, "<br> <font color=#FF3399>param is set to %s.</font><br>", digital_param[digital_param_choice]);  
     }
     else if(analogue_param_choice == 9){
	 fprintf(cgiOut, "<br><font color=#FF3399>Please select a Parameter</font><br>");
    }
   }
   
  fprintf(cgiOut, "<br><br> <INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Submit\"> ");
  fprintf(cgiOut, "</FORM>");
 
 
  if(cgiFormSubmitClicked("submit") == cgiFormSuccess){
    //checks to see if user had selected Parameter correctly

    
    if( (analogue_param_choice == 9) && (digital_param_choice == 8)){
      valid =0;
      fprintf(cgiOut, "<br><font color=#FF3399><li>Please Select a Parameter!</font><br>");
   }
    if((analogue_param_choice != 9) && (digital_param_choice != 8)){
      valid =0;
      fprintf(cgiOut, "<br><font color=#FF3399><li>Please Select Only One Parameter!</font><br>");
    }
    
    valid=1;
    if(valid == 0){
      fprintf(cgiOut, "<br><br><font color=#FF3399>The configuration settings were not complete.  Please fill out the form again.  Thank you.</font><br>");
    }
  
    else if(valid == 1){
      fprintf(cgiOut, "<br><br><font color=#FF3399>You've selected the following command for configuration: <br>");
      fprintf(cgiOut, "<br>%s",command);
     
    
      fprintf(cgiOut, "<br><font color=#FF3399> You've successfully sent the configuration settings.</font>");
    }
  }
    fprintf(cgiOut, "<A HREF=\"/cgi-bin/toolsPage.cgi\"<p>Return to Tools</A></P>");
    return 0;

}







See more files for this project here

EmStar

EmStar is a software system for developing and deploying wireless sensor networks involving Linux-based platforms. As the wireless sensor network community has attempted to deploy more complex designs---large-scale, long-lived systems that need self-organization and adaptivity---a number of difficult software design issues have arisen. Advances in software design have not kept pace with the capabilities of hardware. This is because designing for an adaptive, efficient, and useful sensor network has turned out to be surprisingly complex and difficult. EmStar is a Linux-based software framework, whose goal is to dramatically reduce this complexity, enabling work to be shared and reused, and simplifying and speeding the design of new sensor network applications.

Project homepage: http://cvs.cens.ucla.edu/emstar/
Programming language(s): C,Shell Script
License: other

  Final_Documentation.doc
  dataInfo.c
  frontPage.c
  netStatusMoteConfig.c
  netStatusMoteNetwork.c
  netStatusNeighbors.c
  netStatusPage.c
  netStatusQuery.c
  netTaskPage.c
  toolsPage.c
  toolsPageEraseConfig.c
  toolsPageGetConfig.c
  toolsPageLinkDump.c
  toolsPagePutConfig.c
  toolsPageQuery.c
  toolsPageRequery.c