Skip to content

fix: exclude the AppleTV devices from the device discovery #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions IOSDeviceLib/IOSDeviceLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Comment on lines +300 to 301

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, but it's working. It should be the same. The updated version is more clear, as we are comparing with nullptr below.

switch (device_ptr->msg)
{
Expand Down Expand Up @@ -339,7 +344,9 @@ void device_notification_callback(const DevicePointer* device_ptr)
}
}

print(result);
if (result != nullptr) {
print(result);
}
}

#ifdef _WIN32
Expand Down