The not documentary function
Yuriy
Posts: 20
The not documentary function: translate_device(vdvDev1, vdvDev2).
What it does?
What it does?
0
Comments
PROGRAM_NAME='test'
DEFINE_DEVICE
vdvDev1 = 33001:1:0
vdvDev2 = 33002:1:0
DEFINE_START
translate_device(vdvDev1, vdvDev2)
DEFINE_EVENT
DEFINE_PROGRAM
Is translate_device a keyword in Duet? It doesn't seem to be in Netlinx.
Not too long ago there was a discussion about "redirect_string" which is supposed to make two devices echo all string info from each other. Supposedly it obviates the need to write string handlers to relay info between two devices (for example, when using a TCP/IP connection from a PC or RS232 to IP device) to program an XAP800 or Polycom conferencing mixer through the RS232 port).
I couldn't get it to work. Has anybody used redirect_string successfully? I had a discussion once with a very experienced AMX programmer who told me that, "of course, you can use redirect_string to do that," but I'm not sure whether he actually did it successfully or just surmised that it would work.
regards,
Bob Moyle
I use it in a module that bridges device comm modules (iPorts more often than not), to the serial ports of Global Cache controllers through the virtual device of the Global Cache comm module
Translate_device goes in the Start section of the module, and "connects" a virtual device defined in the module definition, and another virtual defice (vdvModule) Anything done to vdvMain will happen on the vdvModule.
Here is a quick demo that they did in class. Pulsing a channel on the main virtual device does not show the channel active (on the main virtual device) until it is turned on via the module device 2 seconds later.
I remember thinking - wow that is cool, when would I use that, and then forgetting all about it until reading this post.
Translate_Device has nothing to do with DUET. It was created for early AMX programmed modules.
In short, links the two virtual devices together allowing for them to act as one, stopping the "ECHO" effect of send_command and send_strings.
There is alot of caveots when it comes to using this keyword, I would stay away from it unless you completely understand its use and actions.
But the quick down and dirty explaination. "Twisted Voodoo Dolls!".
It really is too bad [img][/img] is disabled...
Agreed. It has nothing to do with Duet and has been around much longer than Duet. It has always been built into the NetLinx programming language and came about as the result of modules and using virtual devices to communicate with them. It was a way to get around the echo effect that Jeff talked about. It is not documented anywhere I know of. In fact, for a long time AMX did not even want anyone to be aware of this (early paranoia I think).
Unless you are a very experienced programmer and truly understand the nuances of programming modules and the interaction of modules with virtual devices and the main NetLinx code you should avoid this.
Also, on the redirect command. This has nothing to do with modules or Duet. It is a command to redirect serial data coming in on a port to go out a different port. So if you redirect serial port 1 to serial port 2 then any input from serial port 1 not only goes up to your program in a data_event but also goes out the other serial port. An example of this might two devices from the same manufacturer which connect via serial. However, you also need to see that serial data. This is a way of sniffing on that port and still having the data show up on the other device.
There really is no harm in that command. It can't do anything wrong other than have more events show up. But once you go down that path it will open up all kinds of questions about the effects of the command and it does get complicated. However, I'm guessing there would lots of answers from the guys on this forum.
It now works like this...
this was the wonderful outcome of the 2009 Gator Bowl.
I'm working on a module to get IP connections to largely self manage.
I string events weren't triggering right and the ONERROR event for the IP Port not being open when a string came through was also not triggered. Back to the drawing board!
Care sharing that document (or where I can find it)? I don't think I've ever come across it...
No worries mate!
I never thought I'd see the day that I would be able to help Phreak!
P.S. Don't forget this is not supported (anymore?).
Neither is wrapping a NetLinx module inside a Duet module
Not supported is just another way of saying fun to implement.
By this you mean that you can do this in a module:
// inside module A
send_level vdvDev, 1, 50
and not trigger this event:
// inside module A
level_event[vdvDev, 1]
{
send_string dvDev, "'VOL=', itoa(level.value)"
}
while still triggering:
// inside main code
level_event[vdvDev, 1]
{
send_level dvTP, 1, itoa(level.value)"
}
in the main code?
This would get rid of the echo that occurs when updating a virtual's level in a module that has events listening on the same channel. That would be very useful.
Paul
That's exactly what it does.
Check out the release notes in the AMX-PI for Duet firmware build 316 (v3.00.316). "Module Virtual Devices". It's also listed (but not explained) on page 76 of the Visual Architect manual. Seems likes essentially the same thing.