A Port of TI's Webserver for the CC3000

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers HttpDynamicHandler.cpp Source File

HttpDynamicHandler.cpp

00001 /*****************************************************************************
00002 *
00003 *  HttpDynamicHandler.c
00004 *  Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
00005 *
00006 *  Redistribution and use in source and binary forms, with or without
00007 *  modification, are permitted provided that the following conditions
00008 *  are met:
00009 *
00010 *    Redistributions of source code must retain the above copyright
00011 *    notice, this list of conditions and the following disclaimer.
00012 *
00013 *    Redistributions in binary form must reproduce the above copyright
00014 *    notice, this list of conditions and the following disclaimer in the
00015 *    documentation and/or other materials provided with the   
00016 *    distribution.
00017 *
00018 *    Neither the name of Texas Instruments Incorporated nor the names of
00019 *    its contributors may be used to endorse or promote products derived
00020 *    from this software without specific prior written permission.
00021 *
00022 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
00023 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
00024 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
00026 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
00027 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00028 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00029 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00030 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00031 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00032 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 *
00034 *****************************************************************************/
00035 #include "mbed.h"
00036 #include "HttpDynamicHandler.h"
00037 #include "netapp.h"
00038 #include "wlan.h"
00039 #include "string.h"
00040 #include "Board.h"
00041 #include "Wheel.h"
00042 
00043 /** 
00044  * @addtogroup HttpDynamicHandler
00045  * @{
00046  */
00047 
00048 #ifdef HTTP_CORE_ENABLE_DYNAMIC
00049 
00050 /** 
00051  * @defgroup HttpDynamicHandler Handlers methods requested by HttpDynamic module
00052  * This module implements methods requested by HttpDynamic module.
00053  * Note this module is only compiled if HTTP_CORE_ENABLE_DYNAMIC is defined in HttpConfig.h
00054  *
00055  * @{
00056  */
00057 
00058 /**
00059  * This function applies an operation on a LED.
00060  * It is assumed that the parameters are ordered as denoted below.
00061  * @param uLedParams Includes the LED parameters: LED number and LED action
00062  * @return no return value
00063  */
00064 void HttpDynamicHandler_ActOnLED(inputParams uLedInParams, outputParams *uLedOutParams)
00065 {
00066     switch(uLedInParams.uLedParam.uLedAction)
00067     {
00068       case OFF:
00069       turnLedOff(uLedInParams.uLedParam.uLedNumber);
00070       break;
00071         case ON:
00072       turnLedOn(uLedInParams.uLedParam.uLedNumber);
00073       break;
00074        case toggle:
00075       toggleLed(uLedInParams.uLedParam.uLedNumber);
00076       break;
00077       default:
00078       break;
00079     }
00080 }
00081 
00082 
00083 /**
00084  * This function gets a temperature reading.
00085  * @param uTempInParams Denotes the temerature units, Celsius or Fahrenheit
00086  * @param uTempOutParams Denotes the temerature value
00087  * @return no return value
00088  */
00089 void HttpDynamicHandler_GetWheelValue(inputParams uWheelInParams, outputParams *uWheelOutParams)
00090 {
00091   uWheelOutParams->sWheelParam.uLedDummyOut   = GetLEDStatus();
00092   uWheelOutParams->sWheelParam.uLedDummyOut   = uWheelOutParams->sWheelParam.uLedDummyOut;
00093   uWheelOutParams->sWheelParam.uWheelPosition = Wheel_getPosition();
00094   uWheelOutParams->sWheelParam.uWheelValue    = Wheel_getValue();
00095 }
00096 /// @}
00097 
00098 #endif // HTTP_CORE_ENABLE_DYNAMIC
00099 
00100