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 | Static Public Member Functions | Data Fields | Static Public Attributes
P2Datas Class Reference

Used to get datas from queries. More...

Public Member Functions

def __init__
 Instanciate a new P2Datas object.
def populate
 Trigger the queries filling with data from the database.
def getPlotData
 Write GnuPlot's datas temporary file.
def getPlotCommand
 Return the GnuPlot's plot command with the good arguments.
def getDateTimeFormats
 Return the time format to use giving the queries.

Static Public Member Functions

def queryToDict
 Return a dict of "option"=>"value" from a query string.
def fillQuery
 Fill a query with datas.

Data Fields

 db
 The Sqlite database object.
 queries
 The query list.
 maxDiff
 The larger range between a begin and a end in seconds.
 sameRange
 Set to True if every handled query have the same date range.
 qArgs
 Store query's arguments.
 tmpfile
 Store the GnuPlot's data temporary file name.

Static Public Attributes

dictionary argsShort = {'b' : 'begin', 'e' : 'end', 't' : 'time', 'f' : 'format', 'd':'data', 'n':'num', 'y':'yaxe', 's':'style', 'c':'color', 'l':'label', 'sc':'scale', 'a':'add' }
 Alias for one letter query parameter to string parameter.
list argsToNone = ['begin','end','time']
 List of argument that have to be set to None after the P2Query creation.

Detailed Description

Used to get datas from queries.

This object handle multiple query's and make request to the Sqlite database.

Definition at line 183 of file p2data.py.

Constructor & Destructor Documentation

def __init__ (   self,
  dbFile,
  queries,
  queryArgSep 
)

Instanciate a new P2Datas object.

Parameters
dbFileis the sqlite db file
queriesis a query string array
queryArgSepis the separator between two query's argument

Definition at line 195 of file p2data.py.

Member Function Documentation

def fillQuery (   datas,
  queries 
)
static

Fill a query with datas.

Parameters
datasAn array of data
queriesAn array of query to fill

Definition at line 264 of file p2data.py.

References p2data.data2List(), and P2Msg.hex2list().

def getDateTimeFormats (   self)

Return the time format to use giving the queries.

Find a good dateTimeFormat for GnuPlot's date display giving the date range of each query

Definition at line 453 of file p2data.py.

References P2Datas.maxDiff, and P2Datas.sameRange.

def getPlotCommand (   self)

Return the GnuPlot's plot command with the good arguments.

Returns
A string representing a GnuPlot's plot command

Definition at line 388 of file p2data.py.

References p2data.colNames(), P2Datas.getPlotData(), P2Datas.qArgs, P2Datas.queries, and P2Datas.tmpfile.

def getPlotData (   self,
  csv = False,
  outfd = None,
  sep = None 
)

Write GnuPlot's datas temporary file.

Use handled query to create and populate GnuPlot's temporary files.

Definition at line 313 of file p2data.py.

References P2Datas.maxDiff, P2Datas.qArgs, P2Datas.queries, P2Datas.sameRange, and P2Datas.tmpfile.

Referenced by P2Datas.getPlotCommand().

def populate (   self)

Trigger the queries filling with data from the database.

When called this function tells to the P2Datas object to get datas from the database and to fill its handled P2Query object.

Definition at line 282 of file p2data.py.

References P2Datas.queries, and P2Datas.sameRange.

def queryToDict (   query,
  sep 
)
static

Return a dict of "option"=>"value" from a query string.

Parameters
queryThe query string
sepThe query's argument separator
Returns
A dict representing each argument as 'option'=>'value'

Definition at line 243 of file p2data.py.


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