Skip to content

Commit

Permalink
Merge changes for v1.0.0
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
thorrak committed Feb 11, 2021
2 parents 64ed1a1 + 345eec0 commit 5fcb188
Show file tree
Hide file tree
Showing 128 changed files with 9,380 additions and 21,568 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.pioenvs
.piolibdeps
CMakeListsPrivate.txt
platformio*.log

### C++ template
# Prerequisites
Expand Down
44 changes: 44 additions & 0 deletions Json Models/BF (Both) JSON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Brewer's Friend / Brewfather JSON

```
{
"name": "Yellow",
"temp": "100.1",
"temp_unit": "F",
"gravity": "1.0123",
"gravity_unit": "G",
"device_source": "TiltBridge"
}
```

## Serialize:

```
StaticJsonDocument<192> doc;
doc["name"] = "Yellow";
doc["temp"] = "100.1";
doc["temp_unit"] = "F";
doc["gravity"] = "1.0123";
doc["gravity_unit"] = "G";
doc["device_source"] = "TiltBridge";
serializeJson(doc, output);
```

## Deserialize:

```
// const char* input;
// size_t inputLength; (optional)
StaticJsonDocument<96> doc;
deserializeJson(doc, input, inputLength);
const char* name = doc["name"]; // "Yellow"
const char* temp = doc["temp"]; // "100.1"
const char* temp_unit = doc["temp_unit"]; // "F"
const char* gravity = doc["gravity"]; // "1.0123"
const char* gravity_unit = doc["gravity_unit"]; // "G"
const char* device_source = doc["device_source"]; // "TiltBridge"
```
260 changes: 260 additions & 0 deletions Json Models/Configuration JSON.md

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions Json Models/GSheets JSON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# GSheets JSON

## Send

```
{
"Beer":"xxxxxxxxxxxxxxxxxxxxxxxxx",
"Temp":"xxxxx",
"SG":"xxxxxxx",
"Color":"xxxxxxx",
"Comment":"",
"Email":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tzOffset":-12
}
```

### Serialize:

```
StaticJsonDocument<512> doc;
doc["Beer"] = "xxxxxxxxxxxxxxxxxxxxxxxxx";
doc["Temp"] = "xxxxx";
doc["SG"] = "xxxxxxx";
doc["Color"] = "xxxxxxx";
doc["Comment"] = "";
doc["Email"] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
doc["tzOffset"] = -12;
String output;
serializeJson(doc, output);
```

### Deserialize:

```
// String input;
StaticJsonDocument<512> doc;
deserializeJson(doc, input);
const char* Beer = doc["Beer"]; // "xxxxxxxxxxxxxxxxxxxxxxxxx"
const char* Temp = doc["Temp"]; // "xxxxx"
const char* SG = doc["SG"]; // "xxxxxxx"
const char* Color = doc["Color"]; // "xxxxxxx"
const char* Comment = doc["Comment"]; // ""
const char* Email = doc["Email"];
int tzOffset = doc["tzOffset"]; // -12
```

## Respond

```
{
"result":"</br>Xxxxxxxxxxxxxxxxxxxxxxxxx</br><strong>TILT | Xxxxxxx</strong></br>Success logging data to the cloud. (row: 64xxx)",
"beername":"Xxxxxxxxxxxxxxxxxxxxxxxxx",
"tiltcolor":"Xxxxxxx",
"doclongurl":"https://docs.google.com/spreadsheets/d/1wK198LabkHZsK330lhKYYu9FNsDwRT8fiRFjLswodys/edit?ouid=111807419907392952307&urlBuilderDomain=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx"
}
```

### Serialize:

```
// Stream& output;
StaticJsonDocument<512> doc;
doc["result"] = "</br>Xxxxxxxxxxxxxxxxxxxxxxxxx</br><strong>TILT | Xxxxxxx</strong></br>Success logging data to the cloud. (row: 64xxx)";
doc["beername"] = "Xxxxxxxxxxxxxxxxxxxxxxxxx";
doc["tiltcolor"] = "Xxxxxxx";
doc["doclongurl"] = "https://docs.google.com/spreadsheets/d/1wK198LabkHZsK330lhKYYu9FNsDwRT8fiRFjLswodys/edit?ouid=111807419907392952307&urlBuilderDomain=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxx";
serializeJson(doc, output);
```

### Deserialize:

```
// Stream& input;
StaticJsonDocument<512> doc;
deserializeJson(doc, input);
const char* result = doc["result"]; // "</br>Xxxxxxxxxxxxxxxxxxxxxxxxx</br><strong>TILT | ...
const char* beername = doc["beername"]; // "Xxxxxxxxxxxxxxxxxxxxxxxxx"
const char* tiltcolor = doc["tiltcolor"]; // "Xxxxxxx"
const char* doclongurl = doc["doclongurl"];
```
37 changes: 37 additions & 0 deletions Json Models/Heap JSON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Heap JSON

```
{
"free":999999,
"max":999999,
"frag":99
}
```

## Serialize:

```
DynamicJsonDocument doc(48);
doc["free"] = 999999;
doc["max"] = 999999;
doc["frag"] = 99;
serializeJson(doc, Serial);
```

## Deserialize:

```
const char* json = "{\"free\":999999,\"max\":999999,\"frag\":99}";
StaticJsonDocument<0> filter;
filter.set(true);
DynamicJsonDocument doc(96);
deserializeJson(doc, json, DeserializationOption::Filter(filter));
long free = doc["free"]; // 999999
long max = doc["max"]; // 999999
int frag = doc["frag"]; // 99
```
31 changes: 31 additions & 0 deletions Json Models/Reset Reason JSON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Reset Reason JSON

```
{
"reason":"REASON_DEEP_SLEEP_AWAKE",
"resetDescription":"Software restart, system_restart, GPIO status won’t change"
}
```

## Serialize:

```
DynamicJsonDocument doc(128);
doc["reason"] = "REASON_DEEP_SLEEP_AWAKE";
doc["resetDescription"] = "Software restart, system_restart, GPIO status won’t change";
serializeJson(doc, Serial);
```

## Deserialize:

```
const char* json = "{\"reason\":\"REASON_DEEP_SLEEP_AWAKE\",\"resetDescription\":\"Software restart, system_restart, GPIO status won’t change\"}";
DynamicJsonDocument doc(192);
deserializeJson(doc, json);
const char* reason = doc["reason"]; // "REASON_DEEP_SLEEP_AWAKE"
const char* resetDescription = doc["resetDescription"]; // "Software restart, system_restart, GPIO status won’t change"
```
55 changes: 55 additions & 0 deletions Json Models/Tilt Hydrometer JSON.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Tilt Hydrometer JSON

This is the return from `tiltHydrometer::to_json_string()`.

```
{
"color":"Yellow",
"temp":"100.1",
"tempUnit":"F",
"gravity":"1.0123",
"gsheets_name":"XXXXXXXXXXXXXXXXXXXXXXXXX",
"weeks_on_battery":123,
"sends_battery":false,
"high_resolution":false,
"fwVersion":1001,
"rssi":-75
}
```

## Serialize:

```
DynamicJsonDocument doc(256);
doc["color"] = "Yellow";
doc["temp"] = "100.1";
doc["tempUnit"] = "F";
doc["gravity"] = "1.0123";
doc["gsheets_name"] = "XXXXXXXXXXXXXXXXXXXXXXXXX";
doc["weeks_on_battery"] = 123;
doc["sends_battery"] = false;
doc["high_resolution"] = false;
doc["fwVersion"] = 1001;
doc["rssi"] = -75;
serializeJson(doc, output);
```

## Deserialize:

```
DynamicJsonDocument doc(384);
deserializeJson(doc, input);
const char* color = doc["color"]; // "Yellow"
const char* temp = doc["temp"]; // "100.1"
const char* tempUnit = doc["tempUnit"]; // "F"
const char* gravity = doc["gravity"]; // "1.0123"
const char* gsheets_name = doc["gsheets_name"]; // "XXXXXXXXXXXXXXXXXXXXXXXXX"
int weeks_on_battery = doc["weeks_on_battery"]; // 123
bool sends_battery = doc["sends_battery"]; // false
bool high_resolution = doc["high_resolution"]; // false
int fwVersion = doc["fwVersion"]; // 1001
int rssi = doc["rssi"]; // -75
```

0 comments on commit 5fcb188

Please sign in to comment.