This document provides detailed information about the components running on the BeagleBone Green (BBG) as part of the Parking System project. The BBG acts as an intermediary device that receives data from the GPS sensor located on another device and forwards it to the central server. The software components on the BBG handle data formatting, inter-process communication (IPC), and data transmission to the server.
- Description: This module is responsible for both formatting data packets and managing shared memory for inter-process communication (IPC). It allows structured data (
DataPacket) to be formatted into a human-readable format and also facilitates the storage of this data in shared memory for other processes to access. - Functionality:
- Formats
DataPacketstructures into human-readable strings. - Manages shared memory segments for storing
DataPacketdata. - Provides functions to attach, detach, and remove shared memory.
- Ensures that the formatted data is consistent and ready for inter-process communication.
- Formats
- Description: This program reads GPS data from a shared memory segment and writes it to a FIFO (named pipe). It handles signal interruptions
SIGINTto ensure data consistency and uses formatted data from thedata_struct_format.cmodule before transmission. - Functionality:
- Reads GPS data from shared memory.
- Writes data to a FIFO defined by
FIFO_PATH. - Gracefully handles signals like
SIGINTto ensure a safe shutdown. - Uses
data_struct_format.cto format the data before sending.
- Key Features:
- Inotify mechanism replaced with shared memory for monitoring file changes.
- Signal handling for interruption (e.g., Ctrl+C) to allow safe termination.
- Modular integration with
data_struct_formatfor data formatting.
- Description: The
sys_com_controller.cmodule initializes UART communication and sets up GPIO pins for TX and RX. It listens for incoming data over UART, processes it asDataPacketstructures, and then uses thedata_struct_format.cmodule to format and display the data. This program ensures reliable communication with the STM32 Nucleo-F746ZG board and prepares data for further processing. - Functionality:
- Initializes UART and GPIO pins for communication.
- Reads incoming data from UART.
- Processes and formats the received data using
data_struct_format.c. - Displays data in both hexadecimal and human-readable formats.
- Sends acknowledgment responses back via UART if necessary.
- Description: This client program reads data from a FIFO and sends it to a TCP server. It is the final stage in the data transmission pipeline on the BBG.
- Functionality:
- Reads data from a FIFO (
tmp/gps_pipe). - Connects to a TCP server using specified IP and port.
- Sends the data, prefixed with the client’s MAC address, to the server.
- Reads data from a FIFO (
The BBG utilizes various IPC mechanisms to facilitate communication between different processes:
- FIFO (Named Pipes):
tmp/gps_pipe: Used to transfer data fromipc_sendertotcp_client.
The FIFOs ensure that data is sequentially processed and forwarded to the appropriate modules or the central server.
The Makefile provided in the project directory is used to compile all the source files. Below are the commands to use:
To compile the programs, navigate to the project directory (~/build/make/) and run:
makeor
make allor make with links
make installTo remove all compiled executables, run:
make cleanStart the out_tcp_client program to read from tmp/gps_pipe and send the data to the central server via TCP.
./out_tcp_clientRun the sys_com_controller program to initiate communication and receive data of DataPacket struct from the STM32 NUCLEO-F746ZG board.
./sys_com_controllerRun the out_ipc_sender program to begin reading GPS data from the shared memory segment and sending it to tmp/gps_pipe.
./out_ipc_sender