Exemple #1
0
def addrow(dicttemp, temp=True):
	global IOdata
	global IOdatatemp
	if temp:
		IOdatatemp.append(dicttemp)
		return True
	else:
		IOdata.append(dicttemp)
		filestoragemod.savefiledata(HWDATAFILENAME,IOdata)
		return True
Exemple #2
0
def replacerow(element,dicttemp):
	searchfield="name"
	searchvalue=element
	for line in data:
		if line[searchfield]==searchvalue:
			for row in line:
				line[row]=dicttemp[row]
			filestoragemod.savefiledata(DATAFILENAME,data)
			return True
	return False
Exemple #3
0
def deleterow(element, temp=True):
	global IOdata
	global IOdatatemp
	searchfield=HW_INFO_NAME
	searchvalue=element
	if temp:
		for line in IOdatatemp:
			if searchfield in line:
				if line[searchfield]==searchvalue:
					IOdatatemp.remove(line)
					return True
		return False
	else:	
		for line in IOdata:
			if searchfield in line:
				if line[searchfield]==searchvalue:
					IOdata.remove(line)
					filestoragemod.savefiledata(HWDATAFILENAME,IOdata)
					return True
		return False
Exemple #4
0
def savecalibartion():
	filestoragemod.savefiledata(HWDATAFILENAME,IOdata)
Exemple #5
0
def	IOdatafromtemp():
	global IOdata
	IOdata=copy.deepcopy(IOdatatemp)
	filestoragemod.savefiledata(HWDATAFILENAME,IOdata)
Exemple #6
0
global FTDATAFILENAME
FTDATAFILENAME = "ftdata.txt"
global DEFFTDATAFILENAME
DEFFTDATAFILENAME = "default/defftdata.txt"

global FTdata
FTdata = []

# read FTdata -----
if not filestoragemod.readfiledata(FTDATAFILENAME,
                                   FTdata):  #read  setting file
    #read from default file
    filestoragemod.readfiledata(DEFFTDATAFILENAME, FTdata)
    print "Fertilizer writing default calibration data"
    filestoragemod.savefiledata(FTDATAFILENAME, FTdata)

# end read IOdata -----

# ///////////////// --- END GLOBAL VARIABLES ------

#-- start filestorage utility--------////////////////////////////////////////////////////////////////////////////////////

# filestoragemod.readfiledata(filename,filedata)
# filestoragemod.savefiledata(filename,filedata)
# filestoragemod.appendfiledata(filename,filedata)
# filestoragemod.savechange(filename,searchfield,searchvalue,fieldtochange,newvalue)
# filestoragemod.deletefile(filename)


def consitencycheck():
Exemple #7
0
def saveWTsetting():
	filestoragemod.savefiledata(WTDATAFILENAME,WTdata)
Exemple #8
0
def savedata(filedata):
	filestoragemod.savefiledata(DATAFILENAME,filedata)
Exemple #9
0

global FTDATAFILENAME
FTDATAFILENAME="ftdata.txt"
global DEFFTDATAFILENAME
DEFFTDATAFILENAME="default/defftdata.txt"

global FTdata
FTdata=[]

# read FTdata -----
if not filestoragemod.readfiledata(FTDATAFILENAME,FTdata): #read  setting file
	#read from default file
	filestoragemod.readfiledata(DEFFTDATAFILENAME,FTdata)
	print "Fertilizer writing default calibration data"
	filestoragemod.savefiledata(FTDATAFILENAME,FTdata)
	
# end read IOdata -----



# ///////////////// --- END GLOBAL VARIABLES ------



#-- start filestorage utility--------////////////////////////////////////////////////////////////////////////////////////	

# filestoragemod.readfiledata(filename,filedata)
# filestoragemod.savefiledata(filename,filedata)
# filestoragemod.appendfiledata(filename,filedata)
# filestoragemod.savechange(filename,searchfield,searchvalue,fieldtochange,newvalue)
Exemple #10
0
def saveWTsetting():
    filestoragemod.savefiledata(WTDATAFILENAME, WTdata)
Exemple #11
0
global WTDATAFILENAME
WTDATAFILENAME = "wtdata.txt"
global DEFWTDATAFILENAME
DEFWTDATAFILENAME = "default/defwtdata.txt"

global WTdata
WTdata = []

# read WTdata -----
if not filestoragemod.readfiledata(WTDATAFILENAME,
                                   WTdata):  #read watering setting file
    #read from default file
    filestoragemod.readfiledata(DEFWTDATAFILENAME, WTdata)
    print "Watering writing default calibration data"
    filestoragemod.savefiledata(WTDATAFILENAME, WTdata)

# end read IOdata -----

# ///////////////// --- END GLOBAL VARIABLES ------

#-- start filestorage utility--------////////////////////////////////////////////////////////////////////////////////////

# filestoragemod.readfiledata(filename,filedata)
# filestoragemod.savefiledata(filename,filedata)
# filestoragemod.appendfiledata(filename,filedata)
# filestoragemod.savechange(filename,searchfield,searchvalue,fieldtochange,newvalue)
# filestoragemod.deletefile(filename)


def consitencycheck():
Exemple #12
0
def savesetting():
    filestoragemod.savefiledata(DATAFILENAME, data)
Exemple #13
0
# ///////////////// -- GLOBAL VARIABLES AND INIZIALIZATION --- //////////////////////////////////////////

DATAFILENAME = "addata.txt"
DEFDATAFILENAME = "default/defaddata.txt"

global data
data = []
tempelementdict = {}

# read data -----
if not filestoragemod.readfiledata(DATAFILENAME,
                                   data):  #read watering setting file
    #read from default file
    filestoragemod.readfiledata(DEFDATAFILENAME, data)
    print("Watering writing default calibration data")
    filestoragemod.savefiledata(DATAFILENAME, data)
# end read data -----

# ///////////////// --- END GLOBAL VARIABLES ------

#-- start filestorage utility--------////////////////////////////////////////////////////////////////////////////////////

# filestoragemod.readfiledata(filename,filedata)
# filestoragemod.savefiledata(filename,filedata)
# filestoragemod.appendfiledata(filename,filedata)
# filestoragemod.savechange(filename,searchfield,searchvalue,fieldtochange,newvalue)
# filestoragemod.deletefile(filename)


def replaceschemanameandsave(replacedict):
    filename = DATAFILENAME
Exemple #14
0
def saveFTsetting():
    filestoragemod.savefiledata(FTDATAFILENAME, FTdata)
Exemple #15
0
def restoredefault():
	filestoragemod.deletefile(DATAFILENAME)
	filedata=[{'name':'clock', 'timezone':'UTC'}]
	filestoragemod.savefiledata(DATAFILENAME,filedata)
Exemple #16
0
def restoredefault():
	filestoragemod.deletefile(DATAFILENAME)
	filedata=[{'name':'login', 'username':'******','password':'******' }]
	filestoragemod.savefiledata(DATAFILENAME,filedata)
Exemple #17
0
def saveFTsetting():
	filestoragemod.savefiledata(FTDATAFILENAME,FTdata)
Exemple #18
0

global WTDATAFILENAME
WTDATAFILENAME="automationdata.txt"
global DEFWTDATAFILENAME
DEFWTDATAFILENAME="default/defautomationdata.txt"

global WTdata
WTdata=[]

# read WTdata -----
if not filestoragemod.readfiledata(WTDATAFILENAME,WTdata): #read watering setting file
	#read from default file
	filestoragemod.readfiledata(DEFWTDATAFILENAME,WTdata)
	print "Watering writing default calibration data"
	filestoragemod.savefiledata(WTDATAFILENAME,WTdata)
	
# end read IOdata -----



# ///////////////// --- END GLOBAL VARIABLES ------



#-- start filestorage utility--------////////////////////////////////////////////////////////////////////////////////////	

# filestoragemod.readfiledata(filename,filedata)
# filestoragemod.savefiledata(filename,filedata)
# filestoragemod.appendfiledata(filename,filedata)
# filestoragemod.savechange(filename,searchfield,searchvalue,fieldtochange,newvalue)
Exemple #19
0
def restoredefault():
	filestoragemod.deletefile(DATAFILENAME)
	filedata=[{"name": "IPsetting", "LocalIPaddress": "192.168.1.172", "LocalPORT": "5172", "LocalAPSSID" : "Hydrosys4", "APtime" : "180"}]
	filestoragemod.savefiledata(DATAFILENAME,filedata)
Exemple #20
0

DATAFILENAME="camdata.txt"
DEFDATAFILENAME="default/defcamdata.txt"
CAMERAPARAMETERS=["camname","resolution","position","servo","time","active","vflip"]


global data
data=[]

# read data -----
if not filestoragemod.readfiledata(DATAFILENAME,data): #read watering setting file
	#read from default file
	filestoragemod.readfiledata(DEFDATAFILENAME,data)
	print "Watering writing default calibration data"
	filestoragemod.savefiledata(DATAFILENAME,data)
# end read data -----



# ///////////////// --- END GLOBAL VARIABLES ------



#-- start filestorage utility--------////////////////////////////////////////////////////////////////////////////////////	

# one row is called "default" and include the default data before setting
# {"resolution": "320x240", "fps": "20", "time": "10:30", "name": "default"}
# once the setting is saved, several lines will be produced with name="camera" and "camname" = video1 , video2 , etc
# {"resolution": "320x240", "fps": "20", "time": "10:30", "name": "camera", "camname" : "video1"}
Exemple #21
0
HWdataKEYWORDS[HW_CTRL_FREQ]=[]
HWdataKEYWORDS[HW_CTRL_MIN]=[]
HWdataKEYWORDS[HW_CTRL_MAX]=[]


# ///////////////// -- Hawrware data structure Setting --  ///////////////////////////////

IOdata=[]
# read IOdata -----
if not filestoragemod.readfiledata(HWDATAFILENAME,IOdata): #read calibration file
	print "warning hwdata file not found -------------------------------------------------------"
	#read from default file
	filestoragemod.readfiledata(DEFHWDATAFILENAME,IOdata)
	print "writing default calibration data"
	filestoragemod.savefiledata(HWDATAFILENAME,IOdata)
# end read IOdata -----
IOdatatemp=copy.deepcopy(IOdata)
IOdatarow={}

# ///////////////// --- END GLOBAL VARIABLES ------


# ///////////////// -- STATUS VARIABLES UTILITY --  ///////////////////////////////
Servo_Status={}
Servo_Status["default"]={'duty':"3"}

Stepper_Status={}
Stepper_Status["default"]={'position':"0"}

Exemple #22
0
def savesetting():
	filestoragemod.savefiledata(DATAFILENAME,data)
Exemple #23
0
def restoredefault():
	filestoragemod.deletefile(DATAFILENAME)
	filedata=[{'name':'email', 'address':'','password':'' }]
	filestoragemod.savefiledata(DATAFILENAME,filedata)