Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Sending serial commands to a GlobalCache

  1. #1
    Join Date
    Jan 2009
    Location
    Wiltshire
    Posts
    24

    Default Sending serial commands to a GlobalCache

    Hi,

    I have a GlobalCache GC-100 that I wish to send commands to be actioned via one of the serial ports.

    I want to use Girder v5 to do this - I already have it happily sending IR commands.

    I have looked in the admin guide and it states their should be an action:

    9.21.4 Send ASCII Action

    However this action is missing from my Girder install.

    I tried the following in a scripting action but it does not work either:

    local gc = globalcache.New("192.168.1.70")
    gc:WriteData("a11", "4999")

    I know the IP, port and data are correct as they work with the GlobalCache test program.

    Can anyone point me in the direction of what I need to do here to get this working?

    Thanks,

    Rob

  2. #2
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    I think you might be able to use the SimpleSend transport class.

    In the transport manager create a SimpleSend device with IP 192.168.1.70 and port 4999 (for serial port 1)

    Then in a lua action do this:


    Code:
    local txManager = ComponentManager:GetComponentUsingName('Transport Manager')
    local tp = txManager:GetTransportUsingName('My SimpleSend')
    tp:Send("hello!")
    Match the "My SimpleSend" to the name you picked for the transport manager instance.
    Ron
    No support through PM

  3. #3
    Join Date
    Jan 2009
    Location
    Wiltshire
    Posts
    24

    Default Fixed!

    Thanks, this has worked and I am now sending commands via the serial port on my GlobalCache.

    Any idea why I dont see the Send ASCII Action detailed in the userguide?

    Cheers,

    Rob

  4. #4
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    It's been removed. Sorry about the misleading info in the manual. I'll address it.
    Ron
    No support through PM

  5. #5
    Join Date
    Jan 2009
    Location
    Wiltshire
    Posts
    24

    Default Enabling via web server

    Now that I have this working in the Girder console my next stage is to get this running in my web page I am creating.

    I have been using the example here to talk to the global cache:

    http://www.promixis.com/forums/showthread.php?t=20636

    However I am accessing the serial ports in a different way.

    Do you have any examples of how I can get the serial port working via a web page?

    Will I have to create a new simple send transport class in the script in the web page or can I use the one I have already created in Grider?

    Thanks,

    Rob

  6. #6
    Join Date
    Jan 1998
    Location
    Jupiter, FL
    Posts
    13,550

    Default

    You can use the class you already have there in fact you can copy and paste that code you have in this thread into a webpage!
    Ron
    No support through PM

  7. #7
    Join Date
    Jan 2009
    Location
    Wiltshire
    Posts
    24

    Default

    Hi,

    I havent looked at this for a little while.

    I have tried to create a web page that will send a serial commmand to my GlobalCache however I am not having any success.

    I have attached my web page, does anyone have any ideas what I am doing wrong?

    Thanks.
    Attached Files Attached Files

  8. #8
    Join Date
    Oct 2005
    Posts
    307

    Default

    You have three problems: You can't run lua on the client side, in a web browser, or in a JavaScript function.

    You need to run a server side lhtml. You can just add an event to the desired action that will be triggered with an JavaScript/jquery ajax call to sendevent.lhtml (part of the default example webpage). Or if you want to make your code work, you can move the lua to a new lhtml file and call it similarly to sendevent.lhtml with ajax passing the serial command like the event is passed.

  9. #9
    Join Date
    Jan 2009
    Location
    Wiltshire
    Posts
    24

    Default

    I have updated this to have seperate files for what the user see's and the LUA part of things.

    I have attached 3 files:

    ajax_sendir_sources.lhtml.txt - script trying to open a direct connection
    control_sources.lhtml.txt - user interface
    Copy of ajax_sendir_sources.lhtml.txt - script trying to call an existing device defined in Girder

    Its still not working, from the Girder logger I can see the command being passed from the user interface to the script file but nothing happens.

    I have tried both of the script files, in one I am trying to send the data directly to the device, in the other I am trying to send the data to a device defined in Girder.

    The device I am trying to connnect to a GloabCache serial port, it works fine in the girder UI and I also have web pages that talk to the IR ports working fine, its just the serial port bits that are causing problems.

    I'm gueesing my LUA script is not right, can anyone help?

    Thanks,

    Rob
    Attached Files Attached Files

  10. #10
    Join Date
    Oct 2005
    Posts
    307

    Default

    Please post your GML file.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •