Home Duet/Cafe Duet

Custom feedback to NetLinx

I want to send a String back to NetLinx from CafeDuet. I tried using both 'processAdvancedEvent()' and 'processPassBackEvent()' but I do not seem to be able to get either of them to send a String back on the Virtual Device.

Does anyone have an example on how to SEND_STRING on the virtual device from inside of Cafe Duet so custom feedback can be handled on the NetLinx side?

Comments

  • TrikinCurtTrikinCurt Junior Member Posts: 158
    Seems there are not a lot of Duet programmers out there! Not sure where you are stuck, but if you enable processpassbackevent you should get data sent back to
    DATA_EVENT[vdvDEVICE]
    {
        
        STRING:
    

    That much works for me anyway... I stuggling more with it to send back a command, for example, on a switcher I can ask for the current input with ?INPUT-ALL,1 and get a data event back. What I want is anytime that it switches inputs it automatically sends the data event back. Sure sounds simple, but I sure am lost!

    Curt
    Trikin
  • SlavikSlavik Junior Member Posts: 18
    Customize feedbacks for Netllinx;

    1.Create Duet device in Duet program:
    public void handleAdvancedEvent(Event obj) {
    if (dvDuet == null)
    // initialize dvDuet with DPS from Netlinx code
    {
    dvDuet = new NetLinxDevice (obj.getDPS(),true);
    dvDuet.initialize();

    }
    switch (obj.type)
    {
    case Event.E_COMMAND:
    {
    switch(obj.dataType)
    {
    case Event.D_STRING8:{
    }
    }
    }
    }
    System.out.println(dvDuet.getDPS().toString());
    }


    2. Send command from NetLinx code for initialize.
    3. Now you can send customize feedbacks from Duet module.
    dvDuet.sendString("Something");
  • TrikinCurtTrikinCurt Junior Member Posts: 158
    Thanks, I will give that a try. So, does these mean the "Standard NetlinX API" does not give events for an input changing, so I need to create a custom event? It seems odd that I would query the status all the time when I can just be notified that it changed?

    Curt
    Trikin
  • I can't get that trick to work, I've tried various version of that trick and I still can't get a string or a command to show up as coming from the virtual device where netlinx can see it.

    public void handleAdvancedEvent(Event obj) {

    log(DEBUG, "Advanced event entered");

    NetLinxDevice testDevice= new NetLinxDevice(obj.getDPS(), true);
    log(DEBUG, "Test device created at ["+logDevice.getDPS().toString()+"]");
    testDevice.sendString("Some random string");
    testDevice.sendCommand("Some random command");


    At this point, the advanced events that I have programmed are getting fired off correctly, however I am not seeing any of the log messages, nor am I seeing any commands or strings being reported back from the virtual device in the Notifications pane in NetLinx Studio and the DATA_EVENT to handle the strings and commands from the virtual device are not executing either.
  • SlavikSlavik Junior Member Posts: 18
    testDevice.initilize();

    Try this:
    NetLinxDevice testDevice= new NetLinxDevice(obj.getDPS(), true);
    testDevice.initilize();
    testDevice.sendString("Some random string");
    testDevice.sendCommand("Some random command");
  • Yeah... that was the problem! Thank you!
    Slavik wrote:
    Try this:
    NetLinxDevice testDevice= new NetLinxDevice(obj.getDPS(), true);
    testDevice.initilize();
    testDevice.sendString("Some random string");
    testDevice.sendCommand("Some random command");
Sign In or Register to comment.