def return_car(self, car_id, booking_id):
     self.client = cl(ip, port)
     data = self.dataHelper.return_car(car_id, booking_id)
     self.client.send_data(data)
     message = self.client.listen_from_server()
     print(message)
     self.client.close_client()
Beispiel #2
0
 def createClient(self):
     try:
         self.client = cl(self)
         self.connected = True
         self.connectedString.set("Verbonden")
         self.lblConnected.config(fg = "green")
         self.debugPrint("Verbonden met Raspberry Pi")
     except:
         self.debugPrint("Verbinding met Rapsberry Pi niet mogelijk:\n    -Staat de Raspberry Pi aan?\n    -Staat de server aan?\n    -Zit deze computer op de ad-hoc?")
Beispiel #3
0
 def createClient(self):
     try:
         self.client = cl(self, self.ownZepName)
         self.zeppelins.append(AbstractZeppelin('red', self.ownZepName, self, self.client))
         self.connected = True
         self.connectedString.set("Verbonden")
         self.lblConnected.config(fg = "green")
         self.debugPrint("Verbonden met Raspberry Pi")
     except:
         self.debugPrint("Verbinding met Rapsberry Pi niet mogelijk:\n    -Staat de Raspberry Pi aan?\n    -Staat de server aan?\n    -Zit deze computer op de ad-hoc?")
 def upload(self, car_id, booking_id, type):
     self.client = cl(ip, port)
     if type == 'unlock':
         data = self.dataHelper.unlock_car(car_id, booking_id)
     else:
         data = self.dataHelper.return_car(car_id, booking_id)
     self.client.send_data(data)
     message = self.client.listen_from_server()
     self.client.close_client()
     return message
 def find_inprogress(self):
     self.client = cl(ip, port)
     data = self.dataHelper.search_inprogress(self.username)
     self.client.send_data(data)
     bookings = self.client.listen_from_server()
     bookings = json.loads(bookings)['data']
     choice = self.load_all_cars(bookings, 'unlocked')
     self.client.close_client()
     if (choice != None):
         self.return_car(bookings[choice]['car_id'],
                         bookings[choice]["booking_id"])
 def load_booking(self, load_type):
     self.client = cl(ip, port)
     if load_type == "booked":
         data = self.dataHelper.search_booking(self.username)
     else:
         data = self.dataHelper.search_inprogress(self.username)
     self.client.send_data(data)
     bookings = self.client.listen_from_server()
     bookings = json.loads(bookings)['data']
     self.client.close_client()
     return bookings
 def find_booked_car(self):
     #take in userid and return a list of car that is related to user, here pandas is recommended
     self.client = cl(ip, port)
     data = self.dataHelper.search_booking(self.username)
     self.client.send_data(data)
     bookings = self.client.listen_from_server()
     bookings = json.loads(bookings)['data']
     choice = self.load_all_cars(bookings, 'booked')
     self.client.close_client()
     if (choice != None):
         self.unlock_car(bookings[choice]['car_id'],
                         bookings[choice]["booking_id"])
 def login(self, user, password):
     """the loogin function of ap, send and recieve data from the server"""
     islogin = False
     self.client = cl(ip, port)
     data = self.dataHelper.login(user, password)
     self.client.send_data(data)
     status = self.client.listen_from_server()
     if status == 'success':
         self.username = user
         print('you have sucessfully login')
         islogin = True
     else:
         print('wrong username or password.')
     self.client.close_client()
     return islogin
 def login_face(self, p_data):
     username = self.get_username()
     islogin = False
     # connect
     self.client = cl(ip, port)
     #convert p_data for tranmission
     data = self.dataHelper.login_face(p_data, username)
     # send data
     self.client.send_data(data)
     # recieve response
     status = self.client.listen_from_server()
     if status == 'success':
         self.username = username
         print('you have sucessfully logged in')
         islogin = True
     else:
         print('your face was not recognised!')
     self.client.close_client()
     return islogin
Beispiel #10
0
def create_client():
    c = cl()  #instaniate new client object
    c.user_id = 12  # set the client user id
    return c
 def newRec (self, code=0, client=0, family='', name='', sname='', data='', comment=''):
     self.appendList(cl(code,client,family,name,sname,data,comment))