Home AMX User Forum NetLinx Studio

Can someone explain what is TP.number:1:0?

In the Sirius duet module, there is a data_event[dvTP.number:1:0] function in a AXS file, seems this dvTP can only be one panel, can I replace it with a panel array, ie, dvTP[] = { TP1,TP2,TP3}? How?

Thanks,
Jacky

Comments

  • viningvining Posts: 4,368
    DEFINE_DEVICE
    dvTP	= 10001:1:0 ;
    
    Then dvTP.Number = 10001
    Then dvTP.Port = 1
    Then dvTP.System = the system this was defined in if 0

    The reason this is being used is most likely to receive strings sent from the TP on port 1. Most likely the sirius TP port is set up to use another TP port in this code. So instead of this data.event being for sirus port it used to receive things like page tracking, keyboard, keypad strings etc that get sent on port 1 but they need to know the TP number it came from so they can relay that received info to the proper DPS use for sirius.

    You can probably change this to an array but you'd need to do addtional changes to make it work as designed and this array would be all the port 1 TPs while your sirus code would use a different array. You'd have to use get_last on the arrays in the event handlers to get the proper index and then change code to something like dvTP[Index].Number:1:0 kind of a thing. It could be simple but it could get tricky depending on where the code takes you.

    Your arrays would also have to match in order and number of TP for both the port 1 TPs and the Sirius TPs.

    Maybe post more code or post a link and someone can help you out when you get stuck.
  • Great explanation Dan!
  • the8thstthe8thst Posts: 470
    I think I recall the Sirius module using the standard touch panel keypad (which only outputs on port 1) for entering channel numbers. The data_event in question is probably looking for a string beginning with 'KEYP-'.
  • yanbinyanbin Posts: 86
    Here is the code block.

    dev dvTPSirius[]= {TP1,TP2,TP3,TP4}

    define_module 'Sirius SCHT ModuleComponent' mMdlCmp1(vdvSiriusTunerArray, dvTPSirius)

    MODULE_NAME='Sirius SCHT ModuleComponent'(dev vdvDev[], dev dvTP)
    DEFINE_EVENT
    data_event[dvTP.number:1:0]
    {
    string:
    {
    if (nSet[nCurrentOutput])
    {
    println("'Data from TP: ',data.text")
    if (find_string(data.text, 'ABORT', 1))
    {
    nSet[nCurrentOutput] = 0
    }

    }
    }
    }
    }
  • ericmedleyericmedley Posts: 4,177
    yanbin wrote: »
    Here is the code block.

    dev dvTPSirius[]= {TP1,TP2,TP3,TP4}

    define_module 'Sirius SCHT ModuleComponent' mMdlCmp1(vdvSiriusTunerArray, dvTPSirius)

    MODULE_NAME='Sirius SCHT ModuleComponent'(dev vdvDev[], dev dvTP)
    DEFINE_EVENT
    data_event[dvTP.number:1:0]
    {
    string:
    {
    if (nSet[nCurrentOutput])
    {
    println("'Data from TP: ',data.text")
    if (find_string(data.text, 'ABORT', 1))
    {
    nSet[nCurrentOutput] = 0
    }

    }
    }
    }
    }
    Yeah, this is as was described above...
    It is simply a way to watch port 1 of the TP (no matter which port you end up assigning the function/feedback bit tons)

    You could accomplish the same thing by assigning a dev array for the function buttons and a second array using the same set of TPs but making sure to use port 1 instead of whatever port for the functions. Then do use the GET_LAST(my_dev_array_on_port_1). Or the device.number method whichever you prefer.
Sign In or Register to comment.