Skip to content

Commit

Permalink
Test Decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH committed Oct 22, 2024
1 parent d6fdd20 commit 582eb75
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class TheengsDecoder {
GTAG,
BOSCHNYON,
JAALEE,
APPLEAIRPODS,
APPLEWATCH,
APPLEDEVICE,
IBEACON,
Expand Down
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
#include "devices/BM6_json.h"
#include "devices/TILT_json.h"
#include "devices/JAALEE_json.h"
#include "devices/APPLEAIRPODS_json.h"
#include "devices/APPLEWATCH_json.h"
#include "devices/APPLEDEVICE_json.h"
#include "devices/iBeacon_json.h"
Expand Down Expand Up @@ -227,6 +228,7 @@ const char* _devices[][2] = {
{_tracker_json_GTAG, _tracker_json_props},
{_tracker_json_NYON, _tracker_json_props},
{_JAALEE_json, _JAALEE_json_props},
{_APPLEAIRPODS_json, _APPLEAIRPODS_json_props},
{_APPLEWATCH_json, _APPLEWATCH_json_props},
{_APPLEDEVICE_json, _APPLEDEVICE_json_props},
{_ibeacon_json, _ibeacon_json_props},
Expand Down
25 changes: 25 additions & 0 deletions src/devices/APPLEAIRPODS_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const char* _APPLEAIRPODS_json = "{\"brand\":\"Test\",\"model\":\"Test (Pro)\",\"model_id\":\"APPLEAIRPODS\",\"tag\":\"0b18\",\"condition\":[\"manufacturerdata\",\"=\",20,\"index\",0,\"4c00071901\"],\"properties\":{\"test\":{\"decoder\":[\"static_value\",\"Test Pods\"]}}}";
/*R""""(
{
"brand":"Test",
"model":"Test (Pro)",
"model_id":"APPLEAIRPODS",
"tag":"0b18",
"condition":["manufacturerdata","=", 20, "index", 0, "4c00071901"],
"properties":{
"test":{
"decoder":["static_value", "Test Pods"]
}
}
})"""";*/

const char* _APPLEAIRPODS_json_props = "{\"properties\":{\"test\":{\"unit\":\"string\",\"name\":\"test\"}}}";
/*R""""(
{
"properties":{
"test":{
"unit":"string",
"name":"test"
}
}
})"""";*/
3 changes: 3 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const char* expected_mfg[] = {
"{\"brand\":\"Onset\",\"model\":\"Hobo Water Level Sensor\",\"model_id\":\"HOBOMX2001\",\"type\":\"UNIQ\",\"lvl_cm\":8.46760273,\"lvl_in\":3.333701862}",
"{\"brand\":\"Onset\",\"model\":\"Hobo Water Level Sensor\",\"model_id\":\"HOBOMX2001\",\"type\":\"UNIQ\",\"lvl_cm\":9.514185786,\"lvl_in\":3.745742436}",
"{\"brand\":\"SwitchBot\",\"model\":\"Outdoor Meter\",\"model_id\":\"W340001X\",\"type\":\"THB\",\"tempc\":25.5,\"tempf\":77.9,\"hum\":50,\"mac\":\"AA:BB:CC:DD:EE:FF\"}",
"{\"brand\":\"Test\",\"model\":\"Test (Pro)\",\"model_id\":\"APPLEAIRPODS\",\"type\":\"BODY\",\"track\":true,\"prmac\":true,\"test\":\"Test Pods\"}",
};

const char* expected_name_uuid_mfgsvcdata[] = {
Expand Down Expand Up @@ -666,6 +667,7 @@ const char* test_mfgdata[][3] = {
{"Hobo Water Level", "", "c500073fd54f0106240000000800529501a0a06aad3d"},
{"Hobo Water Level", "", "c500073fd54f010624000000080092a901a0bcd9c23d"},
{"SwitchBot Outdoor Meter Manufacturerdata", "WoIOSensorTH", "6909aabbccddeeff8b0305993200"},
{"Apple", "AirPods", "4c000719011c93fbf5e4"},
};

TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
Expand Down Expand Up @@ -817,6 +819,7 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::HOBOMX2001,
TheengsDecoder::BLE_ID_NUM::HOBOMX2001,
TheengsDecoder::BLE_ID_NUM::SBOT_M,
TheengsDecoder::BLE_ID_NUM::APPLEAIRPODS,
};

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

0 comments on commit 582eb75

Please sign in to comment.