Concering "Multiple OW handles"

I don't think the library, owlib, is set up for multiple invokation. All the
global variables would colide.

Let's see, that includes the input-device and output device chain heads
(in_connection and out_connection), all the statistics, the cache heads, the
Device array, etc.

We could package it all up in an allocated structure, but it would take a bit of
work.

There is another alternative: OWFS allows multiple 1-wire busses, either
provided by owserver, or directly.

The syntax (already in place) is
OW_init_string( "device1 devices2 --option --option" ) or whatever. Actually the
same as for invoking owserver (minus the output port) or owfs (minus the mount
point). The busses can be addressed independently via the bus.0 bus.1 ...
directories. Adding or subtracting busses on the fly would requiring OW_finish,
OW_init_string with some inefficiency (loss of statistics, loss of cache).

Paul


-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Geo Carncross
Sent: Wed 10/12/2005 9:45 AM
To: [email protected]
Subject: Re: [Owfs-developers] Re: C-API
 
On Wed, 2005-10-12 at 08:17 +0000, Sven Geggus wrote:
> I would propose some kind of filehandle for the above functions and the swig
> Interface which would permit us using more than one bus from a given
> program.

I don't know how straightforward this is.

> I think this could look like this (for your C-API example):
> 
> int OW_init( const char * device, int *ow_handle );
> 
> OW_init may also return the handle.
> 
> int OW_get( const char * path, char * buffer, int buffer_length, int ow_handle
) ;
> int OW_put( const char * path, const char * buffer, int buffer_length, int
ow_handle );
> void OW_finish( int ow_handle ) ;

It should be the return of OW_init() instead of a extra parameter.
OW_get(), put, finish, etc should take it as the first argument.

Putting integers like this at the end makes reading something like this:
        OW_get_buffer("/temp",buf,p,q);

somewhat tricky to read, but:
        OW_get_buffer(q,"/temp",buf,p);

is much easier (and follows read() better).


If this is possible (and hunting is possible), one should be able to:
        while ((h=OW_init(NULL)) > -1) {
                __add_handle(h);
        }

and make sure we don't hit the same device twice on accident.


-- 
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

<<winmail.dat>>

Reply via email to