Welcome, Guest. Please login or register.
Did you miss your activation email?

News:
Precision Simulator update 10.156 (3 July 2022) is now available.
Navburo update 12 (18 November 2021) is now available.
NG FMC and More is released.

Author Topic: Hello world?  (Read 731 times)

Will

  • Join date: May 2009
  • Location: Chicago
  • Posts: 2419
Hello world?
« on: Sat, 11 Jun 2022 16:59 »
Hello team,

I think it might be fun to try making an add-on for PSX that lets pilots use ACARS to request a final loadsheet, and then have the loadsheet printed on a "Paper from the flight deck printer" window. I know that some of this functionality is already available through other add-ons, so it's more about the coding challenge and personalization than just getting access to the functionality.

What I'd like to do with this post is describe the specs, to ask if everything is theoretically possible, and then ask the community if there is anything like a simple "Hello world" app that I can use as a starting point to model from.

Proposed functionality:

1. Menu item like "<REQUEST LOADSHEET" available while the aircraft is on the ground.
2. When the loadsheet is requested, there's an uplink notification (like when ATIS is requested). The crew can print the loadsheet.
3. The loadsheet contains items from the Instructor Pages:

Time
Date
ZFW
CG

Very simple! I think I can learn from a model, but I also think it would take me forever to learn the basics of just how an app connects to PSX and reads and sends variables.

Therefore...

First question: Is any of the proposed functionality impossible or extraordinarily complicated?

Second question: Is there a simple open source "hello world" program out there? Maybe something that puts "hello world" on the CDU, or even more basic, just reads and writes any variable to PSX?

I'm starting from scratch here (and using a Windows 10 machine), so any coding environment is fine with me.

Thanks for considering!
Will /Chicago /USA

Hardy Heinlin

  • Moderator
  • Join date: May 2009
  • Posts: 13156
    • Aerowinx
Re: Hello world?
« Reply #1 on: Sat, 11 Jun 2022 20:32 »
Hello Will,

I would recommend Java because it runs everywhere and it's free, and there's a simple sample code which puts <MILK and NOODLE> on your CDU. You'll find it in Aerowinx/Developers/AddonExample.jar. It already contains the code for the network connection and some examples on how to read and write PSX variables. Could that help as a start?


Regards,

|-|ardy

Jeroen Hoppenbrouwers

  • Moderator
  • Join date: May 2009
  • Location: KTMB
  • Posts: 4457
  • Hoppie designs avionics equipment for airliners.
    • http://www.hoppie.nl/
Re: Hello world?
« Reply #2 on: Sat, 11 Jun 2022 20:53 »
Next to the Java classes, which is as close to native PSX as you will get, there's also my Python for PSX lib.
http://www.hoppie.nl/psxpython/

In the end it does not matter much which programming language you choose. It's not the language, but the thinking behind engineering a program, and the support libraries, that make or break a project.


Hoppie

Will

  • Join date: May 2009
  • Location: Chicago
  • Posts: 2419
Re: Hello world?
« Reply #3 on: Sat, 11 Jun 2022 21:14 »
Thanks guys.

How embarrassing, I've been with PSX since the beginning and yet missed AddonExample.jar until now.

Let's see how steep the learning curve is...
Will /Chicago /USA

Avi

  • Join date: May 2009
  • Location: LLBG
  • Posts: 955
Re: Hello world?
« Reply #4 on: Sun, 12 Jun 2022 00:55 »
CMC-PSX was born from the AddonExample.jar  :)
Avi Adin
LLBG

Will

  • Join date: May 2009
  • Location: Chicago
  • Posts: 2419
Re: Hello world?
« Reply #5 on: Sun, 12 Jun 2022 03:27 »
Thank you, Avi, for the inspiration!

I think if I can compile a .java (text) file into a jar file, then I should be good for the next several weeks of tinkering.

Unfortunately, I'm not there yet.

I renamed AddonExample.java to WJC.java. It's now in ..\jdk-16.0.2\bin.

When I type jar cf EXAMPLE.jar WJC.java, I get java.nio.file.AccessDeniedException.

It looks like jar.exe is trying to write to a Temp directory, but doesn't have permissions. Right? Except that I'm running as administrator.

Sorry for the most basic question! Any tips? Google says I might want to disable my antivirus, but most Google discussions of java.nio.file.AccessDeniedException are regarding uses much more sophisticated than my lowly attempt at compiling my first jar file, so it isn't much help to me (yet).

 
Will /Chicago /USA

martin

  • Join date: May 2009
  • Location: EFTO
  • Posts: 693
Re: Hello world?
« Reply #6 on: Sun, 12 Jun 2022 10:25 »
Hello Will,

yesterday I tried to send you a Private Message via your forum profile. Did you see it?
(Im not entirely sure if/how PMs work on this forum.)

Cheers,
Martin

Will

  • Join date: May 2009
  • Location: Chicago
  • Posts: 2419
Re: Hello world?
« Reply #7 on: Sun, 12 Jun 2022 10:40 »
Hi Martin,

I didn’t get a PM. But I just sent myself one through Aerowinx and I received it, so you might want to try again. Start by clicking on the blue envelope icon underneath the username on the left side of the screen; that should bring up an email form for you to complete.

Thanks!

Will
Will /Chicago /USA

Jeroen Hoppenbrouwers

  • Moderator
  • Join date: May 2009
  • Location: KTMB
  • Posts: 4457
  • Hoppie designs avionics equipment for airliners.
    • http://www.hoppie.nl/
Re: Hello world?
« Reply #8 on: Sun, 12 Jun 2022 13:30 »
Usually you want to move all development files out of whatever your JDK has been installed into.
Typically somewhere in ...\documents.
Keep "installed" files far apart from "written" and "compiled" files.

Unfortunately I have zero experience with Java IDEs or other tools.

Hoppie

Will

  • Join date: May 2009
  • Location: Chicago
  • Posts: 2419
Re: Hello world?
« Reply #9 on: Sun, 12 Jun 2022 14:26 »
Okay, I'm using an IDE now and not running from the command line.

Therefore I withdraw my last question. :-)

Working through some tutorials this morning...
Will /Chicago /USA

martin

  • Join date: May 2009
  • Location: EFTO
  • Posts: 693
Re: Hello world?
« Reply #10 on: Sun, 12 Jun 2022 14:28 »
Hello Will

Quote from: Will
Start by clicking on the blue envelope icon underneath the username on the left side of the screen;

That's what I did and it "seemed" to work. Also sent a PM to myself, which did arrive.
But strangely there seems to be no way to check/review one's Sent messages in one's own profile, so it's all a bit confusing.

However, I did now receive your PM and have replied by direct email, so all good (I hope).

Cheers,
Martin

Hardy Heinlin

  • Moderator
  • Join date: May 2009
  • Posts: 13156
    • Aerowinx
Re: Hello world?
« Reply #11 on: Mon, 13 Jun 2022 03:52 »
What you send is not PM (it's generally deactivated). What you send is email, and that goes via noreply(at)aerowinx, and that aerowinx name may end up in your spam folder, especially when you are on google mail.

martin

  • Join date: May 2009
  • Location: EFTO
  • Posts: 693
Re: Hello world?
« Reply #12 on: Mon, 13 Jun 2022 18:39 »
Quote from: Hardy
What you send is email
Ah ok, thanks. Wasn't aware of the semantic difference.
Quote from: Hardy
that aerowinx name may end up in your spam folder
Nevvah! (Michael Caine voice)
My spam filter is trainable of sorts and has learnt first thing to respect Aerowinx!  ;D

Cheers,
Martin "Not PM" E.