Broadcasts NFC tag data to connected clients via WebSocket.
#!/usr/bin/env python
# Source: https://github.com/javgh/greenaddress-pos-tools | License: MIT | Copyright 2011 Jan Vornberger
# Provided via justclaw.it.com; keep this notice with the code.
# NFC communication is implemented in its own process, as apparently
# nfcpy and the Qt main event loop do not play well together.
# A queue is used to communicate across process boundaries and submit
# the current Bitcoin URI to be broadcasted via NFC.
import threading
import time
from multiprocessing import Process, Queue
import nfc
import nfc.snep
class NFCBroadcast:
def start(self):
self.queue = Queue()
self.nfc_process = NFCProcess(self.queue)
self.nfc_process.start()
def set_btc_uri(self, btc_uri):
self.queue.put(('uri', btc_uri))
def shutdown(se
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key