{"id":22264286,"url":"https://github.com/AnjaDj/Inter-Process-Communication-in-IIoT-Gateway-Device","last_synced_at":"2025-10-13T13:31:31.995Z","repository":{"id":262139094,"uuid":"881025688","full_name":"AnjaDj/Inter-Process-Communication-in-IIoT-Gateway-Device","owner":"AnjaDj","description":"gRPC \u0026 D-Bus","archived":false,"fork":false,"pushed_at":"2025-02-21T09:44:58.000Z","size":17491,"stargazers_count":0,"open_issues_count":19,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-26T06:39:35.779Z","etag":null,"topics":["c","cpp","dbus","driver","grpc","linux","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnjaDj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"supporting libraries/ADC.service","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-30T19:33:57.000Z","updated_at":"2025-02-21T09:45:02.000Z","dependencies_parsed_at":"2024-12-24T13:40:36.725Z","dependency_job_id":"d1f0d0bd-7d85-468e-9a6f-98f098757936","html_url":"https://github.com/AnjaDj/Inter-Process-Communication-in-IIoT-Gateway-Device","commit_stats":null,"previous_names":["anjadj/kernel-space-driver-development-and-grpc-based-communication","anjadj/inter-proccess-communication-using-d-bus-grpc","anjadj/inter-process-communication-in-an-industrial-iot-gateway-device","anjadj/inter-process-communication-in-iiot-gateway-device"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnjaDj/Inter-Process-Communication-in-IIoT-Gateway-Device","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnjaDj","download_url":"https://codeload.github.com/AnjaDj/Inter-Process-Communication-in-IIoT-Gateway-Device/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015312,"owners_count":26085684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","dbus","driver","grpc","linux","python"],"created_at":"2024-12-03T10:08:24.453Z","updated_at":"2025-10-13T13:31:31.988Z","avatar_url":"https://github.com/AnjaDj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🔸 Flash ARM image to SD Card\u003cbr\u003e\nOur Raspberry Pi (using RPi 3B) needs an operating system to work. There are a range of operating systems provided by Raspberry Pi.\u003cbr\u003e\nWe can use \u003cb\u003eRaspberry Pi Imager\u003c/b\u003e as the quick and easy way to install an operating system to a microSD card, or\nalternatively, we can choose from many operating systems available, download it and install manually.\u003cbr\u003e\nFrom `https://www.raspberrypi.com/software/operating-systems/` Raspberry Pi OS (64-bit) is downloaded.\n![image](https://github.com/user-attachments/assets/b13ee226-5e6b-44b8-8ada-3bafec3314a4)\u003cbr\u003e\n\nAfter the download is complited, the `2024-11-19-raspios-bookworm-arm64.img.xz` file should be placed in Download dir of our PC.\u003cbr\u003e\n1. Insert the SD card into the memory card slot and use the command `lsblk` to list block devices such as SD cards, HDD, etc.\u003cbr\u003e\n    Your SD card is most likely recognized as\u003cbr\u003e\n    sdb                        8:16   1  29,1G   0 disk\u003cbr\u003e\n      ├─sdb1                  8:17   1   128M  0 part  /media/user/BOOT\u003cbr\u003e\n      └─sdb2                  8:18   1    29G   0 part  /media/user/rootfs\u003cbr\u003e\n      \n2. Unmount the SD card to be able to write to it.(If your SD card is device /dev/sdb having two partitions, do below to unmount them)\n   ```bash\n   umount /dev/sdb1\n   umount /dev/sdb2\n   \n3. Flash ARM image to SD Card:\n   ```bash\n   xzcat /path/to/2024-11-19-raspios-bookworm-arm64.img.xz | sudo dd bs=1M of=/dev/sdb\n\n4. Now 64bit RPi OS is flashed to your SD card. Eject it from PC and insert it into RPi 3B device.\u003cbr\u003e\n\nFor more detailed information about this topic, visit `https://www.ipfire.org/docs/installation/howto_flash_arm_image`\u003cbr\u003e\n\n# 🔸 Natively build a Linux kernel on RPi 3B\u003cbr\u003e\nComplete quidance on : https://www.raspberrypi.com/documentation/computers/linux_kernel.html#install-directly-onto-the-sd-card.\u003cbr\u003e\n\nBefore you can build for any target, you need the kernel source. To get the kernel source, you need Git:\u003cbr\u003e\n  `sudo apt install git`\u003cbr\u003e\n\nDownload kernel source. For a full list of available branches, see the `https://github.com/raspberrypi/linux`\u003cbr\u003e\n  `git clone --depth=1 --branch \u003cbranch\u003e https://github.com/raspberrypi/linux`\n\nInstall the build dependencies \u003cbr\u003e\n  `sudo apt install bc bison flex libssl-dev make`\n\nNow that we have the kernel source, \u003cb\u003ebuild\u003c/b\u003e a fresh kernel natively\u003cbr\u003e\nIn this case, Im using RPi3B 64bit distribution\n   ```bash\n   cd linux\n   KERNEL=kernel8\n   make bcm2711_defconfig\n   ```\n\nBuild the 64-bit kernel (this step will take A LONG TIME -couple of hours)\u003cbr\u003e\n   `make -j6 Image.gz modules dtbs`\n\nInstall the kernel modules onto the boot media\u003cbr\u003e\n   `sudo make -j6 modules_install`\n\nCreate a backup image of your current kernel and install the fresh kernel image\n   ```bash\n   sudo cp /boot/firmware/$KERNEL.img /boot/firmware/$KERNEL-backup.img\n   sudo cp arch/arm64/boot/Image.gz /boot/firmware/$KERNEL.img\n   sudo cp arch/arm64/boot/dts/broadcom/*.dtb /boot/firmware/\n   sudo cp arch/arm64/boot/dts/overlays/*.dtb* /boot/firmware/overlays/\n   sudo cp arch/arm64/boot/dts/overlays/README /boot/firmware/overlays/\n   ```\n\nFor kernels version 6.5 and above run\u003cbr\u003e\n   `sudo cp arch/arm/boot/dts/broadcom/*.dtb /boot/firmware/`\u003cbr\u003e\nFor kernels up to version 6.4\u003cbr\u003e\n   `sudo cp arch/arm/boot/dts/*.dtb /boot/firmware/`\u003cbr\u003e\n\nCopy over the overlays and README\n   ```bash\n   sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/firmware/overlays/\n   sudo cp arch/arm/boot/dts/overlays/README /boot/firmware/overlays/\n   ```\nFinally, run the following command to reboot your Raspberry Pi and run your freshly-compiled kernel `sudo reboot`\n\n   \n# 🔸 gRPC\n### 🔹 Build and locally install gRPC and Protocol Buffers for C++\n![image](https://github.com/user-attachments/assets/836ccef6-5714-4f28-9c56-bfc60e0e3f99)\n\nPrerequisites\u003cbr\u003e\n - cmake 3.16 or later (https://vitux.com/how-to-install-cmake-on-ubuntu/)\n1. Configures a directory for locally installed packages and ensures the executables are easily accessible from the command line\u003cbr\u003e\n    ```bash\n     ~$ export LOCAL_INSTALL_DIR=$HOME/.local\n     ~$ mkdir -p $LOCAL_INSTALL_DIR\n     ~$ export PATH=\"$LOCAL_INSTALL_DIR/bin:$PATH\"\n2. Install the basic tools required to build gRPC\n     ```bash\n     ~$ sudo apt install -y build-essential autoconf libtool pkg-config\n3. Clone the grpc repo and its submodules\n     ```bash\n     ~$ git clone --recurse-submodules -b v1.66.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc\n4. Build and locally install gRPC and Protocol Buffers\n     ```bash\n     ~$ cd grpc\n     ~/grpc$ mkdir -p cmake/build\n     ~/grpc$ pushd cmake/build\n     ~grpc/cmake/build$ cmake -DgRPC_INSTALL=ON \\\n                              -DgRPC_BUILD_TESTS=OFF \\\n                              -DCMAKE_INSTALL_PREFIX=$LOCAL_INSTALL_DIR \\\n                              ../..\n     ~grpc/cmake/build$ make -j 4\n     ~grpc/cmake/build$ make install\n     ~grpc/cmake/build$ popd\n5. Build the project\u003cbr\u003e\n    in `~/grpc/examples/protos/` save .proto file\u003cbr\u003e\n    in `~/grpc/examples/cpp/` create new directory `myproject` containing source .cc code and CMakeLists.txt\u003cbr\u003e\n    ```bash\n    ~/grpc$ cd examples/cpp/myproject\n    ~/grpc/examples/cpp/myproject$ mkdir -p cmake/build\n    ~/grpc/examples/cpp/myproject$ pushd cmake/build\n    ~/grpc/examples/cpp/myproject/cmake/build$ cmake -DCMAKE_PREFIX_PATH=$LOCAL_INSTALL_DIR ../..\n    ~/grpc/examples/cpp/myproject/cmake/build$ make -j 4\n6. Run the project from the project `build` directory\u003cbr\u003e\n    ```bash\n    ~/grpc/examples/cpp/myproject/cmake/build$ ./app\n\n### 🔹 Build and locally install gRPC and Protocol Buffers for Python\n![image](https://github.com/user-attachments/assets/6b3d902b-eead-412f-9f47-6627ca4bb850)\n\nPrerequisites\u003cbr\u003e\n - Python 3.7 or higher\n - pip version 9.0.1 or higher\n\n1. Install gRPC\n   ```bash\n   ~$ python3 -m pip install grpcio\n2. Install gRPC tools\n   ```bash\n   ~$ python3 -m pip install grpcio-tools\n3. Build the project\u003cbr\u003e\n   create new directory `myproject` containing .proto file and source .py code\u003cbr\u003e\n5. Run the project\u003cbr\u003e\n   from project directory `myproject` in terminal run `python3 app.py`\n\n\n\n# 🔸 From Python script to Linux service using \u003cb\u003esystemd\u003c/b\u003e\nA daemon (or service) is a background process that is designed to run autonomously,with little or not user intervention. Services will start automatically every time the system starts, which eliminates the need to start it manually. Scripts that collect data, represent servers or similar are ideal candidates to be configured as services and not ordinary scripts.\u003cbr\u003e\n  \n1. Write Python script you want to make as service `/path/to/your_script.py`\n2. Make your Python script executable\n   ```bash\n   ~$ chmod +x /path/to/your_script.py\n4. Create systemd service file in directory `/etc/systemd/system/`.  Systemd service files need to be in `/etc/systemd/system/` DIR!\n   ```bash\n   ~$ sudo nano /etc/systemd/system/your_script.service\n5. Add following content to your .service file\n   ```bash\n   [Unit]\n   Description=Python Script Service\n   After=network.target\n   \n   [Service]\n   ExecStart=/usr/bin/python3 /path/to/your_script.py\n   Restart=always\n   User=your_user\n   WorkingDirectory=/path/to/\n   Environment=\"PATH=/usr/bin\"\n   \n   [Install]\n   WantedBy=multi-user.target\n\n6. Reload systemd to recognise new service `your_script.service`\n   ```bash\n   sudo systemctl daemon-reload\n8. Enable new service at system startup\n   ```bash\n   sudo systemctl enable your_script.service\n10. Run service\n    ```bash\n    sudo systemctl start your_script.service\n11. Managing the service\n    - stop service\n      ```bash\n      sudo systemctl stop your_script.service\n    - restart service\n      ```bash\n      sudo systemctl stop your_script.service\n    - disable service at system startup\n      ```bash\n      sudo systemctl disable your_script.service\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnjaDj%2FInter-Process-Communication-in-IIoT-Gateway-Device/lists"}