예제 #1
0
파일: PiHome.py 프로젝트: Rolbot/PiMation
				if len(dserial) < 16:
					# Dserial must be 16 or more letters
					print "Dserial must be 16 or more letters"
					continue
			
				# Stop XBeeMonitor
				XbeeMonitor.stop()
				print "Stopped current Asynchronous Xbee"

				# Start XbeeMonitor with synchronous mode
				XbeeMonitor.startSync()
				print "Started new Sychronous Xbee"

				# Adding new device command, update status for user
				message = addXbeeDevice(XbeeMonitor,dserial)
				db.updateDeviceMessage(int(dserial,16),message)
				
				# Remove garbage device from database if it is not added
				#if message != 'New device is added successfully':
					# Fail to add new device, remove it from database
					#db.removeDevice(int(dserial,16))
				
				# Restart XBeeMonitor and have it run in background again
				XbeeMonitor.stop()
				XbeeMonitor.startAsync()

			else:
				print 'Invalid input'
				continue
	
		except Exception as e: