ownetapi man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

OWNET(1)		     One-Wire File System		      OWNET(1)

NAME
       ownet  ,	 (libownet) - easy C-language 1-wire interface to the owserver
       protocol

SYNOPSIS
       libownet library to link with your program

   Handle
       OWNET_HANDLE
       Handle to each owserver connection

   Initialization
       OWNET_HANDLE OWNET_init( const char * owserver_tcp_address_and_port )
       Associate an owserver (1) tcp/ip address with a handle.

   Directory listing
       int  OWNET_dirlist(  OWNET_HANDLE  owserver_handle  ,  const   char   *
       onewire_path , char ** comma_separated_list )
       Create a comma-separated list of directory elements.

       int  OWNET_dirprocess(  OWNET_HANDLE  owserver_handle  ,	 const	char *
       onewire_path , void (* dirfunc  )  (void	 *,  const  char  *),  void  *
       passed_on_value )
       void  dirfunc ( void * passed_on_value , const char * directory_element
       )
       Apply function dirfunc to each directory element, along with  an	 arbi‐
       trary passed_on_value.

   Get data
       int   OWNET_read(   OWNET_HANDLE	  owserver_handle   ,	const  char  *
       onewire_path , const char ** return_string )
       Read a value (of specified size) from a 1-wire device.

       int  OWNET_lread(  OWNET_HANDLE	owserver_handle	  ,   const   char   *
       onewire_path , const char ** return_string , size_t size , off_t offset
       )
       Read a value (of specified size and offset) from a 1-wire device.

       int  OWNET_present(  OWNET_HANDLE  owserver_handle  ,  const   char   *
       onewire_path )
       Check if a 1-wire device is present.

   Set data
       int OWNET_put( OWNET_HANDLE owserver_handle , const char * onewire_path
       , const char * value_string , size_t size )
       Write a value (of specified size) to a 1-wire device.

       int  OWNET_lwrite(  OWNET_HANDLE	 owserver_handle  ,   const   char   *
       onewire_path , const char * value_string , size_t size , off_t offset )
       Write a value (of specified size and offset) to a 1-wire device.

   Close
       void OWNET_close( OWNET_HANDLE owserver_handle )
       Close the connection to a particular owserver.

       void OWNET_closeall( void )
       Close all open owserver connections.

       void OWNET_finish( void )
       Close all open owserver connections and free all memory.

   Temperature scale
       void OWNET_set_temperature_scale( char temperature_scale )
       char OWNET_get_temperature_scale( void )
       Set and retrieve the temperature scale used for all communications.

   Device format
       void OWNET_set_device_format( const char * device_format )
       const char * OWNET_get_device_format( void )
       Set  and	 retrieve  the 1-wire device serial number format used for all
       communications.

FUNCTIONS
   OW_init
       OW_init_string offers the full flexibility of the owfs (1) and  owhttpd
       (1) command line.

       Arguments
	      Can be as simple as jus the device name, a full parameter speci‐
	      fication.	 One or	 more  device  names  (includes	 tcp,  serial,
	      usb...) and command line switches. See owfs (1) for full syntax.

       Returns
	      0	 for  success.	-1  on error and errno will be set.  OW_finish
	      does not need to be called if OW_init fails.

       Sequence
	      One of the init functions must be called	before	accessing  the
	      1-wire bus.  OW_finish is optional.

   OW_init_args
       OW_init_args  offers  the  full flexibility of the owfs (1) and owhttpd
       (1) command line.

       Arguments
	      One or more device names (includes tcp, serial, usb...) and com‐
	      mand  line  switches.  See  owfs	(1)  for  full	syntax. Unlike
	      OW_init_string the arguments are in argv/argc format.

       Returns
	      0 for success. -1 on error and errno  will  be  set.   OW_finish
	      does not need to be called if OW_init fails.

       Sequence
	      One  of  the  init functions must be called before accessing the
	      1-wire bus.  OW_finish is optional.

   OW_get
       OW_get is used to get directory listings and file contents. The results
       are put in a dynamically allocated buffer.

       Arguments
	      path  is	the path to the directory or file (property).  *buffer
	      returns a pointer to a buffer containing	the  directory	(comma
	      separated)  or  value.   buffer_length returns the length of the
	      value/string in buffer

       Returns
	      number of bytes on success. -1 on error (and errno is set).

       Sequence
	      One of the init functions must be called	before	accessing  the
	      1-wire bus.  OW_finish is optional.

       Important note
	      buffer  is allocated ( with malloc ) by OW_get but must be freed
	      in your program. See malloc (3) and free (3)

   OW_lread
       OW_lread is used to read 1-wire memory chips. Think of it as a combina‐
       tion  of lseek and read It allows random-access to the memory, specify‐
       ing location and length. Unlike OW_get directories cannot  be  obtained
       and  the buffer must be pre-allocated rather than allocated by the rou‐
       tine.  buffer must be at least size length.

       Arguments
	      path is the path to the file (property).	buffer	is  the	 (pre-
	      allocated)  memory area where the value will be placed.  size is
	      the length of bytes requested.  offset is the position  in  file
	      to start reading.

       Returns
	      number of bytes on success. -1 on error (and errno is set).

       Sequence
	      One  of  the  init functions must be called before accessing the
	      1-wire bus.  OW_finish is optional.

   OW_put
       OW_put is an easy way to write to 1-wire chips.

       Arguments
	      path is the path to the file (property).	buffer is the value to
	      be  written.   buffer_length  is the length of the value buffer.
	      Returns number of bytes on success. -1 on error  (and  errno  is
	      set).

       Sequence
	      One  of  the  init functions must be called before accessing the
	      1-wire bus.  OW_finish is optional.

   OW_lwrite
       OW_lwrite is the companion of OW_lread.	It allows writing to arbitrary
       positions  in 1-wire memory.  Think of it as a combination of lseek and
       write.  buffer must be at least size length.

       Arguments
	      path is the path to the file (property).	buffer is the data  to
	      be  written.  size is the length of bytes to be written.	offset
	      is the position in file to start writing.

       Returns
	      number of bytes on success. -1 on error (and errno is set).

       Sequence
	      One of the init functions must be called	before	accessing  the
	      1-wire bus.  OW_finish is optional.

   OW_finish
       OW_finish cleans up the OWFS 1-wire routines, releases devices and mem‐
       ory.

       Arguments
	      None.

       Returns
	      None

       Sequence
	      OW_finish is optional since  cleanup  is	automatic  on  program
	      exit.

DESCRIPTION
   libowcapi
       libowcapi  (1) is an encapsulation of the full libow library for C pro‐
       grams.

       libowcapi (1) allows a C program to  use	 OWFS  principles  (consistent
       naming  scheme, multiple adapters, devices, and compatibility) directly
       from a C program. There are analogous  modules  for  other  programming
       languages:

       C      libowcapi

       perl   owperl

       php    owphp

       python owpython

       tcl    owtcl

EXAMPLE
       /* Simple directory listing -- no error checking */
       #include <ownetapi.h>
       char * buf;
       size_t s ;
       OWNET_init("localhost:4304");
       OWNET_dirlist("/",&buf,&s) ;
       printf("Directory %s0,buf);
       free(buf);
       OWNET_finish() ;

SEE ALSO
AVAILABILITY
       http://www.owfs.org

AUTHOR
       Paul Alfille (paul.alfille@gmail.com)

OWFS Manpage			     2008			      OWNET(1)
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net