Skip to content
Snippets Groups Projects
Commit 6bef59bb authored by Adrien Chabod's avatar Adrien Chabod
Browse files

MAJ machine

parent a7e71a73
No related branches found
No related tags found
1 merge request!1MAJ BDD + Data commande fonctionnel
......@@ -94,6 +94,7 @@ class UartService(Service):
self.add_characteristic(BLE_GET_QUANTITE_MACHINE(bus, 3, self))
self.add_characteristic(BLE_MACHINE_SEND_ORDER(bus, 4, self))
self.add_characteristic(BLE_ADD_INGREDIENT(bus, 5, self))
self.add_characteristic(BLE_MAJ_MACHINE(bus, 6, self))
class Application(dbus.service.Object):
def __init__(self, bus):
......@@ -168,7 +169,14 @@ class BLE_ADD_INGREDIENT(RxCharacteristic):
def WriteValue(self, value, options):
ingredient = format(bytearray(value).decode())
mysql_add_ingredient(ingredient)
class BLE_MAJ_MACHINE(RxCharacteristic):
def __init__(self, bus, index, service):
RxCharacteristic.__init__(self, bus, index, service, SQL_MAJ_MACHINE_CHARACTERISTIC_UUID)
def WriteValue(self, value, options):
maj = unformalize_data_list(format(bytearray(value).decode()))
mysql_maj_machine(maj)
class BLE_MACHINE_SEND_ORDER(RxCharacteristic):
def __init__(self, bus, index, service):
......
from bibliotheques.sql.sql import formalize_data_list, unformalize_data_list
input = "0,None,None/1,6,0/2,2,0/3,None,None/4,None,None/5,None,None"
input = "0,None,None/1,6,0/2,2,0/3,None,None/4,None,None/5,None,None" #id_bec,id_ingredient,quantite
print(type(unformalize_data_list(input[1])))
new_data = unformalize_data_list(input)
......
......@@ -10,5 +10,4 @@ print(mysql_get_cocktail_composition_without_bec(1))
print(mysql_get_cocktail_composition_with_bec(1))
print(mysql_get_bec_from_ingredient(1))
mysql_add_ingredient("test")
mysql_maj_machine(unformalize_data_list(input))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment