Jura-Python-BT
Code for control and payment system of Jura Coffee Machine
Loading...
Searching...
No Matches
Functions | Variables
blue_tests Namespace Reference

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 :) ")
 

Function Documentation

◆ beep()

def blue_tests.beep (   duration)

◆ end_read()

def blue_tests.end_read (   signal,
  frame 
)

◆ get_chip()

def blue_tests.get_chip (   UID)

◆ get_name()

def blue_tests.get_name (   UID)

◆ get_price()

def blue_tests.get_price (   product)

◆ get_value()

def blue_tests.get_value (   UID)

◆ get_vorname()

def blue_tests.get_vorname (   UID)

◆ getAlerts()

def blue_tests.getAlerts (   status)

◆ lockUnlockMachine()

def blue_tests.lockUnlockMachine (   code,
  lock_status 
)

◆ read_statistics()

def blue_tests.read_statistics ( )

◆ readlineCR()

def blue_tests.readlineCR (   port)

◆ scanCard()

def blue_tests.scanCard ( )

◆ set_buylist()

def blue_tests.set_buylist (   UID,
  product_name,
  price 
)

◆ set_value()

def blue_tests.set_value (   UID,
  value 
)

◆ setupBuzzer()

def blue_tests.setupBuzzer (   pin)

◆ sleepTimer()

def blue_tests.sleepTimer (   secs)

Variable Documentation

◆ admin_locked

int blue_tests.admin_locked = 0

◆ ALERTS

dict blue_tests.ALERTS
Initial value:
1= {
2 0: "insert tray", 1: "fill water", 2: "empty grounds", 3: "empty tray", 4: "insert coffee bin",
3 5: "outlet missing", 6: "rear cover missing", 7: "milk alert", 8: "fill system", 9: "system filling",
4 10: "no beans", 11: "welcome", 12: "heating up", 13: "coffee ready", 14: "no milk (milk sensor)",
5 15: "error milk (milk sensor)", 16: "no signal (milk sensor)", 17: "please wait", 18: "coffee rinsing",
6 19: "ventilation closed", 20: "close powder cover", 21: "fill powder", 22: "system emptying",
7 23: "not enough powder", 24: "remove water tank", 25: "press rinse", 26: "goodbye", 27: "periphery alert",
8 28: "powder product", 29: "program-mode status", 30: "error status", 31: "enjoy product", 32: "filter alert",
9 33: "decalc alert", 34: "cleaning alert", 35: "cappu rinse alert", 36: "energy safe", 37: "active RF filter",
10 38: "RemoteScreen", 39: "LockedKeys", 40: "close tab", 41: "cappu clean alert", 42: "Info - cappu clean alert",
11 43: "Info - coffee clean alert", 44: "Info - decalc alert", 45: "Info - filter used up alert", 46: "steam ready",
12 47: "SwitchOff Delay active", 48: "close front cover", 49: "left bean alert", 50: "right bean alert", 51: "cleaning",
13 52: "cleaning finished", 53: "cleaning finished", 54: "cleaning finished", 55: "cleaning finished",
14 56: "cleaning finished", 57: "cleaning finished", 58: "cleaning finished", 59: "cleaning finished",
15}

◆ all_statistics

blue_tests.all_statistics

◆ as_hex

list blue_tests.as_hex = ["%02x" % d for d in decoded]

◆ barista_mode

str blue_tests.barista_mode = "5a401530-ab2e-2548-c435-08c300000710"

◆ barista_mode_handle

str blue_tests.barista_mode_handle = "0x0017"

◆ BtEncoder

◆ buttonPress

bool blue_tests.buttonPress = False

◆ BUZZER

int blue_tests.BUZZER = 7

◆ characteristics

dict blue_tests.characteristics
Initial value:
1= {
2 "machine_status": [machine_status, machine_status_handle],
3 "barista_mode": [barista_mode, barista_mode_handle],
4 "product_progress": [product_progress, product_progress_handle],
5 "heartbeat": [heartbeat_uuid, heartbeat_handle],
6 "heartbeat_read": [heartbeat_read_uuid, heartbeat_read_handle],
7 "start_product": [start_product, start_product_handle],
8 "statistics_command": [statistics_command_uuid, statistics_command_handle],
9 "statistics_data": [statistics_data_uuid, statistics_data_handle],
10 "uart_tx": [uart_tx_uuid, uart_tx_hnd],
11 "uart_rx": [uart_rx_uuid, uart_rx_hnd]
12}

◆ child

blue_tests.child

◆ chosen

int blue_tests.chosen = 0

◆ client_to_pay

list blue_tests.client_to_pay = []

◆ continue_reading

bool blue_tests.continue_reading = True

◆ counter

int blue_tests.counter = 0

◆ CURRENT_STATISTICS

blue_tests.CURRENT_STATISTICS

◆ data

list blue_tests.data = child.readline()

◆ data2

list blue_tests.data2 = [int(x, 16) for x in data.split()]

◆ db

mdb blue_tests.db = mdb.connect(host = "127.0.0.1", user = "root", passwd = os.getenv("PASSWD"), db = "AnnelieseDB")

◆ decoded

BtEncoder blue_tests.decoded = BtEncoder.encDecBytes(data2, KEY_DEC)

◆ DEVICE

os blue_tests.DEVICE = os.getenv("DEVICE")

◆ disp_init

int blue_tests.disp_init = 1

◆ else

blue_tests.else :

◆ emergency_unlock

int blue_tests.emergency_unlock = 0

◆ except

blue_tests.except :

◆ heartbeat_handle

str blue_tests.heartbeat_handle = "0x0011"

◆ heartbeat_read_handle

str blue_tests.heartbeat_read_handle = "0x0032"

◆ heartbeat_read_uuid

str blue_tests.heartbeat_read_uuid = "5a401538-ab2e-2548-c435-08c300000710"

◆ heartbeat_uuid

str blue_tests.heartbeat_uuid = "5a401529-ab2e-2548-c435-08c300000710"

◆ in_machine_products

dict blue_tests.in_machine_products
Initial value:
1= {
2 0:"Overall",
3 1:"Ristretto",
4 2:"Espresso",
5 3:"Coffee",
6 8:"Cappuccino",
7 5:"Milkcoffee",
8 6:"Espresso Macchiato",
9 7:"Latte Macchiato",
10 8:"Milk Foam",
11 9:"Flat White"
12}

◆ initial_time

time blue_tests.initial_time = time.time()

◆ JuraEncoder

◆ keep_alive_code

blue_tests.keep_alive_code

◆ KEY_DEC

blue_tests.KEY_DEC

◆ lastName

def blue_tests.lastName = get_name(uid_str)

◆ lastSeen

str blue_tests.lastSeen = ""

◆ lcd

lcddriver blue_tests.lcd = lcddriver.lcd()

◆ lock_status

def blue_tests.lock_status = "unlocked"

◆ locking_code

blue_tests.locking_code

◆ machine_status

str blue_tests.machine_status = "5a401524-ab2e-2548-c435-08c300000710"

◆ machine_status_handle

str blue_tests.machine_status_handle = "0x000b"

◆ mastercard1

os blue_tests.mastercard1 = os.getenv("MASTER_CARD_1")

◆ mastercard2

os blue_tests.mastercard2 = os.getenv("MASTER_CARD_2")

◆ MIFAREReader

MFRC522 blue_tests.MIFAREReader = MFRC522.MFRC522()

◆ msgStr1

str blue_tests.msgStr1 = str(product_made + " was made!")

◆ msgStr2

str blue_tests.msgStr2 = str(" Happy betty :) ")

◆ msgStr3

str blue_tests.msgStr3 = str("Hold for 2s please ")

◆ msgStr4

str blue_tests.msgStr4 = str("Chip below ")

◆ over

int blue_tests.over = 0

◆ passwd

os blue_tests.passwd = os.getenv("PASSWD")

◆ payment_to_date

int blue_tests.payment_to_date = 1

◆ port

serial blue_tests.port = serial.Serial("/dev/serial0", baudrate = 9600, timeout = 1.0)

◆ preName

def blue_tests.preName = get_vorname(uid_str)

◆ priceCoffee

dict blue_tests.priceCoffee
Initial value:
1= {
2 "Ristretto":0.45,
3 "Espresso":0.45,
4 "Coffee":0.45,
5 "Cappuccino":0.6,
6 "Milkcoffee":0.6,
7 "Espresso Macchiato":0.55,
8 "Latte Macchiato":0.75,
9 "Milk Foam":0.25,
10 "Flat White":0.7
11}

◆ product_made

bool blue_tests.product_made = False

◆ product_progress

str blue_tests.product_progress = "5a401527-ab2e-2548-c435-08c300000710"

◆ product_progress_handle

str blue_tests.product_progress_handle = "0x001a"

◆ PRODUCTS

dict blue_tests.PRODUCTS
Initial value:
1= {
2 0:"Overall",
3 1:"Ristretto",
4 2:"Espresso",
5 4:"Coffee",
6 29:"Cappuccino",
7 5:"Milkcoffee",
8 6:"Espresso Macchiato",
9 7:"Latte Macchiato",
10 8:"Milk Foam",
11 46:"Flat White"
12}

◆ start_product

str blue_tests.start_product = "5a401525-ab2e-2548-c435-08c300000710"

◆ start_product_handle

str blue_tests.start_product_handle = "0x000e"

◆ started

int blue_tests.started = 0

◆ statistics_command_handle

str blue_tests.statistics_command_handle = "0x0026"

◆ statistics_command_uuid

str blue_tests.statistics_command_uuid = "5A401533-ab2e-2548-c435-08c300000710"

◆ statistics_data_handle

str blue_tests.statistics_data_handle = "0x0029"

◆ statistics_data_uuid

str blue_tests.statistics_data_uuid = "5A401534-ab2e-2548-c435-08c300000710"

◆ time_total

int blue_tests.time_total = int(time.time() - initial_time)

◆ try

blue_tests.try :

◆ uart_rx_hnd

str blue_tests.uart_rx_hnd = "0x0036"

◆ uart_rx_uuid

str blue_tests.uart_rx_uuid = "5a401624-ab2e-2548-c435-08c300000710"

◆ uart_tx_hnd

str blue_tests.uart_tx_hnd = "0x0039"

◆ uart_tx_uuid

str blue_tests.uart_tx_uuid = "5a401625-ab2e-2548-c435-08c300000710"

◆ uid_str

str blue_tests.uid_str = scanCard()

◆ unlock_code

blue_tests.unlock_code

◆ value

def blue_tests.value = get_value(uid_str)

◆ value_new

def blue_tests.value_new = 0

◆ value_str

str blue_tests.value_str = str("Balance: " + str('%.2f' % value) + " EUR")

◆ welStr

str blue_tests.welStr = str("Hello " + preName)