Difference between revisions of "Component: BBC Weather Observation (Comms: IoT/Cloud)"
(XML import) |
|||
Line 22: | Line 22: | ||
==Examples== | ==Examples== | ||
− | + | ||
+ | Here is a basic example to read the observation data and report the information on a graphical display. | ||
+ | |||
+ | {{Fcfile|BBCWeatherDemo.fcfx|BBCWeatherDemo}} | ||
+ | |||
+ | |||
+ | The location can be set by adjusting the BBC Weather location property, see the component property tooltips for more information on how to do this. | ||
+ | |||
+ | On an embedded device you would need a TCP/IP component to allow the communications to the BBC server. This then links to the Network Comms component. | ||
+ | |||
Revision as of 09:02, 7 August 2019
Author | MatrixTSL |
Version | 1.0 (Release) |
Category | Comms: IoT/Cloud |
Contents
BBC Weather Observation component
Easily allows you to collect observed weather metrics for your area using the BBC Weather data service. Supports temperature and humidty for your selected area. Also available are Wind Direction, Wind Speed and Air Pressure but please note these are not always available depending on your selected area.
Examples
Here is a basic example to read the observation data and report the information on a graphical display.
The location can be set by adjusting the BBC Weather location property, see the component property tooltips for more information on how to do this.
On an embedded device you would need a TCP/IP component to allow the communications to the BBC server. This then links to the Network Comms component.
Downloadable macro reference
GetWindDirection
Reads the reported wind direction as a string.
Please note this data may not be available for your selected location.
Parameters
- This macro has no parameters
Return value
RequestData
Requests data about your selected location from the BBC weather service.
Returns true if the request was successful.
Must be called before trying to call any of the GetXXX macros.
Parameters
- This macro has no parameters
Return value
- BOOL : Returns true if the operation is a success, else false
GetHumidity
Reads the reported humidity in Relative Humdity.
Parameters
- This macro has no parameters
Return value
GetTemperature
Reads the reported temperature in the selected scale.
Parameters
- BOOL Scale
- 0 = Celcius, 1 = Farenheit
Return value
GetWindSpeed
Reads the reported wind speed in MPH.
Please note this data may not be available for your selected location.
Parameters
- This macro has no parameters
Return value
SetLocationCode
Allows the location code to be altered from the default location code set in the component properties.
After changing the location the RequestData macro must be called to refresh the forecast variables.
Parameters
- <- STRING NewLocation
- New location string, see Location property tooltip for more info.
- This parameter may be returned back to the caller
Return value
- This call does not return a value
GetPressure
Reads the reported air pressure in milli bar (mb).
Please note this data may not be available for your selected location.
Parameters
- This macro has no parameters
Return value
GetLocationName
Reads the reported location name as a string.
Parameters
- This macro has no parameters
Return value
Initialise
Sets up the component ready to collect weather data.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
Network Comms Component
This property is of type Panel object and can be referenced with the variable name NetworkCommsComp.
Network Communications component to use as the bridge to the TCP/IP network.
BBC IP Address
This property is of type Line of text and can be referenced with the variable name IPAddr.
IP Address linked to the following URL: weather-broker-cdn.api.bbci.co.uk
Location Code
This property is of type Line of text and can be referenced with the variable name Location.
BBC code for your area.
In a web browser go to www.bbc.co.uk/weather/
Then type in your city in the search bar and your code will be shown at the end of the URL.
For example Manchester in the UK = 2643123
In the UK you can also use the first half of your post code, e.g. HX1
Receive Timeout
This property is of type Unsigned integer and can be referenced with the variable name RxTimeout.
Maximum time to wait for valid incoming data.