The code in this repository acts as a Linux interface for controlling JURA coffee makers over a serial (UART) connection. Once running, the following file-interface will be exposed:
/
├── tmp
│ ├── coffee_maker
│ │ ├── tx
│ │ ├── rx
│ │ ├── status
│ │ ├── mode
│ │ └── device
│ └── ...
└── ...
txis a FIFO named pipe where you can write stuff to, to send it to the coffee maker.rxis a FIFO named pipe where you can read stuff from, that gets send from the coffee maker.statusis a simple text file containing the status of the connection (1== Running).modeis a simple text file containing the current operation mode. Currently just a placeholder for the future.deviceis a simple text file containing the device name of the connected coffee maker (e.g.EF532M V02.03).
The following requirements are required to build this project.
- A C++20 compatible compiler like gcc or clang
- The build system is written using CMake
- For managing dependencies in CMake, we are using conan
To install those dependencies on Fedora, run the following commands:
sudo dnf install -y gcc clang cmake python3 python3-pip
pip3 install --user conanTo install those dependencies on a Raspberry Pi, running the Raspberry Pi OS, run the following commands:
sudo apt install -y cmake python3 python3-pip
pip3 install --user conanFor all the other requirements, head over here: https://github.com/Jutta-Proto/hardware-pi#raspberry-pi-os
Run the following commands to build this project:
# Clone the repository:
git clone https://github.com/Jutta-Proto/linux-diver.git
# Switch into the newly cloned repository:
cd linux-driver
# Build the project:
mkdir build
cd build
cmake ..
cmake --build .From inside the build directory, you can execute the driver with the following command:
./src/Jutta_Driver /dev/tty0
Here /dev/tty0 is the path to the serial port, you are using. In case you are running this on a Raspberry Pi, and you connected like described here, it should be /dev/tty0.
The following example shows how to read from a FIFO named pipe.
import os
import errno
FIFO = "/tmp/coffee_maker/rx"
try:
os.mkfifo(FIFO)
except OSError as oe:
if oe.errno != errno.EEXIST:
raise
while True:
print("Opening FIFO...")
with open(FIFO) as fifo:
print("FIFO opened")
while True:
data = fifo.read()
if len(data) == 0:
print("Writer closed")
break
print('Read: "{0}"'.format(data))