Skip to content

Commit

Permalink
Feasycom Bluetooth Beacons (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Mar 28, 2024
1 parent d8dcd79 commit 8aaa359
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/devices/FEASY.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Feasycom Bluetooth Beacon

|Model Id|[FEASY](https://github.com/theengs/decoder/blob/development/src/devices/FEASY_json.h)|
|-|-|
|Brand|Feasycom|
|Model|Bluetooth Beacon|
|Short Description|Various types of Bluetooth beacons|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|different batteries depending on type or USB|
|Exchanged Data|beacon model, battery, plugged-in (true for USB powered beacons)|
|Encrypted|No|
|Device Tracker|✅|
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class TheengsDecoder {
BM3IN1,
BM4IN1,
MS_CDP,
FEASY,
GAEN,
HHCCPOT002,
BPARASITE,
Expand Down
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "devices/CGP1W_json.h"
#include "devices/CGP23W_json.h"
#include "devices/CGPR1_json.h"
#include "devices/FEASY_json.h"
#include "devices/GAEN_json.h"
#include "devices/H5055_json.h"
#include "devices/H5072_json.h"
Expand Down Expand Up @@ -180,6 +181,7 @@ const char* _devices[][2] = {
{_BM3IN1_json, _BM3IN1_json_props},
{_BM4IN1_json, _BM4IN1_json_props},
{_MS_CDP_json, _MS_CDP_json_props},
{_FEASY_json, _FEASY_json_props},
{_GAEN_json, _GAEN_json_props},
{_HHCCPOT002_json, _HHCCPOT002_json_props},
{_BPARASITE_json, _BPARASITE_json_props},
Expand Down
63 changes: 63 additions & 0 deletions src/devices/FEASY_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const char* _FEASY_json = "{\"brand\":\"Feasycom\",\"model\":\"Beacon\",\"model_id\":\"FEASY\",\"tag\":\"0608\",\"condition\":[\"servicedata\",\"=\",22,\"&\",\"uuid\",\"index\",0,\"fff0\"],\"properties\":{\"beaconmodel\":{\"decoder\":[\"string_from_hex_data\",\"servicedata\",0,2,false,false],\"lookup\":[\"19\",\"BP109\",\"1a\",\"BP103\",\"1b\",\"BP104\",\"1c\",\"BP201\",\"1d\",\"BP106\",\"1e\",\"BP101\",\"24\",\"BP120\",\"27\",\"BP108\",\"28\",\"BP108N\"]},\"batt\":{\"condition\":[\"servicedata\",20,\"!\",\"65\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",20,2,false,false],\"post_proc\":[\"&\",127]},\"plugged-in\":{\"condition\":[\"servicedata\",20,\"65\"],\"decoder\":[\"static_value\",true]},\"_plugged-in\":{\"condition\":[\"servicedata\",20,\"!\",\"65\"],\"decoder\":[\"static_value\",false]},\"mac\":{\"decoder\":[\"mac_from_hex_data\",\"servicedata\",8]}}}";

/*R""""(
{
"brand":"Feasycom",
"model":"Beacon",
"model_id":"FEASY",
"tag":"0608",
"condition":["servicedata", "=", 22, "&", "uuid", "index", 0, "fff0"],
"properties":{
"beaconmodel":{
"decoder":["string_from_hex_data", "servicedata", 0, 2, false, false],
"lookup":["19", "BP109",
"1a", "BP103",
"1b", "BP104",
"1c", "BP201",
"1d", "BP106",
"1e", "BP101",
"24", "BP120",
"27", "BP108",
"28", "BP108N"]
},
"batt":{
"condition":["servicedata", 20, "!", "65"],
"decoder":["value_from_hex_data", "servicedata", 20, 2, false, false],
"post_proc":["&", 127]
},
"plugged-in":{
"condition":["servicedata", 20, "65"],
"decoder":["static_value", true]
},
"_plugged-in":{
"condition":["servicedata", 20, "!", "65"],
"decoder":["static_value", false]
},
"mac":{
"decoder":["mac_from_hex_data", "servicedata", 8]
}
}
})"""";*/

const char* _FEASY_json_props = "{\"properties\":{\"beaconmodel\":{\"unit\":\"string\",\"name\":\"beacon model\"},\"batt\":{\"unit\":\"%\",\"name\":\"battery\"},\"plugged-in\":{\"unit\":\"status\",\"name\":\"plug\"},\"mac\":{\"unit\":\"string\",\"name\":\"MAC address\"}}}";
/*R""""(
{
"properties":{
"beaconmodel":{
"unit":"string",
"name":"beacon model"
},
"batt":{
"unit":"%",
"name":"battery"
},
"plugged-in":{
"unit":"status",
"name":"plug"
},
"mac":{
"unit":"string",
"name":"MAC address"
}
}
})"""";*/
3 changes: 3 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ const char* expected_uuid[] = {
"{\"brand\":\"NodOn\",\"model\":\"NIU smart button\",\"model_id\":\"NODONNIU\",\"type\":\"BTN\",\"acts\":true,\"cont\":true,\"track\":true,\"button\":9,\"color\":\"Lagoon\",\"batt\":96}",
"{\"brand\":\"NodOn\",\"model\":\"NIU smart button\",\"model_id\":\"NODONNIU\",\"type\":\"BTN\",\"acts\":true,\"cont\":true,\"track\":true,\"button\":10,\"color\":\"Lagoon\",\"batt\":98}",
"{\"brand\":\"NodOn\",\"model\":\"NIU smart button\",\"model_id\":\"NODONNIU\",\"type\":\"BTN\",\"acts\":true,\"cont\":true,\"track\":true,\"button\":3,\"color\":\"CozyGrey\",\"batt\":89}",
"{\"brand\":\"Feasycom\",\"model\":\"Beacon\",\"model_id\":\"FEASY\",\"type\":\"BCON\",\"track\":true,\"beaconmodel\":\"BP108\",\"batt\":100,\"plugged-in\":false,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
};

const char* expected_mac_mfg[] = {
Expand Down Expand Up @@ -967,6 +968,7 @@ const char* test_uuid[][4] = {
{"NodOn NIU", "0x0000", "servicedata", "02599c37d90287a52152000660259003"},
{"NodOn NIU", "0x0000", "servicedata", "02599c37d90287a521520006622b8104"},
{"NodOn NIU", "0x0000", "servicedata", "02599c37d90287a521520004595eb905"},
{"Feasycom BP108", "0xfff0", "servicedata", "27021992aabbccddeeff64"},
};

TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{
Expand Down Expand Up @@ -1101,6 +1103,7 @@ TheengsDecoder::BLE_ID_NUM test_uuid_id_num[]{
TheengsDecoder::BLE_ID_NUM::NODONNIU,
TheengsDecoder::BLE_ID_NUM::NODONNIU,
TheengsDecoder::BLE_ID_NUM::NODONNIU,
TheengsDecoder::BLE_ID_NUM::FEASY,
};

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

0 comments on commit 8aaa359

Please sign in to comment.