コード例 #1
0
ファイル: __init__.py プロジェクト: bootc/owfs-cvsimport
def init( iface ):
    """
    Initialize the OWFS library by specifying the interface mechanism
    to be used for communications to the 1-wire network.

    Examples:

        ow.init( 'u' )

    Will initialize the 1-wire interface to use the USB controller.

        ow.init( '/dev/ttyS0' )

    Will initialize the 1-wire interface to use the /dev/ttyS0 serial
    port.

        ow.init( 'remote_system:3003' )

    Will initialize the 1-wire interface to use the owserver running
    on remote_system on port 3003.
    """
    #print 'ow.__init__'
    global initialized
    if not initialized:
        if not _OW.init( iface ):
            raise exNoController
        initialized = True
コード例 #2
0
ファイル: __init__.py プロジェクト: zdzichu/owfs
def init( iface ):
    """
    Initialize the OWFS library by specifying the interface mechanism
    to be used for communications to the 1-wire network.

    Examples:

        ow.init( 'u' )

    Will initialize the 1-wire interface to use the USB controller.

        ow.init( '/dev/ttyS0' )

    Will initialize the 1-wire interface to use the /dev/ttyS0 serial
    port.

        ow.init( 'remote_system:3003' )

    Will initialize the 1-wire interface to use the owserver running
    on remote_system on port 3003.
    """
    #print 'ow.__init__'
    global initialized
    if not initialized:
        if not _OW.init( iface ):
            raise exNoController
        initialized = True
コード例 #3
0
ファイル: raw_access.py プロジェクト: GrandHsu/iicontrollibs
Example showing direct access to the underlying owfs libraries.
"""


import sys
from ow import _OW


def tree( path, indent = 0 ):
    raw = _OW.get( path )
    if raw:
        entries = raw.split( ',' )
        for entry in entries:
            print ' ' * indent, entry
            if entry[ -1 ] == '/':
                tree( entry, indent + 4 )


if __name__ == "__main__":
    if len( sys.argv ) == 1:
        print 'usage: tree.py u|serial_port_path|localhost:4304'
        sys.exit( 1 )
    else:
        if not _OW.init( sys.argv[ 1 ] ):
	    print 'problem initializing the 1-wire controller'
	    sys.exit( 1 )


tree( '/' )
コード例 #4
0
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
::EOH

Example showing direct access to the underlying owfs libraries.
"""

import sys
from ow import _OW


def tree(path, indent=0):
    raw = _OW.get(path)
    if raw:
        entries = raw.split(',')
        for entry in entries:
            print ' ' * indent, entry
            if entry[-1] == '/':
                tree(entry, indent + 4)


if __name__ == "__main__":
    if len(sys.argv) == 1:
        print 'usage: tree.py u|serial_port_path|localhost:4304'
        sys.exit(1)
    else:
        if not _OW.init(sys.argv[1]):
            print 'problem initializing the 1-wire controller'
            sys.exit(1)

tree('/')