Main server of the BeaconBlink system.
This server is responsible for data flow between all other components of the system, as well as the database.
It also serves the web application, which is the main interface for users.
- Node.js
- Express
- TypeScript
- FetchAPI
- TypeScript
- React
- TailwindCSS
- React Select
- React Router
- Axios
- FetchAPI
- React-icons
It is not recommended to run the server alone. Be sure to run the whole Deployment.
Make sure to change docker-compose.yml.example to docker-compose.yml.
Then execute the command:
docker-compose upFirst build with npm:
npm run buildThen start the server:
npm run startProvides the main page of the application. All routing is done on the client side using React Router.
index.htmlfile.
Allows for identifying a device by displaying its MAC address on its screen and emitting a sound signal.
mac_address: string - MAC address of the device to be identified.
Responsible for creating a task that displays the sent message and adds it to the queues of specified devices.
mac_address[]: string[] - MAC addresses of devices on which the message is to be displayed.message: string - Content of the message.
Allows switching the calibration mode for individual devices, indicating the room being calibrated. If a device previously calibrated a room that is now not on the list, it will disable the calibration mode for that room. After each completed calibration, an appropriate request is also sent to the machine learning module informing about the need for additional training due to new data.
devices[]: string[] - MAC addresses of devices that are to calibrate the given room.roomId: string - ID of the room to be calibrated.
This endpoint forms the basis of communication between Beacons and the server. Upon receiving a signal, the last login time of the device in the system is updated. If the Beacon is not in the database - it is added. Then, if the device is in calibration mode, the received network scan goes to the database, to the scan_results field for the calibrated room. If not - the network scan is sent to the machine learning module, which returns the predicted location of the device in a response message. As a response, this endpoint returns a list of commands to be executed by the device. The list will always contain a command to display a message containing the current location or the room currently being calibrated (in the case of calibration mode). Additionally, if there are pending messages for this device in the database, a command displaying the oldest pending message is added to the list, along with a command to emit a sound signal.
mac_address: string - MAC address of the Beacon connecting to the server.scan_results: NetworkInfo[] - Information about networks scanned by the Beacon.
- Object of class ServerResponse.
Returns information about all rooms saved in the database.
- Array of objects Room[].
Returns information from the database about the room with the specified ID.
id: string - Room identifier.
- Object of class Room.
Returns information about all tags assigned to rooms.
- Array of strings string[].
Adds a new room to the database.
newRoom: Room - New room.
Updates the room with the given identifier.
id: string - Room identifier.
updatedRoom: Room - Updated room.
Removes the room with the given identifier from the database. Additionally, it sends information to the machine learning module about the need to retrain the model due to changes in the system.
id: string - Room identifier.
Returns information about all devices saved in the database.
- Array of objects Device[].
Returns information from the database about the device with the specified MAC address.
mac_address: string - MAC address of the device.
- Object of class Device.
Adds a new device to the database.
newDevice: Device - New device.
Returns information about all devices located in the room with the given identifier.
roomId: string - Room identifier.
- Array of objects Device[].
Returns information about all devices that are calibrating the room with the given identifier.
roomId: string - Room identifier.
- Array of objects Device[].
Updates the device with the given MAC address.
mac_address: string - MAC address of the device.
updatedDevice: Device - Updated device.
Removes the device with the specified MAC address from the database.
mac_address: string - MAC address of the device.