# An Architecture for Reliable Transportation of Delicate Goods
## 5 Workflow
### Merchandise Aggregation and Disaggregation
#### 5.3.1 Type (c) Topology  
Figure 9 shows the topology of the conceived solution. Outside the container there will be one or more type B devices. Inside there will be the merchandises with the type A and/or B devices. They are connected using a star topology, where a type B device is the central node, and all the others are terminal nodes that communicate with the central node. No communication among terminals is required, other than point-to-point among terminal and central node. Figure 9: Type (C) topology using a B device as central node and A/B devices as peripherals. Except for type A devices, which are continuously advertising (awake), all the others are normally sleeping and waking up periodically. If they have non-compliances to report, they send them to the central device. Each non-compliance contains the relative time (time elapsed since the trip started), the identification of the measure and the acquire value. Each report contains the merchandise temporary identifier and the list of non-compliances encrypted using the public key provided when contracting the transport service. Using the security mode 1 of the BLE standard, level 2, 3 or 4, it is also possible (and desirable) to encrypt the communication channel [41]. Nevertheless, the communication is only possible if each node is on the whitelist of the other. In normal conditions, the whitelist on the central node will have several accepted devices (terminals) and a terminal whitelist will have a single accepted device (the central node). The Generic Attribute Profile (GATT) establishes how to exchange data over the BLE connection, including the available roles that the interacting devices can adopt. The devices that implement the central role are the ones that scan for the services advertised by those that implement the peripheral role. The BLE services are implemented on the peripherals and each service can contain one or more characteristics. Each characteristic could have one or more access modes. In the present work the modes used are the read, write and notification modes. The read and write modes, when set, allow the central to, respectively, read and write the value of the characteristic. The notification mode enables the automatic notification of the central device, whenever the characteristic value changes on the terminal device. On the star topology, the terminal nodes implement the peripheral role, and the central node implements both roles, the central to communicate with the terminals, and the peripheral to communicate with the smartphone. By default, the smartphones establish the BLE connections on the role of central. Figure 10 represents the common part of the aggregation and disaggregation protocols. Whenever the operator adds a merchandise with a monitor device to a container that supports the star topology, the operator should make the association among devices, making the central node a front-end, accessible from the outside of the container, that reports information collected from the terminals inside the container. The association is done activating the low range advertise mode on the peripheral (Figure 10--message 2). Controlling the time the button is pressed, it is possible to activate the device for different behaviors (simple click activates the advertise function, long click activates the advertise function in low range mode, very long click resets the device). With low-range advertise, the radio signal is propagated only for short distances (it can be configured to operate from a few centimeters to a few meters). In this way, the connection between devices is only possible when they are close. Typically, the central node will be fixed somewhere outside the container and the terminal is fixed on the merchandise. The operator will have to bring the merchandise closer to the central device. Previously, it is necessary to activate the scan mode on the central and the low range advertise on the terminal.