Skip to content

Commit

Permalink
Apple Watch, iPhone and iPad adjustments (#476) (#477)
Browse files Browse the repository at this point in the history
• Changed state string property to boolean unlocked - for Apple Watch, iPhone and iPad
• iPhone/iPad doc added
  • Loading branch information
DigiH authored Dec 22, 2023
1 parent 885ddc2 commit dad5f4f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 29 deletions.
17 changes: 17 additions & 0 deletions docs/devices/AppleDevice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Apple iPhone/iPad

|Model Id|[APPLEDEVICE](https://github.com/theengs/decoder/blob/development/src/devices/APPLEDEVICE_json.h)|
|-|-|
|Brand|Apple|
|Model|Apple iPhone/iPad|
|Short Description|Various Apple iPhone/iPad models|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|Rechargeable battery|
|Exchanged Data|unlocked|
|Encrypted|No|
|Presence Tracker|✅|

Currently only usefully working with the [Theengs Gateway](https://gateway.theengs.io/use/use.html#details-options) **Identity Address** and **IRK** functionality, to be able to decrypt the randomly changing Bluetooth MAC address to the static identity MAC address.

Instructions on how to get the [Identity Address and IRK for an Apple Watch, iPhone or iPad](https://gateway.theengs.io/use/use.html#getting-identity-resolving-key-irk-for-apple-watch-iphone-and-ipad)
6 changes: 3 additions & 3 deletions docs/devices/AppleWatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

|Model Id|[APPLEWATCH](https://github.com/theengs/decoder/blob/development/src/devices/APPLEWATCH_json.h)|
|-|-|
|Brand|Apple Watch|
|Model|Smart watch|
|Brand|Apple|
|Model|Apple Watch|
|Short Description|Various Apple Watch models|
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|Rechargeable battery|
|Exchanged Data|locked/unlocked state|
|Exchanged Data|unlocked|
|Encrypted|No|
|Presence Tracker|✅|

Expand Down
18 changes: 9 additions & 9 deletions src/devices/APPLEDEVICE_json.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const char* _APPLEDEVICE_json = "{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"tag\":\"1018\",\"condition\":[\"manufacturerdata\",\">=\",8,\"index\",0,\"4c0010\"],\"properties\":{\"state\":{\"condition\":[\"manufacturerdata\",9,\"b\"],\"decoder\":[\"static_value\",\"unlocked recent authenticated interaction\"]},\"_state\":{\"condition\":[\"manufacturerdata\",9,\"!\",\"b\"],\"decoder\":[\"static_value\",\"locked\"]}}}";
const char* _APPLEDEVICE_json = "{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"tag\":\"1018\",\"condition\":[\"manufacturerdata\",\">=\",8,\"index\",0,\"4c0010\"],\"properties\":{\"unlocked\":{\"condition\":[\"manufacturerdata\",9,\"b\"],\"decoder\":[\"static_value\",true]},\"_unlocked\":{\"condition\":[\"manufacturerdata\",9,\"!\",\"b\"],\"decoder\":[\"static_value\",false]}}}";
/*R""""(
{
"brand":"Apple",
Expand All @@ -7,24 +7,24 @@ const char* _APPLEDEVICE_json = "{\"brand\":\"Apple\",\"model\":\"Apple iPhone/i
"tag":"1018",
"condition":["manufacturerdata", ">=", 8, "index", 0, "4c0010"],
"properties":{
"state":{
"unlocked":{
"condition":["manufacturerdata", 9, "b"],
"decoder":["static_value", "unlocked recent authenticated interaction"]
"decoder":["static_value", true]
},
"_state":{
"_unlocked":{
"condition":["manufacturerdata", 9, "!", "b"],
"decoder":["static_value", "locked"]
"decoder":["static_value", false]
}
}
})"""";*/

const char* _APPLEDEVICE_json_props = "{\"properties\":{\"state\":{\"unit\":\"string\",\"name\":\"state\"}}}";
const char* _APPLEDEVICE_json_props = "{\"properties\":{\"unlocked\":{\"unit\":\"status\",\"name\":\"lock\"}}}";
/*R""""(
{
"properties":{
"state":{
"unit":"string",
"name":"state"
"unlocked":{
"unit":"status",
"name":"lock"
}
}
})"""";*/
21 changes: 12 additions & 9 deletions src/devices/APPLEWATCH_json.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const char* _APPLEWATCH_json = "{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"tag\":\"0b18\",\"condition\":[\"manufacturerdata\",\"index\",10,\"98\",\"|\",\"manufacturerdata\",\"index\",10,\"18\",\"&\",\"manufacturerdata\",\"=\",18,\"index\",0,\"4c001005\"],\"properties\":{\"state\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",10,2],\"lookup\":[\"98\",\"unlocked\",\"18\",\"locked\"]}}}";
const char* _APPLEWATCH_json = "{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"tag\":\"0b18\",\"condition\":[\"manufacturerdata\",\"index\",10,\"98\",\"|\",\"manufacturerdata\",\"index\",10,\"18\",\"&\",\"manufacturerdata\",\"=\",18,\"index\",0,\"4c001005\"],\"properties\":{\"unlocked\":{\"condition\":[\"manufacturerdata\",10,\"98\"],\"decoder\":[\"static_value\",true]},\"_unlocked\":{\"condition\":[\"manufacturerdata\",10,\"18\"],\"decoder\":[\"static_value\",false]}}}";
/*R""""(
{
"brand":"Apple",
Expand All @@ -7,21 +7,24 @@ const char* _APPLEWATCH_json = "{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\
"tag":"0b18",
"condition":["manufacturerdata", "index", 10, "98", "|", "manufacturerdata", "index", 10, "18", "&", "manufacturerdata", "=", 18, "index", 0, "4c001005"],
"properties":{
"state":{
"decoder":["string_from_hex_data", "manufacturerdata", 10, 2],
"lookup":["98", "unlocked",
"18", "locked"]
"unlocked":{
"condition":["manufacturerdata", 10, "98"],
"decoder":["static_value", true]
},
"_unlocked":{
"condition":["manufacturerdata", 10, "18"],
"decoder":["static_value", false]
}
}
})"""";*/

const char* _APPLEWATCH_json_props = "{\"properties\":{\"state\":{\"unit\":\"string\",\"name\":\"state\"}}}";
const char* _APPLEWATCH_json_props = "{\"properties\":{\"unlocked\":{\"unit\":\"status\",\"name\":\"lock\"}}}";
/*R""""(
{
"properties":{
"state":{
"unit":"string",
"name":"state"
"unlocked":{
"unit":"status",
"name":"lock"
}
}
})"""";*/
16 changes: 8 additions & 8 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ const char* expected_mfg[] = {
"{\"brand\":\"Oral-B\",\"model\":\"BT Toothbrush\",\"model_id\":\"ORALB_BT\",\"type\":\"BODY\",\"state\":\"sleeping\",\"mode\":\"turbo\",\"sector\":\"sector 8\",\"pressure\":32,\"duration\":135}",
"{\"brand\":\"GENERIC\",\"model\":\"BM6 Battery Monitor\",\"model_id\":\"BM6\",\"type\":\"BATT\",\"track\":true,\"batt\":77,\"device\":\"BM6 Tracker\"}",
"{\"brand\":\"GENERIC\",\"model\":\"BM6 Battery Monitor\",\"model_id\":\"BM6\",\"type\":\"BATT\",\"track\":true,\"batt\":78,\"device\":\"BM6 Tracker\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"type\":\"BODY\",\"track\":true,\"prmac\":true,\"state\":\"locked\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"type\":\"BODY\",\"track\":true,\"prmac\":true,\"state\":\"unlocked\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"type\":\"BODY\",\"track\":true,\"prmac\":true,\"unlocked\":false}",
"{\"brand\":\"Apple\",\"model\":\"Apple Watch\",\"model_id\":\"APPLEWATCH\",\"type\":\"BODY\",\"track\":true,\"prmac\":true,\"unlocked\":true}",
"{\"brand\":\"Aranet\",\"model\":\"Aranet4 CO₂ Monitor\",\"model_id\":\"ARANET4\",\"type\":\"AIR\",\"tempc\":26,\"tempf\":78.8,\"hum\":19,\"pres\":804,\"co2\":879,\"batt\":98}",
"{\"brand\":\"Aranet\",\"model\":\"Aranet4 CO₂ Monitor\",\"model_id\":\"ARANET4\",\"type\":\"AIR\",\"tempc\":26.3,\"tempf\":79.34,\"hum\":17,\"pres\":803.2,\"co2\":844,\"batt\":98}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"state\":\"locked\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"state\":\"locked\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"state\":\"unlocked recent authenticated interaction\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"state\":\"locked\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"state\":\"locked\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"state\":\"unlocked recent authenticated interaction\"}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"unlocked\":false}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"unlocked\":false}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"unlocked\":true}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"unlocked\":false}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"unlocked\":false}",
"{\"brand\":\"Apple\",\"model\":\"Apple iPhone/iPad\",\"model_id\":\"APPLEDEVICE\",\"type\":\"TRACK\",\"track\":true,\"prmac\":true,\"unlocked\":true}",
};

const char* expected_name_uuid_mfgsvcdata[] = {
Expand Down

0 comments on commit dad5f4f

Please sign in to comment.