Exemplo n.º 1
0
def main():

	tabletService = AndroidService()

	# (True, [inventoryDetailsId, X_index, Y_index, X_encoder, Y_encoder]..., newVirtualCartRowId)
	reservationInfo1 = tabletService.reserveInventoryIfAvailable(1, 1, 1)
	reservationInfo2 = tabletService.reserveInventoryIfAvailable(1, 2, 1)
	depositInfo1 = (MessageFormat.depInv, 1)
	depositInfo2 = (MessageFormat.depInv, 2)

	print(reservationInfo1)
	print(reservationInfo2)


	aQueue = queue.Queue(maxsize=0)

	arduinoComm = ArduinoComm("/dev/ttyACM0", baudrate=9600, timeout=None)


	# [ MessageFormat.retInv
	#  (True, 
	#  [inventoryDetailsId, barcodeDetailsFk, X_index, Y_index, X_encoder, Y_encoder, checkoutFlag],
	#  newVirtualCartRowId)
	# ]

	robotService = ArduinoService()
	
	for info in reservationInfo1[1]:
		encAbove = robotService.getLocationBoxAbove(info[0])

		aQueue.put([MessageFormat.retInv, (reservationInfo1[0], list(info)+encAbove, reservationInfo1[2])])
	arduinoComm.enqueue(aQueue)

	time.sleep(5)

	for info in reservationInfo2[1]:
		encAbove = robotService.getLocationBoxAbove(info[0])
		aQueue.put([MessageFormat.retInv, (reservationInfo2[0], list(info)+encAbove, reservationInfo2[2]) ])
	arduinoComm.enqueue(aQueue)

	time.sleep(5)

	aQueue.put(depositInfo1)
	arduinoComm.enqueue(aQueue)

	time.sleep(5)

	aQueue.put(depositInfo2)
	arduinoComm.enqueue(aQueue)
Exemplo n.º 2
0
def testGetLocationBoxAbove():
	print(sys._getframe().f_code.co_name + ": ")

	dbConnect = DbConnect(InventoryDAO.getDbDir())
	connector = dbConnect.getConnection()

	arduinoService = ArduinoService()

	print(arduinoService.getLocationBoxAbove(1))

	print("===================================================")
	print("Testing testGetLocationBoxAbove-------------------complete\n\n\n")
Exemplo n.º 3
0
	def enqueueToRobot(self):
		print("AdminTask::enqueueToRobot")
		while not self.msgQueue.empty():
			msg = self.msgQueue.get()

			if msg[0] == MessageFormat.retInv:
				for info in msg[1][1]:
					robotService = ArduinoService()
					encAbove = robotService.getLocationBoxAbove(info[0])
					aQueue = queue.Queue(0)
					aQueue.put([MessageFormat.retInv, (msg[0], list(info)+encAbove, msg[1][2]) ])

					self.robotComm.enqueue(aQueue)

			# [MessageFormat.depInv, barcode]
			elif msg[0] == MessageFormat.depInv:
				aQueue = queue.Queue(0)
				aQueue.put(msg)

				self.robotComm.enqueue(aQueue)