## 3 Proposal Architecture
### WSN Infrastructure  
The network used for the detection and transmission of data was developed using WiSe nodes; therefore, the nodes have a low energy consumption rate [19]. Low energy consumption is a very important consideration because the network life, integrity and security for health applications requires exceptional reliability [17].For these reasons, the WSN infrastructure employs a 128-bit AES encryption algorithm to protect network integrity and security, ensuring that the information is not intercepted by nodes that do not belong to the network [29]. A hybrid routing protocol that is dynamic, scalable, destination-centered, with a hierarchical structure was developed for the network. The system is based on IEEE 802.15.4, which contemplates the use of mobile nodes that form the network infrastructure. The infrastructure nodes handle the Received Signal Strength Indication (RSSI) to proactively create the network and can serve as: Cluster Head (CH), End Devices (ED) and SINK. On the other hand, the mobile node only sends data when an event occurs (either and increased or decreased heart rate, or a fall). Therefore, the information is sent to a single network node that immediately reacts to the alert and finds the event destination. To cover this and other functions, the proposed routing algorithm uses a series of network packets which are described in Table 2.  
To create the network's structure, the nodes begin in an undefined state, except for the SINK. Each node periodically sends HELLO packets to localize any possible neighboring nodes. The HELLO packets are then broadcast and received by all of the immediate neighbors and is not retransmitted, this to prevent network flooding. Once the undefined nodes receive an answer (HACK packet) from a defined structure node (CH, ED or SINK), it will change its status (ED) and will stop transmitting the HELLO packets; then it will select the best link based on the Received Signal Strength Indication (RSSI). The functions of the nodes (ED) are to send DATA packets from a mobile node to its respective (CH) and reply to the HELLO packets received from undefined nodes. When a node (ED) is connected to another infrastructure node, it creates and stores its new neighbor in a routing table; afterwards, it assumes the role (CH). The (CH) then routes the information received from the (ED and mobile nodes), maintaining the network nodes connected and replying to HELLO packets to the \begin{table}
\begin{tabular}{c c c} \hline \hline
**Type of Packet** & **Length (Bytes)** & **Description** \\ \hline HELLO & 11 & The packet code is 0 \(\times\)48. The HELLO packet discovers the network. \\ \hline HACK & 11 & The packet code is 0 \(\times\) 58. The HACK packet confirms reception of the HELLO packet. \\ \hline TOKEN & 11 & The packet code is 0 \(\times\) 54. The TOKEN packet explores the network before sending a DATA packet. \\ \hline TACK & 11 & The packet code is 0 \(\times\) 4 B. The TACK packet confirms that the TOKEN packet was received. \\ \hline DATA & 19 & The packet’s code is 0 \(\times\) 44. The DATA packet contains data about the information’s origin, as well as the patient’s heart rate, the event code, the number of hops and the packet counter. DATA packets, however, can be adapted to carry even more information. \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Packets generated by the routing protocol. undefined infrastructure nodes. On the other hand, mobile nodes are already defined before joining the network. The primary purpose of a mobile node is to monitor user variables, discover the destination of the information monitored for each event and send DATA packets to the network. The routing of DATA packets is carried out by a hybrid mechanism. A mobile node must first reactively identify its destination by broadcasting a TOKEN packet. Only upon receiving a (TACK) unicast reply from a network node will the mobile node send a return DATA package.