def main(): print "Launched." if not os.path.exists("dataSaved.csv"): try: f = open("dataSaved.csv", "w") except IOError: print "Unable to create CSV file. Exiting." return else: f.close() v = Verarbeitung() v.loadData() v.saveDataCSV() t = Thread(target=application.realmain) t.start() print "Web server launched!" try: print "About to launch local server..." server.main(v) except KeyboardInterrupt: pass finally: print "Exiting. Saving data." v.saveData() t._Thread__stop()
def main(verInstance=None): global v parser = argparse.ArgumentParser(description='Python server to listen to BeagleBone client.')#The ArgumentParser object will hold all the information necessary to parse the command line into Python data types parser.add_argument('-p', '--port', default=1234, type=int, help="Remote server port.") args = parser.parse_args() if verInstance != None: v = verInstance else: v = Verarbeitung() reactor.listenTCP(args.port, ServerFactory()) reactor.run()
''' @Author: Quoc-Nam DESSOULES, Claire LOFFLER To retrieve the data from the BB and send them to the server-side ''' from verarbeitung import Verarbeitung from client import Client, MyClientFactory import argparse from threading import Timer from twisted.internet import reactor import time MIN_TEMP = Verarbeitung.MIN_TEMP v = Verarbeitung() factory = None prevTemp0 = MIN_TEMP prevTemp1 = MIN_TEMP prevLux = -1 prevHumidity = -1 prevPressure = -1 def main(): global v, factory #We let the user the possibility to choose the frequency of retrieval of the data and of sending the data, as well as the server whith whom he's speaking parser = argparse.ArgumentParser( description='Python program to retrieve external data from Beagle Bone.' ) #The ArgumentParser object will hold all the information necessary to parse the command line into Python data types parser.add_argument('-m', '--time_measurement',
def setUp(self): self.ver = Verarbeitung()