Create a custom CDU page that retrieves METAR information

A how-to is an informal, often short, description of how to accomplish some specific task (Wikipedia)
User avatar
wpslider
Posts: 5098
Joined: 06 Feb 2013, 18:38
Location: Faro - PT
Contact:

Create a custom CDU page that retrieves METAR information

Post by wpslider » 26 Jul 2013, 14:47

Hello,

With ProSim release 1.29, it is now possible to extend CDU pages to retrieve data from the Internet.

I'll show an example on How to create a CDU page that retrieves METAR information from NOAA.

Before start, we need to understand that we cannot retrieve formated or html data. The returned page must PLAIN TEXT.

This can be used-> http:\\weather.noaa.gov/pub/data/observations/metar/stations/EHAM.TXT

This CANNOT be used-> http://aviationweather.gov/adds/metars/ ... n_ids=eham" onclick="window.open(this.href);return false;


In version 1.29 a new type "http" of message was added.
ProSim737/ACARS/readme.txt wrote: A <message> element defines an ACARS message. Attributes:
- id : The ID of the message used to refer to it.
- code : The ACARS code that is used in the ACARS message to identify this message.
- description : The description of this message, used in ACARS programs.
- title : The link displayed in the CDU on LSK6R when an uplink is received.
- type : Optional, default is "acars". Can be "acars" for regular ACARS server processing or "http" for a http request.
This new type allows data retrieval from a web page in plain text.

To use the new property, we must add a new message like this:

Code: Select all

<message id="Metar" type="http" response="MetResponse">
        <url>http://weather.noaa.gov/pub/data/observations/metar/stations/${ICAO}.TXT</url>
</message>
where ${ICAO} is our variable.

To customize your CDU you first need to create a new ACARS file. Do not change any of the files included with ProSim. Every time you update ProSim, they are overwritten.

Instead, create your own ACARS file like this:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<acars name="myCustom" id="myCustom">

	<include id="default"/>
	<include id="menu"/>
	<include id="weather"/>

</acars>
save it as myCustom.xml

This will include all required files.
<include id="default"/>is the default ACARS file from ProSim
<include id="menu"/>is an extention to the default ACARS main page. We cannot append items to already existing CDU pages, so this file will extend the main ACARS menu adding a second page with our customizations.
<include id="weather"/> is our custom pages.

This is how the file menu.xml looks like:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<acars id="menu">

  <page title="DLNK -APPLICATION MENU" id="menu">

     <subpage>
    	<lsk2l link="cpdlc">CPDLC</lsk2l>
    	<lsk3l link="message">MESSAGING</lsk3l>
    	<lsk2r link="aocstd">AOC STD</lsk2r>
    	<lsk3r link="ats">ATS</lsk3r>
    	<lsk4r link="technical">TECHNICAL</lsk4r>
     </subpage>

     <subpage>
	<lsk1r link="weather">WEATHER</lsk1r>
     </subpage>

  </page>

</acars>
The first subpage group will overwrite the default one (We cannot append pages, so we need to overwrite it)
The second subpage group adds the second page with our items.

And finally our weather.xml looks like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<acars id="weather">

    <page title="WEATHER" id="weather">
        <lsk1l send="Metar">REQ METAR</lsk1l>
        <lsk3l input="ICAO" size="4">ICAO</lsk3l>
        <lsk6l link="menu">EXIT</lsk6l>
    </page>

    <page title="WEATHER" id="_genericUplink" uplink="MetResponse">
        <lsk1l output="_rawMessage" lines="2"/>
        <lsk2l output="_rawMessage" lines="2"/>
        <lsk3l output="_rawMessage" lines="2"/>
        <lsk4l output="_rawMessage" lines="2"/>
        <lsk5l output="_rawMessage" lines="2"/>
        <lsk6l link="menu">RETURN</lsk6l>
        <lsk6r action="print">PRINT</lsk6r>
    </page>

    <!--MESSAGE SECTION-->

    <message id="MetResponse" title="weather">
    </message>

    <message id="Metar" type="http" response="MetResponse">
        <url>http://weather.noaa.gov/pub/data/observations/metar/stations/${ICAO}.TXT</url>
    </message>


</acars>
We have defined two pages.
One is our custom page and the other is a customized uplink page where results will be shown.

Here is the result:
Image
Select DLNK

Image
A second page is available. press PAGE DOWN

Image
Select WEATHER.

Image
Our custom page is shown.

Image
Enter AD ICAO. And select REQ. METAR.

Image
New message available. Select new option WEATHER in LSK6R

Image
METAR is shown in the CDU

Don't forget to select your new acars file in ProSim confirguration.

Attached are all three files for this example. Just unzip all files to your ACARS folder and select myCustom from ProSim config.

Enjoy
Attachments
cdu_weather.zip
(1.26 KiB) Downloaded 610 times
Humberto Miguel
Image

NedHamilton
Posts: 588
Joined: 17 Apr 2012, 00:25
Location: North Carolina

Re: Create a custom CDU page that retrieves METAR informatio

Post by NedHamilton » 26 Jul 2013, 14:55

Very nice. I can't wait to try it out.
Ned

NedHamilton
Posts: 588
Joined: 17 Apr 2012, 00:25
Location: North Carolina

Re: Create a custom CDU page that retrieves METAR informatio

Post by NedHamilton » 26 Jul 2013, 16:32

I have a question:

Where does Prosim know to use the file myCustom.xml?

Is it hardwired into the code?
Ned

User avatar
wpslider
Posts: 5098
Joined: 06 Feb 2013, 18:38
Location: Faro - PT
Contact:

Re: Create a custom CDU page that retrieves METAR informatio

Post by wpslider » 26 Jul 2013, 17:04

Don't forget to select your new acars file in ProSim confirguration.

Attached are all three files for this example. Just unzip all files to your ACARS folder and select myCustom from ProSim config.
;)
Humberto Miguel
Image

NedHamilton
Posts: 588
Joined: 17 Apr 2012, 00:25
Location: North Carolina

Re: Create a custom CDU page that retrieves METAR informatio

Post by NedHamilton » 26 Jul 2013, 17:50

Thanks. I missed that.

Will Prosim undates from now on contain weather.xml and menu.xml files?
Ned

NedHamilton
Posts: 588
Joined: 17 Apr 2012, 00:25
Location: North Carolina

Re: Create a custom CDU page that retrieves METAR informatio

Post by NedHamilton » 26 Jul 2013, 17:58

Tried it but only got the single Application Menu page. It doesn't say "1/2" just DLINK Application Menu.
Ned

egkkman
Posts: 1571
Joined: 29 Aug 2011, 08:52

Re: Create a custom CDU page that retrieves METAR informatio

Post by egkkman » 26 Jul 2013, 19:11

Hi ned,

Did you place the new xml files in the ACARS folder and select the custom.xml on the config page of Prosim?

Regards

Dave

User avatar
wpslider
Posts: 5098
Joined: 06 Feb 2013, 18:38
Location: Faro - PT
Contact:

Re: Create a custom CDU page that retrieves METAR informatio

Post by wpslider » 26 Jul 2013, 20:03

NedHamilton wrote:Will Prosim undates from now on contain weather.xml and menu.xml files?
Prosim updates will not contain these files. But they wont be overwritten or deleted by prosim.
Humberto Miguel
Image

NedHamilton
Posts: 588
Joined: 17 Apr 2012, 00:25
Location: North Carolina

Re: Create a custom CDU page that retrieves METAR informatio

Post by NedHamilton » 26 Jul 2013, 20:07

egkkman wrote:Hi ned,

Did you place the new xml files in the ACARS folder and select the custom.xml on the config page of Prosim?

Regards

Dave
Yes
Ned

User avatar
wpslider
Posts: 5098
Joined: 06 Feb 2013, 18:38
Location: Faro - PT
Contact:

Re: Create a custom CDU page that retrieves METAR informatio

Post by wpslider » 26 Jul 2013, 20:13

You must have the following files in your ACARS directory:

default.xml
menu.xml
myCustom.xml
Readme.txt
silent.xml
weather.xml

Do you confirm you have all of the above in you ACARS directory?

In prosim config, do you see the new myCustom option under ACARS profile?

Did you select it?

Regards
Humberto Miguel
Image

Post Reply

Return to “ProSim737 - How-tos”