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

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

Function Documentation

◆ beep()

def old_blue.beep (   duration)

◆ end_read()

def old_blue.end_read (   signal,
  frame 
)

◆ get_chip()

def old_blue.get_chip (   UID)

◆ get_name()

def old_blue.get_name (   UID)

◆ get_price()

def old_blue.get_price (   product)

◆ get_value()

def old_blue.get_value (   UID)

◆ get_vorname()

def old_blue.get_vorname (   UID)

◆ getAlerts()

def old_blue.getAlerts (   status)

◆ getUID_stats()

def old_blue.getUID_stats ( )

◆ lockUnlockMachine()

def old_blue.lockUnlockMachine (   code,
  lock_status,
  unlock_code = "77e1" 
)

◆ read_statistics()

def old_blue.read_statistics ( )

◆ readlineCR()

def old_blue.readlineCR (   port)

◆ scanCard()

def old_blue.scanCard ( )

◆ set_buylist()

def old_blue.set_buylist (   UID,
  product_name 
)

◆ set_value()

def old_blue.set_value (   UID,
  value 
)

◆ setupBuzzer()

def old_blue.setupBuzzer (   pin)

◆ sleepTimer()

def old_blue.sleepTimer (   secs)

Variable Documentation

◆ admin_locked

int old_blue.admin_locked = 0

◆ admin_prod

int old_blue.admin_prod = 0

◆ ALERTS

dict old_blue.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

old_blue.all_statistics

◆ as_hex

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

◆ barista_mode

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

◆ barista_mode_handle

str old_blue.barista_mode_handle = "0x0017"

◆ BtEncoder

◆ buttonPress

bool old_blue.buttonPress = False

◆ BuzzerPin

int old_blue.BuzzerPin = 7

◆ c

mdb old_blue.c = db.cursor()

◆ characteristics

dict old_blue.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

pexpect old_blue.child = pexpect.spawn("gatttool -b " + DEVICE + " -I -t random")

◆ chosen

int old_blue.chosen = 0

◆ client_to_pay

str old_blue.client_to_pay = ""

◆ continue_reading

bool old_blue.continue_reading = True

◆ counter

int old_blue.counter = 0

◆ CURRENT_STATISTICS

BtEncoder old_blue.CURRENT_STATISTICS = decoded

◆ current_time

int old_blue.current_time = int(time.time() - initial_time)

◆ data

list old_blue.data = child.readline()

◆ data2

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

◆ datefmt

old_blue.datefmt

◆ db

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

◆ decoded

◆ DEVICE

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

◆ disp_init

int old_blue.disp_init = 1

◆ else

old_blue.else :

◆ emergency_unlock

int old_blue.emergency_unlock = 0

◆ except

old_blue.except :

◆ filename

old_blue.filename

◆ format

old_blue.format

◆ heartbeat_handle

str old_blue.heartbeat_handle = "0x0011"

◆ heartbeat_read_handle

str old_blue.heartbeat_read_handle = "0x0032"

◆ heartbeat_read_uuid

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

◆ heartbeat_uuid

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

◆ hour

int old_blue.hour = int(time.strftime("%H"))

◆ in_machine_products

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

◆ initial_time

old_blue.initial_time

◆ intial_time_2

time old_blue.intial_time_2 = time.time()

◆ JuraEncoder

◆ keep_alive_code

old_blue.keep_alive_code

◆ KEY_DEC

old_blue.KEY_DEC

◆ lastName

def old_blue.lastName = get_name(uid_str)

◆ lastSeen

str old_blue.lastSeen = ""

◆ lcd

lcddriver old_blue.lcd = lcddriver.lcd()

◆ level

old_blue.level

◆ lock_status

def old_blue.lock_status = "unlocked"

◆ locking_code

old_blue.locking_code

◆ machine_status

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

◆ machine_status_handle

str old_blue.machine_status_handle = "0x000b"

◆ mastercard1

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

◆ mastercard2

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

◆ minute

int old_blue.minute = int(time.strftime("%M"))

◆ msgStr1

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

◆ msgStr2

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

◆ msgStr3

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

◆ msgStr4

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

◆ over

int old_blue.over = 0

◆ passwd

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

◆ payed_prod

int old_blue.payed_prod = 0

◆ payment_to_date

int old_blue.payment_to_date = 1

◆ port

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

◆ preName

def old_blue.preName = get_vorname(uid_str)

◆ price_product

dict old_blue.price_product = priceCoffee[product_made]

◆ priceCoffee

dict old_blue.priceCoffee
Initial value:
1= {
2 "Americano":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}

◆ prod

def old_blue.prod = read_statistics()

◆ product_made

bool old_blue.product_made = False

◆ product_progress

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

◆ product_progress_handle

str old_blue.product_progress_handle = "0x001a"

◆ PRODUCTS

dict old_blue.PRODUCTS
Initial value:
1= {
2 0:"Overall",
3 1:"Americano",
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}

◆ RFIDREADER

MFRC522 old_blue.RFIDREADER = MFRC522.MFRC522()

◆ start_product

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

◆ start_product_handle

str old_blue.start_product_handle = "0x000e"

◆ started

int old_blue.started = 0

◆ statistics_command_handle

str old_blue.statistics_command_handle = "0x0026"

◆ statistics_command_uuid

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

◆ statistics_data_handle

str old_blue.statistics_data_handle = "0x0029"

◆ statistics_data_uuid

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

◆ time_total

int old_blue.time_total = int(time.time() - intial_time_2)

◆ timeout

old_blue.timeout

◆ total_prod

int old_blue.total_prod = 0

◆ try

old_blue.try :

◆ uart_rx_hnd

str old_blue.uart_rx_hnd = "0x0036"

◆ uart_rx_uuid

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

◆ uart_tx_hnd

str old_blue.uart_tx_hnd = "0x0039"

◆ uart_tx_uuid

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

◆ uid_str

def old_blue.uid_str = scanCard()

◆ unlock_code

old_blue.unlock_code

◆ value

def old_blue.value = get_value(uid_str)

◆ value_new

def old_blue.value_new = 0

◆ value_str

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

◆ welStr

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