Jump to content

Making an "ACARS"


Tom

Recommended Posts

Hi all,

I'm looking to make a script to run as an equivalent to that of FSACARS/kACARS etc which instead gets data from online xml feed(s).

I just want to be able to feed the live map from it and compile & automatically send PIREPS to the system when they're completed.

After looking through the FSACARS and kACARS scripts in the modules folder I'm still not really picking up how I would do it.

Would anyone be able to explain how the process works, what files are involved and what data will need to be provided?

Thanks :)

Link to comment
Share on other sites

  • Administrators

Basically you create a script, and you can create it as a module. Your app has to hit that module (or a cron or something if you're reading a feed), where that code gets run.

You need to call one of the ACARSData functions, to file a PIREP or update an actual flight status. To do that, you fill in a data structure and pass it to it. For example, kACARS is updating a status of a flight:

https://github.com/nshahzad/phpVMS/blob/master/core/modules/kACARS_Free/kACARS_Free.php#L179

There's that array, which get's passed to UpdateFlightData().

So perhaps it will be something like simplexml_load_data('your feed url'), and then filling out that data structure and passing it to UpdateFlighData.

FilePIREP is similar:

https://github.com/nshahzad/phpVMS/blob/master/core/modules/kACARS_Free/kACARS_Free.php#L255

Link to comment
Share on other sites

Right ok, so seeing as I'm doing it with XML rather than an actual program I'm going to have to set a cron to run the script?

How often should that run? I believe my host sets a limit to 15 minutes - would that be a problem do you think?

I think I have an fair idea for how to do it now.

Link to comment
Share on other sites

  • Administrators

Right ok, so seeing as I'm doing it with XML rather than an actual program I'm going to have to set a cron to run the script?

How often should that run? I believe my host sets a limit to 15 minutes - would that be a problem do you think?

I think I have an fair idea for how to do it now.

Yeah, 15 minutes is OK. You can set WGET or curl as a script to call yoursite.com/index.php/module/retrieve, where this will run this code:

class Module extends CodonModule { 

 public function retreive() {

// your XML parsing code in here, 
$cws = new CodonWebService();
$xml = simplexml_load_string($cws->get ('URL to your XML'));

// continue
 }
}

And you can do all your parsing, etc there as if it's a regular ACARS module

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...