Yes, actually there is only one user at a time. This will install on
workstations and only run localhost.
I'll give this a whirl, thanks so much.
On Oct 28, 11:59 am, mdipierro <[EMAIL PROTECTED]> wrote:
> I am assuming there is a single ser object for ALL users.
>
> indefinite=10*10
> ser = cache.ram("ser+, serial.Serial(0,9600), indefinite)
>
> def index():
> ## open COM port on initial page load
> return dict()
>
> ## each ajax request polls until is reads, returns read
> ## another poll request is immediately kicked off
> def poll():
> while True:
> curCode = ser.read(1)
> if curCode:
> n = ser.inWaiting()
> curCode += ser.read(n)
> return curCode
>
> ## catch page unload and cleanly close connection to serial port
> def close():
> ser.close();
> cache.ram('ser',None,0) # delete it from cache (0 is now!)
>
> On Oct 28, 10:49 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Thanks Massimo.
>
> > If I use cache.ram how can different functions in a controller access
> > the cached object? Also, is there anyway to specify what happens to
> > an object with it "expires". In my case it'll be best to close the
> > connection before it is destroyed.
>
> > for example:
>
> > def index():
> > ## open COM port on initial page load
> > ser = cache.ram("ser", serial.Serial(0,9600), 5000) ## can this
> > timeout be indefinite?
>
> > ## each ajax request polls until is reads, returns read
> > ## another poll request is immediately kicked off
> > def poll():
> > while True:
> > curCode = ser.read(1)
> > if curCode:
> > n = ser.inWaiting()
> > curCode += ser.read(n)
> > return curCode
>
> > ## catch page unload and cleanly close connection to serial port
> > def close():
> > ser.close();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---