Skip to content

Commit

Permalink
Docker container (#13)
Browse files Browse the repository at this point in the history
* Fixed .csv header with correct information. Updated version number. Added docker container for linux.
  • Loading branch information
kikofmas authored Nov 18, 2024
1 parent 3a4424c commit d2a388c
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:jammy-20240911.1

# Install dependencies for pycairo, pyobject and pydbus
RUN apt update
RUN apt install -y python3.10
RUN apt install -y python3-pip
RUN apt install -y wget
RUN apt install -y libcairo2-dev libxt-dev libgirepository1.0-dev
RUN apt install -y build-essential libdbus-glib-1-dev libgirepository1.0-dev
RUN apt install -y ninja-build patchelf bluez dbus bluetooth

# Start bluetooth services
RUN service dbus start
RUN service bluetooth start

# Copy requirements file and install python requirements
COPY requirements.txt ./
RUN pip3 install meson
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy all files to container
COPY . .
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,34 @@ Install them using `pip`:
pip install -r requirements.txt
```

## Using Docker in Linux

When running the API on Linux, if issues arise, it is recommended to try using it inside a docker container.

First, install [docker](https://docs.docker.com/engine/install/).

Then, clone the repository and navigate to the directory:
```sh
# Getting this repository
git clone https://github.com/scientisst/scientisst-sense-api-python.git
cd scientisst-sense-api-python
```

Then, build the docker container with:
```sh
sudo docker build -t sense_docker .
```

It is required to build the container only once. Finally, run the container with:
```sh
sudo docker run -v /var/run/dbus/:/var/run/dbus/:z --privileged -it sense_docker
```

This will open a terminal inside the container with access to bluetooth and Wi-Fi. To exit the container run:
```sh
exit
```

## Running

### Automatic
Expand Down
2 changes: 1 addition & 1 deletion scientisst/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from scientisst.scientisst import *

__version__ = "1.1.0"
__version__ = "1.2.0"
13 changes: 13 additions & 0 deletions sense_src/file_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ def __get_metadata(self, address, fs, channels, api_version, firmware_version, a
"Timestamp": timestamp.timestamp(),
"ISO 8601": timestamp.isoformat(),
}
if API_MODE_DICT[api_com_version] == API_MODE_SCIENTISST:
metadata = {
"API version": api_version,
"Channels": channels,
"Channels labels": get_channel_labels(channels, self.mv),
"Device": address,
"Firmware version": firmware_version,
"Header": get_header(channels, self.mv, api_com_version),
"Resolution (bits)": [12, 1, 1, 1, 1] + self.__get_channel_resolutions(),
"Sampling rate (Hz)": fs,
"Timestamp": timestamp.timestamp(),
"ISO 8601": timestamp.isoformat(),
}
else:
metadata = {
"API version": api_version,
Expand Down

0 comments on commit d2a388c

Please sign in to comment.