I am working with an RFID antenna and Raspberry pi (raspbian). The connection is through the UDP socket over Python 2.7.x.
import socket
import sys
import time
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address = ('192.168.2.16', 49152)
print >>sys.stderr, 'starting up on %s port %s' % server_address
sock.bind(server_address)
while True:
print >>sys.stderr, '\nwaiting to receive message'
data, address = sock.recvfrom(4096)
print >>sys.stderr, 'received %s bytes from %s' % (len(data), address)
print >>sys.stderr, data
if data:
thetime = time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime())
if len(data) > 0:
data = data[1:40]
print "Card Scanned. Tag ID:", data # print the tag number
print "card = ", [data], " a las: ", thetime
Currently, the application is reading this (doing a print): \ xff \ xff \ x102 \ r \ x01 \ xe2 \ x00 \ x00 \ x165 \ x16 \ x02g \ x140 \ x8f \ x91 \ xd6
How can I translate this to the TAG serial number? It should be like this: E20000163516026714308F91
and should be saved in a .txt file
Greetings!