@@ -239,7 +239,8 @@ void get_device_properties(std::string device_identifier, json &result)
239
239
result[" productType" ] = get_device_property_value (device_identifier, " ProductType" );
240
240
result[" deviceName" ] = get_device_property_value (device_identifier, " DeviceName" );
241
241
result[" productVersion" ] = get_device_property_value (device_identifier, kProductVersion );
242
- result[" deviceColor" ] = get_device_property_value (device_identifier, " DeviceColor" );
242
+ result[" deviceColor" ] = get_device_property_value (device_identifier, " DeviceColor" );
243
+ result[" deviceClass" ] = get_device_property_value (device_identifier, " DeviceClass" );
243
244
// available values:
244
245
// "BluetoothAddress","BoardId","CPUArchitecture","ChipID","DeviceClass",
245
246
// "DeviceColor","DeviceName","FirmwareVersion","HardwareModel",
@@ -261,13 +262,13 @@ void update_device_result(std::string device_identifier, json &result)
261
262
262
263
void on_device_found (const DevicePointer* device_ptr, std::string device_identifier, json &result)
263
264
{
264
- /*
265
- Interface type can be one of the followings:
266
- -1 - invalid interface type
267
- 0 - unknown interface type
268
- 1 - usb interface type
269
- 2 - wifi interface type
270
- */
265
+ /*
266
+ Interface type can be one of the followings:
267
+ -1 - invalid interface type
268
+ 0 - unknown interface type
269
+ 1 - usb interface type
270
+ 2 - wifi interface type
271
+ */
271
272
int interface_type = AMDeviceGetInterfaceType (device_ptr->device_info );
272
273
if (interface_type == kUSBInterfaceType || interface_type == kWIFIInterfaceType ) {
273
274
if (devices.count (device_identifier)) {
@@ -286,13 +287,17 @@ void on_device_found(const DevicePointer* device_ptr, std::string device_identif
286
287
}
287
288
288
289
update_device_result (device_identifier, result);
290
+ if (result[" deviceClass" ] == " AppleTV" ) {
291
+ // We do not support AppleTV devices
292
+ result = nullptr ;
293
+ }
289
294
}
290
295
}
291
296
292
297
void device_notification_callback (const DevicePointer* device_ptr)
293
298
{
294
299
std::string device_identifier = get_cstring_from_cfstring (AMDeviceCopyDeviceIdentifier (device_ptr->device_info ));
295
- json result;
300
+ json result = nullptr ;
296
301
result[kDeviceId ] = device_identifier;
297
302
switch (device_ptr->msg )
298
303
{
@@ -339,7 +344,9 @@ void device_notification_callback(const DevicePointer* device_ptr)
339
344
}
340
345
}
341
346
342
- print (result);
347
+ if (result != nullptr ) {
348
+ print (result);
349
+ }
343
350
}
344
351
345
352
#ifdef _WIN32
0 commit comments