Home AMX User Forum AMX General Discussion

data events for module devices

When if I define a touch panel(1000:2:0) combine it with a virtual device(32001:1:0)in a main code file.when the touch panel receives a event the data,string event fires.

but when I pass the touch panel to a module and define the data event in the module and not in the main program the event never fires. any ides?

Comments

  • ericmedleyericmedley Posts: 4,177
    samos wrote:
    When if I define a touch panel(1000:2:0) combine it with a virtual device(32001:1:0)in a main code file.when the touch panel receives a event the data,string event fires.

    but when I pass the touch panel to a module and define the data event in the module and not in the main program the event never fires. any ides?

    I don't believe the association passes through to the module. There are other ways of linking devices together that might work better.

    For example creating a DEV

    example:
    DEFINE_DEVICE
    
    10001:01:0  =  TP_1
    10002:01:0  = TP_2
    
    33001:01:0  =  vTP_1
    
    DEFINE_VARIABLE
    
    DEV dev_TP=[]
    {
    TP_1,
    TP_2,
    vTP_1
    }
    
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dev_TP,1]
    {
    PUSH:
      {
      SEND_COMMAND dev_TP, 'ADBEEP'
      }
    }
    
    

    This little routine will send a double beep command to all the touch panels if any of the panel's button 1 is pushed.

    The advantage of this is that you can easily address multiple devices with one reference. However, the devices are still unconnected and can still send and receive separate commands.

    another example
    BUTTON_EVENT[dev_TP,1]
    {
    PUSH:
      {
      TP_DEVICE=Button.Input.Device.Number
      SEND_COMMAND TP_DEVICE:01:0, 'ADBEEP'
      SEND_COMMAND dev_TP, 'TEXT1-Somebody pushed button 1'
      }
    }
    

    This will send a double beep command to only the device that the button was pushed but will send a text message for all the TPs button number 1

    there are other things to look at as well such as DEVCHAN and DEVLEV.

    give those a look in the help file ans see if it helps you out.
  • samossamos Posts: 106
    This does not help really. I need to pass a device as a module parameter. Then in the module write a data event for device. The data events string event only seems active when in the main source

    example that works
    ******************************************************
    PROGRAM_NAME='STANDERD_SRC'

    DEFINE_DEVICE
    dvTP = 10001:2:0
    vdvTP = 32001:2:0

    DEFINE_START
    define_combine(vdvTP,dvTP)

    DATA_EVENT[vdvTP]
    {
    string:
    {
    if(1) send_string 0, 'data.text
    }
    }
    *********************************************************





    example that does not work
    ******************************************************
    PROGRAM_NAME='STANDERD_SRC'

    DEFINE_DEVICE
    dvTP = 10001:2:0
    vdvTP = 32001:2:0

    DEFINE_START
    define_combine(vdvTP,dvTP)
    DEFINE_MODULE 'Login' mdlLogin(vdvTP)


    MODULE_NAME='Login'(dev vdvTP)


    DATA_EVENT[vdvTP]
    {
    string:
    {
    if(1) send_string 0, 'data.text
    }
    }
    ******************************************************


    i have a touch panel has four buttons with there string output port on each set as 2
    then there string out is set to 1,2,3,4.

    now in netlinx diagnostics i see a event for 10001:2:0 and 32001:2:0
    like this

    Line 72 :: String From [10001:2:1]-[1] - 11:24:57
    Line 72 :: String From [32001:2:1]-[1] - 11:24:57

    when the data event is not in the module and in the main_src the data.text is displayed in telnet, and when the data event is in the module the data is not displayed in telnet.
  • Works fine for me

    Mainline:
    PROGRAM_NAME='STANDERD_SRC'
    
    DEFINE_DEVICE
    
    dvTP = 10001:1:0
    vdvTP = 32001:1:0
    
    DEFINE_START
    
    define_combine(vdvTP,dvTP)
    
    DEFINE_MODULE 'mSandpit' mdlLogin(vdvTP)
    

    Module:
    MODULE_NAME='mSandpit'(dev vdvTp)
    
    define_event
    
    DATA_EVENT[vdvTP]
    {
    string:
      {
      send_string 0, data.text
      }
    }
    

    BTW I used a G3 browser panel not a real one
  • samos wrote:
    This does not help really. I need to pass a device as a module parameter. Then in the module write a data event for device. The data events string event only seems active when in the main source

    example that works
    ******************************************************
    PROGRAM_NAME='STANDERD_SRC'

    DEFINE_DEVICE
    dvTP = 10001:2:0
    vdvTP = 32001:2:0

    DEFINE_START
    define_combine(vdvTP,dvTP)

    DATA_EVENT[vdvTP]
    {
    string:
    {
    if(1) send_string 0, 'data.text
    }
    }
    *********************************************************





    example that does not work
    ******************************************************
    PROGRAM_NAME='STANDERD_SRC'

    DEFINE_DEVICE
    dvTP = 10001:2:0
    vdvTP = 32001:2:0

    DEFINE_START
    define_combine(vdvTP,dvTP)
    DEFINE_MODULE 'Login' mdlLogin(vdvTP)


    MODULE_NAME='Login'(dev vdvTP)


    DATA_EVENT[vdvTP]
    {
    string:
    {
    if(1) send_string 0, 'data.text
    }
    }
    ******************************************************


    i have a touch panel has four buttons with there string output port on each set as 2
    then there string out is set to 1,2,3,4.

    now in netlinx diagnostics i see a event for 10001:2:0 and 32001:2:0
    like this

    Line 72 :: String From [10001:2:1]-[1] - 11:24:57
    Line 72 :: String From [32001:2:1]-[1] - 11:24:57

    when the data event is not in the module and in the main_src the data.text is displayed in telnet, and when the data event is in the module the data is not displayed in telnet.
    A virtual device by default only has 1 port (and only 255 channels, and 8 levels). To have more ports, you have to set them by SET_VIRTUAL_PORT_COUNT(vdvTP,2) for 2 ports, either in the ONLINE handler of the virtual device, or in DEFINE_START (a virtual device is online at DEFINE_START)

    Next issue may be that panel internal strings will sent back on port 1 only. So i.e. a keypad string AKEYP-123 from the panel's internal keypads always is sent on port 1.
Sign In or Register to comment.