Skip to content

DeviceDiscoveryExtension iOS xcode14.0 beta1

Israel Soto edited this page Aug 24, 2022 · 3 revisions

#DeviceDiscoveryExtension.framework https://github.com/xamarin/xamarin-macios/pull/15741

diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDCommon.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDCommon.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDCommon.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDCommon.h	2022-05-21 07:04:46.000000000 -0400
@@ -0,0 +1,39 @@
+/*
+	Copyright (C) 2021-2022 Apple Inc. All Rights Reserved.
+*/
+
+#ifndef DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
+#error "Please #import <DeviceDiscoveryExtension/DeviceDiscoveryExtension.h> instead of this file directly."
+#endif
+
+#pragma once
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// Marks an API as exported.
+#ifndef DD_EXTERN
+#ifdef __cplusplus
+#define DD_EXTERN extern "C" __attribute__((visibility("default")))
+#else
+#define DD_EXTERN extern __attribute__((visibility("default")))
+#endif
+#endif
+
+/// Work around some projects disabling OS_OBJECT_USE_OBJC by mapping to strong/assign as needed.
+#if defined( OS_OBJECT_USE_OBJC ) && OS_OBJECT_USE_OBJC
+	#define dd_os_ownership		strong
+#else
+	#define dd_os_ownership		assign
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDDevice.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDDevice.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDDevice.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDDevice.h	2022-06-03 18:07:53.000000000 -0400
@@ -0,0 +1,139 @@
+// Copyright (C) 2021-2022 Apple Inc. All Rights Reserved.
+
+#ifndef DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
+#error "Please #import <DeviceDiscoveryExtension/DeviceDiscoveryExtension.h> instead of this file directly."
+#endif
+
+#pragma once
+
+#import <DeviceDiscoveryExtension/DDCommon.h>
+#import <Foundation/Foundation.h>
+#import <Network/Network.h>
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//---------------------------------------------------------------------------------------------------------------------------
+///	@defgroup	Supported Protocols
+typedef NSString * DDDeviceProtocolString NS_STRING_ENUM;
+
+API_AVAILABLE( ios( 16.0 ) )
+DD_EXTERN DDDeviceProtocolString const DDDeviceProtocolStringInvalid;
+
+API_AVAILABLE( ios( 16.0 ) )
+DD_EXTERN DDDeviceProtocolString const DDDeviceProtocolStringDIAL NS_SWIFT_NAME(DDDeviceProtocolString.dial);
+
+//---------------------------------------------------------------------------------------------------------------------------
+
+/// Flags for the device.
+typedef NS_OPTIONS( NSUInteger, DDDeviceFlags )
+{
+	DDDeviceFlagsNone				= 0,			/// No flags.
+	DDDeviceFlagsSupportsAudio		= ( 1U << 1 ),	/// Supports playback of audio content.
+	DDDeviceFlagsSupportsVideo		= ( 1U << 2 ),	/// Supports playback of video content.
+};
+
+/// Converts a device flags to a string for logging, etc.
+API_AVAILABLE( ios( 16.0 ) )
+NSString * DDDeviceFlagsToString( DDDeviceFlags inFlags );
+
+//---------------------------------------------------------------------------------------------------------------------------
+
+typedef NS_ENUM( NSInteger, DDDeviceProtocol )
+ {
+	DDDeviceProtocolInvalid											= 0,	/// Invalid protocol.
+	DDDeviceProtocolDIAL NS_SWIFT_NAME(DDDeviceProtocol.dial)		= 1,	/// DIAL protocol.
+ };
+
+/// Converts a device protocol type to a string for logging, etc.
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+NSString * DDDeviceProtocolToString( DDDeviceProtocol inValue );
+
+//---------------------------------------------------------------------------------------------------------------------------
+/// Category of the device.
+typedef NS_ENUM( NSInteger, DDDeviceCategory )
+{
+	DDDeviceCategoryHiFiSpeaker NS_SWIFT_NAME(hifiSpeaker)					= 0,	/// Hi-Fi speaker.
+	DDDeviceCategoryHiFiSpeakerMultiple NS_SWIFT_NAME(hifiSpeakerMultiple)	= 1,	/// Multiple Hi-Fi speakers.
+	DDDeviceCategoryTVWithMediaBox NS_SWIFT_NAME(tvWithMediaBox)			= 2,	/// TV with MediaBox.
+	DDDeviceCategoryTV NS_SWIFT_NAME(tv)									= 3,	/// TV.
+} NS_SWIFT_NAME(DDDevice.Category);
+
+/// Converts a device category to a string for logging, etc.
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+NSString * DDDeviceCategoryToString( DDDeviceCategory inValue );
+
+//===========================================================================================================================
+/// State of the device.
+typedef NS_ENUM( NSInteger, DDDeviceState )
+{
+	DDDeviceStateInvalid		= 0,  /// Invalid/unapproved state.
+	DDDeviceStateActivating		= 10, /// Selected by the user.
+	DDDeviceStateActivated		= 20, /// Authorized and connected.
+	DDDeviceStateAuthorized		= 25, /// Authorized by the user.
+	DDDeviceStateInvalidating	= 30, /// Invalidating state.
+};
+
+/// Converts a device state to a string for logging, etc.
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+NSString * DDDeviceStateToString( DDDeviceState inValue );
+
+//===========================================================================================================================
+/// DeviceDiscoveryExtension device.
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+@interface DDDevice : NSObject
+
+- (instancetype) init NS_UNAVAILABLE;
+
+/// Initializes a DD device with display name, category, protocol type, and identifier.
+- (instancetype) initWithDisplayName:(NSString *) displayName category:(DDDeviceCategory) category
+	protocolType:(UTType *) protocolType identifier:(NSString *) identifier NS_DESIGNATED_INITIALIZER;
+
+/// Identifier to communicate with the device via Bluetooth.
+@property (readwrite, strong, nullable, nonatomic) NSUUID *bluetoothIdentifier;
+
+/// Category of the device.
+@property (readwrite, assign, nonatomic) DDDeviceCategory category;
+
+/// Name of the device. Should be suitable for displaying to a user.
+@property (readwrite, copy, nonatomic) NSString *displayName;
+
+/// Identifier of the device.
+@property (readwrite, copy, nonatomic) NSString *identifier;
+
+/// Endpoint to communicate with the device via networking.
+@property (readwrite, dd_os_ownership, nullable, nonatomic) nw_endpoint_t networkEndpoint
+	NS_REFINED_FOR_SWIFT;
+
+/// Protocol of the device.
+@property (readwrite, assign, nonatomic) DDDeviceProtocol protocol;
+
+/// Uniform Type for the protocol.
+@property (readwrite, strong, nonatomic) UTType *protocolType;
+
+/// State of the device.
+@property (readwrite, assign, nonatomic) DDDeviceState state;
+
+/// TXT record of the device.
+@property (readwrite, copy, nullable, nonatomic) NSData *txtRecordData
+	NS_REFINED_FOR_SWIFT;
+
+/// URL used for SSDP connection.
+/// The URL must have a valid hostname, no query parameters, and a maximum size of 100 bytes.
+@property (readwrite, copy, nonatomic) NSURL *url;
+
+@end
+
+#ifdef __cplusplus
+}
+#endif
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDErrors.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDErrors.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDErrors.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDErrors.h	2022-05-31 14:53:01.000000000 -0400
@@ -0,0 +1,55 @@
+/*
+	Copyright (C) 2021-2022 Apple Inc. All Rights Reserved.
+*/
+
+#ifndef DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
+#error "Please #import <DeviceAccess/DeviceAccess.h> instead of this file directly."
+#endif
+
+#pragma once
+
+#import <DeviceDiscoveryExtension/DeviceDiscoveryExtension.h>
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// NSError domain for DeviceAccess errors.
+API_AVAILABLE( ios( 16.0 ) )
+DD_EXTERN NSString * const DDErrorDomain;
+
+/// Error codes used with DDErrorDomain.
+/// DeviceDiscoveryExtension error code range: 350000-350999.
+typedef NS_ERROR_ENUM( DDErrorDomain, DDErrorCode )
+{
+	DDErrorCodeSuccess				= 0,		/// Success.
+	DDErrorCodeUnknown				= 350000,	/// Underlying failure with an unknown cause.
+	DDErrorCodeBadParameter			= 350001,	/// Bad parameter.
+	DDErrorCodeUnsupported			= 350002,	/// Unsupported value, operation, etc.
+	DDErrorCodeTimeout				= 350003,	/// Session or operation timed out.
+	DDErrorCodeInternal				= 350004,	/// Internal problem.
+	DDErrorCodeMissingEntitlement	= 350005,	/// Missing entitlement.
+	DDErrorCodePermission			= 350006,	/// Lacks permission to perform the operation.
+	
+	// Next error code to be allocated
+	DDErrorCodeNext,
+	
+}	API_AVAILABLE( ios( 16.0 ) );
+
+/// Type for returning NSError's from functions. Avoids long and repetitious method signatures.
+API_AVAILABLE( ios( 16.0 ) )
+typedef NSError * _Nullable __autoreleasing * _Nullable		DDErrorOutType;
+
+/// Invoked when a fail-able operation completes or an error occurs.
+/// @param		inError		nil if successful. non-nil if an error occurred.
+API_AVAILABLE( ios( 16.0 ) )
+typedef void ( ^DDErrorHandler )( NSError * _Nullable inError );
+
+#ifdef __cplusplus
+}
+#endif
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDEvent.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDEvent.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDEvent.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDEvent.h	2022-05-31 14:53:01.000000000 -0400
@@ -0,0 +1,87 @@
+// Copyright (C) 2021-2022 Apple Inc. All Rights Reserved.
+
+#ifndef DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
+#error "Please #import <DeviceDiscoveryExtension/DeviceDiscoveryExtension.h> instead of this file directly."
+#endif
+
+#pragma once
+
+#import <DeviceDiscoveryExtension/DDCommon.h>
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+@class DDDevice;
+@class DDEvent;
+
+//===========================================================================================================================
+/// Type of event.
+typedef NS_ENUM( NSInteger, DDEventType )
+{
+	DDEventTypeUnknown					= 0,	/// Unknown event. Placeholder for initializing event types.
+	DDEventTypeDeviceFound				= 40,	/// [DDDeviceEvent] Device found.
+	DDEventTypeDeviceLost				= 41,	/// [DDDeviceEvent] Device lost.
+	DDEventTypeDeviceChanged			= 42,	/// [DDDeviceEvent] Device changed.
+	DDEventTypeDevicesPresentChanged	= 50,	/// [DDDeviceEvent] Device changed.
+};
+
+/// Converts an event to a string for logging, etc.
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+NSString * DDEventTypeToString( DDEventType inValue );
+
+/// Invoked when an event occurs.
+typedef void ( ^DDEventHandler )( DDEvent *inEvent );
+
+//===========================================================================================================================
+/// Event for status and other updates.
+DD_EXTERN
+@interface DDEvent : NSObject
+
+/// Type of event. Type may indicate the subclass of DAEvent to provide additional properties.
+@property (readonly, assign, nonatomic) DDEventType eventType;
+
+@end
+
+//===========================================================================================================================
+
+/// Device-related event (e.g. found, lost).
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+@interface DDEventDevice : DDEvent
+
+/// Initializes a device event.
+- (instancetype) initWithEventType:(DDEventType) type device:(DDDevice *) device;
+
+/// Device found or lost.
+@property (readonly, strong, nonatomic) DDDevice *device;
+
+@end
+
+/// Device-related event (e.g. found, lost).
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+@interface DDDeviceEvent : DDEventDevice
+
+@end
+
+//===========================================================================================================================
+/// Reports the one or more devices are present changes.
+DD_EXTERN
+API_AVAILABLE( ios( 16.0 ) )
+@interface DDEventDevicesPresent : DDEvent
+
+/// One or more devices are present.
+@property (readonly, assign, nonatomic) BOOL devicesPresent;
+
+@end
+
+#ifdef __cplusplus
+}
+#endif
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDExtension.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDExtension.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDExtension.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DDExtension.h	2022-05-21 07:04:46.000000000 -0400
@@ -0,0 +1,34 @@
+/*
+	Copyright (C) 2021-2022 Apple Inc. All Rights Reserved.
+*/
+
+#ifndef DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
+#error "Please #import <DeviceDiscoveryExtension/DeviceDiscoveryExtension.h> instead of this file directly."
+#endif
+
+#pragma once
+
+#import <DeviceDiscoveryExtension/DDCommon.h>
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//---------------------------------------------------------------------------------------------------------------------------
+/// Manages a session between the extension and host.
+DD_EXTERN
+@interface DDDiscoverySession : NSObject
+
+/// Reports an event to the host.
+- (void) reportEvent:(DDEvent *) inEvent;
+
+@end
+
+#ifdef __cplusplus
+}
+#endif
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DeviceDiscoveryExtension.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DeviceDiscoveryExtension.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DeviceDiscoveryExtension.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/DeviceDiscoveryExtension.framework/Headers/DeviceDiscoveryExtension.h	2022-05-21 07:04:46.000000000 -0400
@@ -0,0 +1,17 @@
+/*
+	Copyright (C) 2021-2022 Apple Inc. All Rights Reserved.
+*/
+
+#pragma once
+
+#ifndef DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
+#define DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
+#endif
+
+#import <DeviceDiscoveryExtension/DDCommon.h>
+#import <DeviceDiscoveryExtension/DDDevice.h>
+#import <DeviceDiscoveryExtension/DDErrors.h>
+#import <DeviceDiscoveryExtension/DDEvent.h>
+#import <DeviceDiscoveryExtension/DDExtension.h>
+
+#undef DEVICE_DISCOVERY_EXTENSION_INDIRECT_INCLUDES
Clone this wiki locally