3.2. Carrier Station
The Carrier Station component represents vehicles that are in charge of load’s transportation.
The SafeTrack was designed to allow numerous Carrier Stations, each is constituted by a proposed
component called SafeDuino, a collection of RFID tags and an application that runs in a mobile device, named SafeTrack Mobile, as seen in Fig. 4. The Carrier Station has RFID components that identify the vehicle and the carried loads.
A RFID tag is fixed on the vehicle, that permits its identification when it enters a Depot Station.
Moreover, a set of RFID tags are attached to the loads, because by the EPC code is possible to know information, such as: manufacturer, product type, and also exactly identify which load corresponds to a certain tag.
The SafeDuino is aimed to manage the entering and leaving of loads in the vehicle, always informing the SafeTrack Mobile when a load enters or leaves. It is composed by an Arduino, a Bluetooth module, a RFID reader and a battery that supplies energy to all components.
The RFID reader only detects the presence of a particular tag in a specific distance range, not being able to identify if it is entering or leaving the Carrier Station.
This control is done by an embedded application in Arduino platform called SafeDuino App, that communicates with the RFID reader and the Bluetooth module via serial port.
The battery can be recharged through 12 volts socket usually provided in transporting vehicles. The reading of tags in SafeDuino App is done in synchronous or asynchronous mode.
In synchronous mode, the mobile device sends a request to the RFID reader and receives in return a list with the EPC numbers of all tags inside the reader range.
On the other hand, in the asynchronous mode, the SafeDuino App is registered in the RFID reader, and from that moment on it always receives notifications when a tag is read.
The format of data that the RFID reader sends to the SafeDuino App changes between each manufacturer.
The reader can share its events by data models in low level as the ALE specification of EPCGlobal (ALE, 2012), or in high level data structures, such as an object in Java or C++ languages.
The SafeDuino App aims to identify if a certain read tag is an entering or leaving event of load in a Carrier Station. Furthermore, the SafeDuino App communicates with the SafeTrack Mobile via Bluetooth, in order to notify the event occurrences.
The entering and leaving events of loads can be managed by using a single RFID antenna fixed on the exit door of the Carrier Station.
Another possibility is doing this control through two or even more antennas uniformly fixed in the Carrier Station, covering the whole area inside the vehicle.
Choosing which approach to use directly implies in the control logic of SafeDuino App.
In case of a single antenna, the SafeDuino App uses a binary tree to represent the vehicles loads.
Initially, the tree is created empty, this indicates that there is no load in the Carrier Station. That way, each tag read by the RFID reader causes a search in the tree.
If the EPC number of tag is found in the tree, a timer is started, if there is no other read of tag within a configurable time, the tag’s node is removed from the tree and a notification is sent to SafeTrack Mobile informing that the load left the vehicle.
If the EPC number of tag is not in the tree, it is inserted and a notification is sent to SafeTrack Mobile informing that the load entered the vehicle.
In the other approach, where the SafeDuino uses two or more antennas, the SafeDuino App requests to the reader the tags that are inside the range, receiving the set of data in a format defined by the manufacturer.
This format can be a vector, a list, or a binary tree. In every new requisition, the SafeDuino App stores the set of current tags (A) and the set of previous tags (B).
Thus, it uses a set of operations to find the loads that entered and left the Carrier Station.
Through the operation A-B is possible to identify all the tags that are now inside the vehicle and then notify the SafeTrack Mobile.
The operation B-A detects the tags that left the Carrier Station since last requisition, notifying this event to the SafeTrack Mobile.
SafeTrack Mobile is an application that runs as a background service in a mobile device, and sends the Carrier Station and loads information to the SafeTrack Server.
The SafeTrack Mobile application was based on Oliveira et al. (2013).
We remodeled the service to allow sending information about the load’s condition, entering and leaving events of loads in the vehicle, and also vehicle’s information.
This application is composed of six components, as the Fig. 5 shows: User Interface, Logical Module, Data Access Module, Offline Buffer, Event Buffer and a communication component, which is subdivided into Service Consumer and Duino Interface.
In the top of architecture, we added a module in a way that the drivers can interact with the SafeTrack Mobile.
With this User Interface, they can see in a map, the current location, the traveled road with visited points, the next stop, and also the remaining stops and final destination.
Moreover, the User Interface provides to the drivers specific information of each set, such as, local and date that every load has to be picked up and delivered.
The communication component is composed by two modules: Service Consumer and Duino Interface.
The Service Consumer is responsible for the communication with the SafeTrack Server, which is done by GPRS using SOAP protocol.
This module packs the information into SOAP messages and sends them through HTTPS to the SafeTrack Server.
In case of reply, the module receives the SOAP messages and transforms them into data structures at a higher level.
The module Duino Interface does the communication between the component SafeDuino and the mobile device, using Bluetooth.
The Logical Module is in charge of processing the data, and also interconnects to other components of SafeTrack Mobile.
It is divided into four submodules. The Access Manager does the user’s authentication with the SafeTrack Server, allowing access control and context management.
The Event Manager deals with the received RFID events through the Duino Interface.
The manager transforms the raw data of events into structured objects and sends them to the Data Access module to be persisted in a temporary storage buffer, called Event Buffer.
The Fusion Manager calculates the latitude, longitude and the current velocity of Carrier Station using the GPS signal.
It also associates the stored RFID events in the Event Buffer to the location’s information and velocity of Carrier Station, sending it to the SafeTrack Server via Service Consumer.
The data is sent in a priority way, so if the Offline Buffer has associated data, it will be sent, otherwise new information of location and velocity are calculated and sent to the SafeTrack Server by the Service Consumer.
In case of error in sending it, the information return to the Offline Buffer until the reestablishment of the connection. After sending, the module Fusion Manager waits the return of SafeTrack Server, informing the alert code to be generated by the SafeTrack Mobile, if there is any problem with the Carrier Station.
In addition, the Alerts Manager module is called to do the necessary measures, making the authentication with the SafeTrack Server.
In this process, a cryptography of the IMEI (International Mobile Equipment Identity) number of the device with a SHA-1 algorithm is sent with other associated information.
The Alerts Manager also has a service to continuously check error’s occurrences, caused by misuse of the device or driver carelessness.
In these cases, besides SMS text messages and audible warnings, the system informs the SafeTrack Server that those problems happened.
The supported alarms are: shutting down the mobile device, low battery of the mobile device, shutting down the GPS, and closing the SafeTrack Mobile application.
The Data Access Module manages the Offline and Event Buffer. The Offline Buffer is a local database that is used only when a connection with the server is lost.
The objective of the Offline Buffer is to keep all acquired positions stored until the connection is restored.
The reason to implement this feature is that sometimes the device can be passing through a shadow zone (an area without GPRS coverage that hinders the device to send data to the server).