The GraphQL APIs can be accessed via http://xxx.xxx.xxx.xxx:8000/graphql. If you are connected via the hotspot use 192.168.42.1 to access the APIs. If you are connected to the internet, you can use the IP address of the server instead of the hotspots. Replace the “xxx.xxx.xxx.xxx” in http://xxx.xxx.xxx.xxx:8000/graphql with this IP address.
Important remark: when connecting to the GraphQL development interface via hotspot, the server still needs a working internet connection, in order to download some browser libraries from CDN. In future versions the latter requirement will be dropped.
All documentation regarding the APIs can be found in the Documentation Explorer at the right hand side at http://xxx.xxx.xxx.xxx:8000/graphql.
Click on ‘Docs’ in the upper right corner to open this Documentation Explorer. A list of all available queries and mutations is shown there.
For example, to retrieve the vibration data, you first need to retrieve the exact timestamps using vibrationTimestampHistory and then use these timestamps to get the vibrationArray you want.
{
deviceManager {
device(macId: “78:47:8e:af”) {
__typename
… on GrapheneVibrationCombo {
vibrationTimestampHistory(limit:10)
}
}
}
}
On top of the exact date, you need to specify which fields you want to retrieve out of the vibrationArray.
{
deviceManager {
deviceList {
parent
macId
tag
}
device(macId: “78:47:8e:af “) {
__typename
… on GrapheneVibrationCombo {
lastSeen
vibrationTimestampHistory
vibrationArray(isoDate: “2018-03-08T09:12:48.681441+00:00”) {
axis
numSamples
sampleRate
rawSamples
formatRange
}
}
}
}
}
The result of this vibrationArray request is a raw AccelerationPack structure. This object packs the following data:
AccelerationPack =
- numSamples: number of samples in the vibration array
- rawSamples: raw, unscaled vibration array
- sampleRate: [Hz]
- formatRange: sensitivity during capture (e.g 4 == ±4g)
- axis: ‘X’, ‘Y’ or ‘Z’
Please keep in mind that the rawSamples part contains the raw vibration data and you still need to convert it to g units.
Raw Vibration Data -> Acceleration[g]
The raw vibration vector is converted to acceleration g-units with the following conversion formula, (n == numSamples):
Accel[g]=rawSamples[1..n]/512.*formatRange
Times[s]=[0:n-1]./sampleRate