def main(): #a = append, r+ = read/write, w = write, r = read #Test using a class sensor2 = SDfile(SDfileRootPath, "Nest") #sensor2.quickInit(headers) #sensor2.quickAppend("3,nest,sept12,5:30pm" + '\n') #sensor2.quickAppend("4,nest,sept12,5:30pm" + '\n') #sensor2.quickAppend("4,nest,sept12,10:30pm" + '\n') sensor2.quickAppendBuffer(["black,panago,sept12,10:30pm", "green,pizzahut,sept12,10:30pm", "black,freshSlice,sept12,10:30pm"])
while True: if binBuffer.getEmptyFlag() == False: mainDeque = binBuffer.flushBuffer() #Buffer queue should be empty #print "Sending signal to Display " #Update global count values #print binBuffer.getCount("black") globalVars.blackCount = 0 #print binBuffer.getCount("green") globalVars.greenCount = 2 #print binBuffer.getCount("blue") globalVars.blueCount = 4 #print binBuffer.getCount("grey") globalVars.greyCount = 6 #print "Sending signal to SD to save " sdFile.quickAppendBuffer(mainDeque) #inserts the buffer to database, and the count values to update the display print "calling update database" db.updateDatabase(mainDeque, globalVars.blackCount, globalVars.greenCount, globalVars.blueCount, globalVars.greyCount) #date = time.strftime("%d_%m_%Y") #get current date #filePath = relativePath + date + "_" + location + "_" + color + ".csv" #print "quickRead: " + str(sdFile.quickRead(filePath)) #Test buffer #test = raw_input ("Enter stuff in deque: ") #color = raw_input ("Enter color: ") #binBuffer.simulateQueue(test,color) sleep(3) globalVars.blackCount += 1