Jura-Python-BT
Code for control and payment system of Jura Coffee Machine
|
Main script to run for BlackBetty. More...
Namespaces | |
namespace | blue |
Functions | |
def | blue.setupBuzzer (pin) |
Setup buzzer. | |
def | blue.beep (duration) |
Make a beep sound. | |
def | blue.lockUnlockMachine (code, lock_status, unlock_code="77e1") |
Lock or unlock the machine. | |
def | blue.scanCard () |
Scan for RFID tag. | |
def | blue.getAlerts (status) |
Get alerts from the decoded machine status and convert it to the corresponding alerts (if any) If the corresponding bit is not set, the alert is not active. | |
def | blue.end_read (signal, frame) |
End the program Runs when Ctrl+C is pressed. | |
def | blue.read_statistics () |
Read the statistics from the machine. | |
Variables | |
json | blue.CHARACTERISTICS = json.load(open("/home/pi/Jura-Python-BT/data/uuids_handles.json"))["characteristics"] |
Global Constants The dictionary of UUIDs and handles of the bluetooth characteristics. | |
json | blue.ALERTS = json.load(open("/home/pi/Jura-Python-BT/data/alerts.json"))["alerts"] |
The dictionary of alerts from machine status. | |
json | blue.PRODUCTS = json.load(open("/home/pi/Jura-Python-BT/data/products.json"))["products"] |
The dictionary of products the machine can make. | |
json | blue.PRICECOFFEE = json.load(open("/home/pi/Jura-Python-BT/data/prices.json"))["pricecoffee"] |
The dictionary of prices of the products. | |
int | blue.BUZZER_PIN = 7 |
The pin for the buzzer. | |
os | blue.DEVICE = os.getenv("DEVICE") |
Load the environment variables from .env file. | |
os | blue.MASTERCARD1 = os.getenv("MASTER_CARD_1") |
The UID of master card 1 read from .env file. | |
os | blue.MASTERCARD2 = os.getenv("MASTER_CARD_2") |
The UID of master card 2 read from .env file. | |
db_connect | blue.DB = db_connect() |
The open database connection. | |
BtEncoder | blue.BtEncoder = BtEncoder() |
The instance of the BtEncoder class. | |
JuraEncoder | blue.JuraEncoder = JuraEncoder() |
The instance of the JuraEncoder class. | |
MFRC522 | blue.RFIDREADER = MFRC522.MFRC522() |
The instance of the RFID reader class | |
blue.filename | |
blue.level | |
blue.format | |
blue.datefmt | |
lcddriver | blue.lcd = lcddriver.lcd() |
Initialize LCD. | |
blue.child = pexpect.spawn("gatttool -b " + DEVICE + " -I -t random") | |
Get all necessary variables from setup.py -> check file for more information. | |
blue.keep_alive_code | |
blue.locking_code | |
blue.unlock_code | |
blue.KEY_DEC | |
blue.all_statistics | |
blue.initial_time | |
blue.CURRENT_STATISTICS = decoded | |
db_connect | blue.c = DB.cursor() |
int | blue.emergency_unlock = 0 |
blue.else : | |
str | blue.lock_status = "unlocked" |
blue.try : | |
serial | blue.port = serial.Serial("/dev/serial0", baudrate = 9600, timeout = 1.0) |
blue.except : | |
bool | blue.buttonPress = False |
The variables used in the main loop. | |
bool | blue.continue_reading = True |
str | blue.lastSeen = "" |
int | blue.counter = 0 |
int | blue.disp_init = 1 |
int | blue.payment_to_date = 1 |
str | blue.client_to_pay = "" |
int | blue.admin_locked = 0 |
int | blue.admin_prod = 0 |
int | blue.total_prod = 0 |
int | blue.payed_prod = 0 |
int | blue.current_time = int(time.time() - initial_time) |
int | blue.hour = int(time.strftime("%H")) |
int | blue.minute = int(time.strftime("%M")) |
int | blue.second = int(time.strftime("%S")) |
child | blue.data = child.readline() |
BtEncoder | blue.decoded = BtEncoder.encDecBytes(data, KEY_DEC) |
blue.timeout | |
def | blue.uid_str = scanCard() |
def | blue.prod = read_statistics() |
bool | blue.product_made = False |
get_value | blue.value = get_value(DB, uid_str) |
str | blue.value_str = str("Balance: " + str('%.2f' % value) + " EUR") |
get_name | blue.lastName = get_name(DB, uid_str) |
get_vorname | blue.preName = get_vorname(DB, uid_str) |
str | blue.welStr = str("Hello " + preName) |
str | blue.msgStr3 = str("Hold for 2s please ") |
str | blue.msgStr4 = str("Chip below ") |
time | blue.intial_time_2 = time.time() |
int | blue.chosen = 0 |
int | blue.started = 0 |
int | blue.over = 0 |
int | blue.time_total = int(time.time() - intial_time_2) |
list | blue.data2 = [int(x, 16) for x in data.split()] |
list | blue.as_hex = ["%02x" % d for d in decoded] |
json | blue.price_product = PRICECOFFEE[product_made] |
int | blue.value_new = 0 |
str | blue.msgStr1 = str(product_made + " was made!") |
str | blue.msgStr2 = str(" Happy betty :) ") |