Skip to content

Commit

Permalink
Impedance ??
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH committed Feb 14, 2024
1 parent 839b457 commit 74f29c9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/devices/EVOLVE_json.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
const char* _EVOLVE_json = "{\"brand\":\"e.volve\",\"model\":\"Scale\",\"model_id\":\"EVOLVE\",\"tag\":\"0501\",\"condition\":[\"manufacturerdata\",\"=\",28,\"index\",0,\"aca0\",\"&\",\"manufacturerdata\",\"index\",16,\"20\"],\"properties\":{\"weight\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",18,6,false,false],\"post_proc\":[\"^\",2924704,\"/\",1000]},\"unit\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",26,1,false,false],\"lookup\":[\"a\",\"kg\",\"b\",\"kg\",\"8\",\"lb\",\"9\",\"lb\",\"e\",\"st\",\"f\",\"st\"]},\"mac\":{\"decoder\":[\"revmac_from_hex_data\",\"manufacturerdata\",4]}}}";
const char* _EVOLVE_json = "{\"brand\":\"e.volve\",\"model\":\"Scale\",\"model_id\":\"EVOLVE\",\"tag\":\"0501\",\"condition\":[\"manufacturerdata\",\"index\",16,\"20\",\"|\",\"manufacturerdata\",\"index\",16,\"ad\",\"&\",\"manufacturerdata\",\"=\",28,\"index\",0,\"aca0\"],\"properties\":{\"weight\":{\"condition\":[\"manufacturerdata\",16,\"20\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",18,6,false,false],\"post_proc\":[\"^\",2924704,\"/\",1000]},\"unit\":{\"condition\":[\"manufacturerdata\",16,\"20\"],\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",26,1],\"lookup\":[\"a\",\"kg\",\"b\",\"kg\",\"8\",\"lb\",\"9\",\"lb\",\"e\",\"st:lb\",\"f\",\"st:lb\"]},\"impedance\":{\"condition\":[\"manufacturerdata\",16,\"ad\"],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",18,6,false,false],\"post_proc\":[\"^\",2924704,\"/\",10000]},\"mac\":{\"decoder\":[\"revmac_from_hex_data\",\"manufacturerdata\",4]}}}";
/*R""""(
{
"brand":"e.volve",
"model":"Scale",
"model_id":"EVOLVE",
"tag":"0501",
"condition":["manufacturerdata", "=", 28, "index", 0, "aca0" , "&", "manufacturerdata", "index", 16, "20"],
"condition":["manufacturerdata", "index", 16, "20", "|", "manufacturerdata", "index", 16, "ad", "&", "manufacturerdata", "=", 28, "index", 0, "aca0"],
"properties":{
"weight":{
"condition":["manufacturerdata", 16, "20"],
"decoder":["value_from_hex_data", "manufacturerdata", 18, 6, false, false],
"post_proc":["^", 2924704, "/", 1000]
},
"unit":{
"decoder":["string_from_hex_data", "manufacturerdata", 26, 1, false, false],
"condition":["manufacturerdata", 16, "20"],
"decoder":["string_from_hex_data", "manufacturerdata", 26, 1],
"lookup":["a", "kg",
"b", "kg",
"8", "lb",
"9", "lb",
"e", "st:lb",
"f", "st:lb"]
},
"impedance":{
"condition":["manufacturerdata", 16, "ad"],
"decoder":["value_from_hex_data", "manufacturerdata", 18, 6, false, false],
"post_proc":["^", 2924704, "/", 10000]
},
"mac":{
"decoder":["revmac_from_hex_data", "manufacturerdata", 4]
}
}
})"""";*/

const char* _EVOLVE_json_props = "{\"properties\":{\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"},\"unit\":{\"unit\":\"string\",\"name\":\"unit\"},\"mac\":{\"unit\":\"string\",\"name\":\"MAC address\"}}}";
const char* _EVOLVE_json_props = "{\"properties\":{\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"},\"unit\":{\"unit\":\"string\",\"name\":\"unit\"},\"impedance\":{\"unit\":\"Ω\",\"name\":\"impedance\"},\"mac\":{\"unit\":\"string\",\"name\":\"MAC address\"}}}";
/*R""""(
{
"properties":{
Expand All @@ -38,6 +45,10 @@ const char* _EVOLVE_json_props = "{\"properties\":{\"weight\":{\"unit\":\"kg\",\
"unit":"string",
"name":"unit"
},
"impedance":{
"unit":"Ω",
"name":"impedance"
},
"mac":{
"unit":"string",
"name":"MAC address"
Expand Down
3 changes: 3 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const char* expected_mfg[] = {
"{\"brand\":\"Mobvoi\",\"model\":\"TicWatch GTH (Pro)\",\"model_id\":\"TICWATCHGTH\",\"type\":\"TRACK\",\"cidc\":false,\"acts\":true,\"track\":true,\"device\":\"TicWatch GTH (Pro) Tracker\"}",
"{\"brand\":\"XOSS\",\"model\":\"X2 Heart Rate Sensor\",\"model_id\":\"XOSSX2\",\"type\":\"BODY\",\"cidc\":false,\"bpm\":63,\"batt\":97}",
"{\"brand\":\"e.volve\",\"model\":\"Scale\",\"model_id\":\"EVOLVE\",\"type\":\"SCALE\",\"cidc\":false,\"weight\":69.874,\"unit\":\"kg\",\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"e.volve\",\"model\":\"Scale\",\"model_id\":\"EVOLVE\",\"type\":\"SCALE\",\"cidc\":false,\"impedance\":281.8048,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
};

const char* expected_name_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -544,6 +545,7 @@ const char* test_mfgdata[][3] = {
{"Mobvoi", "TicWatch GTH Pro", "0000aabbccddeeff"},
{"XOSS", "X2", "04ff0161063f"},
{"E.volve", "Scale", "aca0ffeeddccbbaa202db0520db4"},
{"E.volve", "Scale", "aca0ffeeddccbbaaad07a0a00bbf"},
};

TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
Expand Down Expand Up @@ -674,6 +676,7 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::TICWATCHGTH,
TheengsDecoder::BLE_ID_NUM::XOSSX2,
TheengsDecoder::BLE_ID_NUM::EVOLVE,
TheengsDecoder::BLE_ID_NUM::EVOLVE,
};

// uuid test input [test name] [device name] [uuid] [manufacturer data] [service data]
Expand Down

0 comments on commit 74f29c9

Please sign in to comment.