# Smartwatch-Based Monitoring and Alert System for Factory Operators Using Public Cloud Services
## 4 Results
### Presenting Detailed Use Cases
#### 4.2.7 Sending Notifications  
Sending notifications in the system can be performed in several ways in order to make sure that all the employees are connected at all times. The following methods are used:  
1. Supervisor sends notifications from web application to selected supervised employees This functionality allows supervisors to send notifications to specific active employees. It includes a form where supervisors can select employees, enter the message, and set the notification category. When a notification is sent, a POST request is made to the application server, where the employees, message text, and notification category are extracted from the request body. Using a support function, the system retrieves Firebase tokens associated with the selected employees based on their IDs, stored in the EmployeeTokens table. The notification message is then constructed with a title and body in the notification section, along with the notification category in the data section. The message, along with the list of Firebase tokens, is sent to the specified devices using Firebase Cloud Messaging (PCM) to ensure targeted delivery. This setup allows for efficient, real-time communication between supervisors and employees, with messages reaching only the intended recipients. An example of the flow is shown in Figure 15.
2. Supervisor sends notification to all supervised employees via the smartwatch This feature allows supervisors to notify their supervised employees about various events or updates, whether these are predefined or entered by the supervisor manually on the smartwatch interface presented in Figure 16. Sending a notification from a  
Figure 14: Sequence diagram of timesheet flow when updated. supervisor to their supervised employees can be conducted from the smartwatch application by retrieving Firebase tokens for all employees supervised by a specific supervisor. The notification content is then prepared and sent to multiple devices, allowing the supervisor to effectively reach all supervised employees at once. This setup ensures efficient and scalable communication for supervisors managing larger teams. The messages are sent also through the application server, which has the FCM server set up using POST requests. 3. Supervised employee sends notifications to supervisor via the smartwatch This function allows employees to notify their supervisor about various issues or needs. Notifications can be either predefined to reduce effort or entered manually by the employee. To send a notification from an employee to their supervisor, the employee's ID is first extracted from the POST request sent to the application server. Then, the supervisor is identified by searching for the employee's supervisor in the \"EmployeesSupervisors\" table. After identifying the supervisor, the function retrieves the supervisor's Firebase token from the EmployeeTokens table. Next, the notification is constructed with the personalized information from the request body and is sent to the supervisor via Firebase. This process ensures that supervisors receive relevant, individualized messages directly from their employees. 4. Employee sends notifications to an active employee via the smartwatch This is a functionality that enables employees to notify any other active employee through a message entered by the user on the smartwatch interface presented in Figure 17. As the operator chooses who they want to notify, a new screen appears allowing the user to type a message via the watch's keyboard. This setup facilitates direct communication between employees, allowing them to quickly send messages to colleagues as needed in real time, while having the freedom to create a custom message, specifically tailored to their needs. To send a notification, the sender's and recipient's IDs are first extracted from the POST request sent to the application server. The recipient's associated Firebase token is then retrieved from the EmployeeTokens table.