Skip to content

Commit

Permalink
Polar H10 (#274)
Browse files Browse the repository at this point in the history
Polar H10 initial
  • Loading branch information
DigiH authored Jan 31, 2023
1 parent 24895d9 commit e6e2fc9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/devices/PH10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Polar H10 Heart Rate Sensor

|Model Id|[H10](https://github.com/theengs/decoder/blob/development/src/devices/PH10_json.h)|
|-|-|
|Brand|Polar|
|Model|Heart Rate Sensor|
|Short Description|Chest strap heart rate sensor|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power source|CR2025|
|Exchanged data|heart rate|
|Encrypted|No|
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class TheengsDecoder {
ABN03,
ABTEMP,
AMPHIRO,
PH10,
TPTH,
MOPEKA,
T201,
Expand Down
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include "devices/ABN03_json.h"
#include "devices/ABTemp_json.h"
#include "devices/Amphiro_json.h"
#include "devices/PH10_json.h"
#include "devices/TPTH_json.h"
#include "devices/Mopeka_json.h"
#include "devices/T201_json.h"
Expand Down Expand Up @@ -142,6 +143,7 @@ const char* _devices[][2] = {
{_ABN03_json, _ABN03_json_props},
{_ABTemp_json, _ABTemp_json_props},
{_AMPHIRO_json, _AMPHIRO_json_props},
{_PH10_json, _PH10_json_props},
{_TPTH_json, _TPTH_json_props},
{_Mopeka_json, _Mopeka_json_props},
{_T201_json, _T201_json_props},
Expand Down
24 changes: 24 additions & 0 deletions src/devices/PH10_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const char* _PH10_json = "{\"brand\":\"Polar\",\"model\":\"Heart Rate Sensor\",\"model_id\":\"H10\",\"condition\":[\"manufacturerdata\",\"=\",12,\"index\",0,\"6b00\"],\"properties\":{\"bpm\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",10,2,false,false]}}}";
/*R""""(
{
"brand":"Polar",
"model":"Heart Rate Sensor",
"model_id":"H10",
"condition":["manufacturerdata", "=", 12, "index", 0, "6b00"],
"properties":{
"bpm":{
"decoder":["value_from_hex_data", "manufacturerdata", 10, 2, false, false]
}
}
})"""";*/

const char* _PH10_json_props = "{\"properties\":{\"bpm\":{\"unit\":\"bpm\",\"name\":\"heart rate\"}}}";
/*R""""(
{
"properties":{
"bpm":{
"unit":"bpm",
"name":"heart rate"
}
}
})"""";*/
6 changes: 6 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ const char* expected_mfg[] = {
"{\"brand\":\"Govee\",\"model\":\"Smart Air Quality Monitor\",\"model_id\":\"H5106\",\"cidc\":false,\"tempc\":-7.5,\"tempf\":18.5,\"hum\":76,\"pm25\":0}",
"{\"brand\":\"Govee\",\"model\":\"Smart Air Quality Monitor\",\"model_id\":\"H5106\",\"cidc\":false,\"tempc\":-2.7,\"tempf\":27.14,\"hum\":94,\"pm25\":7}",
"{\"brand\":\"Govee\",\"model\":\"Smart Air Quality Monitor\",\"model_id\":\"H5106\",\"cidc\":false,\"tempc\":-9.8,\"tempf\":14.36,\"hum\":64,\"pm25\":1}",
"{\"brand\":\"Polar\",\"model\":\"Heart Rate Sensor\",\"model_id\":\"H10\",\"bpm\":70}",
"{\"brand\":\"Polar\",\"model\":\"Heart Rate Sensor\",\"model_id\":\"H10\",\"bpm\":104}",
};

const char* expected_name_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -365,6 +367,8 @@ const char* test_mfgdata[][3] = {
{"H5106", "GVH5106_1234", "01000101848420c0"},
{"H5106", "GVH5106_1234", "0100010181aa77cf"},
{"H5106", "GVH5106_1234", "0100010185e12c39"},
{"Polar", "Polar H10 75087320", "6b003b164446"},
{"Polar", "Polar H10 75087320", "6b002f166b68"},
};

TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
Expand Down Expand Up @@ -451,6 +455,8 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::H5106,
TheengsDecoder::BLE_ID_NUM::H5106,
TheengsDecoder::BLE_ID_NUM::H5106,
TheengsDecoder::BLE_ID_NUM::PH10,
TheengsDecoder::BLE_ID_NUM::PH10,
};

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

0 comments on commit e6e2fc9

Please sign in to comment.