pyP2Monitor
1.0.0
Monitor a P2 furnace activity reading data on serial port
|
Class implementing and handling the communication protocol with the furnace. More...
Public Member Functions | |
def | __init__ |
Instanciate a new P2Furn. | |
def | restartSerialPort |
Restart the serial port. | |
def | readMsg |
Read a message from the furnace. | |
def | sendMsg |
Send a message to the furnace. | |
def | runAuth |
Begin the authentication stage. | |
def | runInit |
Run the initialisation stage. | |
def | readData |
Run the data retrieve function. | |
def | stop |
Close the serial port and reset stage lag. |
Static Public Member Functions | |
def | userId |
Return user hex value used to auth, given a user name. |
Data Fields | |
port | |
The serial port filename. | |
com | |
The Associated P2Com object. | |
curStage | |
Stores the current stage. |
Static Public Attributes | |
int | STAGE_PREINIT = 0 |
Before initialisation stage. | |
int | STAGE_LOGIN = 1 |
Authentication stage. | |
int | STAGE_INIT = 2 |
Initialisation exchange stage. | |
int | STAGE_POST_INIT = 3 |
After initialisation stage. | |
int | STAGE_XCHG = 4 |
Data exchange stage. | |
string | USER_PLUMBER = "52610300007B" |
Plumber user. | |
string | USER_NORMAL = "526103000001" |
Normal user. | |
string | USER_NORMAL_ALT = "5261030000F3" |
Alternate normal user. | |
string | USER_SERVICE = "52610300FFF9" |
Service user. |
Class implementing and handling the communication protocol with the furnace.
Definition at line 42 of file p2proto.py.
def __init__ | ( | self, | |
serial_port | |||
) |
Instanciate a new P2Furn.
serial_port | The serial port filename (eg : /dev/ttyS0 ) |
Definition at line 83 of file p2proto.py.
def readData | ( | self, | |
waitdata = 0.5 , |
|||
storage = [("sqlite", "p2.db" , |
|||
dateFromP2 = False |
|||
) |
Run the data retrieve function.
storage | is a dict storing each data storage. Possible keys values are "sqlite" for sqlite db (value is the db file) or "file" for ascii dump (value is the dump file) |
dateFromP2 | is True when we want the furnace date and time, if false we take the date and time from the computer |
TypeError | On invalid type for parameter storage |
Definition at line 299 of file p2proto.py.
def readMsg | ( | self | ) |
Read a message from the furnace.
Simply call P2Com::read()
Definition at line 126 of file p2proto.py.
def runAuth | ( | self, | |
user = USER_SERVICE , |
|||
maxRetry = 3 , |
|||
retryWait = 10 |
|||
) |
Begin the authentication stage.
user | Is the hexadecimal representation of the message to send to authenticate |
maxRetry | The maximum number of retry before exit and consider as failed |
retryWait | The number of seconds between two authentication try |
Exception | On invalid type for parameters |
Definition at line 147 of file p2proto.py.
References P2Furn.curStage.
def runInit | ( | self | ) |
Run the initialisation stage.
P2ComError | On protocol error |
Definition at line 172 of file p2proto.py.
References P2Furn.curStage.
def sendMsg | ( | self, | |
msg | |||
) |
Send a message to the furnace.
Simply call P2Com::sendMsg()
msg | A P2Msg object |
Definition at line 135 of file p2proto.py.
|
static |
Return user hex value used to auth, given a user name.
user | the user name |
Definition at line 101 of file p2proto.py.
curStage |
Stores the current stage.
WARNING HERE WE SET OUR REPLY HEADER FROM AN INVALID/INCOMPLETE MESSAGE.
Definition at line 91 of file p2proto.py.
Referenced by P2Furn.runAuth(), P2Furn.runInit(), and P2Furn.stop().