def rfid_reader_proc(side):
    try:
        # find RFID USB devices
        devices = tuple(
            usb.core.find(find_all=True, idVendor=0x08ff, idProduct=0x0009))
        if (len(devices) != 2):
            print "Both RFID Readers are not found!"
            raise RuntimeError
        if (side == "home"):
            device = devices[0] if (
                devices[0].address < devices[1].address) else devices[1]
        else:
            device = devices[1] if (
                devices[0].address < devices[1].address) else devices[0]

        reader = RFIDReader(0x08ff,
                            0x0009,
                            84,
                            16,
                            should_reset=False,
                            debug=False,
                            device=device)
        reader.initialize()

        while True:
            id = reader.read().strip()
            print(side + " " + id)
            r = requests.post(SERVER_URL + "/events/addplayer/" + side,
                              params={'id': id})
            print r.text

    except KeyboardInterrupt:
        pass
Example #2
0
def main():
	card_id = "1851655304"
	reader.initialize()
	p = subprocess.Popen("exec i3lock -n ; killall rfid_login.py", stdout=subprocess.PIPE, shell=True)
	while True:
		RFID_input = reader.read().strip()
		if RFID_input == card_id:
			print "Access Granted" 
			p.kill()
			print "Read uuid from RFID reader:{0}".format(RFID_input)
                        sys.exit()
		else:
			print "Access Denied"
			print "Read uuid from RFID reader:{0}".format(RFID_input)
Example #3
0
def rfid_reader_proc(side):
    try:
        # find RFID USB devices
        devices = tuple(usb.core.find(find_all=True, idVendor=0x08ff, idProduct=0x0009))
        if (len(devices) != 2):
            print "Both RFID Readers are not found!"
            raise RuntimeError
        if (side == "home"):
            device = devices[0] if (devices[0].address < devices[1].address) else devices[1]
        else:
            device = devices[1] if (devices[0].address < devices[1].address) else devices[0]
    
        reader = RFIDReader(0x08ff, 0x0009, 84, 16, should_reset=False, debug=False, device=device)
        reader.initialize()

        while True:
            id = reader.read().strip()
            print(side + " " + id)
            r = requests.post(SERVER_URL + "/events/addplayer/" + side, params={'id' :id} )
            print r.text
            
    except KeyboardInterrupt:
        pass
from keyboard_alike import reader


class RFIDReader(reader.Reader):
    """
    This class supports common black RFID Readers for 125 kHz read only tokens
    http://www.dx.com/p/intelligent-id-card-usb-reader-174455
    """
    pass


if __name__ == "__main__":
    reader = RFIDReader(0x08ff, 0x0009, 84, 16, should_reset=False)
    reader.initialize()
    print(reader.read().strip())
    reader.disconnect()
Example #5
0
    driver = webdriver.Chrome(
        executable_path="/usr/lib/chromium-browser/chromedriver",
        chrome_options=chrome_options)


if __name__ == "__main__":
    player_scanner = vlc.MediaPlayer(
        "file:///home/habemus/Documents/pyring/scanner_sweep.mp3")
    player_error = vlc.MediaPlayer(
        "file:///home/habemus/Documents/pyring/beep_error.mp3")
    reader = RFIDReader(0x13ba, 0x18, 8, 10, should_reset=False, debug=False)
    reader.initialize()
    create_driver()
    navigate_to(BASE_URL + "/show_login_ring")
    while True:
        data = reader.read().strip()
        #On enlève tout ce qui est après un éventuel \n pour limiter la casse sur la lecture
        #si on passe trop vite sur le lecteur
        #Normalement obsolète depuis le rework de keyboard alike, mais on garde au cas ou ...
        data = data.split("\n")[0]
        #On enlève les leading 0 et on en rajoute 3, parce qu'on en a pas toujours le même nombre
        data = data.lstrip("0")
        data = "000" + data
        if len(data) != 10:
            print("Erreur de lecture : taille de données incorrecte : " +
                  str(len(data)))
            player_error.stop()
            player_error.play()
            count_sound = count_sound + 1
        else:
            player_scanner.stop()
Example #6
0
from keyboard_alike import reader
from time import sleep
from shapes import *

reader = reader.Reader(0xffff, 0x0035, 84, 16, should_reset=False)

shapes = {
    "09144068": cube,
    "18553444": pyramid,
    "09359668": diamond,
    "18720820": prism,
    "09126404": random_cube
}

while True:
    reader.initialize()

    print("Ready")

    # shape is reset to an empty string so the while loop
    # can be used to error check bad input.
    shape = ""
    while shape not in shapes:
        shape = reader.read().strip()

    shapes[shape]()

    reader.disconnect()
    sleep(0.1)
Example #7
0
def read_rfid():
    reader = RFIDReader(0x08ff, 0x0009, 84, 16, should_reset=False)
    reader.initialize()
    rfid_code = reader.read().strip()
    reader.disconnect()
    return rfid_code
from keyboard_alike import reader


class RFIDReader(reader.Reader):
    """
    This class supports common black RFID Readers for 125 kHz read only tokens
    http://www.dx.com/p/intelligent-id-card-usb-reader-174455
    """

    pass


if __name__ == "__main__":
    reader = RFIDReader(0x08FF, 0x0009, 84, 16, should_reset=False)
    reader.initialize()
    print(reader.read().strip())
    reader.disconnect()
			time.sleep(self.sleepTimeS)
		
		self.pinList.reverse()
#GPIO.cleanup()
		# find more information on this script at
		# http://youtu.be/WpM1aq4B8-A


if __name__ == "__main__":
	reader = RFIDReader()
	reader.initialize()
	relay = Relay([24], 0.5)
	while True:
		try:
			print('Waiting rfid...')
			data = reader.read().strip()
			print('RFID: %s' % data)
				
			#            print('HTTP Request...')
			#            params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0, 'data': data})
			#            headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
			#            conn = http.client.HTTPConnection("www.mysite.com:80")
			#            conn.request("POST", "/query", params, headers)
			#            response = conn.getresponse()
			#            print(response.status, response.reason)
			#            dataHTTP = response.read()
			#            conn.close()
			relay.openRelay()
		except KeyboardInterrupt:
			
				print("\n\nBye Bye")
Example #10
0
import uinput
from time import sleep

reader = reader.Reader(0xffff, 0x0035, 16, 4, should_reset=False, debug=True)
reader.initialize()

device = uinput.Device([
        uinput.KEY_UP,
        uinput.KEY_LEFT,
        uinput.KEY_DOWN,
        uinput.KEY_RIGHT
        ])

key_press = {
             "09144068" : uinput.KEY_UP,
             "09756356" : uinput.KEY_LEFT,
             "19110900" : uinput.KEY_DOWN,
             "09359668" : uinput.KEY_RIGHT
            }

while True:

    key = ""
    while key not in key_press:
        key = reader.read().strip()
    
    device.emit_click(key_press[key])

    sleep(0.1)
    
Example #11
0
import mcpi.block as block
from time import sleep

reader = reader.Reader(0xffff, 0x0035, 84, 16, should_reset=False)

mc = minc.Minecraft.create()

blocks = {
    "09756356": block.MELON.id,
    "19110900": block.CACTUS.id,
    "09126404": block.CHEST.id
}

while True:
    reader.initialize()

    print("Ready")

    # block is reset to an empty string so the while loop
    # can be used to error check bad input.
    blk = ""
    while blk not in blocks:
        blk = reader.read().strip()

    (x, y, z) = mc.player.getPos()

    mc.setBlock(x, y, z, blocks[blk], 1)

    reader.disconnect()
    sleep(0.1)