Facility Control

 View Only
  • 1.  Write to DB using Dashboard? Odd request maybe...

    Posted 08-30-2017 10:48
    I suppose this is going a bit beyond what Dashboard was intended for, but I was just wondering, are there any way to connect to an external DB (localhost or otherwise connected) and write the value of the parameteres to this? Just curious... Working on an idea for a dashboard where this would come in handy.


  • 2.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 08-30-2017 20:09
    Yes, this is possible but not really exposed in the UI.
    You can easily publish your parameters from one DashBoard to another - publishing the entire UI is a little more difficult.

    If you specify jsonport="1234" (or whatever port you want), you can add a connection to those parameters inside of another DashBoard by adding it as a TCP/IP openGear or DashBoard connect device using the JSON protocol.

    James
    #DashBoard


  • 3.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 08-31-2017 20:47

    I have added an example that demonstrates the concept and shows the steps to add the consumer of the information.

    https://discussions.rossvideo.com/filedata/fetch?id=13450


    #DashBoard


  • 4.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 09-11-2017 20:17
    While this would be nice and usefull indeed, and I really appreciate the example, it's not quite what I was after.

    I'm not after publishing my parameters from one DashBoard to another (though I can certainly use this too!).
    But I can easilly see how my question above can be interpreted that way. My mistake mixing other lingo into this.. heh..

    I'm interested in how, and if, I could connect to an external database (MySQL or similar) and write data into that?
    #DashBoard


  • 5.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 09-12-2017 15:32
    At present, DashBoard can read data from the file system, TCP/UDP, HTTP, and FTP. It does not have drivers for reading from/writing to any relational database (MySQL and others).
    However, if your database supports restful HTTP calls, you might be able to get what you're looking for that way.
    #DashBoard


  • 6.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 09-19-2017 21:24
    Hmmm, ok.
    Well, I'll keep looking into it!

    Might I suggest a possible addition in a future update?

    Thanks again anyways!!
    #DashBoard


  • 7.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 09-20-2017 15:28
    I'll make a note of it in our requests database. Best of luck!

    James
    #DashBoard


  • 8.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 04-03-2018 14:27
    Hey @jamespeltzer , I got another one for you on this one...

    I have definetly found uses for this, and the ability to share the parameters from one "main" DashBoard and have others provide data input etc.
    Now I have another question though. Do you have a good example, and a "best practise" to show or hide a panel element on the consumer DashBoard from the Provider?

    IE: Me pressing a "GOAL" button in the main DashBoard, would show and prompt a canvas on another screen where our "stats" guys sit, so they can then choose from a preset jersey list on who scored. They press "send" and this data is inserted into a list of "events" and then hides the canvas again (resets for next time).

    I've been looking around to do it with GPI, or through UDP and a listener, but I am definetly open for better ideas!
    Or rather, I HAVE it working with UDP messages, and a listener that has a series of if and else if for what it should do depending on the messages.
    I guess I'm just wondering if there is a "hide element" that would work across the jsonport?
    #DashBoard


  • 9.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 04-04-2018 08:28
    Ok, I was somewhat on the right track then.
    What do you mean "real OGP/DashBoard Connec devices" by the way?

    How do you set a listener to listen for parameter changes though?

    For now I have a UDP listener, that checks the incomming message, and then runs a custom function based on what the message is.
    Say I send the message [I]/reveal/goalstats[/I] then using the javascript .split function I can look through any word separated by / and build the ogscript command based on that.
    Meaning I can also send [I]/hide/goalstats[/I] and the same function would build the command easilly itself.
    #DashBoard


  • 10.  RE: Write to DB using Dashboard? Odd request maybe...

    Posted 04-04-2018 09:11

    Basically... On the consumer panel, I have a "Basic Canvas" called "test_canvas".
    This panel also includes a listener for UDP commands. All it does is to listen to UDP commands on the port 53535 [I](same as QLAB by chance *wink wink*)[/I], and then send the message through a custom function called "UDPHideShowElement":

    <listener autostart="true" listenport="53535" maxlength="1024" name="UDP Listener" udp="true">
       <task tasktype="ogscript">if (event.getEventType() == 1)
    {
       UDPHideShowElement(event.getBytesAsString());
    }
    </task>
    </listener>

    Now, for the custom function, what it does is to simply separate the message into an array, split by / in order to get the different parts of the message.
    The custom function that in turn created the function that runs the ogscript is as follows:

    <api>function UDPHideShowElement(msg) {
       msg = msg.split("/");
       var f = "function udpFunction() {ogscript."+msg[1]+"('"+msg[2]+"');}";
       eval(f); udpFunction();
    }</api>

    [I]At the moment, I am only after reveal and hide, so it does not need to do more than this. But basically based on the way ogscript is built up, I can technically check for the msg[1] and create a case as to where it handles differently based on whatever the type of ogscript I want to be able to "build" with UDP.
    The fact that I also split by / makes it so that I can put in a simple IF check in my listener for the first character of the UDP message, basically asking for the first character in a "command" like this to be /, allowing me to set up other UDP commands for the panel as well as this dynamic function control.[/I]

    Now on the "provider" panel that will hold all my parameters etc, all I need to do now, is send a UDP string to the machine with the consumer panel like so:

    ogscript.sendUDPString("localhost", 53535, "/hide/test_canvas");

    And this will in turn create a function on the consumer panel that in turn runs the following:

    ogscript.hide("test_canvas");

    And then I have a UDP command that I can easilly change the UDP string command in order to hide/reveal other panels, simply by changing the last element of the UDP string to match the ID of whatever canvas/button/element in the consumer panel.

    This in turn also lets me build up commands and let other devices that can simply send UDP commands as well to trigger either functions, tasks, buttons or hide/reveal panel elements with ease, by building dynamic ogscript code through UDP commands. Think Raspberry PI, Arduino, or any other UDP software for that matter.

    Full code on "CONSUMER PANEL":

    <abs contexttype="opengear" gridsize="20" id="_top" objectid="localhost:5566&lt;br&gt;Slot 0&lt;br&gt;Device" objecttype="Device" scroll="horizontal">
       <meta>
          <api>function customUDPCommand(msg) {
       msg = msg.split("/");
       var f = "function udpFunction() {ogscript."+msg[1]+"('"+msg[2]+"');}";
       eval(f); udpFunction();
    }</api>
          <listener autostart="true" listenport="53535" maxlength="1024" name="UDP Listener" udp="true">
             <task tasktype="ogscript">if (event.getEventType() == 1)
    {
       var udp = event.getBytesAsString();
       if (udp.charAt(0) == "/") {
          customUDPCommand(udp);
       } else {
          ogscript.debug("Not custom command...");
       }
    }
    </task>
          </listener>
       </meta>
       <abs height="280" id="test_canvas" left="60" style="bg#5D5D5D;bdr:thick;bdr#BDBDBD;" top="80" width="260"/>
       <button buttontype="push" height="100" id="btn1" left="80" name="btn1" top="380" width="100"/>
       <button buttontype="push" height="120" id="btn2" left="240" name="btn2" top="460" width="120"/>
    </abs>

    #DashBoard