-
Notifications
You must be signed in to change notification settings - Fork 7
What is Suripu
Tim Bart edited this page Apr 29, 2014
·
4 revisions
Suripu is composed of three parts:
- The service which listens for incoming data over HTTP / Protobuf and stores it.
- The Oauth2 API which provides a way to access the data
- The factory which exposes an HTTP endpoint to store public key generated at the factory level.
We have chosen Protobuf as a serialization protocol for exchanging information over the wire. The main benefits are small footprint, extensibility and built-in documentation.
message SimpleSensorBatch {
message GpsInfo {
optional float latitude = 1;
optional float longitude = 2;
optional float accuracy = 3;
optional float speed = 4;
optional string provider = 5;
}
message SimpleSensorSample {
optional int64 timestamp = 1;
optional float ambient_temperature = 2; // deprecated
optional float ambient_humidity = 3; // deprecated
optional float ambient_light = 4; // deprecated
optional float ambient_decibels = 5;
optional float ambient_air_quality = 6; // deprecated
optional bytes device_data = 7; //
optional bytes device_data_signature = 8;
optional float sound_amplitude = 9;
optional GpsInfo gps = 10;
optional int32 offset_millis = 11;
}
optional string device_id = 1;
repeated SimpleSensorSample samples = 2;
}
A SimpleSensorBatch
message contains a list of SimpleSensorSample
collected from device, phone and/or both.
The GPS information, is for instance, only available on the phone, whereas the air quality is only collected on the device.
SimpleSensorSample
contains a free form byte payload optional bytes device_data = 7;
for which, there is no spec yet. The current implementation is as follows:
final LittleEndianDataInputStream dataInputStream = new LittleEndianDataInputStream(inputStream);
int temp, light, humidity, airQuality;
long timestamp;
timestamp = dataInputStream.readLong();
temp = dataInputStream.readInt();
light = dataInputStream.readInt();
humidity = dataInputStream.readInt();
airQuality = dataInputStream.readInt();
Dropwizard/Jersey is used for the HTTP framework on top of which suripu is built, for both receiving data – the service – and processing API requests.