Home AMX User Forum NetLinx Studio

Send string to a controller

adysadys Posts: 395
how can I send a string to a controller without declare virtual device?

I want to send string from controller to controller for a simple command to update the screen, what is the device that I need to put in the data event?

I mean this one

DATA_EVENT[vdvStatusCmd]
{
COMMAND:
{


can I use some address to catch data event only for the controller?

Maybe 5001:0:0?

I seach and didn't find nothing about it


thanks

Ady.

Comments

  • REBUILD_EVENTREBUILD_EVENT Posts: 127
    usually one declares a virtual device on both controllers, e.g.
    on system 1:
    vdvMyDevice = 33001:1:0

    on system 2:
    vdvMyDevice = 33001:1:1 // make sure you type system 1 here. otherwise it's not gonna be the same device

    then send your string to this device and get it in the data_event of the other controller. make sure that one controller is in the URL List of the other controller (but not both controllers in both URL Lists)
    if you want to send strings in both directions, you should consider sending SEND_STRING in one direction and SEND_COMMAND in the other
  • adysadys Posts: 395
    Thanks

    this is what I have done so far, just wondring if there is a way without virtual device

    look so simple if I could just listen on 5001:0:0 and just get the strings
  • ericmedleyericmedley Posts: 4,177
    adys wrote:
    Thanks

    this is what I have done so far, just wondring if there is a way without virtual device

    look so simple if I could just listen on 5001:0:0 and just get the strings
    I may not be understanding what you're saying but I'll do my best.

    If two masters are connected to each other via the master-to-master URL method you should be able to send strings from one master to the other directly.

    Say for example the main master is System 1 and the 2nd master is system 2.

    In the program on master one

    SEND_STRING 0:0:2, 'hello world'

    then if you monitor 0:0:0 on the 2nd master, you should get the string.
  • adysadys Posts: 395
    ericmedley wrote:
    I may not be understanding what you're saying but I'll do my best.

    If two masters are connected to each other via the master-to-master URL method you should be able to send strings from one master to the other directly.

    Say for example the main master is System 1 and the 2nd master is system 2.

    In the program on master one

    SEND_STRING 0:0:2, 'hello world'

    then if you monitor 0:0:0 on the 2nd master, you should get the string.


    thanks!


    that exactly what I wanted to know.
    on what device address to listen on the 2nd master

    I thought maybe 5001:0:0 , but 0:0:0 is good too :)

    I ususly use 0.0.0 for debug, isn't it for debug and notifications ?
  • adys wrote:
    thanks!


    that exactly what I wanted to know.
    on what device address to listen on the 2nd master

    I thought maybe 5001:0:0 , but 0:0:0 is good too :)

    I ususly use 0.0.0 for debug, isn't it for debug and notifications ?


    sending to 0:0:0 means sending to the controller the code runs on. which is used for debug.
  • adysadys Posts: 395
    Ok, thanks


    But now the debug will have full of messages and if I connect with Telnet, of Diagnostics windows, I will see al the messages.


    Any way to filter that?
  • viningvining Posts: 4,368
    adys wrote:
    Any way to filter that?
    First make sure that all you code and modules use debug variables that need to be set in order to send_string 0:0:0 so that only code your working on is supplying diagnostics with feedback and when your not debugging any thing nothing is sent other than messages generating from the system itself. Then in your string to the masters put in a "tag line" ID that you can use to "filter" by using an if(find_string(cMasterBuff,"'tag line'",1)) in the DATA_EVENT you create for the master. The tag line can be any thing you want to put in your send_string like SEND_STRING 0:0:2, 'COMM FROM 0:0:1 ->', cDATA,'<-',ITOA(__LINE__),'>',crlf". In this example your would just filter or parse for if(find_string(cMasterBuff,"'COMM FROM 0:0:1 ->",1)).
  • adysadys Posts: 395
    Thanks

    I wonder why AMX didn't make seperate ports for debug and messaging, it would made things simpler.

    If I have to filter it alone maybe its better to go with the tranditional way of using virtual device and leave 0.0.0 for debug as it is today...
  • NMarkRobertsNMarkRoberts Posts: 455
    Ady, I feel like you or I or we have missed the point of this thread.

    Could you please start over and tell us what you want to achieve, and what is preventing that? I accept that sometimes "we don't know what we don't know" which makes it tough!
  • adysadys Posts: 395
    Ok :)


    I want to call a funcation on controller x from code that running on controller y.

    I must send string or command, right?

    usualy what I do I declare a virtual device, and monitor it with data event.

    What I asked is why I need to declare virtual device instead of sending it the controllet itself.
    and wanted to know what is the adrees of the controller if I want to monitor it..

    Not very important, but since I am getting a lot of tricks and info in the forous that I can't find anywhere else, its was worth asking :)
  • DHawthorneDHawthorne Posts: 4,584
    adys wrote:
    Thanks

    I wonder why AMX didn't make seperate ports for debug and messaging, it would made things simpler.

    If I have to filter it alone maybe its better to go with the tranditional way of using virtual device and leave 0.0.0 for debug as it is today...

    They did - you make a virtual for your messaging. Not every system needs it, after all, and creating a virtual device for this purpose costs practically nothing in terms of resources or programming time.
Sign In or Register to comment.