Jura-Python-BT
Code for control and payment system of Jura Coffee Machine
|
Functions | |
def | setupBuzzer (pin) |
def | beep (duration) |
def | sleepTimer (secs) |
def | lockUnlockMachine (code, lock_status) |
def | get_name (UID) |
def | get_vorname (UID) |
def | get_chip (UID) |
def | get_value (UID) |
def | set_value (UID, value) |
def | get_price (product) |
def | set_buylist (UID, product_name, price) |
def | readlineCR (port) |
def | scanCard () |
def | getAlerts (status) |
def | end_read (signal, frame) |
def | read_statistics () |
Variables | |
int | BUZZER = 7 |
BtEncoder | BtEncoder = BtEncoder() |
JuraEncoder | JuraEncoder = JuraEncoder() |
os | DEVICE = os.getenv("DEVICE") |
os | mastercard1 = os.getenv("MASTER_CARD_1") |
os | mastercard2 = os.getenv("MASTER_CARD_2") |
os | passwd = os.getenv("PASSWD") |
mdb | db = mdb.connect(host = "127.0.0.1", user = "root", passwd = os.getenv("PASSWD"), db = "AnnelieseDB") |
lcddriver | lcd = lcddriver.lcd() |
dict | priceCoffee |
dict | PRODUCTS |
dict | in_machine_products |
dict | ALERTS |
str | machine_status = "5a401524-ab2e-2548-c435-08c300000710" |
str | machine_status_handle = "0x000b" |
str | barista_mode = "5a401530-ab2e-2548-c435-08c300000710" |
str | barista_mode_handle = "0x0017" |
str | product_progress = "5a401527-ab2e-2548-c435-08c300000710" |
str | product_progress_handle = "0x001a" |
str | heartbeat_uuid = "5a401529-ab2e-2548-c435-08c300000710" |
str | heartbeat_handle = "0x0011" |
str | heartbeat_read_uuid = "5a401538-ab2e-2548-c435-08c300000710" |
str | heartbeat_read_handle = "0x0032" |
str | start_product = "5a401525-ab2e-2548-c435-08c300000710" |
str | start_product_handle = "0x000e" |
str | statistics_command_uuid = "5A401533-ab2e-2548-c435-08c300000710" |
str | statistics_command_handle = "0x0026" |
str | statistics_data_uuid = "5A401534-ab2e-2548-c435-08c300000710" |
str | statistics_data_handle = "0x0029" |
str | uart_rx_uuid = "5a401624-ab2e-2548-c435-08c300000710" |
str | uart_rx_hnd = "0x0036" |
str | uart_tx_uuid = "5a401625-ab2e-2548-c435-08c300000710" |
str | uart_tx_hnd = "0x0039" |
dict | characteristics |
child | |
keep_alive_code | |
locking_code | |
unlock_code | |
KEY_DEC | |
all_statistics | |
initial_time = time.time() | |
CURRENT_STATISTICS | |
int | emergency_unlock = 0 |
else : | |
str | lock_status = "unlocked" |
MFRC522 | MIFAREReader = MFRC522.MFRC522() |
try : | |
serial | port = serial.Serial("/dev/serial0", baudrate = 9600, timeout = 1.0) |
except : | |
bool | buttonPress = False |
bool | continue_reading = True |
str | lastSeen = "" |
int | counter = 0 |
int | disp_init = 1 |
int | payment_to_date = 1 |
list | client_to_pay = [] |
int | admin_locked = 0 |
def | uid_str = scanCard() |
bool | product_made = False |
def | value = get_value(uid_str) |
str | value_str = str("Balance: " + str('%.2f' % value) + " EUR") |
def | lastName = get_name(uid_str) |
def | preName = get_vorname(uid_str) |
str | welStr = str("Hello " + preName) |
str | msgStr3 = str("Hold for 2s please ") |
str | msgStr4 = str("Chip below ") |
int | chosen = 0 |
int | started = 0 |
int | over = 0 |
int | time_total = int(time.time() - initial_time) |
child | data = child.readline() |
list | data2 = [int(x, 16) for x in data.split()] |
BtEncoder | decoded = BtEncoder.encDecBytes(data2, KEY_DEC) |
list | as_hex = ["%02x" % d for d in decoded] |
int | value_new = 0 |
str | msgStr1 = str(product_made + " was made!") |
str | msgStr2 = str(" Happy betty :) ") |
def blue_tests.beep | ( | duration | ) |
def blue_tests.end_read | ( | signal, | |
frame | |||
) |
def blue_tests.get_chip | ( | UID | ) |
def blue_tests.get_name | ( | UID | ) |
def blue_tests.get_price | ( | product | ) |
def blue_tests.get_value | ( | UID | ) |
def blue_tests.get_vorname | ( | UID | ) |
def blue_tests.getAlerts | ( | status | ) |
def blue_tests.lockUnlockMachine | ( | code, | |
lock_status | |||
) |
def blue_tests.read_statistics | ( | ) |
def blue_tests.readlineCR | ( | port | ) |
def blue_tests.scanCard | ( | ) |
def blue_tests.set_buylist | ( | UID, | |
product_name, | |||
price | |||
) |
def blue_tests.set_value | ( | UID, | |
value | |||
) |
def blue_tests.setupBuzzer | ( | pin | ) |
def blue_tests.sleepTimer | ( | secs | ) |
int blue_tests.admin_locked = 0 |
dict blue_tests.ALERTS |
blue_tests.all_statistics |
list blue_tests.as_hex = ["%02x" % d for d in decoded] |
str blue_tests.barista_mode = "5a401530-ab2e-2548-c435-08c300000710" |
str blue_tests.barista_mode_handle = "0x0017" |
bool blue_tests.buttonPress = False |
int blue_tests.BUZZER = 7 |
dict blue_tests.characteristics |
blue_tests.child |
int blue_tests.chosen = 0 |
list blue_tests.client_to_pay = [] |
bool blue_tests.continue_reading = True |
int blue_tests.counter = 0 |
blue_tests.CURRENT_STATISTICS |
list blue_tests.data = child.readline() |
list blue_tests.data2 = [int(x, 16) for x in data.split()] |
mdb blue_tests.db = mdb.connect(host = "127.0.0.1", user = "root", passwd = os.getenv("PASSWD"), db = "AnnelieseDB") |
BtEncoder blue_tests.decoded = BtEncoder.encDecBytes(data2, KEY_DEC) |
os blue_tests.DEVICE = os.getenv("DEVICE") |
int blue_tests.disp_init = 1 |
blue_tests.else : |
int blue_tests.emergency_unlock = 0 |
blue_tests.except : |
str blue_tests.heartbeat_handle = "0x0011" |
str blue_tests.heartbeat_read_handle = "0x0032" |
str blue_tests.heartbeat_read_uuid = "5a401538-ab2e-2548-c435-08c300000710" |
str blue_tests.heartbeat_uuid = "5a401529-ab2e-2548-c435-08c300000710" |
dict blue_tests.in_machine_products |
time blue_tests.initial_time = time.time() |
blue_tests.keep_alive_code |
blue_tests.KEY_DEC |
str blue_tests.lastSeen = "" |
lcddriver blue_tests.lcd = lcddriver.lcd() |
def blue_tests.lock_status = "unlocked" |
blue_tests.locking_code |
str blue_tests.machine_status = "5a401524-ab2e-2548-c435-08c300000710" |
str blue_tests.machine_status_handle = "0x000b" |
os blue_tests.mastercard1 = os.getenv("MASTER_CARD_1") |
os blue_tests.mastercard2 = os.getenv("MASTER_CARD_2") |
MFRC522 blue_tests.MIFAREReader = MFRC522.MFRC522() |
str blue_tests.msgStr1 = str(product_made + " was made!") |
str blue_tests.msgStr2 = str(" Happy betty :) ") |
str blue_tests.msgStr3 = str("Hold for 2s please ") |
str blue_tests.msgStr4 = str("Chip below ") |
int blue_tests.over = 0 |
os blue_tests.passwd = os.getenv("PASSWD") |
int blue_tests.payment_to_date = 1 |
serial blue_tests.port = serial.Serial("/dev/serial0", baudrate = 9600, timeout = 1.0) |
def blue_tests.preName = get_vorname(uid_str) |
dict blue_tests.priceCoffee |
bool blue_tests.product_made = False |
str blue_tests.product_progress = "5a401527-ab2e-2548-c435-08c300000710" |
str blue_tests.product_progress_handle = "0x001a" |
dict blue_tests.PRODUCTS |
str blue_tests.start_product = "5a401525-ab2e-2548-c435-08c300000710" |
str blue_tests.start_product_handle = "0x000e" |
int blue_tests.started = 0 |
str blue_tests.statistics_command_handle = "0x0026" |
str blue_tests.statistics_command_uuid = "5A401533-ab2e-2548-c435-08c300000710" |
str blue_tests.statistics_data_handle = "0x0029" |
str blue_tests.statistics_data_uuid = "5A401534-ab2e-2548-c435-08c300000710" |
int blue_tests.time_total = int(time.time() - initial_time) |
blue_tests.try : |
str blue_tests.uart_rx_hnd = "0x0036" |
str blue_tests.uart_rx_uuid = "5a401624-ab2e-2548-c435-08c300000710" |
str blue_tests.uart_tx_hnd = "0x0039" |
str blue_tests.uart_tx_uuid = "5a401625-ab2e-2548-c435-08c300000710" |
str blue_tests.uid_str = scanCard() |
blue_tests.unlock_code |
def blue_tests.value_new = 0 |
str blue_tests.value_str = str("Balance: " + str('%.2f' % value) + " EUR") |
str blue_tests.welStr = str("Hello " + preName) |