Exemplo n.º 1
0
import time
import REST
import subprocess

# Run a constant cycle of checking for new recipets to process
while True:
    # Ping webserver for new reciept
    request = REST.checkTranmission()
    if request.status_code == 200:
        # A new reciept has been found!
        print("Reciept Found!")
        data = request.json()
        recipetID = data['recieptID']

        # Scan NFC for connection
        # Declare Var
        userID = ""

        # Run a sub program to access the NFC inteface and enable
        # Emulator mode
        print("starting subprocess")
        process = subprocess.Popen(['./nfc-emulate'],
                                   stdout=subprocess.PIPE,
                                   universal_newlines=True)

        # Get current subprocess status - Make sure it has not finished yet
        status = process.poll()

        while status is None:
            # Check the subprocess current runnning status
            status = process.poll()