Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlueCharm BC04P and BC021 #332

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/devices/BC08.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# BlueCharm Beacon 08
# BlueCharm Beacon 08/04P/021

|Model Id|[BC08](https://github.com/theengs/decoder/blob/development/src/devices/BC08_json.h)|
|Model Id|[KSensor](https://github.com/theengs/decoder/blob/development/src/devices/BC08_json.h)|
|-|-|
|Brand|BlueCharm|
|Model|Beacon 08|
|Short Description|Water-Resistant MultiBeacon (KBeacon and iBeacon protocols supported)|
|Model|Beacon 08/04P/021|
|Short Description|Water-Resistant (not the BC021) MultiBeacon (KBeacon and iBeacon protocols supported)|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power source|CR2477|
Expand Down
9 changes: 5 additions & 4 deletions src/devices/BC08_json.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const char* _BC08_json = "{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08\",\"model_id\":\"BC08\",\"tag\":\"0708\",\"condition\":[\"servicedata\",\"=\",26,\"&\",\"uuid\",\"index\",0,\"feaa\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",10,2,false,true]},\"accx\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",14,4,false,true]},\"accy\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,false,true]},\"accz\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,false,true]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",6,4,false,false],\"post_proc\":[\"/\",1000]}}}";
const char* _BC08_json = "{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08/04P/021\",\"model_id\":\"KSensor\",\"tag\":\"0708\",\"condition\":[\"servicedata\",\"=\",26,\"&\",\"uuid\",\"index\",0,\"feaa\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",10,4,false,true],\"post_proc\":[\"/\",253]},\"accx\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",14,4,false,true]},\"accy\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,false,true]},\"accz\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,false,true]},\"volt\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",6,4,false,false],\"post_proc\":[\"/\",1000]}}}";
/*R""""(
{
"brand":"BlueCharm",
"model":"Beacon 08",
"model_id":"BC08",
"model":"Beacon 08/04P/021",
"model_id":"KSensor",
"tag":"0708",
"condition":["servicedata", "=", 26, "&", "uuid", "index", 0, "feaa"],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "servicedata", 10, 2, false, true]
"decoder":["value_from_hex_data", "servicedata", 10, 4, false, true],
"post_proc":["/", 253]
},
"accx":{
"decoder":["value_from_hex_data", "servicedata", 14, 4, false, true]
Expand Down
13 changes: 11 additions & 2 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ const char* expected_uuid[] = {
"{\"brand\":\"ClearGrass/Qingping\",\"model\":\"Alarm Clock\",\"model_id\":\"CGC1/CGD1\",\"type\":\"THB\",\"tempc\":21,\"tempf\":69.8,\"hum\":51,\"batt\":100}",
"{\"brand\":\"Jaalee\",\"model\":\"TH sensor\",\"model_id\":\"F525\",\"type\":\"THB\",\"acts\":true,\"tempc\":24.5147998,\"tempf\":76.12663965,\"hum\":36.84286499,\"batt\":100}",
"{\"brand\":\"SwitchBot\",\"model\":\"Curtain\",\"model_id\":\"W070160X\",\"type\":\"WCVR\",\"acts\":true,\"motion\":false,\"position\":100,\"calibrated\":true,\"lightlevel\":1,\"batt\":17}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08\",\"model_id\":\"BC08\",\"type\":\"ACEL\",\"track\":true,\"tempc\":24,\"tempf\":75.2,\"accx\":33,\"accy\":-3,\"accz\":-1006,\"volt\":3.091}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08\",\"model_id\":\"BC08\",\"type\":\"ACEL\",\"track\":true,\"tempc\":-11,\"tempf\":12.2,\"accx\":-107,\"accy\":-407,\"accz\":-896,\"volt\":3.085}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08/04P/021\",\"model_id\":\"KSensor\",\"type\":\"ACEL\",\"track\":true,\"tempc\":24.28458498,\"tempf\":75.71225296,\"accx\":33,\"accy\":-3,\"accz\":-1006,\"volt\":3.091}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08/04P/021\",\"model_id\":\"KSensor\",\"type\":\"ACEL\",\"track\":true,\"tempc\":-11.13043478,\"tempf\":11.96521739,\"accx\":-107,\"accy\":-407,\"accz\":-896,\"volt\":3.085}",
"{\"brand\":\"SwitchBot\",\"model\":\"Contact Sensor\",\"model_id\":\"W120150X\",\"type\":\"CTMO\",\"acts\":true,\"cont\":true,\"contact\":\"timeout not closed\",\"movement\":false,\"lightlevel\":\"dark\",\"scopetested\":false,\"in_ct\":1,\"out_ct\":0,\"push_ct\":2,\"batt\":100}",
"{\"brand\":\"SwitchBot\",\"model\":\"Motion Sensor\",\"model_id\":\"W110150X\",\"type\":\"CTMO\",\"acts\":true,\"cont\":true,\"movement\":false,\"led\":false,\"scopetested\":false,\"sensingdistance\":\"long\",\"lightlevel\":\"bright\",\"batt\":100}",
"{\"brand\":\"Tile\",\"model\":\"Smart Tracker\",\"model_id\":\"TILE\",\"type\":\"TRACK\",\"cidc\":false,\"acts\":true,\"cont\":true,\"track\":true,\"device\":\"Tile Tracker\"}",
Expand All @@ -253,6 +253,9 @@ const char* expected_uuid[] = {
"{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY10\",\"type\":\"PLANT\",\"tempc\":11,\"tempf\":51.8,\"moi\":14,\"lux\":79012,\"fer\":91,\"batt\":40}",
"{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY10\",\"type\":\"PLANT\",\"tempc\":0,\"tempf\":32,\"moi\":98,\"lux\":71,\"fer\":0,\"batt\":100}",
"{\"brand\":\"Xiaomi/VegTrug\",\"model\":\"MiFlora\",\"model_id\":\"HHCCJCY10\",\"type\":\"PLANT\",\"tempc\":21,\"tempf\":69.8,\"moi\":96,\"lux\":548,\"fer\":0,\"batt\":100}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08/04P/021\",\"model_id\":\"KSensor\",\"type\":\"ACEL\",\"track\":true,\"tempc\":22.26086957,\"tempf\":72.06956522,\"accx\":31,\"accy\":31,\"accz\":-859,\"volt\":3.162}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08/04P/021\",\"model_id\":\"KSensor\",\"type\":\"ACEL\",\"track\":true,\"tempc\":30.35573123,\"tempf\":86.64031621,\"accx\":34,\"accy\":-14,\"accz\":977,\"volt\":3.03}",
"{\"brand\":\"BlueCharm\",\"model\":\"Beacon 08/04P/021\",\"model_id\":\"KSensor\",\"type\":\"ACEL\",\"track\":true,\"tempc\":-14.92490119,\"tempf\":5.135177866,\"accx\":109,\"accy\":-31,\"accz\":1046,\"volt\":3.194}",
};

const char* expected_mac_mfg[] = {
Expand Down Expand Up @@ -688,6 +691,9 @@ const char* test_uuid[][4] = {
{"Mi flora pink tuya", "0xfd50", "servicedata", "0e006e0134a428005b"},
{"Mi flora pink tuya", "0xfd50", "servicedata", "620000000047640000"},
{"Mi flora pink tuya", "0xfd50", "servicedata", "6000d2000224640000"},
{"BlueCharm BC04P", "0xfeaa", "servicedata", "21010b0c5a1600001f001ffca5"},
{"BlueCharm BC021", "0xfeaa", "servicedata", "21010b0bd61e000022fff203d1"},
{"BlueCharm BC021", "0xfeaa", "servicedata", "21010b0c7af140006dffe10416"},
};

TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{
Expand Down Expand Up @@ -786,6 +792,9 @@ TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{
TheengsDecoder::BLE_ID_NUM::HHCCJCY10,
TheengsDecoder::BLE_ID_NUM::HHCCJCY10,
TheengsDecoder::BLE_ID_NUM::HHCCJCY10,
TheengsDecoder::BLE_ID_NUM::BC08,
TheengsDecoder::BLE_ID_NUM::BC08,
TheengsDecoder::BLE_ID_NUM::BC08,
};

// MAC manufacturer data test input [test name] [mac] [data]
Expand Down