# Development, Implementation and Evaluation of An Epidemic Communication System
## 4 Development of the Epidemic Communication System  
### Device Implementation  
The parameters of the wireless devices were determined based on the analysis in Section 3. The RSSI value for connection was set to \(-25\) dBm, which was measured to achieve a communication range of 0.3 m. First, as shown in Figure 7, the actions and conditions from searching for the receiving station to connecting and disconnecting are explained in the flowchart presented in Figure 11. The STA scans the beacon signals of the surrounding APs, and acquires the SSID and RSSI upon receiving the beacon signal. This information is then passed to Python and saved in a list. The RSSI is compared with \(-25\) dBm, and the AP with the highest RSSI, i.e., the nearest AP, is then searched for. The connection process is then executed. After the connection, the image data are transmitted, and the connection is disconnected when the RSSI falls below \(-25\) dBm or when the transmission of image data completes. This operation can be repeated to transfer data to the destination. The transmission and reception algorithm for epidemic communication was implemented using a Raspberry Pi 3B+ (RasPi) [38] and external wireless device dongle. The RasPi is a low-cost and lightweight single-board computer with communication features such as Wi-Fi and USB ports. Some information on the use of Raspberry Pi 3 Model B+ [39] is as follows. Operating temperature: approximately 60 \({}^{\circ}\)C; current consumption: approximately 500 mA; CPU utilization: approximately 8%. Figure 12 shows the configuration of the developed device. Both a receiving and transmitting interface are required for relay communication. The external wireless LAN dongle served as the receiving interface, and the built-in wireless LAN of the RasPi served as the transmission interface. The receiving interface uses the infrastructure mode access point (AP) function to transmit beacon signals, and the transmitting interface uses the station (STA) function. Figure 10: Average amount of data that can be transferred relative to the distance of the interfering station. For relay communication during the connection process, the STA of the transmitting interface was connected to the AP of the receiving interface to establish an affiliation relationship. The connection destination was unrestricted because we had multiple interfaces on a single device to enable flexible connections between devices. If a device has only one interface, it cannot transmit or receive information simultaneously, which leads to a decrease in communication opportunities. We implemented the epidemic communication algorithm in Python. The switching of the STA's connection destination was performed using NetworkManager, which is a Linux operating system function. To establish links with multiple wireless stations, the connection process must be performed every time the devices approach each other. At this time, the connection process time incurs overhead in communication time, leading to a decrease in the amount of actual data transfer. Therefore, using NetworkManager to complete the authentication process in advance, we reduced unnecessary connection process time. The Hostapd software MAC, which is a RasPi feature, was used for AP control. Figure 13 shows the implemented protocol stack. Epidemic communication generally involves a bundle layer that accumulates data. This layer is inserted into the protocol stack above the transport layer and below the application layer. The bundle layer [40]  
Figure 11: Connection and disconnection control flowchart. Figure 12: Configuration of the developed wireless system. implements a store-carry-forward mechanism in which nodes store data in their own buffers and transfer the data when it becomes available to other connected nodes. Data created in the application layer are converted into variable-length data called a bundle and stored in persistent storage for a long time; when a node is within the communication distance, the data are retrieved from this persistent storage for transfer.