Need some code enlightenment!
kmenshouse
Posts: 32
I'm relatively new to the Netlinx programming scene and encountered some code I had not seen before. This is in a module for the Yamaha RXV2700. I'm interested in the line that starts with "println". I can't find that command in the Help section for Studio. If anyone has the time I would love to hear what that line does and particularly what is the significance of the number 39? Does it refer back to the G4API numbers? Thanks for any comments.
Keith
Keith
button_event[dvTP, BTN_SRCSEL_INPUT] { push: { stack_var integer nTempInput nTempInput = get_last(BTN_SRCSEL_INPUT) send_command vdvDev[nCurrentOutput], "'INPUT-',sInputLabels[nTempInput]" println("'send_command ',dpstoa(vdvDev[nCurrentOutput]),', ',39,'INPUT-',sInputLabels[nTempInput],39") } }
0
Comments
Assume that this is a duet module.
Also assume that there are multiple speaker zones supported by the RX-V2700, which I believe is some kind of surround processor that will support multiple rooms.
Let's say you have the virtual device for the unit defined as 42001:1:0 and 42001:2:0 and so on for each available zone.
Let's also say that there is an array in the module for inputs such as DVD1, DVD2, VCR, Aux1, and so on.
So from the touch panel you select the DVD2 input to go to the kitchen which is zone 2.
The normal send_command line in the code shown tells the module that the input selected for zone 2 is DVD2.
The println function is probably a central debug display routine in the module that looks something like this:
Rather than have the IF (nDEBUG) statement every time he would want to send debug output to the master console, the developer just calls the println function.
The 39 is the decimal value for the single quote character, so the value that is passed to the println() function maps out to look like this:
send_command 42001:2:0, 'INPUT-DVD2'
which is what the function gets in the cVALUE variable.
If you have used telnet to get to the master and issued the MSG ON command, AND have set the debug variable (generally this is some command such as SEND_COMMAND vdvDEV, 'DEBUG-ON') then you will see that when a command is sent to the virtual device, it will also print out on the console.
We have a function that would appear to work the same way. Instead of send_string 0 or send_command dvVirtual,"'!T' ....etc, it is simply fnMsgOut("Hello NetLinx'",destination,address)
Where destination may be declared as a button or the terminal etc.
It is simplified here, but we can append font size etc too as necessary.
println doesn't exactly follow the assumed naming convention used for calls or functions, but perhaps it could be re-written as fnPrintln() if it did (assuming it was a function not a call!).
....that's not to say it has to follow this naming convention in any case by the way!
:-)
The 39s are just single quote (?) characters.
Keith