Home AMX User Forum AMX General Discussion

Need some code enlightenment!

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
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")
	}
}

Comments

  • mpullinmpullin Posts: 949
    kmenshouse wrote: »
    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?
    println() is not a function in NetLinx. The module you are looking at must have defined println() as a function using a DEFINE_FUNCTION block. Since I'm not familiar with the module I can't tell you what that function does or what its parameters mean.
  • I've never seen this module, but I would make the following assumptions:

    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:
    DEFINE_FUNCTION (CHAR cVALUE[])
    {
        IF (nDEBUG)
        {
            SEND_COMMAND 0,"cVALUE"
        }
    }
    

    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.
  • DarksideDarkside Posts: 345
    mpullin wrote: »
    println() is not a function in NetLinx. The module you are looking at must have defined println() as a function using a DEFINE_FUNCTION block. Since I'm not familiar with the module I can't tell you what that function does or what its parameters mean.
    mpullin is on the program! it will be a handler for debug or panel update etc

    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!

    :-)
  • Joe HebertJoe Hebert Posts: 2,159
    This is the function in question and it can be found on line 134:
    //*******************************************************************
    // Function : println                                               *
    // Purpose  : to print a line to the telnet session                 *
    // Params   : sTxt - the data to print to the telnet session        *
    // Return   : none                                                  *
    //*******************************************************************
    define_function println (char sTxt[])
    {
    	if (nDbg > 2)
    	{
    		send_string 0, "'** Message from SourceSelectComponent.axs: ',sTxt"
    	}
    }
    
    The 39s are just single quote (?) characters.

    kmenshouse wrote: »
    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
    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")
    	}
    }
    
  • Thanks to everybody who has posted. It's exactly what I was asking about. It helps a great deal on the project I am using the module on.

    Keith
Sign In or Register to comment.