Skip to content

Commit 320eb7c

Browse files
committed
fix: exclude the AppleTV devices from the device discovery
1 parent aef3881 commit 320eb7c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

IOSDeviceLib/IOSDeviceLib.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ void get_device_properties(std::string device_identifier, json &result)
240240
result["deviceName"] = get_device_property_value(device_identifier, "DeviceName");
241241
result["productVersion"] = get_device_property_value(device_identifier, kProductVersion);
242242
result["deviceColor"] = get_device_property_value(device_identifier, "DeviceColor");
243+
result["deviceClass"] = get_device_property_value(device_identifier, "DeviceClass");
243244
// available values:
244245
// "BluetoothAddress","BoardId","CPUArchitecture","ChipID","DeviceClass",
245246
// "DeviceColor","DeviceName","FirmwareVersion","HardwareModel",
@@ -286,13 +287,17 @@ void on_device_found(const DevicePointer* device_ptr, std::string device_identif
286287
}
287288

288289
update_device_result(device_identifier, result);
290+
if (result["deviceClass"] == "AppleTV") {
291+
// We do not support AppleTV devices
292+
result = nullptr;
293+
}
289294
}
290295
}
291296

292297
void device_notification_callback(const DevicePointer* device_ptr)
293298
{
294299
std::string device_identifier = get_cstring_from_cfstring(AMDeviceCopyDeviceIdentifier(device_ptr->device_info));
295-
json result;
300+
json result = nullptr;
296301
result[kDeviceId] = device_identifier;
297302
switch (device_ptr->msg)
298303
{
@@ -339,7 +344,9 @@ void device_notification_callback(const DevicePointer* device_ptr)
339344
}
340345
}
341346

342-
print(result);
347+
if (result != nullptr) {
348+
print(result);
349+
}
343350
}
344351

345352
#ifdef _WIN32

0 commit comments

Comments
 (0)