ifreaddata==readdata2:ifreaddata==chr(0)*numberorreaddata=="":debug("--> only zeros",level=1,tab=1)self._init=Falsetime.sleep(0.1)self._initialize()else:breakelse:debug("--> not identical",level=1,tab=1)else:ifreaddata==chr(0)*numberorreaddata=="":debug("--> only zeros",level=1,tab=1)else:break

defread_history(self,delai_dernier_releve=0):ifnotself._init:ifnotself._initialize():return""l=0x7fff-HISTORY_BUFFER_ADR+1nb=12*5*20l=18*nbnb_enreg_max=1750address_max=HISTORY_BUFFER_ADR+nb_enreg_max*18-1address=HISTORY_BUFFER_ADRend_of_data=Falsedata=[]j=0last_record=Nonewhilenotend_of_dataandj<MAXRETRIES:nb_ok=0j+=1debug("read history from address : %s"%hex(address),1)ifl+address>address_max:l=address_max-address+1ifl>0:data_read=self._read_safe(address,l)

defGetMySQLParameters(fichier_ini):mysql_host="localhost"mysql_base=fichier_inimysql_user="root"mysql_password=""try:importConfigParsercp=ConfigParser.ConfigParser()f=open(os.getcwd()+os.sep+"%s.ini"%fichier_ini,"r")cp.readfp(f)ifcp.has_section("server"):ifcp.has_option("server","host"):mysql_host=cp.get("server","host")else:print"option 'host' is not present"ifcp.has_option("server","base"):mysql_base=cp.get("server","base")ifcp.has_option("server","user"):mysql_user=cp.get("server","user")ifcp.has_option("server","password"):mysql_password=cp.get("server","password")else:print"section 'server' is not present"f.close()except:print"exception in reading '%s.ini'"%fichier_inihost="localhost"returnmysql_host,mysql_base,mysql_user,mysql_password