commit 841effe8e1b7e5f74e569e9ea7b1f5ed9ce2f47a Author: James Pattinson Date: Tue Feb 11 17:16:53 2025 +0000 first commit diff --git a/BPC.mp3 b/BPC.mp3 new file mode 100644 index 0000000..fa5a9f2 Binary files /dev/null and b/BPC.mp3 differ diff --git a/BPCBeep.mp3 b/BPCBeep.mp3 new file mode 100644 index 0000000..fd10e08 Binary files /dev/null and b/BPCBeep.mp3 differ diff --git a/PressureChange.mp3 b/PressureChange.mp3 new file mode 100644 index 0000000..b1f4efb Binary files /dev/null and b/PressureChange.mp3 differ diff --git a/agcs-dev.html b/agcs-dev.html new file mode 100644 index 0000000..c612a9c --- /dev/null +++ b/agcs-dev.html @@ -0,0 +1,397 @@ + + + + + + EGFH Tower + + + + + + + + + + +
+
+
QNH
+
QFE
+
+
+
XXXX
+
XXXX
+
+
+
+
Surface Wind
+
Instant Wind
+
+ +
+
2
+
1
+
+
+
+
2min Gust
+
OAT
+
+ +
+
XXX
+
XXX
+
+
+ +
+
QNH: XXX
+
+ +

+ +

+

Connection Status: Not Connected
+ + + + diff --git a/agcs.html b/agcs.html new file mode 100644 index 0000000..b551964 --- /dev/null +++ b/agcs.html @@ -0,0 +1,386 @@ + + + + + + EGFH Tower + + + + + + + + + + +
+
+
QNH
+
QFE
+
+
+
XXXX
+
XXXX
+
+
+
+
Surface Wind
+
Instant Wind
+
+ +
+
2
+
1
+
+
+
+
2min Gust
+
OAT
+
+ +
+
XXX
+
XXX
+
+
+ +
+
QNH: XXX
+
+ +

+ +

+

Connection Status: Not Connected
+ + + + diff --git a/agcs_old.html b/agcs_old.html new file mode 100644 index 0000000..6662f42 --- /dev/null +++ b/agcs_old.html @@ -0,0 +1,391 @@ + + + + + + EGFH Tower + + + + + + + + +

UNDER TEST Swansea Tower Live

+
+ + + +
+
+
QNH
+
QFE
+
+
+
XXXX
+
XXXX
+
+
+
+
Surface Wind
+
Instant Wind
+
+ +
+
2
+
1
+
+
+
+
2min Gust
+
+
+ +
+
XXX
+
XXX
+
+
+ +
+
QNH: XXX
+
+ + +

+ + + + + +
+
+ + +
+
+

+

Connection Status: Not Connected
+ + + + diff --git a/agcs_old2.html b/agcs_old2.html new file mode 100644 index 0000000..26a5467 --- /dev/null +++ b/agcs_old2.html @@ -0,0 +1,400 @@ + + + + + + EGFH Tower + + + + + + + +

UNDER TEST Swansea Tower Live

+
+ + + +
+
+
QNH
+
QFE
+
+
+
XXXX
+
XXXX
+
+
+
+
Surface Wind
+
Instant Wind
+
+ +
+
2
+
1
+
+
+
+
2min Gust
+
OAT
+
+ +
+
XXX
+
XXX
+
+
+ +
+
QNH: XXX
+
+ +

+ + + + + +
+
+ + +
+
+

+

Connection Status: Not Connected
+ + + + diff --git a/egfh.html b/egfh.html new file mode 100644 index 0000000..5b8f81f --- /dev/null +++ b/egfh.html @@ -0,0 +1,84 @@ + + + + + + Swansea Weather + + + + + +

Swansea Weather Info

+ +

Displaying both Raw and manipulated values. Wind speed is converted to kts and rounded to nearest kt. Direction padded with Zero and rounded to nearest 5 degrees

+

Note that this is obtaining data from the Davis servers in the cloud where the weather console uploads to. Currently this updates every 15(!) minutes - lets look at changing this

+
+

+

+

+

+

+

+

+ +
+ + + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..33da5b2 --- /dev/null +++ b/index.php @@ -0,0 +1,2 @@ + + + + + + EGFH Tower + + + + + + + + +

UNDER TEST Swansea Tower Live

+ Instant wind data is received from the sensor by the Raspberry Pi via radio reciever and updates in real time. + +

+ The Barometric data actually comes from the Davis console device indirectly via the Internet and has a 15 minute delay. There will soon be a barometric sensor connected locally to fix this. +

+ + + +

+
+
+
+
+ +
+
+

QNH: XXX

+
+
+
+

QFE: XXX

+
+ + + + + +
+
+ + + +
+
+

+

Connection Status: Not Connected
+ + + + + diff --git a/wind2.html b/wind2.html new file mode 100644 index 0000000..340ff5c --- /dev/null +++ b/wind2.html @@ -0,0 +1,349 @@ + + + + + + EGFH Tower + + + + + + + + +

UNDER TEST Swansea Tower Live

+ Instant wind data is received from the sensor by the Raspberry Pi via radio reciever and updates in real time. + +

+ The Barometric data actually comes from the Davis console device indirectly via the Internet and has a 15 minute delay. There will soon be a barometric sensor connected locally to fix this. +

+ + + +
+
+
QNH
+
QFE
+
+
+
XXXX
+
XXXX
+
+
+
+
2min Wind
+
Instant Wind
+
+ +
+
2
+
1
+
+ +
+ +
+
QNH: XXX
+
+ + +

+ + + + + +
+
+ + +
+
+

+

Connection Status: Not Connected
+ + + + diff --git a/wlproxy.php b/wlproxy.php new file mode 100644 index 0000000..2709bc2 --- /dev/null +++ b/wlproxy.php @@ -0,0 +1,260 @@ + and +// are disabled by default, see for more information. +// callback - If specified, the response JSON will be wrapped in this named +// function call. This parameter and are disabled by +// default, see for more information. +// user_agent - This value will be sent to the remote URL request as the +// `User-Agent:` HTTP request header. If omitted, the browser user agent +// will be passed through. +// send_cookies - If send_cookies=1, all cookies will be forwarded through to +// the remote URL request. +// send_session - If send_session=1 and send_cookies=1, the SID cookie will be +// forwarded through to the remote URL request. +// full_headers - If a JSON request and full_headers=1, the JSON response will +// contain detailed header information. +// full_status - If a JSON request and full_status=1, the JSON response will +// contain detailed cURL status information, otherwise it will just contain +// the `http_code` property. +// +// Topic: POST Parameters +// +// All POST parameters are automatically passed through to the remote URL +// request. +// +// Topic: JSON requests +// +// This request will return the contents of the specified url in JSON format. +// +// Request: +// +// > ba-simple-proxy.php?url=http://example.com/ +// +// Response: +// +// > { "contents": "...", "headers": {...}, "status": {...} } +// +// JSON object properties: +// +// contents - (String) The contents of the remote URL resource. +// headers - (Object) A hash of HTTP headers returned by the remote URL +// resource. +// status - (Object) A hash of status codes returned by cURL. +// +// Topic: JSONP requests +// +// This request will return the contents of the specified url in JSONP format +// (but only if $enable_jsonp is enabled in the PHP script). +// +// Request: +// +// > ba-simple-proxy.php?url=http://example.com/&callback=foo +// +// Response: +// +// > foo({ "contents": "...", "headers": {...}, "status": {...} }) +// +// JSON object properties: +// +// contents - (String) The contents of the remote URL resource. +// headers - (Object) A hash of HTTP headers returned by the remote URL +// resource. +// status - (Object) A hash of status codes returned by cURL. +// +// Topic: Native requests +// +// This request will return the contents of the specified url in the format it +// was received in, including the same content-type and other headers (but only +// if $enable_native is enabled in the PHP script). +// +// Request: +// +// > ba-simple-proxy.php?url=http://example.com/&mode=native +// +// Response: +// +// > ... +// +// Topic: Notes +// +// * Assumes magic_quotes_gpc = Off in php.ini +// +// Topic: Configuration Options +// +// These variables can be manually edited in the PHP file if necessary. +// +// $enable_jsonp - Only enable if you really need to. If you +// install this script on the same server as the page you're calling it +// from, plain JSON will work. Defaults to false. +// $enable_native - You can enable , but you should only do +// this if you also whitelist specific URLs using $valid_url_regex, to avoid +// possible XSS vulnerabilities. Defaults to false. +// $valid_url_regex - This regex is matched against the url parameter to +// ensure that it is valid. This setting only needs to be used if either +// $enable_jsonp or $enable_native are enabled. Defaults to '/.*/' which +// validates all URLs. +// +// ############################################################################ + +// Change these configuration options if needed, see above descriptions for info. +$enable_jsonp = false; +$enable_native = false; +$valid_url_regex = '/.*/'; + +$apikey = "beliqdwnzkkeqdar4sb9xfhxzdv3rf03"; +$apisecret = "zpdi1jrycd17gjmx0ldqydj9meboavwg"; + +$url = 'https://api.weatherlink.com/v2/' . $_GET['api'] . "?api-key=" . $apikey; + +// ############################################################################ + +if ( !$url ) { + + // Passed url not specified. + $contents = 'ERROR: url not specified'; + $status = array( 'http_code' => 'ERROR' ); + +} else if ( !preg_match( $valid_url_regex, $url ) ) { + + // Passed url doesn't match $valid_url_regex. + $contents = 'ERROR: invalid url'; + $status = array( 'http_code' => 'ERROR' ); + +} else { + $ch = curl_init( $url ); + + if ( strtolower($_SERVER['REQUEST_METHOD']) == 'post' ) { + curl_setopt( $ch, CURLOPT_POST, true ); + curl_setopt( $ch, CURLOPT_POSTFIELDS, $_POST ); + } + + if ( $_GET['send_cookies'] ) { + $cookie = array(); + foreach ( $_COOKIE as $key => $value ) { + $cookie[] = $key . '=' . $value; + } + if ( $_GET['send_session'] ) { + $cookie[] = SID; + } + $cookie = implode( '; ', $cookie ); + + curl_setopt( $ch, CURLOPT_COOKIE, $cookie ); + } + + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); + curl_setopt( $ch, CURLOPT_HEADER, true ); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); + + curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-Api-Secret: $apisecret"] ); + + curl_setopt( $ch, CURLOPT_USERAGENT, $_GET['user_agent'] ? $_GET['user_agent'] : $_SERVER['HTTP_USER_AGENT'] ); + + list( $header, $contents ) = preg_split( '/([\r\n][\r\n])\\1/', curl_exec( $ch ), 2 ); + + $status = curl_getinfo( $ch ); + + curl_close( $ch ); +} + +// Split header text into an array. +$header_text = preg_split( '/[\r\n]+/', $header ); + +if ( $_GET['mode'] == 'native' ) { + if ( !$enable_native ) { + $contents = 'ERROR: invalid mode'; + $status = array( 'http_code' => 'ERROR' ); + } + + // Propagate headers to response. + foreach ( $header_text as $header ) { + if ( preg_match( '/^(?:Content-Type|Content-Language|Set-Cookie):/i', $header ) ) { + header( $header ); + } + } + + print $contents; + +} else { + + // $data will be serialized into JSON data. + $data = array(); + + // Propagate all HTTP headers into the JSON data object. + if ( $_GET['full_headers'] ) { + $data['headers'] = array(); + + foreach ( $header_text as $header ) { + preg_match( '/^(.+?):\s+(.*)$/', $header, $matches ); + if ( $matches ) { + $data['headers'][ $matches[1] ] = $matches[2]; + } + } + } + + // Propagate all cURL request / response info to the JSON data object. + if ( $_GET['full_status'] ) { + $data['status'] = $status; + } else { + $data['status'] = array(); + $data['status']['http_code'] = $status['http_code']; + } + + // Set the JSON data object contents, decoding it from JSON if possible. + $decoded_json = json_decode( $contents ); + $data['contents'] = $decoded_json ? $decoded_json : $contents; + + // Generate appropriate content-type header. + $is_xhr = strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; + header( 'Content-type: application/' . ( $is_xhr ? 'json' : 'x-javascript' ) ); + + // Get JSONP callback. + $jsonp_callback = $enable_jsonp && isset($_GET['callback']) ? $_GET['callback'] : null; + + // Generate JSON/JSONP string + $json = json_encode( $data ); + + print $jsonp_callback ? "$jsonp_callback($json)" : $json; + +} + +?>