Home AMX User Forum AMXForums Archive Threads Tips and Tricks

Virtual TouchPanels?

I'm exploring the possibility of creating a virtual device and having it function like a phantom touchpanel. For instance:
DEFINE_DEVICE

vdvMEDIAPLAY = 35000:1:0
vdvPHANTOMTP = 35001:1:0
DEFINE_MODULE 'AMX_MAX4PLUS_UI' AMX_MAX4Plus_UI3 (vdvMEDIAPLAY,vdvPHANTOMTP,TP_BUTTONS,TP_FIELDS,nUI3_DEFAULT_ZONE,nUI3_DEF_ASPECT,nUI3_DEF_AUDIO,strIP_ADDRESS,UI3_LISTS)
This would allow me to use other people's UI files without having to modify them so that the button definitions fit my interface, or having to change my interface if I need to swap modules. Also, no need to have multiple instances of the module in my code for each touchpanel I have.

Here's the question: can I generate Button_Events on a virtual device?
For instance, if someone pushes 47 one of my real TPs, I want that to push 1 on my phantom TP, which will then cause the desired reaction from the UI Module, in this case the MAX's.

If so, how?

Comments

  • Do it!

    I have made this method work with great success.

    Use the command DO_PUSH(vdvTP,button_channel)

    Example
    BUTTON_EVENT[dvTP,47]
    {
       PUSH:
       {
          DO_PUSH(vdvPHANTOMTP,1)
       }
    }
    
    

    You can also monitor sent text and page flips. :)
    DATA_EVENT[vdvPHANTOMTP]
    {
       COMMAND:
       {
          IF(FIND_STRING(DATA.TEXT,'TEXT',1) OR FIND_STRING(DATA.TEXT,'PAGE',1))
             SEND_COMMAND dvTP,DATA.TEXT
       }
    }
    

    Of course you can always store the returned text in an array for later use.
    DATA_EVENT[vdvPHANTOMTP]
    {
       STACK_VAR nINDEX
       LOCAL_VAR cTEMP_TEXT[30][30]
       COMMAND:
       {
          IF(FIND_STRING(DATA.TEXT,'TEXT',1))
          {
             REMOVE_STRING(DATA.TEXT,'TEXT',1)
             nINDEX = ATOI(REMOVE_STRING(DATA.TEXT,'-',1))
             cTEMP_TEXT[nINDEX] = DATA.TEXT
          }
       }
    }
    

    Enjoy!
  • Yes, it should. My G3 panels allow me to monitor what is going on at the far end.
  • mpullinmpullin Posts: 949
    Awesome.

    Thanks a lot.

    EDIT: You think this would qualify as a tip or trick?
  • Tip or trick
    mpullin wrote:
    Thanks a lot.

    EDIT: You think this would qualify as a tip or trick?

    Sure, but how do we get it moved?
  • All done!!
  • Yet another example why Suzanne rocks. :)

    P>S> yes I am sucking up, looking for one of those leather jackets or even one like Chip got. :):):)
  • frthomasfrthomas Posts: 176
    What you cannot do, though, is transfer HOLD and RELEASE info. DO_PUSH is a timed thing.

    You also cannot simulate online & offline, the way a wireless panel would behave.

    Fred
  • dchristodchristo Posts: 177
    frthomas wrote:
    What you cannot do, though, is transfer HOLD and RELEASE info. DO_PUSH is a timed thing.

    I've never tried it, but wouldn't DO_PUSH_TIMED and DO_RELEASE work for this? In theory, shouldn't the DO_PUSH_TIMED trigger the HOLD event, assuming that the timer for the DO_PUSH exceeds the timer for the HOLD event?

    --D
  • Do_Push - More to it
    frthomas wrote:
    What you cannot do, though, is transfer HOLD and RELEASE info. DO_PUSH is a timed thing.
    Fred

    Right you are Dave!

    Here are other options to the DO_PUSH statement.

    DO_PUSH_TIMED

    Similar to DO_PUSH except this one lets you specify the timeout. DO_PUSH defaults to a 0.5s push on a channel before issuing a DO_RELEASE for you (unless another DO_PUSH is executed for the same channel). DO_PUSH_TIMED lets you control the length of time that will pass before the automatic DO_RELEASE is generated. The syntax:
    DO_PUSH_TIMED(DEV Device, INTEGER Channel, LONG Timeout)
    
    Parameters:
    Device - the device to PUSH.
    Channel - the channel to PUSH.
    Timeout - the time (in 1/10ths of seconds) that the PUSH shall remain active. If zero is specified as the timeout then the timeout is 0.5s.

    If DO_PUSH_TIMED_INFINITE is specified as the timeout then the push never times out. This will allow the simulation of a HOLD.

    Make sure you generate a DO_RELEASE.
Sign In or Register to comment.