Build a complete java application to run on an ni master
rrdbstudios
Posts: 160
Ok, so maybe not totally duet, but a utility module (bypassing snapi) and then netlinx that only imports that module, and the rest all done in java.
Anybody done this before here? I know AMX has with a few of their customers.
Im looking for a good example to get started off of, im new to duet, however have a past in java and can handle most any netlinx project, so now I want to bump up and use java, plus the customer requested it for other reasons.
Any and all pro's and con's are accepted.
Anybody done this before here? I know AMX has with a few of their customers.
Im looking for a good example to get started off of, im new to duet, however have a past in java and can handle most any netlinx project, so now I want to bump up and use java, plus the customer requested it for other reasons.
Any and all pro's and con's are accepted.
0
Comments
Thanks for the tip's Kim, I am reading up on the oscar OSGi framework, but with little to no duet background, I am still figuring out how to make it all fit more or less...
Any other tips or examples, etc are greatly welcomed!
Ok, so I am on a mission to write an entire application (just a small one to start) with duet.
Basically, where Im at:
I've created a utilty only module, so no snapi is included. I have activator.java and my utility_test.java and utility test_dr1_0_0.axs files.
Within my java files I know I need to add my devices and TP's, such as:
NetLinxDevice dvTP = new NetLinxDevice(new DPS(10001,1,0),false);
dvTP.initialize();
catch events
dvTP.addButtonListener(this);
dvTP.addDataListener(this);
From what I understand, I need to place my module inside my normal netlinx code.
"DEFINE_MODULE 'utility test_dr1_0_0'( WHAT GOES HERE )"
BUT, if im adding all my physical devices within the java code, what do I add into the "DEFINE_MODULE" area... Im adding many devices.. Do I leave this empty, it wont compile though...
Any thoughts on this would be beyound helpful to really get me going... I havent taken a duet class, but I have the software and want to learn what I can while I have time prior to any classes.
Thanks all!
Now, as this is a normal NetLinx module you can change the parameter list to add in additional data which you can push into that properties array and read out within the java side. Alternatively, in your case you may want to just nuke the dvPhysicalDevice parameter so that you only have to pass a Duet virtual to the module for instantiation. If you do this just pop a dummy physical device in the properties array.
Just for reference and so others can follow for the future:
..now do I HAVE TO pass any parameters from netlinx? Can I just import the com.amx.duet.core.* and com.amx.duet.da.*; packages and access all ports this way? (please correct me if I say anything incorrect)
Is there any reason to ever do anything with the activator.java file? In a traditional OSGi bundle, there is a start() and stop() method within the class.
Does it seem like im on the right path, or am I looking the wrong direction...
Thanks!
As far as outside communications, I'm using some home-grown socket stuff as well as creating a Jetty instance to service http requests.
I havent touched this idea in a while since jumping into a new project, but would you be willing to send an example or stripped down application?
Is it possible to take standard bundles created and upload them and activate them? you mentioned jetty not being used in 4.x, well why not in a new bundles manifest, import the package there and build the new bundle encapsulating the required package? Im not sure how netlinx would handle this, but a thought...
For v4 I would probably just embed Tiny Java Web Server vs. Jetty, I've used it in a Duet module as well. I think I tried creating an instance of the http server that is in v4, don't remember, but I might have gotten a security violation.
Try setting AMX-Type: Duet in your jar manifest. See [post=8076]this post[/post] for more info.