Home AMX User Forum NetLinx Studio

Check to see if TP is online

At the moment I have a variable that changes itself to 1/0 on the online and offline data events from the TP. Is there a way to eliminate the need for this and do something like "if (dvTP = online)"?

Comments

  • jazzwyldjazzwyld Posts: 199
    Waiting to be trumped

    If you are truly trying to set something to change on ONLINE or OFFLINE Events, then that's where you should place your variable.
  • dchristodchristo Posts: 177
    I agree with Jeff, however, you can do this:
    if(Device_ID(dvTp) > 0)
    {
    }
    

    --D
  • jcereckejcerecke Posts: 40
    jazzwyld wrote: »
    If you are truly trying to set something to change on ONLINE or OFFLINE Events, then that's where you should place your variable.

    My reasoning is this:
    I have a bargraph (or 6) on my TP which controls channels on an audio mixing desk via RS232. When the TP goes offline, it somehow generates a level event of 0 for all bargraphs, which then gets rid of all my audio.
    So I want to check if the TP is online when the level event occurs and if it is to change the level else do nothing.
  • kbeattyAMXkbeattyAMX Posts: 358
    jcerecke wrote: »
    My reasoning is this:
    I have a bargraph (or 6) on my TP which controls channels on an audio mixing desk via RS232. When the TP goes offline, it somehow generates a level event of 0 for all bargraphs, which then gets rid of all my audio.
    So I want to check if the TP is online when the level event occurs and if it is to change the level else do nothing.

    What about just doing if (level.value) then control my mixing desk. However I would use a virtualTP for level control because it does not go off line. Combine the VirtTP with the RealTP.
  • jazzwyldjazzwyld Posts: 199
    jcerecke wrote: »
    My reasoning is this:
    I have a bargraph (or 6) on my TP which controls channels on an audio mixing desk via RS232. When the TP goes offline, it somehow generates a level event of 0 for all bargraphs, which then gets rid of all my audio.
    So I want to check if the TP is online when the level event occurs and if it is to change the level else do nothing.

    That is just an issue. When a panel goes offline it sends a level.event 0.
  • jcereckejcerecke Posts: 40
    Thats cool. Thanks for all the suggestions.
  • AuserAuser Posts: 506
    jazzwyld wrote: »
    That is just an issue. When a panel goes offline it sends a level.event 0.

    No actually, kbeattyAMX is correct. If you combine the physical device(s) level with a virtual device level you WON'T get the level event with value = 0 when the/a physical device goes offline. This is because the virtual device never goes offline and therefore the level is always tracked in memory.

    It's possible to combine the levels using COMBINE_LEVELS or COMBINE_DEVICES. Using device arrays is generally better practice/more desirable than combining devices - as such COMBINE_LEVELS would be recommended.

    I'm not sure of the context in which you're dealing with the incoming level events, but something along these lines would achieve what you're after:
    DEFINE_DEVICE
    // Physical devices
    dvTP_1                     = 10001:1:0
    dvTP_2                     = 10001:2:0
    dvTP_3                     = 10001:3:0
    
    vdvTP                      = 33001:1:0
    
    // Virtual which maintains the level regardless
    // of the online state of the physical devices
    vdvAUDIO                   = 33002:1:0
    
    DEFINE_CONSTANT
    // Index of the level being tracked
    char    LVL_VOLUME         = 1
    
    // A level on a virtual device is used to keep a
    // constant record of the level's current value
    devlev  lvlTRACKED_VOLUME  = {vdvAUDIO, LVL_VOLUME}
    
    // This is the level array to catch incoming level
    // events from (ie. from the panels)
    devlev  lvlTP_VOLUME[] =
    {
      {vdvTP,  LVL_VOLUME},
      {dvTP_1, LVL_VOLUME},
      {dvTP_2, LVL_VOLUME},
      {dvTP_3, LVL_VOLUME}
    }
    
    DEFINE_START
    // Combine levels to prevent unwanted events
    // when physical devices go online/offline
    combine_levels(lvlTRACKED_VOLUME, lvlTP_VOLUME)
    
    DEFINE_EVENT
    level_event[lvlTP_VOLUME]
    {
      // Handle the event here...
    }
    

    The same can be achieved for devices which generate channel events when they go offline using COMBINE_CHANNELS.
Sign In or Register to comment.