Closed ppyordanov closed 9 years ago
Data is loaded into project models via the _loadModels()_ method. It takes a _JSON InputStream_ as an inpout parameter and parses the data making use of the _Genson serializer_. Converted models are then inserted into a list, which is returned to the caller.
Below is the method signature:
public ArrayList<DataReading> loadModels(InputStream JSONresource);
New model data structure (JSON serialized):
{
"id": 1,
"route_id": 1,
"device_id": 1,
"timestamp": "2014-10-13 10:01:45",
"longitude": 14.7,
"latitude": 148.8,
"temperature": 20,
"co": 50,
"no2": 50,
"battery": 66.3
}
The SCK RESTful API provides data in a slightly different format compared to this project's model structure. The data needs to be reformatted /parsed/ in order to be loaded into a model set for DB insertion.