Home AMX User Forum NetLinx Modules & Duet Modules

Command from and to duet

Hi,

Just a quick question about using duet modules. I'm pretty new at AMX programming and want to use the duet modules with SNAPI as intended.
I learned to implement modules by using SEND_COMMMAND to control the devices through virtual devices, and use SEND_STRING in the modules for feedback.
But... for Duet modules SEND_COMMAND are used for controlling, but i also get COMMANDS back from the duet modules. How do i know (or how do my modules know) where the command originated? Is it from my code or is it coming form the Duet module? I guess my DATA_EVENT will fire in both situations. Or am i wrong?

Greetz,

Erwin van Maasakkers

Comments

  • AMXJeffAMXJeff Posts: 450
    erwinm wrote: »
    Hi,

    Just a quick question about using duet modules. I'm pretty new at AMX programming and want to use the duet modules with SNAPI as intended.
    I learned to implement modules by using SEND_COMMMAND to control the devices through virtual devices, and use SEND_STRING in the modules for feedback.
    But... for Duet modules SEND_COMMAND are used for controlling, but i also get COMMANDS back from the duet modules. How do i know (or how do my modules know) where the command originated? Is it from my code or is it coming form the Duet module? I guess my DATA_EVENT will fire in both situations. Or am i wrong?

    Greetz,

    Erwin van Maasakkers

    DUET is different, your send commands will not trigger your data event. Only messages from the DUET module will.
  • erwinmerwinm Posts: 6
    AMXJeff wrote: »
    DUET is different, your send commands will not trigger your data event. Only messages from the DUET module will.

    I still don't quite understand...
    lets say i have a real device and a virtual device, of that real device.
    Then i have a module, define_module 'mdlAcmeLcdDisplay' modLcd(vdvCD, dvCD) <-this would be the jar file)
    and a UI module, define_module 'mdlLcdDisp_UI' modLcd_UI(vdvCD,dvCD)
    When i do a SEND_COMMAND from the modLcd_UI, let's say "ASPECT=NORMAL", a response from the DUET would be a COMMAND "ASPECT=NORMAL". If i catch this response with a DATA_EVENT COMMAND:, wouldn't my command that i did send in the first place trip that same catch?
    (i'm dutch, excuse me for my poor english)

    Erwin
  • PhreaKPhreaK Posts: 966
    One of the key differences between a NetLinx virtual device and a Duet virtual device is a NetLinx virtual will echo any commands or strings that you send it. Using both commands (for incoming data) and string events (outgoing data) in a NetLinx module allows you identify the source of the event and ensure you don't double up on any event parsing. In Duet modules however this is not required - all of you interaction with them will be via commands and channels. When a command is sent to a duet virtual device it is not echoed so if you are seeing a command come from it, you can be sure that it originated from within the module.
Sign In or Register to comment.