Server that handles querying and writing to the database.
There are three main classes in this repository:
- DatabaseManager.java which is responsible for Connecting, writing to, and reading from the database. Writes get json object which have the formart that is described by Mobiper. We then write the main fields into an influx database. Reading on the other hand reads data and converts it into a Json object to send back to the client who asked for the data.
- ServerReadTask The will spawn this thread to work with an http server/client. The idea is that the client will need data to display in form of graphs and hence it will ask via this socket presented in this class for the data. For now this socket just requires the measurement type. Which will change soon.
- ServerWriteTask Finally we have the thread that is responsible for writting the points into the databases. This is going to be a thread that the mobile phones will be sending data for writing to the database. For now, the assumption is that the data is just simple measurments that are to be recorded. We will change these soon.
- Using your client create a socket to connect to the server. Once connected just to the server the
measurement types
for which you need data for and the server will get these and return them to you immediately.
- Ensure that the config files on the phone have the correct server address.
- Connect to this server address and then use this socekct for the duration of the connection to send data to the server in form of a json. for now we are assuming the happy case where all the data is in the correct formart though this will need to change.
This is the format of the data we expect from the mobile phones:
[
{ "device_id": "device ID",
"account_name":"account_name"
"properties": {
"timestamp": "timestamp in ISO8601 format",
"os_version": "device OS version",
"location": {
"latitude": latitude value as floating point decimal degrees,
"longitude": longitude value as floating point decimal degrees
}
"location_type": "location type string",
"network_type": "network type string",
"carrier": "carrier identifier string",
}
"type": "measurement type",
"timestamp": "measurement timestamp in ISO8601 format",
"success": true or false,
"task_key": "task key associated with this measurement, if any",
"parameters": [
{ "paramName1": "paramValue1" },
{ "paramName2": "paramValue2" },
...
],
"values": [
{ "valueName1": "valueValue1" },
{ "valueName2": "valueValue2" },
...
],
},
{ /* Additional Measurement... */ },
{ /* Additional Measurement... */ },
]
From this we will take out the import values fields.
All the time fields represent time in milliseconds
"values": [
{ "target_ip": "String" },
{ "ping_method": "String"},
{"mean_rtt_ms": "Double"},
{"min_rtt_ms":"Double"},
{"max_rtt_ms":"Double"},
{"stddev_rtt_ms":"Double"}
]
"values": [
{"num_hps ": "number" },
{"hop_N_addr_i": "Map/List of Pairs"},
{"hop_N_rtt_ms ": "List of Doubles"}
]
"values": [
{ "address": "String" },
{ "real_hostname": "String"},
{"time_ms": "Double"}
]
"values": [
{"time_ms": "String"},
{"code": "String"}
]
"values": [
{"tcp_speed_results": "List of results"},
{"data_limit_exceeded": "Boolean"},
{"duration":"Double"},
{"server_version":"String"}
]
"values": [
{"time_ms": "String"},
{"code": "String"}
]
Check out the Issues that still need to be fixed.