Home AMX User Forum NetLinx Studio

Device ID of R4

Greetings,

I am working with an R4. I know that there is a way to use DEVICE_ID to return the type of device, probably in a DATA_EVENT? How exactly is this keyword used?

I am writing a module that has lots of variable text. I would like to use DEVICE_ID in a conditional to not send the text to R4 type remotes.

Any suggestions? Thanks!

Comments

  • AMXJeffAMXJeff Posts: 450
    Most the time we use it to determine if the device is online. DEVICE_ID returns a zero if the device is not online.
    DEFINE_PROGRAM
    
    IF (DEVICE_ID(dvTP) > 0)
    {
       // DO WHATEVER
    }
    
    

    If you know the actual deviceID of the R4 ($142 i think) then you can tell if the TP is the R4.
    DATA_EVENT[dvTPArray]
    {
        STRING:
        {
            // R4 DEVICE
            IF (DEVICE_ID(DATA.DEVICE) == $142)
            {
            }
            // EVERYTHING ELSE
            ELSE
            {
            }
        }
    }
    
  • TurnipTruckTurnipTruck Posts: 1,485
    Where do you find the devices ids if you don't have a device in front of you to play with?
  • AMXJeffAMXJeff Posts: 450
    Good question... I lot of times it is in the PI documents. Then again sometimes not...

    http://www.amx.com/techdocs/HelpFiles/AMX-ProductInformation/Public-FlashHelp/AMX_Product_Information_(AMX-PI).htm

    You could always use the DEVICE_ID_STRING function. But then you would need a clue as to what this returns as well...
    IF (FIND_STRING(UPPER_STRING(DEVICE_ID_STRING(dvTP)), 'R-4', 1) > 0)
    {
    }
    
    
  • viningvining Posts: 4,368
    This link was posted in a thread a few weks ago that lists all the device ids for AMX equipment:
    AMX-PI contains a list of device IDs: http://www.amx.com/techdocs/HelpFile..._to_AMX-PI.htm

    You'll find it in "AMX Supplemental Product Documentation" -> Device ID Information
    __________________
    Marc Scheibein, ACE

    I was trying to run device id at start up on my TP array all load values into a TP type array to determine feedback. I figured I'd load an array with values at start up rather than call the device id function every time there's a need for feedback. That seems like it would be considerably more processor intensive.

    Unfortunately I think device id only works if a device is online and the R4s if sleeping don't get a value returned. Actually the help file for device id says it main purpose is to show if a device is online and when aren't the R4s sleeping. So I had to put the device id call in the TP data event online handler to load the array to run if the current value was zero so it only has to run once.
  • TurnipTruckTurnipTruck Posts: 1,485
    I would like to use it to prevent sending variable text to and R4s in a device array.
    DATA_EVENT [UIArray]
    {
    ONLINE:
      {
      IF (NOT(DEVICE_ID(DATA.DEVICE)="$0142"))
        {
        //Do things for devices that are not R4s
        }
      }
    }
    

    Seem reasonable?
  • viningvining Posts: 4,368
    If you using the R4 comm module you probably have the virtuals for the R4's in the UIArray which means you'll need to make another UI array for the real devices. So TPs would be the same in both array but in the real device array you would use the real R4 DPS. That screwed me up for a while.

    I also create several other arrays to control feedback. As I stated before I create an integer array to hold the results of the DEVICE_ID function since it has to be easier on the system to do once then on every send string or level for every UI device every time feedback needs to be sent. I know the iPort module does it that way but it can't be efficient. In the UI arrays below I only have R4s since I don't have TPs in these rooms but normally you would have keypads, R4's, TPs etc. I also posted a while ago that I couldn't find the ID for the Metreau keypas so in the code example I just made one up. I have a keypad and I was going to connect it and see what it is but my master didn't have the phoenix connecter on the Axlink port cuz the price we pay for these things isn't enough to cover the cost for connector on all the ports. So I got pissed and gave up.
    VOLATILE DEV dvDVD_UIArry[DVD_NUM_TPS] = {vdvTPR4_1_DVD,vdvTPR4_2_DVD} //TPs THAT CAN CONTROL ANY OF THESE DVDs
    //if using the R4 comm module need a 2nd array for UIs listing the real devices not the virtuals to discover device types!!
    VOLATILE DEV dvDVD_RealUIArry[DVD_NUM_TPS] = {dvTPR4_1_DVD,dvTPR4_2_DVD} //combine all real UIs in the same order
    
    VOLATILE INTEGER nDVD_UI_TypeArry[DVD_NUM_TPS] //UI types: 1=KP, 2=R4, 3=G3, 4=G4. 
    
    VOLATILE INTEGER nDVD_ActiveTPArry[DVD_NUM_TPs] ; //Array to show which(in any) DVD Players it is "On Page" of this device.
    

    I then create a data event for the real UI array like this:
    DATA_EVENT[dvDVD_RealUIArry]
    
         {
         ONLINE:
    	  {
    	  STACK_VAR INTEGER nUIIndx ;
    	  STACK_VAR INTEGER nDeviceID ;
    	  STACK_VAR INTEGER nValue ; //UI types: 1=KP, 2=R4, 3=G3, 4=G4. 
    	    
    	  nUIIndx = GET_LAST(dvDVD_RealUIArry) ;
    	  nDeviceID = DEVICE_ID(dvDVD_RealUIArry[nUIIndx]) ;
    	  if(!nDVD_UI_TypeArry[nUIIndx])//only run if value hasn't been set already!
    	       {
    	       SELECT
    		    {
    		    ACTIVE(nDeviceID == 999)://keypads  find out number/s
    			 {
    			 nValue = UI_TYPE_KP ;
    			 }
    		    ACTIVE(nDeviceID == 322)://R4
    			 {
    			 nValue = UI_TYPE_R4 ;
    			 }
    		    ACTIVE(nDeviceID < 256)://G3 panel
    			 {
    			 nValue = UI_TYPE_G3 ;
    			 }
    		    ACTIVE(1)://G4
    			 {
    			 nValue = UI_TYPE_G4 ;
    			 }
    		    }
    	       nDVD_UI_TypeArry[nUIIndx] = nValue ;
    	       fnDVD_DeBug("'UI Device: ',fnDEV_TO_STRING(dvDVD_RealUIArry[nUIIndx]),' is a ',DVD_TXT_UI_TYPE[nValue],'. ** UI Type #',itoa(nValue),' **. >-Line-<',ITOA(__LINE__),'>',CRLF") ;
    	       }
    	  }
         }
    

    Since all my arrays are in order when in comes time for feedback I run a for loop on the UI array and 1st see if its active on this devices page. If it is I'll test it further against the nUI_TypeArry to determine what feedback the "On Page" UI's should get.
  • AMXJeffAMXJeff Posts: 450
    I would like to use it to prevent sending variable text to and R4s in a device array.
    DATA_EVENT [UIArray]
    {
    ONLINE:
      {
      IF (NOT(DEVICE_ID(DATA.DEVICE)="$0142"))
        {
        //Do things for devices that are not R4s
        }
      }
    }
    

    Seem reasonable?

    // except for the double quotes. I would write this like this.
    DATA_EVENT [UIArray]
    {
      ONLINE:
      {
         IF (DEVICE_ID(DATA.DEVICE) != $142 )
         {
            //Do things for devices that are not R4s
         }
      }
    }
    
  • TurnipTruckTurnipTruck Posts: 1,485
    AMXJeff wrote: »
    // except for the double quotes. I would write this like this.
    DATA_EVENT [UIArray]
    {
      ONLINE:
      {
         IF (DEVICE_ID(DATA.DEVICE) != $142 )
         {
            //Do things for devices that are not R4s
         }
      }
    }
    

    What would be the difference in operation?

    As to Vining's response, I have stopped using the queing module. I have had no problems. Things even seem faster sometimes.
  • viningvining Posts: 4,368
    TurnipTruck wrote:
    As to Vining's response, I have stopped using the queing module. I have had no problems. Things even seem faster sometimes.
    I've been thinking about dropping the module too since others on this forum have successful abandoned it as well. I just need some time and get around to modifying the feedback on some of my other device modules to prevent choking the gateway. I've also been putting 1 R4 per gateway and completley gave up on the idea of using repeaters and making a single Mesh Network to allow the R4s to roam and control things through out the house. Now they are basically just local TV remotes with minor added functionality to control other stuff in the room but just the minimum stuff that makes sense and justify the expense of using it over a Universal RF remote..
  • TurnipTruckTurnipTruck Posts: 1,485
    vining wrote: »
    I've also been putting 1 R4 per gateway and completley gave up on the idea of using repeaters and making a single Mesh Network to allow the R4s to roam and control things through out the house.

    My thoughts exactly. Functionally, the R4 is not a carry-around-the-house device. The loss of throughput from having the repeaters is not acceptable to me.
Sign In or Register to comment.