Beispiel #1
0
	def tail(self):
		# Use the ttyLinux module to catch escape key
		try:
			ttyLinux.setSpecial()
			while 1:
				time.sleep(1)
				keys				= ttyLinux.readLookAhead()
				if [keys].__str__() == "[\'\\x1b\']":
					break
				try:
					self.t_locks['nxt'].acquire()
					tmp_state			= libs.sound.state(self.connects['nxt']['con'])
					self.t_locks['nxt'].release()
					self.sensor_state	= tmp_state
					print tmp_state
				except:
					self.display('%s:\t\t\t\tUnable to get sensor state' % self.getName(), level=25)
					break
		finally:
			ttyLinux.setNormal()
Beispiel #2
0
 def tail(self):
     # Use the ttyLinux module to catch escape key
     try:
         ttyLinux.setSpecial()
         while 1:
             time.sleep(1)
             keys = ttyLinux.readLookAhead()
             if [keys].__str__() == "[\'\\x1b\']":
                 break
             try:
                 self.t_locks['nxt'].acquire()
                 tmp_state = libs.sound.state(self.connects['nxt']['con'])
                 self.t_locks['nxt'].release()
                 self.sensor_state = tmp_state
                 print tmp_state
             except:
                 self.display('%s:\t\t\t\tUnable to get sensor state' %
                              self.getName(),
                              level=25)
                 break
     finally:
         ttyLinux.setNormal()
Beispiel #3
0
	def tail(self):
		# Use the ttyLinux module to catch escape key
		try:
			ttyLinux.setSpecial()
			while 1:
				time.sleep(1)
				keys				= ttyLinux.readLookAhead()
				if [keys].__str__() == "[\'\\x1b\']":
					break
				try:
					self.t_locks['nxt'].acquire()
					tmp_state				= libs.touch.state(self.connects['nxt']['con'])
					self.t_locks['nxt'].release()
					if tmp_state:
						if self.sensor_state == 1:
							print "1"
							continue
						else:
							# The state has changed
							self.sensor_state	= 1
							self.display('%s:\t\t\tIN' % self.getName(), level=50)
							print "1"
							continue
					else:
						if self.sensor_state == 0:
							print "0"
							continue
						else:
							# The state has changed
							self.sensor_state	= 0
							self.display('%s:\t\t\tOUT' % self.getName(), level=50)
							print "0"
							continue
				except:
					self.display('%s:\t\t\tUnable to get sensor state' % self.getName(), level=25)
					break
		finally:
			ttyLinux.setNormal()