pyP2Monitor  1.0.0
Monitor a P2 furnace activity reading data on serial port
 All Data Structures Namespaces Functions Variables Groups Pages
Public Member Functions | Data Fields
P2Com Class Reference

The class managing the communication with the furnace on serial port. More...

Public Member Functions

def __init__
 Instanciate a new P2Com object and open the serial port with the good parameters.
def getCom
 Return the serial port object.
def checksum
 Obsolete function (the checksum is not processed here now)
def write
 Write raw datas on to the furnace after adding checksum to it (obsolete)
def sendMsg
 Write data to serial port.
def read
 Read datas on the serial port.
def close
 Close the serial port.

Data Fields

 timeout
 A small timeout.
 failTimeout
 Read fail timeout.
 ser
 The serial port object self.ser = serial.Serial(portFile,9600,serial.EIGHTBITS,serial.PARITY_NONE,serial.STOPBITS_ONE,self.timeout,)
 FRAME_END
 The last char of a sended frame "\r".
 RECV_END
 The last char sended by the furnace in a frame (obsolete and false)

Detailed Description

The class managing the communication with the furnace on serial port.

Definition at line 97 of file p2com.py.

Constructor & Destructor Documentation

def __init__ (   self,
  portFile 
)

Instanciate a new P2Com object and open the serial port with the good parameters.

Parameters
portFileThe file name of the serial port (/dev/ttyS0 by default)

Definition at line 103 of file p2com.py.

Member Function Documentation

def checksum (   msg)

Obsolete function (the checksum is not processed here now)

Process a checksum given a message

@todo
Remove P2Com.checksum()

Definition at line 127 of file p2com.py.

def close (   self)

Close the serial port.

Returns
None

Definition at line 227 of file p2com.py.

def read (   self)

Read datas on the serial port.

    Reads datas from the serial port and returns a P2Msg
Exceptions
P2ComErrorOn receive error
Returns
P2Msg object

Definition at line 199 of file p2com.py.

References P2Com.failTimeout, and P2Com.timeout.

def sendMsg (   self,
  msg 
)

Write data to serial port.

Parameters
msga P2Msg object
Returns
None

Definition at line 187 of file p2com.py.

def write (   self,
  msg 
)

Write raw datas on to the furnace after adding checksum to it (obsolete)

   Take as argument a string representing hexadecimal numbers
   and send the associated bytes array to the serial port.

   Exemple : a call to write("10050F") sends [16,5,15] to the serial port
Parameters
msga string representing an hexadecimal number
Returns
None

Definition at line 154 of file p2com.py.

References P2Com.FRAME_END.

Field Documentation

timeout

A small timeout.

This small tiemout is used as time between each read retry

Definition at line 107 of file p2com.py.

Referenced by P2Com.read().


The documentation for this class was generated from the following file: