From 320eb7c0f7e9883ef23a5ce6f451e55e08b6f2e3 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Thu, 3 Oct 2019 14:51:46 +0300 Subject: [PATCH] fix: exclude the AppleTV devices from the device discovery --- IOSDeviceLib/IOSDeviceLib.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/IOSDeviceLib/IOSDeviceLib.cpp b/IOSDeviceLib/IOSDeviceLib.cpp index b6e3beb..c0a33a0 100644 --- a/IOSDeviceLib/IOSDeviceLib.cpp +++ b/IOSDeviceLib/IOSDeviceLib.cpp @@ -240,6 +240,7 @@ void get_device_properties(std::string device_identifier, json &result) result["deviceName"] = get_device_property_value(device_identifier, "DeviceName"); result["productVersion"] = get_device_property_value(device_identifier, kProductVersion); result["deviceColor"] = get_device_property_value(device_identifier, "DeviceColor"); + result["deviceClass"] = get_device_property_value(device_identifier, "DeviceClass"); // available values: // "BluetoothAddress","BoardId","CPUArchitecture","ChipID","DeviceClass", // "DeviceColor","DeviceName","FirmwareVersion","HardwareModel", @@ -286,13 +287,17 @@ void on_device_found(const DevicePointer* device_ptr, std::string device_identif } update_device_result(device_identifier, result); + if (result["deviceClass"] == "AppleTV") { + // We do not support AppleTV devices + result = nullptr; + } } } void device_notification_callback(const DevicePointer* device_ptr) { std::string device_identifier = get_cstring_from_cfstring(AMDeviceCopyDeviceIdentifier(device_ptr->device_info)); - json result; + json result = nullptr; result[kDeviceId] = device_identifier; switch (device_ptr->msg) { @@ -339,7 +344,9 @@ void device_notification_callback(const DevicePointer* device_ptr) } } - print(result); + if (result != nullptr) { + print(result); + } } #ifdef _WIN32