## 2 Proposed Software Architecture
### Software Architecture Design
#### 2.2.1 Conceptual View  
Based on the identified requirements, we designed a layered and tiered software architecture to develop smart mobile distributed systems for managing and streamlining the activities of individuals and members of evacuation, search, and rescue brigadesin emergency cases such as earthquakes or fires (see Figure 1). The proposed software architecture is based on the general approach presented in [30] for two-tier software architectures for context-aware distributed mobile systems, and we also incorporated key ideas from our conceptual design that are related to information gathering and processing, as described in [31]. In our software architecture, tiers complement layers; services are modeled in vertical abstract layers, while tiers handle the functionality of a specific layer within nodes. Each layer is independent since it performs a specific service. The mobile tier is intended to work on devices with limited storage and processing capabilities (for instance, mobile devices). On the other hand, the manager/administrator tier is designed to work on devices with greater storage and processing capacity, such as servers. Therefore, the workload is higher in the administrator tier than in the mobile tier. Although layers exist in both tiers and have the same name, their services depend on the device's hardware. The layers and components of the mobile tier are described below:  
Plugin layer: This layer refers to plugins, which are independent components that are responsible for collecting sensor data from various hardware components, such as retrieving information from available Wi-Fi networks that the mobile device can detect. Sensorization layer: It is responsible for managing the different plugins involved in the administration and control system of the activities of the brigades. This layer contains a component whose function is as follows:  
* Pre-process layer: It is responsible for eliminating out-of-range values and converting the format for the upper layers. Figure 1: Proposed layered software architectural design: mobile tier (**left**) and manager tier (**right**). Storage layer: It saves helpful information such as the last location and authentication credentials. Information gathering layer: It is responsible for extracting the information that the user needs. This layer is made up of the following components:  
* Indoor location detection module: This module is responsible for identifying the person's location inside a building. * Exit route detection module: This module identifies the route to the closest exit. * Health status detection module. This module is responsible for determining the health status of the person. * Emergency obtaining module: This module is responsible for obtaining the emergency that the person is indicating. * Security zone detection module: This module is responsible for obtaining the location of security zones. Report layer: This layer can capture the information required to generate the reports that the brigades must pass on to the civil protection internal unit (CPIU) coordinator or civil protection. Emergency actions layer: It controls functionalities such as sending notifications to the brigades, emergency calls, etc. The modules that this layer contains are:  
* Module for sending notifications to the brigades: This module oversees notifying the brigades about a possible problem indicated by the person. * Emergency call module: This module generates an emergency call if the user requires it. * First aid instructions module: It is responsible for generating first aid indications if it is required. * Module for sending messages: This module is responsible for sending messages between a person and the brigade. Communication layer: This layer maintains security and communication with the administrator tier. The modules that this layer contains are:  
* Security module: This module oversees the security of access to the system. * Connection module between the tiers: This module maintains a connection between the administrator and mobile tiers.