Jump to content
Sign in to follow this  
Guest

Java

Recommended Posts

Guest

Simconnect is tcp/ip based so it should be possible to connect from Java. Anyone tried it - what about the message format??

Share this post


Link to post
Share on other sites
Guest qurious

In theory this is possible, but very hard to do because the wire protocol is not documented.Another approach is to try J# and use the .NET wrapper.Or you could use C# and start with the sample code. That is what I did and so far I have found moving between Java and C# not too hard (with a bit of help from Google of course).And then when you hit a problem and are not sure if it is the C# code you can create a minimal C program using the C/C++ SDK to check if the problem is with the SDK or with the C# wrapper. So far I've been able to reproduce the C# issues I've had in requesting or setting variables with the C/C++ SDK.

Share this post


Link to post
Share on other sites

>In theory this is possible, but very hard to do because the>wire protocol is not documented.>>Another approach is to try J# and use the .NET wrapper.>>Or you could use C# and start with the sample code. That is>what I did and so far I have found moving between Java and C#>not too hard (with a bit of help from Google of course).>>And then when you hit a problem and are not sure if it is the>C# code you can create a minimal C program using the C/C++ SDK>to check if the problem is with the SDK or with the C#>wrapper. So far I've been able to reproduce the C# issues I've>had in requesting or setting variables with the C/C++ SDK.I really haven't taken a look at it all, as I don't do a lot of Java programming, but I thought the .NET framework was supposed to be pretty extensible over all the different languages involved. Does that just mean J#?

Share this post


Link to post
Share on other sites
Guest qurious

The reason I mentioned J# was because the original question was about Java, but I'm pretty sure you are right that .NET works across all languages that support it. But I think there may be differences in the way those languages support references to COM objects because the syntax will be different for each language. That was the main reason I chose to use C# instead of J#. I know that Java language skills would carry over, but because you can't carry over Swing and/or the AWT to J# and you have to learn the Interoperablility services anyway and on top of that J# is like Java but still has some syntax differences it made much more sense to go to direct to C#.The only thing that I miss so far is that a Java program allows you to have both a command line and a GUI at the same time, which means you can use stdin to read an input file after filtering and/or processing it with other command line programs and you can use stdout to write output that is useful for debugging. But hat is no big deal, really.

Share this post


Link to post
Share on other sites

I've never used interop before, so that's caused me some troubles with user-defined types so far, but I'm working through it.For debug, I've just gone the easy route (for me, anyways) and created a second windows form with a big textbox that I just dump all text output to.One thing we "will" (I can't say for sure, but this is what I've been told) get is better documentation on the managed wrapper.

Share this post


Link to post
Share on other sites
Guest

> One thing we "will" (I can't say for sure, but this is what I've been told) get is better documentation on the managed wrapper.Thats a good news and hopefully all the samples will have c# versions too.

Share this post


Link to post
Share on other sites

>> One thing we "will" (I can't say for sure, but this is what>I've been told) get is better documentation on the managed>wrapper.>>Thats a good news and hopefully all the samples will have c#>versions too.Agree...I am really getting amped to use SimConnect. I teach a .NET/C# class and it is far more enjoyable than the previous languages I've taught: C/C++, VB, Java


Jeff Bea

I am an avid globetrotter with my trusty Lufthansa B777F, Polar Air Cargo B744F, and Atlas Air B748F.

Share this post


Link to post
Share on other sites

>>> One thing we "will" (I can't say for sure, but this is>what>>I've been told) get is better documentation on the managed>>wrapper.>>>>Thats a good news and hopefully all the samples will have c#>>versions too.>>Agree...>>I am really getting amped to use SimConnect. I teach a>.NET/C# class and it is far more enjoyable than the previous>languages I've taught: C/C++, VB, Java>Do you work with interop functions to talk to unmanaged code? I haven't used that before, so I've tripped up a few times, and I was wondering if you could recommend some resources for me.

Share this post


Link to post
Share on other sites
Guest qurious

I've started writing all debug messages to a log file using a TextWriter - that way I can compare my log to the FSX simconnect log if things go wrong.The interop thing has been a learning curve for me too, especially with structs and strings. I used the sample code that came with he SDK and the C# object browser and got things working eventually.And yes, I hope the doco gets better but what I am really looking forward to in the retail version is if the new variables that relate to AI (such as ai desired heading and ai unit mode) can be set just like the doco says. Those variables have been giving me the most problems so far.

Share this post


Link to post
Share on other sites

Are you giving the desired heading data while it is attached to the AI or detached, and do you have it flying a flight plan or a set of waypoints (I know, pretty much the same thing, but you can override a plan with defined waypoints).I haven't tried setting that yet, so I'm very curious.

Share this post


Link to post
Share on other sites
Guest 2002cbr600f4i

As a Java programmer by trade, this is something I'm going to be VERY interested in as well. One of the projects that I'm doing at work is a java-based handheld command+control interface for small UAV's and we've had to tie into FlightGear to do our testing (since we don't have access to a real UAV). FG SUCKS in terms of scenery and available aircraft and such, but it provides a VERY easy Telnet-based interface to access all the internal simulator properties, allowing you to get/put anything. They also provided some Java classes to do the Telnet interface. I was able to get my code hooked up to FG and sending/receiving telemetry/etc inside of a day.I looked at X-Plane, but the only option there was the Plugin system and they absolutely refuse to do anything to support Java (even though at one time there was a person who wrote a Java-wrapper for the Plugin system, that person has dropped off the face of the earth and the code is nowhere to be found.) They insist that Java is too slow for the simulator and refuse to be of any help in supporting it, but they'll support PASCAL and Python and several other languages (frustrating that people STILL think Java is slow... It's NOT! Swing is... but the Java language itself with the newer JVM's is almost as fast as native C++.)I'd REALLY like to switch out to using FS-X. While I might not be able to talk directly to SimConnect, maybe somebody will come up with some sort of XML/SOAP type interface/interconnect.Yes, C# is an option as well, although I haven't done much with C# and I still find it frustratingly too "MS-ish" in how it does some things (event handling for instance). However, it might prove to be a means to providing an interface to a language-neutral API in the future.If anyone else out there comes up with any ideas, I'm all ears! I'd be willing to help out on any Java interface projects as well in my free time.--2002cbr600f4i

Share this post


Link to post
Share on other sites

I have books coming out of my ears...I'll thumb throught them, but I have worked briefly with unsafe code to demonstrate pointers, it is pretty seamless.J-


Jeff Bea

I am an avid globetrotter with my trusty Lufthansa B777F, Polar Air Cargo B744F, and Atlas Air B748F.

Share this post


Link to post
Share on other sites

>I have books coming out of my ears...>>I'll thumb throught them, but I have worked briefly with>unsafe code to demonstrate pointers, it is pretty seamless.>>J-I've had no issues with MarshalAs(UnmanagedType.whatever) unless I'm using userdefined data types, and then I've run into problems.

Share this post


Link to post
Share on other sites
Guest Lee

>>I'd REALLY like to switch out to using FS-X. While I might not>be able to talk directly to SimConnect, maybe somebody will>come up with some sort of XML/SOAP type>interface/interconnect.>Now the conversation is getting interesting. Are you talking about creating web services using XML/SOAP? I don't know much about SimConnect, but I've been using Delphi and C# (Delphi's brother) for a long time. Java would be great for this too. Creating web service wrappers around the SimConnect interface would really open up a world of possibilites. One that I can think of is Brian's AI controller program (or something like it) running a VATSIM type environment where servers can insert AI aircraft or AI controllers into the server system. Then SOAP clients can pool the servers via web services as updates are needed. Think about it, AI and real folks flying together in a single online virtual world. Of course, a simple TCP/IP interface would do the trick too. But what's the fun in that!I think I'll get started on this. I should have it completed by..... Sunday! :-hah Lee.Now where are those Starfleet interfaces? Press a few buttons, reconfigure systems they were never intended to do, and bamm! A fully scalable system of solving everyone's problems. Yes, I work for a large corporation with "fantastic" users. I had a bad day today. Falling off of my soapbox now.....

Share this post


Link to post
Share on other sites
Guest 2002cbr600f4i

Lee,YEah, although I was thinking more just to expose the interface and allow remote machines to hook in with any old language they want as long as they could handle the XML/SOAP web services calls. Would love to collaborate with you on this!I actually helped write a book on Web services technologies a few years back. "Teach Yourself Web Services in 24 Hours" from Sams (I'm Mike Kopack....) I'm sure the tech has changed a bit since then, but the principles are the same.I'm pulling down the Beta right now, so give me a couple days to gawk at it and the documentation and see what I can figure out. I'm sure I can handle the java side, it's the C#/MS side of things I'm a bit clueless on.--2002cbr600f4i

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...