Remote storage services allow our partners to store and retrieve any amount of data, at any time. Integrating a remote storage service to one of your projects will allow our cloud to write the data we receive to your remote storage. Bluzone aims to integrate with several leading providers. At this time, Bluzone supports Amazon Simple Storage Service (S3). Integrating a S3 bucket into our project is extremely straightforward. The following tutorial describes how to integrate a S3 bucket into your project through the Bluzone Portal.
The following steps outline how to configure a Bluzone project to archive data to a S3 bucket.
Select the configuration from the grid
Uncheck the "Enable this remote storage" box
Click "Save"
The Bluzone app will take a few minutes to setup the remote storage. Once it's finished, our cloud will begin writing data to your bucket.
The data stored in the S3 bucket is in Protocol Buffer format (https://developers.google.com/protocol-buffers/). Furthermore, the data can be either High Speed Motion Data or Location Event Data. The the "protobuf" file that can be used to generate stub code for parsing the message structure of High Speed Motion Data is beaconmetrics.proto and similiarly the file necessary for Location Event data is locpb.proto (more information regarding the syntax of the .proto file can be found here).
To generate the classes you'll need to read BeaconMetrics messages you need to install the protocol buffer compiler, protoc. See here for detailed installation instructions: https://github.com/google/protobuf, e.g.
wget https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip ~/Downloads mkdir -p ~/Downloads/protoc cd $_ unzip ~/Downloads/protoc-3.4.0-osx-x86_64.zip cp bin/protoc /usr/local/bin rm -fR ~/Downloads/protoc-3.4.0-osx-x86_64.zip ~/Downloads/protoc |
To create a Java class from the proto file run the following command. A Java class will be created, e.g. Beaconmetrics.java.
protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/beaconmetrics.proto |
Once you have the Java class you can begin parsing BeaconMetric files stored in Protocol Buffer Format. For example,
BeaconMetrics.BeaconRawMetricMap beaconRawMetricMap = BeaconMetrics.BeaconRawMetricMap.parseFrom(new FileInputStream("<FILE_PATH>"); beaconRawMetricMap.getResultsMap(); |
Alternatively, you can use protoc to parse the data. For example,
protoc --decode_raw < ~/Downloads/2017-09-29.proto.gz |
For a detailed tutorial on Protocol Buffers go here.