pyownet Documentation



Similar documents
File Transfer Protocol (FTP) Chuan-Ming Liu Computer Science and Information Engineering National Taipei University of Technology Fall 2007, TAIWAN

socketio Documentation

Design Notes for an Efficient Password-Authenticated Key Exchange Implementation Using Human-Memorable Passwords

Introduction to Computer Networks

Napster and Gnutella: a Comparison of two Popular Peer-to-Peer Protocols. Anthony J. Howe Supervisor: Dr. Mantis Cheng University of Victoria

Improving DNS performance using Stateless TCP in FreeBSD 9

Implementing and testing tftp

2. IP Networks, IP Hosts and IP Ports

PROFESSIONAL. Node.js BUILDING JAVASCRIPT-BASED SCALABLE SOFTWARE. Pedro Teixeira WILEY. John Wiley & Sons, Inc.

TECHNICAL NOTE TNOI27

Getting Started with the Internet Communications Engine

GDC Data Transfer Tool User s Guide. NCI Genomic Data Commons (GDC)

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

Chapter 3. Internet Applications and Network Programming

OCS Training Workshop LAB14. Setup

TOE2-IP FTP Server Demo Reference Design Manual Rev1.0 9-Jan-15

Session NM059. TCP/IP Programming on VMS. Geoff Bryant Process Software

1 Introduction: Network Applications

Introducing the Adafruit Bluefruit LE Sniffer

IP address format: Dotted decimal notation:

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

First Workshop on Open Source and Internet Technology for Scientific Environment: with case studies from Environmental Monitoring

Apache Thrift and Ruby

µtasker Document FTP Client

Configuring Health Monitoring

About Firewall Protection

HTTP. Internet Engineering. Fall Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

CREW - FP7 - GA No Cognitive Radio Experimentation World. Project Deliverable D7.5.4 Showcase of experiment ready (Demonstrator)

ICT SEcurity BASICS. Course: Software Defined Radio. Angelo Liguori. SP4TE lab.

A Java-based system support for distributed applications on the Internet

Design of a SIP Outbound Edge Proxy (EPSIP)

Process Control and Automation using Modbus Protocol

PktFilter A Win32 service to control the IPv4 filtering driver of Windows 2000/XP/Server

PRODUCTIVITY ESTIMATION OF UNIX OPERATING SYSTEM

Agenda. Distributed System Structures. Why Distributed Systems? Motivation

DEPLOYMENT GUIDE Version 1.1. DNS Traffic Management using the BIG-IP Local Traffic Manager

EMG Ethernet Modbus Gateway User Manual

About this document. The technical fundamentals

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

Networking Overview. (as usual, thanks to Dave Wagner and Vern Paxson)

Network Licensing. White Paper 0-15Apr014ks(WP02_Network) Network Licensing with the CRYPTO-BOX. White Paper

AppGate Personal Firewall 2.5.0

User Manual. Onsight Management Suite Version 5.1. Another Innovation by Librestream

Packet Capture. Document Scope. SonicOS Enhanced Packet Capture

>>> SOLUTIONS <<< c) The OSI Reference Model has two additional layers. Where are these layers in the stack and what services do they provide?

Authorize Sauce Documentation

Configuring Health Monitoring

McAfee Web Gateway 7.4.1

Smart Tips. Enabling WAN Load Balancing. Key Features. Network Diagram. Overview. Featured Products. WAN Failover. Enabling WAN Load Balancing Page 1

Alarms of Stream MultiScreen monitoring system

presentation DAD Distributed Applications Development Cristian Toma

Syslog Windows Tool Set (WTS) Configuration File Directives And Help

Network-Oriented Software Development. Course: CSc4360/CSc6360 Instructor: Dr. Beyah Sessions: M-W, 3:00 4:40pm Lecture 2

[Prof. Rupesh G Vaishnav] Page 1

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi

CONTROL MICROSYSTEMS DNP3. User and Reference Manual

monoseq Documentation

Remote login (Telnet):

How do I get to

Cluster APIs. Cluster APIs

Flask-SSO Documentation

List of FTP commands for the Microsoft command-line FTP client

Domain Name Resolver (DNR) Configuration

RECOVER ( 8 ) Maintenance Procedures RECOVER ( 8 )

Guideline for setting up a functional VPN

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

Lecture 2-ter. 2. A communication example Managing a HTTP v1.0 connection. G.Bianchi, G.Neglia, V.Mancuso

Middleware Lou Somers

Introducing the Microsoft IIS deployment guide

Multi-threaded FTP Client

$ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Cannot connect to some.host.name: $@";

IT304 Experiment 2 To understand the concept of IPC, Pipes, Signals, Multi-Threading and Multiprocessing in the context of networking.

How To Configure A Network Monitor Probe On A Network Wire On A Microsoft Ipv6 (Networking) Device (Netware) On A Pc Or Ipv4 (Network) On An Ipv2 (Netnet) Or Ip

Hands On Activities: TCP/IP Network Monitoring and Management

Overview of Computer Networks

Agent Languages. Overview. Requirements. Java. Tcl/Tk. Telescript. Evaluation. Artificial Intelligence Intelligent Agents

Configuring Nex-Gen Web Load Balancer

IMPLEMENTATION OF AN AGENT MONITORING SYSTEM IN A JINI ENVIRONMENT WITH RESTRICTED USER ACCESS

Application Note: AN00121 Using XMOS TCP/IP Library for UDP-based Networking

DSA-1000 / PRT-1000 Device Server / Thermal Printer

MeshBee Open Source ZigBee RF Module CookBook

TFTP Usage and Design. Diskless Workstation Booting 1. TFTP Usage and Design (cont.) CSCE 515: Computer Network Programming TFTP + Errors

python-escpos Documentation

Introduction to Synoptic

Java Network. Slides prepared by : Farzana Rahman

CNT5106C Project Description

Application Protocols for TCP/IP Administration

User Manual Document HTTP-Direct / FTPServer and FLASH file system

IP - The Internet Protocol

Building a Multi-Threaded Web Server

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

THE PROXY SERVER 1 1 PURPOSE 3 2 USAGE EXAMPLES 4 3 STARTING THE PROXY SERVER 5 4 READING THE LOG 6

GlobalSCAPE DMZ Gateway, v1. User Guide

DNS zone transfers from FreeIPA to non-freeipa slave servers

BIT COMMANDER. Serial RS232 / RS485 to Ethernet Converter

Data Link Layer(1) Principal service: Transferring data from the network layer of the source machine to the one of the destination machine

CSE331: Introduction to Networks and Security. Lecture 6 Fall 2006

Operating Systems Design 16. Networking: Sockets

Transcription:

pyownet Documentation Release 0.10.0 Stefano Miccoli March 30, 2016

Contents 1 Contents 3 1.1 Introduction............................................. 3 1.2 Installation.............................................. 4 1.3 pyownet.protocol low level interface to owserver protocol................ 5 2 Indices and tables 15 i

ii

Abstract pyownet is a pure python package for interfacing with OWFS via the owserver network protocol. OWFS is a software system to access devices on a 1-Wire network. Contents 1

2 Contents

CHAPTER 1 Contents 1.1 Introduction pyownet is a pure Python package for interfacing to a 1-Wire network via OWFS. A brief introduction to the main components with which pyownet interacts is given below. 1.1.1 1-Wire 1-Wire is a a single contact serial interface developed by Maxim Integrated. A typical 1-Wire network is composed by a master device and a collection of slave devices/sensors. The master device is usually connected to a host computer via a serial or USB interface, but there exist also ethernet or other network adapters. See also: 1-Wire Maxim 1-Wire technology brief from Maxim Integrated 1-Wire Wikipedia description of the 1-Wire bus system on Wikipedia 1.1.2 OWFS and the owserver protocol The 1-Wire File System, in short OWFS, is a software system that allows to access a 1-Wire bus via a supported master device. OWFS comprises many different modules which offer different access protocols to 1-Wire data: owhttpd (http), owftpd (ftp) and owfs (filesystem interface via FUSE). Since only a single program can access the 1-Wire bus at one time, there is also a back end component, owserver, that arbitrates access to the bus from multiple client processes. Client processes can query an owserver (the program) via network sockets speaking the owserver protocol. OWFS offers many language bindings for writing owserver clients: among others c, java, perl, php, python, which can be found in the OWFS source tree under the module/ownet directory. See also: OWFS 1-Wire File System - development site official OWFS site owserver protocol brief The owserver protocol follows a client-server paradigm: the client makes a connection to the listening socket of the owserver program and sends a message. The server replies with another message, and then either closes the connection or waits for other messages 1. The default port 4304/tcp (and 4304/udp, although UDP is not used) is registered at the IANA as owserver service for this purpose. Both the client and server messages are composed by a fixed length header and a variable length payload. The header structure is defined in the OWFS source tree in file module/owlib/src/include/ow_message.h as: 1 For a discussion of this type of keep-alive connection see Persistent vs. non-persistent proxy objects.. 3

#include <stdint.h> /* message to owserver */ struct server_msg { int32_t version; int32_t payload; int32_t type; int32_t control_flags; int32_t size; int32_t offset; }; /* message to client */ struct client_msg { int32_t version; int32_t payload; int32_t ret; int32_t control_flags; int32_t size; int32_t offset; }; #define OWSERVER_PROTOCOL_VERSION 0 The version member is set to OWSERVER_PROTOCOL_VERSION, payload is the payload length (in bytes), while server_msg.type is a constant that describes the type of request made to the server (see also Message types). client_msg.ret is a server return code (used to signal errors or abnormal situations) while control_flags are used to control various aspects of the owserver protocol (see also Flags). After the header the actual payload is transmitted, as a (binary) stream of bytes (of length server_msg.payload or client_msg.payload). See also: owserver network protocol protocol specification 1.1.3 pyownet package contents To time pyownet comprises a single module pyownet.protocol, which is a low-level implementation of the client side of the owserver protocol. It can be considered a replacement of the official OWFS module ownet.connection (to be found in module/ownet/python). Although low-level, it s use is fairly simple, due to the peculiar OWFS design, with it s file-system like structure. A higher-level module pyownet.sensors is under development. 1.2 Installation 1.2.1 Source code Source code for pyownet is hosted on GitHub: https://github.com/miccoli/pyownet. The project is registered on PyPI: https://pypi.python.org/pypi/pyownet. Python version support The code base is written in Python 2, but Python 3 is fully supported, and is the main developing language. Running the 2to3 tool will generate valid and, whenever possible, idiomatic Python 3 code. The present documentation refers to the Python 3 version of the package. 4 Chapter 1. Contents

Explicitly supported versions are Python 2.6, 2.7, 3.2 through 3.5. 1.2.2 Install from PyPI The preferred installation method is from PyPI via pip: pip install pyownet This will install the pyownet package in the default location. If you are also interested in usage examples and tests you can download the source package from the PyPI downloads, unpack it, and install: python setup.py install In the source tree there will be example and test directories. 1.2.3 Install from GitHub The most complete source tree is kept on GitHub: git clone https://github.com/miccoli/pyownet.git cd pyownet python setup.py install Usually the master branch should be aligned with the most recent release, while there could be other feature branches active. 1.2.4 Reporting bugs Please open an issue on the pyownet issues page. 1.3 pyownet.protocol low level interface to owserver protocol Warning: This software is still in alpha testing. Although it has been successfully used in production environments for more than 4 years, its API is not frozen yet, and could be changed. The pyownet.protocol module is a low-level implementation of the client side of the owserver protocol. Interaction with an owserver takes place via a proxy object whose methods correspond to the owserver protocol messages. >>> from pyownet import protocol >>> owproxy = protocol.proxy(host="server.example.com", port=4304) >>> owproxy.dir() ['/10.000010EF0000/', '/05.000005FA0100/', '/26.000026D90200/', '/01.000001FE0300/', '/43.000043BC >>> owproxy.read('/10.000010ef0000/temperature') b' 1.6' 1.3.1 Persistent vs. non-persistent proxy objects. The owserver protocol presents two variants: non-persistent connection and persistent connection. In a nonpersistent connection a network socket is bound and torn down for each client-server message exchange; the protocol is stateless. For a persistent connection the same socket is reused for subsequent client-server interactions and the socket has to be torn down only at the end of the session. Note that there is no guarantee that a persistent 1.3. pyownet.protocol low level interface to owserver protocol 5

connection is granted by the server: if the server is not willing to grant a persistent connection, the protocol requires a fall-back towards a non-persistent connection. Correspondingly two different proxy object classes are implemented: non-persistent and persistent. Non-persistent proxy objects are thread-safe: at each method call of this class, a new socket is bound and torn down after a reply is received. Even if multiple threads use concurrently the same pyownet proxy object, there is no risk of garbling the order of the responses. Persistent proxy objects are not thread safe: on the first call to a method, a socket is bound to the owserver and kept open for reuse in subsequent calls; it is responsibility of the user to explicitly close the connection at the end of a session. This mode is not thread safe because if multiple threads use the same socket to send messages to an owserver, there is no guarantee that they will receive the respective answer due to a race condition on the single socket stream. If a single persistent proxy object has to be used by multiple threads, a locking mechanism has to be implemented, to prevent concurrent use of the persistent socket. In general, if performance is not an issue, it is safer to use non-persistent connection proxies: the protocol is simpler to manage, and usually the cost of creating a socket for each message is negligible with respect to the 1-wire network response times. 1.3.2 Timeouts owserver operations are synchronous: on a given socket connection, the server waits for an incoming client message, replies to the message, and closes the connection (when in non-persistent mode) or starts over (when in persistent mode.) Since 1-wire replies can take a long time to be generated, after receiving a request, the server sends keepalive frames at 1 second intervals to signal the client that the connection is still alive and that a response is in preparation. All methods of a pyownet proxy object are blocking: method calls return only after a server response is received. To avoid dead-locks, two different timeout mechanisms are implemented: a low level timeout on socket operations, a high level timeout valid for owserver messages. The low level timeout is applied to all socket operations: when the timeout is expired 1 a ConnError is raised. This typically happens if there are network problems or the owserver crashes. The high level timeout is optional, and is specified as a keyword argument to the proxy object methods. If timeout==0 the operation blocks as long as the owserver sends keepalive packets. For timeout>0, after timeout seconds a OwnetTimeout exception is raised. Please note that the check for an expired timeout is performed only after a keepalive packet is received from the server, therefore once every second. 1.3.3 Factory functions pyownet.protocol.proxy(host= localhost, port=4304, flags=0, persistent=false, verbose=false) Parameters host (str) host to contact port (int) tcp port number to connect with flags (int) protocol flag word to be ORed to each outgoing message (see Flags). persistent (bool) whether the requested connection is persistent or not. verbose (bool) if true, print on sys.stdout debugging messages related to the owserver protocol. Returns proxy object Raises 1 The socket timeout interval is set by the internal constant _SCK_TIMEOUT, by default 2 seconds. 6 Chapter 1. Contents

pyownet.protocol.connerror if no connection can be established with host at port. pyownet.protocol.protocolerror if a connection can be established but the server does not support the owserver protocol. Proxy objects are created by this factory function; for persistent=false will be of class _Proxy or _PersistentProxy for persistent=true pyownet.protocol.clone(proxy, persistent=true) Parameters proxy existing proxy object persistent (bool) whether the new proxy object is persistent or not Returns new proxy object There are costs involved in creating proxy objects (DNS lookups etc.). Therefore the same proxy object should be saved and reused in different parts of the program. The main purpose of this functions is to quickly create a new proxy object with the same properties of the old one, with only the persistence parameter changed. Typically this can be useful if one desires to use persistent connections in a multithreaded environment, as per the example below: from pyownet import protocol def worker(shared_proxy): with protocol.clone(shared_proxy, persistent=true) as newproxy: rep1 = newproxy.read(some_path) rep2 = newproxy.read(some_otherpath) # do some work owproxy = protocol.proxy(persistent=false) for i in range(num_threads): th = threading.thread(target=worker, args=(owproxy, )) th.start() Of course, is persistence is not needed, the code could be more simple: from pyownet import protocol def worker(shared_proxy): rep1 = shared_proxy.read(some_path) rep2 = shared_proxy.read(some_otherpath) # do some work owproxy = protocol.proxy(persistent=false) for i in range(num_threads): th = threading.thread(target=worker, args=(owproxy, )) th.start() 1.3.4 Proxy objects Proxy objects are returned by the factory functions proxy() and clone(): methods of the proxy object send messages to the proxied server and return it s response, if any. They exists in two versions: non-persistent _Proxy instances and persistent _PersistentProxy instances. The corresponding classes should not be instantiated directly by the user, but only by the factory functions. class pyownet.protocol._proxy Objects of this class follow the non-persistent protocol: a new socket is created and connected to the owserver for each method invocation; after the server reply message is received, the socket is shut down. The implementation is thread-safe: different threads can use the same proxy object for concurrent access to the owserver. 1.3. pyownet.protocol low level interface to owserver protocol 7

ping() Send a ping message to owserver. Returns None This is actually a no-op; this method could be used for verifying that a given server is accepting connections and alive. present(path, timeout=0) Check if a node is present at path. Parameters path (str) OWFS path timeout (float) operation timeout (seconds) Returns True if an entity is present at path, False otherwise Return type bool dir(path= /, slash=true, bus=false, timeout=0) List directory content Parameters path (str) OWFS path to list slash (bool) True if directories should be marked with a trailing slash bus (bool) True if special directories should be listed timeout (float) operation timeout (seconds) Returns directory content Return type list Return a list of the pathnames of the entities that are direct descendants of the node at path, which has to be a directory: >>> owproxy = protocol.proxy() >>> owproxy.dir() ['/10.000010EF0000/', '/05.000005FA0100/', '/26.000026D90200/', '/01.000001FE0300/', '/43 >>> owproxy.dir('/10.000010ef0000/') ['/10.000010EF0000/address', '/10.000010EF0000/alias', '/10.000010EF0000/crc8', '/10.0000 If slash=true the pathnames of directories are marked by a trailing slash. If bus=true also special directories (like /settings, /structure, /uncached ) are listed. read(path, size=max_payload, offset=0, timeout=0) Read node at path Parameters path (str) OWFS path size (int) maximum length of data read offset (int) offset at which read data timeout (float) operation timeout (seconds) Returns binary buffer Return type bytes Return the data read from node at path, which has not to be a directory. >>> owproxy = protocol.proxy() >>> owproxy.read('/10.000010ef0000/type') b'ds18s20' 8 Chapter 1. Contents

The size parameters can be specified to limit the maximum length of the data buffer returned; when offset > 0 the first offset bytes are skipped. (In python slice notation, if data = read(path), then read(path, size, offset) returns data[offset:offset+size].) write(path, data, offset=0, timeout=0) Write data at path. Parameters path (str) OWFS path data (bytes) binary data to write offset (int) offset at which write data timeout (float) operation timeout (seconds) Returns None Writes binary data to node at path; when offset > 0 data is written starting at byte offset offset in path. >>> owproxy = protocol.proxy() >>> owproxy.write('/10.000010ef0000/alias', b'myalias') sendmess(msgtype, payload, flags=0, size=0, offset=0, timeout=0) Send message to owserver. Parameters msgtype (int) message type code payload (bytes) message payload flags (int) message flags int (offset) message size int message offset timeout (float) operation timeout (seconds) Returns owserver return code and reply data Return type (int, bytes) tuple This is a low level method meant as direct interface to the owserver protocol, useful for generating messages which are not covered by the other higher level methods of this class. This method sends a message of type msgtype (see Message types) with a given payload to the server; flags are ORed with the proxy general flags (specified in the flags parameter of the proxy() factory function), while size and offset are passed unchanged into the message header. The method returns a (retcode, data) tuple, where retcode is the server return code (< 0 in case of error) and data the binary payload of the reply message. >>> owproxy = protocol.proxy() >>> owproxy.sendmess(protocol.msg_dirall, b'/', flags=protocol.flg_bus_ret) (0, b'/10.000010ef0000,/05.000005fa0100,/26.000026d90200,/01.000001fe0300,/43.000043bc040 >>> owproxy.sendmess(protocol.msg_dirall, b'/nonexistent') (-1, b'') class pyownet.protocol._persistentproxy Objects of this class follow the persistent protocol, reusing the same socket connection for more than one method call. When a method is called, it firsts check for an open connection: if none is found a socket is created and bound to the owserver. All messages are sent to the server with the FLG_PERSISTENCE flag set; if the server grants persistence, the socket is kept open, otherwise the socket is shut down as for _Proxy instances. In other terms if persistence is not granted there is an automatic fallback to the non-persistent protocol. 1.3. pyownet.protocol low level interface to owserver protocol 9

The use of the persistent protocol is therefore transparent to the user, with an important difference: if persistence is granted by the server, a socket connection is kept open to the owserver, after the last method call. It is the responsibility of the user to explicitly close the connection at the end of a session, to avoid server timeouts. _PersistentProxy objects have all the methods of _Proxy instances, plus a method for closing a connection. close_connection() if there is an open connection, shuts down the socket; does nothing if no open connection is present. Note that after the call to close_connection() the object can still be used: in fact a new method call will open a new socket connection. To avoid the need of explicitly calling the close_connection() method, _PersistentProxy instances support the context management protocol (i.e. the with statement.) When the with block is entered a socket connection is opened; the same socket connection is closed at the exit of the block. A typical usage pattern could be the following: owproxy = protocol.proxy(persistent=true) with owproxy: # here socket is bound to owserver # do work which requires to call owproxy methods res = owproxy.dir() # etc. # here socket is closed # do work that does not require owproxy access with owproxy: # again a connection is open res = owproxy.dir() # etc. In the above example, outside of the with blocks all socket connections to the owserver are guaranteed to be closed. Moreover the socket connection is opened when entering the block, even before the first call to a method, which could be useful for error handling. For non-persistent connections, entering and exiting the with block context is a no-op. 1.3.5 Exceptions Base classes exception pyownet.protocol.error The base class for all exceptions raised by this module. Concrete exceptions exception pyownet.protocol.owneterror This exception is raised to signal an error return code by the owserver. This exception inherits also from the builtin OSError and follows its semantics: it sets arguments errno, strerror, and, if available, filename. Message errors are derived from the owserver introspection, by consulting the /settings/return_codes/text.all node. exception pyownet.protocol.ownettimeout This exception is raised when there is an owserver operation in progress but a given timeout period has expired. This is distinct from a low-level socket timeout which is signaled by a ConnError). See Timeouts. exception pyownet.protocol.connerror This exception is raised when a low level socket system call fails. In fact ConnError simply wraps 10 Chapter 1. Contents

the Python OSError exception along with all its arguments, from which it inherits. In other terms it is implemented as try: # call some socket method/function except OSError as exc: raise ConnError(*exc.args) Typical situations in which this exception occurs are when a network connection to the owserver cannot be established, a socket timeout occurs at the OS level. For Python versions prior to 3.5, this exception could also be raised for an interrupted system call, see PEP 475 3. exception pyownet.protocol.protocolerror This exception is raised when a successful network connection is established, but the remote server does not speak the owserver network protocol or some other error occurred during the exchange of owserver messages. exception pyownet.protocol.malformedheader A subclass of ProtocolError: raised when it is impossible to decode the reply header received from the remote owserver. exception pyownet.protocol.shortread A subclass of ProtocolError: raised when the payload received from the remote owserver is too short. exception pyownet.protocol.shortwrite A subclass of ProtocolError: raised when it is impossible to send the complete payload to the remote owserver. Exception hierarchy The exception class hierarchy for this module is: pyownet.error +-- pyownet.protocol.error +-- pyownet.protocol.owneterror +-- pyownet.protocol.ownettimeout +-- pyownet.protocol.connerror +-- pyownet.protocol.protocolerror +-- pyownet.protocol.malformedheader +-- pyownet.protocol.shortread +-- pyownet.protocol.shortwrite 1.3.6 Constants pyownet.protocol.max_payload Defines the maximum number of bytes that this module is willing to read in a single message from the remote owserver. This limit is enforced to avoid security problems with malformed headers. The limit is hardcoded to 65536 bytes. 2 Message types These constants can by passed as the msgtype argument to _Proxy.sendmess() method See also: 3 See also issue #8. 2 Subject to change while package is in alpha phase. 1.3. pyownet.protocol low level interface to owserver protocol 11

owserver message types pyownet.protocol.msg_error pyownet.protocol.msg_nop pyownet.protocol.msg_read pyownet.protocol.msg_write pyownet.protocol.msg_dir pyownet.protocol.msg_presence pyownet.protocol.msg_dirall pyownet.protocol.msg_get pyownet.protocol.msg_dirallslash pyownet.protocol.msg_getslash Flags The module defines a number of constants, to be passed as the flags argument to proxy(). If more flags should apply, these have to be ORed together: e.g. for reading temperatures in Kelvin and pressures in Pascal, one should call: owproxy = protocol.proxy(flags=flg_temp_k FLG_PRESS_PA) See also: OWFS development site: owserver flag word general flags pyownet.protocol.flg_bus_ret pyownet.protocol.flg_persistence pyownet.protocol.flg_alias pyownet.protocol.flg_safemode pyownet.protocol.flg_uncached pyownet.protocol.flg_ownet temperature reading flags pyownet.protocol.flg_temp_c pyownet.protocol.flg_temp_f pyownet.protocol.flg_temp_k pyownet.protocol.flg_temp_r pressure reading flags pyownet.protocol.flg_press_mbar pyownet.protocol.flg_press_atm pyownet.protocol.flg_press_mmhg 12 Chapter 1. Contents

pyownet.protocol.flg_press_inhg pyownet.protocol.flg_press_psi pyownet.protocol.flg_press_pa sensor name formatting flags pyownet.protocol.flg_format_fdi pyownet.protocol.flg_format_fi pyownet.protocol.flg_format_fdidc pyownet.protocol.flg_format_fdic pyownet.protocol.flg_format_fidc pyownet.protocol.flg_format_fic These flags govern the format of the 1-wire 64 bit addresses as reported by OWFS: flag format FLG_FORMAT_FDIDC 10.67C6697351FF.8D FLG_FORMAT_FDIC 10.67C6697351FF8D FLG_FORMAT_FIDC 1067C6697351FF.8D FLG_FORMAT_FIC 1067C6697351FF8D FLG_FORMAT_FDI 10.67C6697351FF FLG_FORMAT_FI 1067C6697351FF FICD are format codes defined as below: format interpretation F family code (1 byte) as hex string I device serial number (6 bytes) as hex string C Dallas Semiconductor 1-Wire CRC (1 byte) as hex string D a single dot character. 1.3. pyownet.protocol low level interface to owserver protocol 13

14 Chapter 1. Contents

CHAPTER 2 Indices and tables genindex search 15

16 Chapter 2. Indices and tables

Index Symbols _PersistentProxy (class in pyownet.protocol), 9 _Proxy (class in pyownet.protocol), 7 C clone() (in module pyownet.protocol), 7 close_connection() 10 ConnError, 10 (py- method), ownet.protocol._persistentproxy D dir() (pyownet.protocol._proxy method), 8 E Error, 10 F FLG_ALIAS (in module pyownet.protocol), 12 FLG_BUS_RET (in module pyownet.protocol), 12 FLG_FORMAT_FDI (in module pyownet.protocol), 13 FLG_FORMAT_FDIC (in module pyownet.protocol), 13 FLG_FORMAT_FDIDC (in module pyownet.protocol), 13 FLG_FORMAT_FI (in module pyownet.protocol), 13 FLG_FORMAT_FIC (in module pyownet.protocol), 13 FLG_FORMAT_FIDC (in module pyownet.protocol), 13 FLG_OWNET (in module pyownet.protocol), 12 FLG_PERSISTENCE (in module pyownet.protocol), 12 FLG_PRESS_ATM (in module pyownet.protocol), 12 FLG_PRESS_INHG (in module pyownet.protocol), 12 FLG_PRESS_MBAR (in module pyownet.protocol), 12 FLG_PRESS_MMHG (in module pyownet.protocol), 12 FLG_PRESS_PA (in module pyownet.protocol), 13 FLG_PRESS_PSI (in module pyownet.protocol), 13 FLG_SAFEMODE (in module pyownet.protocol), 12 FLG_TEMP_C (in module pyownet.protocol), 12 FLG_TEMP_F (in module pyownet.protocol), 12 FLG_TEMP_K (in module pyownet.protocol), 12 FLG_TEMP_R (in module pyownet.protocol), 12 FLG_UNCACHED (in module pyownet.protocol), 12 M MalformedHeader, 11 MAX_PAYLOAD (in module pyownet.protocol), 11 MSG_DIR (in module pyownet.protocol), 12 MSG_DIRALL (in module pyownet.protocol), 12 MSG_DIRALLSLASH (in module pyownet.protocol), 12 MSG_ERROR (in module pyownet.protocol), 12 MSG_GET (in module pyownet.protocol), 12 MSG_GETSLASH (in module pyownet.protocol), 12 MSG_NOP (in module pyownet.protocol), 12 MSG_PRESENCE (in module pyownet.protocol), 12 MSG_READ (in module pyownet.protocol), 12 MSG_WRITE (in module pyownet.protocol), 12 O OwnetError, 10 OwnetTimeout, 10 P ping() (pyownet.protocol._proxy method), 7 present() (pyownet.protocol._proxy method), 8 ProtocolError, 11 proxy() (in module pyownet.protocol), 6 pyownet.protocol (module), 5 Python Enhancement Proposals PEP 475, 11 R read() (pyownet.protocol._proxy method), 8 S sendmess() (pyownet.protocol._proxy method), 9 ShortRead, 11 ShortWrite, 11 W write() (pyownet.protocol._proxy method), 9 17