Home AMX User Forum NetLinx Studio

Channel Event Needed for Device Creation?

I ran across some code written by another programmer which has me a bit stumped. It is in a module which has the device and a virtual passed into it. In the module, there is a channel event for the virtual on a programmer-chosen channel labeled 'DEBUG' which then fires off an empty ON. There is a small comment that says it is needed for device creation. I see this in a number of his modules but don't know why turning on a channel would be needed...would this possibly be to open up communication from the module back out to the main program?

Thanks,
Matthew

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    If this is for debug purposes, the programmer is probably using the state of that channel to determine if debug information is sent or not. Basically, the code probably does this:

    if([vdvDevice,DEBUG])
    sendDebugInfo();


    Jeff
  • Yeah, it's strange. I totally understand turning a debugging channel on but was not sure why it would be labeled 'Needed for Device Creation'...don't see how the two would be connected. Might just be some orphan code.

    Thanks for the response!

    Cheers,
    Matthew
  • AuserAuser Posts: 506
    Hi Matthew,

    More information required. I think we'd need to see the code you're referring to in order to understand the context of the other programmer's comment.
  • Here is an example...where vdvVirtualDevice has been passed into the module. I can understand turning on debugging by using the channel, but just not sure why they have it marked as 'REQUIRED CHANNEL REFERENCE'. Required for debugging, maybe. I just wanted to make sure that this isn't something that needs to be done in order for the device to communicate back to the main program through the virtual:
    DEFINE_CONSTANT
    
    DEBUGGING = 254
    
    //////////////////////////////////////////////////////////////
    // REQUIRED CHANNEL REFERENCE 
    //////////////////////////////////////////////////////////////
    CHANNEL_EVENT[vdvVirtualDevice,DEBUGGING]
    {
      ON:
        ON[]
      
    }
    
    
Sign In or Register to comment.