Duet Module Writing
invostar
Posts: 9
Hello,
I just got a hold of Cafe Duet (after an arm and a leg) and have begun writing my first module. I read almost every document that is available and came to a dead end.
Q: Where do you actually write the hex codes that need to be sent out to the device?
I am writing an RS-232 module for a Denon DCM-390 5-disc changer. I chose the DiscDevice as the component from the SNAPI.
The only thing I can assume is that you overwrite the methods from IDiscDeviceComponent such as setDisc with enQueing the actual hex command to set the disc to that number.
I have training in a couple of weeks and want to make the most of it since there seems to be virtually no support for Cafe Duet.
Thanks in advance for your help!
PS: Do any of you have any module samples? the Math sample doesn't really help much. Thanks!
I just got a hold of Cafe Duet (after an arm and a leg) and have begun writing my first module. I read almost every document that is available and came to a dead end.
Q: Where do you actually write the hex codes that need to be sent out to the device?
I am writing an RS-232 module for a Denon DCM-390 5-disc changer. I chose the DiscDevice as the component from the SNAPI.
The only thing I can assume is that you overwrite the methods from IDiscDeviceComponent such as setDisc with enQueing the actual hex command to set the disc to that number.
I have training in a couple of weeks and want to make the most of it since there seems to be virtually no support for Cafe Duet.
Thanks in advance for your help!
PS: Do any of you have any module samples? the Math sample doesn't really help much. Thanks!
0
Comments
We have also recently bought an Cafe Duet. For already two weeks im tring to write a simple module for Opticis OHM66 matrix switcher. In netlinx i would have already written this stuff with no problems. I cannot uderstand the position of AMX. They sell Cafe Duet and there is no any tutorial or somekind of step-by-step guide for real module with real device! So what's the point for integrator (who cannot take additional courses in because of geographical position) to buy such a tool that is not inexpensive and there is no any theoretical support ? ? ?
Now as dealers who came from a software engineering background who know the power of Java and other OO languages we think Cafe Duet makes a lot of sense. I know that there are a probably a good number of dealers around the country who think the same way but are stuck in the exact same trap - how can we implement without support and why pay all of that money for an open source eclipse product?
AMX should embrace Java, which is a proven technology with a huge programmer base. Instead they are trying to chase the rest of the AV industry and create wizard tools. In the age of IT convergence in the AV world it seems that taking a different approach and going out of the box that AMX could really set themselves apart - and also up for success.
Just my two pennies.
PS - We will be attending a Duet training and I hope that this really jump starts our efforts. It would still be nice to have some better documentation and tutorials but this is currently all that AMX offers. We'll share our experiences as we go and would appreciate any feedback from those who have already been through this process.
Well, after fighting along and asking people (thanks Spire_Jeff) for more information, I wrote my first working module.
It's in its baby stages, but at least I got the entire process flow from Touch Panel -> NetLinx -> Duet Module -> Serial Port down.
First of all, to answer my own question:
Yes, the way to write the actual hex commands is by overriding the methods from the extended device class.
The way to do this is as follows:
The empty methods get added to the end of the file (if you have that setting).
Then you write the actual hex codes you want to send to the device like so:
This is for a Denon DCM390 5-disc changer. Ideally you would not send the command straight to the device but rather queue it. PriorityQueue (under AMXTools com.amx.duet.tools.util) is a great candidate for this. That is my next goal.
About the super.setDisc. This actually calls the method inside the device class (DiscDevice in this case). If you take a look at the methods, most of them are empty. So in reality there is no fault in calling it. I'm just going to get used to do it in case there's a class with non-empty methods.
Another useful tip. Keep things simple. At first you might feel tempted to use all the opportunities that Java offers, but take it slow. My enQueue didn't work and was breaking the module.
Lastly, I hope the few of us that are privileged enough to understand the advantage of Java bond together and use this forum as a community and support site. Frankly, we have no other option.
I look forward to working with you!
Paul
When wanting to create an IP connection do you use Java.IO and Java.Net and create your socket directly or do you pipe it back to your defined netlinx device (ie dvIPDEVICE = 0:11:0).
If it's the latter, do you have any idea how to set up comms? I'm lacking a little in operating manual!!!
Paul: I see how that makes sense. What about for functions with a return?
For example:
You have to put it at the end in those cases, right?
No, you are just reading the superclass' variable so it doesn't really matter. The special keywords 'this' and 'super' have very specific usage though, so other than their typical applications you won't use them much. Super is only generally used in the subclasses constructor to init the superclass as in:
Overuse of 'this' or 'super' usually means something is amiss somewhere.
Paul
Patrick
Till then it's trial and error I guess...
We can but hope!
I have some experience with java eclipse but am missing the link to AMX. Is there any examples that someone may have?
Here's a good place to start:
http://java.sun.com/docs/books/tutorial/networking/sockets/index.html
At the training, you will receive many examples of how to do the things that generally you need to do. But don't think that Duet is strictly for simple module writing to control a single device. Yes, it can do that, but it can do so much more if you want it to.
Don't fear Duet. Yes, it does take just a bit to get up and running, but once you do, you'll find it far superior to Netlinx code.
Sheldon Samuels
SchoolView Technologies, LLC
If you define your TP in Duet, first be aware that the TP will only trigger events within Duet at that point. But you can always define port 1 for Netlinx buttons and port 2 for Duet buttons, etc. If you define the TP in Duet, add a button listener in Duet and process the buttons directly in Duet.
dvDuetTP = new NetLinxDevice(new DPS("10001:1:0"),false);
dvDuetTP.addChannelListener(this);
dvDuetTP.addButtonListener(this);
dvDuetTP.addDataListener(this);
dvDuetTP.notifyOnline();
dvDuetTP.initialize();
or you can get a bit more detailed with adding your listeners by doing the following:
dvDuetTP.addDataListener(new IDataListener() {
public void handleDataEvent(Event evt)
{
do something here or call another class
}
});
Be sure to define your listeners before the initialize() statement. It makes a difference.
Hope this helps.
Sheldon Samuels