Home AMX User Forum NetLinx Studio

How do I send strings from a particular port?

From what I see, every input or output in AMX Duet modules is assigned it's own port. I am trying to make a module myself, but without Duet. Now, I am handling all the responses in a Data event of the real device. If I receive a string regarding, say, Input 3, I want to send a string from that particular port (maybe 33001:3:0), so I can handle it properly in my main program. Is there a way to do so?

One other thing. If from the module's data_event I do a send_string, from what device will it be recognized? Will it be a send_string from the real device or a virtual device?

Comments

  • HedbergHedberg Posts: 671
    dspot wrote: »
    From what I see, every input or output in AMX Duet modules is assigned it's own port. I am trying to make a module myself, but without Duet. Now, I am handling all the responses in a Data event of the real device. If I receive a string regarding, say, Input 3, I want to send a string from that particular port (maybe 33001:3:0), so I can handle it properly in my main program. Is there a way to do so?

    One other thing. If from the module's data_event I do a send_string, from what device will it be recognized? Will it be a send_string from the real device or a virtual device?

    send_command 33001:3:0,'This is the string I want to handle'

    then in your main program, or interface module, you have a data_event for that virtual device to process the string in the command: handler.

    Won't that do it?
  • dspotdspot Posts: 23
    Hedberg wrote: »
    send_command 33001:3:0,'This is the string I want to handle'

    then in your main program, or interface module, you have a data_event for that virtual device to process the string in the command: handler.

    Won't that do it?

    So in the command handler I put send_string 0,"data.text"? Will try that tomorrow.
  • viningvining Posts: 4,368
    dspot wrote: »
    So in the command handler I put send_string 0,"data.text"? Will try that tomorrow.

    Yep, then you'll see everything coming in from that dev in diagnostics. Same for string handlers or anywhere else in your code where want to see what's goin' on, if code is firing as expected and with what values when firing, etc, etc.

    You can also add an if(nDev_DeBug) var before that line so you can turn the printing to the diagnostic window on or off when you need. Just drop that var into into the debug window and change the value during runtime. You'll need to once you have thousands of these entries through out your code. I use a distinct nDev_DeBug var per dev (nThisDev_DeBug or nThatDev_DeBug) so i can print only what i want when i want. Plus when you're not actually debugging code you don't need the master processing these send_strings.
Sign In or Register to comment.