Page 1 of 16 12311 ... LastLast
Results 1 to 10 of 155

Thread: Threaded NetRemote Feedback.lua

  1. #1
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default Threaded NetRemote Feedback.lua

    Here's the first cut of Threaded NetRemote Feedback.lua

    As per NetRemote Feedback.lua, I'd recommend installing it in the luascript directory and using
    Code:
    require('Threaded NetRemote Feedback')
    in any script that wants to use it.

    Each client is run on a separate thread.

    The interface should be identical to the non-threaded version, let me know if you find any discrepancies here.

    There is also an optimisation implemented - when a label or image is queued, it checks the existing queue for labels with the same name, and flags them so that they will be ignored. This should speed up paging through long lists of labels and images. If you don't want this behaviour then SendLabel() etc. now has an extra parameter 'noskip' - if this is true then the label etc will still be transmitted to NetRemote even if another value for the same label is queued. I hope that makes sense.

    NB this queue optimisation does not apply to SendImageFromURL since that will be sent to NetRemote asynchronously, ie when the image data is ready. Each SendImageFromURL will start a new thread, so it's probably best not to call it too often.

    To further speed up a caller that's sending multiple labels and images there's also a function NetRemote.LookupClient(ipAddress) which gives you access to the NRClient object directly. I probably wouldn't recommend holding on to one of these for too long, but it should be okay for the lifetime of a function.

    Please post any bugs in this thread.
    Last edited by Rob H; October 21st, 2008 at 04:05 AM.
    --Rob

  2. #2
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    Nice one, Cheers Rob, Seems good so far
    Thx, Dan

    Onwards and Upwards!
    http://www.danward.co.uk

  3. #3
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Nice coding.

    Haven't run it yet but in case you need to exit a thread you can use


    gir.IsLuaExiting ()


    to detect an impending script reset.


    We should look at adding the weather stuff to this... ie..

    SendCurrentConditions ()
    SendForecastConditions ()
    SendSatellite () -- options for animate or not.

    Do avoid reliance on any one type of weather provider, we should standardize what conditions and what variables we will use across NR and Girder.

    Dan?

  4. #4
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Thanks Mike, that will simplify things a bit.

    Does it make sense to put the weather stuff in here? Or should it go in a separate file e.g. Weather Feedback.lua that makes use of this.

    Any thoughts on why SetBinaryImage() shows an error in the logger, yet the graphic is transferred correctly.
    --Rob

  5. #5
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Good question...

    The weather stuff would stay seperate... ie retrieval and local display.

    We should have a plugin/setting page that the user can decide to send the local weather to nr clients as an option. This can go on the weather setup page.

    However, the actual functions that send the weather probably should be in NR feedback? Yes no?

  6. #6
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    I'm not convinced that there's good reason to put them in unless there's something different about the data, ie they need to call different methods of the comms server.

    How about if Weather Feedback.lua simply added extra functions to the the NetRemote table instead.

    I'd need to see an example really.
    --Rob

  7. #7
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Hm, the more I think about it, you're right

    Should we send the data as a table serialized into a string?

  8. #8
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    That's a possibility - I have no problem with adding a SendTable function. Are you thinking of using Pickle for this or some other method?
    --Rob

  9. #9
    Join Date
    Nov 2003
    Location
    Hove, E Sussex, UK
    Posts
    4,005

    Default

    With Regard to Weather.

    I have been working on the scripts for weather.com, they are multi Thread too.

    As to standardising the variables, I would agree, that is a very good idea.

    Currently, my scripts use a Table for storing the Data, so that Day0 is today, Day1, tomorrow, etc.

    So I end up with data something like "Day0.sunr" for sun rise for example, with in a day is "Day0.1.xxx" and "Day0.2.xxx" which respresents a sub table for am and pm data.

    I still have some tidying to do but would be happy to make a compatible format.

    Thoughts?
    Thx, Dan

    Onwards and Upwards!
    http://www.danward.co.uk

  10. #10
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    Quote Originally Posted by danward79
    With Regard to Weather.

    I have been working on the scripts for weather.com, they are multi Thread too.

    As to standardising the variables, I would agree, that is a very good idea.

    Currently, my scripts use a Table for storing the Data, so that Day0 is today, Day1, tomorrow, etc.

    So I end up with data something like "Day0.sunr" for sun rise for example, with in a day is "Day0.1.xxx" and "Day0.2.xxx" which respresents a sub table for am and pm data.

    I still have some tidying to do but would be happy to make a compatible format.

    Thoughts?
    i started a new thread on this

Page 1 of 16 12311 ... 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
  •