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