diff --git a/docs/devices/XOSSX2.md b/docs/devices/XOSSX2.md new file mode 100644 index 000000000..65b58225b --- /dev/null +++ b/docs/devices/XOSSX2.md @@ -0,0 +1,12 @@ +# XOSS X2 Heart Rate Sensor + +|Model Id|[XOSSX2](https://github.com/theengs/decoder/blob/development/src/devices/XOSSX2_json.h)| +|-|-| +|Brand|XOSS| +|Model|X2 Heart Rate Sensor| +|Short Description|Chest strap heart rate sensor| +|Communication|BLE broadcast| +|Frequency|2.4Ghz| +|Power Source|CR2032| +|Exchanged Data|heart rate, battery| +|Encrypted|No| diff --git a/src/decoder.h b/src/decoder.h index 4842400ad..b65040947 100644 --- a/src/decoder.h +++ b/src/decoder.h @@ -123,6 +123,7 @@ class TheengsDecoder { AMPHIRO, ORALB_BT, PH10, + XOSSX2, TPTH, MOPEKA, T201, diff --git a/src/devices.h b/src/devices.h index 668879d31..8b28cb9d4 100644 --- a/src/devices.h +++ b/src/devices.h @@ -78,6 +78,7 @@ #include "devices/Amphiro_json.h" #include "devices/OralB_json.h" #include "devices/PH10_json.h" +#include "devices/XOSSX2_json.h" #include "devices/TPTH_json.h" #include "devices/Mopeka_json.h" #include "devices/T201_json.h" @@ -189,6 +190,7 @@ const char* _devices[][2] = { {_AMPHIRO_json, _AMPHIRO_json_props}, {_OralB_json, _OralB_json_props}, {_PH10_json, _PH10_json_props}, + {_XOSSX2_json, _XOSSX2_json_props}, {_TPTH_json, _TPTH_json_props}, {_Mopeka_json, _Mopeka_json_props}, {_T201_json, _T201_json_props}, diff --git a/src/devices/XOSSX2_json.h b/src/devices/XOSSX2_json.h new file mode 100644 index 000000000..c7b2cb4ac --- /dev/null +++ b/src/devices/XOSSX2_json.h @@ -0,0 +1,33 @@ +const char* _XOSSX2_json = "{\"brand\":\"XOSS\",\"model\":\"X2 Heart Rate Sensor\",\"model_id\":\"XOSSX2\",\"tag\":\"0b00\",\"condition\":[\"manufacturerdata\",\"=\",12,\"index\",0,\"04ff\"],\"properties\":{\"bpm\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",10,2,false,false]},\"batt\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",6,2,false,false],\"post_proc\":[\"&\",127]}}}"; +/*R""""( +{ + "brand":"XOSS", + "model":"X2 Heart Rate Sensor", + "model_id":"XOSSX2", + "tag":"0b00", + "condition":["manufacturerdata", "=", 12, "index", 0, "04ff"], + "properties":{ + "bpm":{ + "decoder":["value_from_hex_data", "manufacturerdata", 10, 2, false, false] + }, + "batt":{ + "decoder":["value_from_hex_data", "manufacturerdata", 6, 2, false, false], + "post_proc":["&", 127] + } + } +})"""";*/ + +const char* _XOSSX2_json_props = "{\"properties\":{\"bpm\":{\"unit\":\"bpm\",\"name\":\"heart rate\"},\"batt\":{\"unit\":\"%\",\"name\":\"battery\"}}}"; +/*R""""( +{ + "properties":{ + "bpm":{ + "unit":"bpm", + "name":"heart rate" + }, + "batt":{ + "unit":"%", + "name":"battery" + } + } +})"""";*/ diff --git a/tests/BLE/test_ble.cpp b/tests/BLE/test_ble.cpp index e5fed00fe..ff1e8fda4 100644 --- a/tests/BLE/test_ble.cpp +++ b/tests/BLE/test_ble.cpp @@ -145,6 +145,7 @@ const char* expected_mfg[] = { "{\"brand\":\"Theengs\",\"model\":\"iBeacon Tracker\",\"model_id\":\"TheengsIB01\",\"type\":\"TRACK\",\"cidc\":false,\"track\":true,\"device\":\"Theengs iBeacon Tracker\"}", "{\"brand\":\"Theengs\",\"model\":\"iBeacon Tracker\",\"model_id\":\"TheengsIB02\",\"type\":\"TRACK\",\"cidc\":false,\"track\":true,\"prmac\":true,\"device\":\"Theengs iBeacon Tracker\"}", "{\"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\",\"bpm\":63,\"batt\":97}", }; const char* expected_name_uuid_mfgsvcdata[] = { @@ -540,6 +541,7 @@ const char* test_mfgdata[][3] = { {"Theengs", "iBeacon Tracker", "4c000215546865656e67732d69426561636f6e31f644000064"}, {"Theengs", "iBeacon Tracker", "4c000215546865656e67732d69426561636f6e32f644000064"}, {"Mobvoi", "TicWatch GTH Pro", "0000aabbccddeeff"}, + {"XOSS", "X2", "04ff0161063f"}, }; TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ @@ -668,6 +670,7 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{ TheengsDecoder::BLE_ID_NUM::TheengsIB01, TheengsDecoder::BLE_ID_NUM::TheengsIB02, TheengsDecoder::BLE_ID_NUM::TICWATCHGTH, + TheengsDecoder::BLE_ID_NUM::XOSSX2, }; // uuid test input [test name] [device name] [uuid] [manufacturer data] [service data]