Title: Pablo Antoln
1- Pablo Antolín
- Francisco Milagro
- TID
PHP EDITION!!
2Application View
Windmeter
Disco Ball
Rain Sensor
Lamp
Fan
Phone
Thermometer
3Your assignment
- If temperature is above 20 degrees the DiscoBall
should be rotating. - When windspeed exceeds 2 the Light should flash 3
times. - Windspeed can be altered by turning on Fan in
front of Windmeter. - When leaving application Fan and DiscoBall should
be turned off.
41. Set up the environment
- Install a web server with PHP support like
Apache. You can try easy to install Apache
distributions like XAMPP (Apache, PHP MySQL) - We will use Eclipse as the IDE to create the
first Hydra application in Hydra - You can of course use any other IDE or text editor
52. Create a PHP project
- Point your content to the htdocs folder in the
server and create an index.php file
63. Web Service References
- Use these endpoints to consume the services
- DiscoBall http//212.214.80.1618080/3/BasicSwitc
hWS - Fan http//212.214.80.1618080/4/BasicSwitchWS
- Light http//212.214.80.1618080/2/EnhancedSwitch
WS - Thermometer http//212.214.80.1618080/Thermomete
rWS - Windmeter http//212.214.80.1618080/WindmeterWS
74 Start coding
//Create a PHP SOAP Client to access the
thermometer service clientT new
SoapClient("http//212.214.80.1618080/Thermometer
WS?wsdl") //Get temperature result
clientT-gtGetIndoorTemperature() indoorTemp
result-gtGetIndoorTemperatureResult if
(indoorTemp gt 20) //Rotate DiscoBall
clientD new SoapClient("http//212.214.80.1618
080/3/BasicSwitchWS?wsdl") result
clientD-gtTurnOn() //Turn on the fan clientF
new SoapClient("http//212.214.80.1618080/4/Bas
icSwitchWS?wsdl") result clientF-gtTurnOn()
85 Finalise your Code
//Check wind speed clientW new
SoapClient("http//212.214.80.1618080/WindmeterWS
?wsdl") windSpeed 0 while (windSpeed lt 2)
result clientW-gtGetWindSpeed()
windSpeed result-gtGetWindSpeedResult if
(windSpeed gt 2) //Blink light
clientL new SoapClient("http//212.214.80.1618
080/2/EnhancedSwitchWS?wsdl") result
clientL-gtFlash(3) //Turn off fan and
disco ball result clientF-gtTurnOff() result
clientD-gtTurnOff()
96. View Application when Executinghttp//webcam.c
net.se/view/index.shtml
- Run the application from a browser
- http//localhostserverport/HydraForDummies
- Check that everything is working in the live
webcam
10Congratulations! You are now a Hydra Pro!