Skip to content
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

[AccessorySetupKit] Implement Xcode 16.0 beta 1-6 changes. #20857

Merged
merged 14 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
208 changes: 208 additions & 0 deletions src/accessorysetupkit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
#if NET
using System;

using CoreBluetooth;
using CoreFoundation;
using Foundation;
using ObjCRuntime;
using UIKit;

namespace AccessorySetupKit {
[Native]
[iOS (18, 0)]
public enum ASAccessoryState : long {
Unauthorized = 0,
AwaitingAuthorization = 10,
Authorized = 20,
}

[Flags]
[Native]
[iOS (18, 0)]
public enum ASAccessoryRenameOptions : ulong {
Ssid = 1U << 0,
}

[Flags]
[Native]
[iOS (18, 0)]
public enum ASAccessorySupportOptions : ulong {
BluetoothPairingLE = 1U << 1,
BluetoothTransportBridging = 1U << 2,
}

[BaseType (typeof (NSObject))]
[iOS (18, 0)]
[DisableDefaultCtor]
interface ASAccessory {
[Export ("state", ArgumentSemantic.Assign)]
ASAccessoryState State { get; }

[Export ("bluetoothIdentifier", ArgumentSemantic.Copy), NullAllowed]
NSUuid BluetoothIdentifier { get; }

[Export ("displayName", ArgumentSemantic.Copy)]
string DisplayName { get; }

[Export ("SSID", ArgumentSemantic.Copy), NullAllowed]
string Ssid { get; }

[Export ("descriptor", ArgumentSemantic.Copy)]
ASDiscoveryDescriptor Descriptor { get; }
}

[Native]
[iOS (18, 0)]
public enum ASAccessoryEventType : long {
Unknown = 0,
Activated = 10,
Invalidated = 11,
MigrationComplete = 20,
AccessoryAdded = 30,
AccessoryRemoved = 31,
AccessoryChanged = 32,
PickerDidPresent = 42,
PickerDidDismiss = 45,
}

[BaseType (typeof (NSObject))]
[iOS (18, 0)]
[DisableDefaultCtor]
interface ASAccessoryEvent {
[Export ("eventType", ArgumentSemantic.Assign)]
ASAccessoryEventType EventType { get; }

[Export ("accessory", ArgumentSemantic.Copy), NullAllowed]
ASAccessory Accessory { get; }

[Export ("error", ArgumentSemantic.Copy), NullAllowed]
NSError Error { get; }
}

delegate void ASAccessorySessionCompletionHandler ([NullAllowed] NSError error);

[BaseType (typeof (NSObject))]
[iOS (18, 0)]
[DisableDefaultCtor]
interface ASAccessorySession {
[Export ("accessories", ArgumentSemantic.Copy)]
ASAccessory [] Accessories { get; }

[Export ("activateWithQueue:eventHandler:")]
void Activate (DispatchQueue queue, Action<ASAccessoryEvent> eventHandler);

[Export ("invalidate")]
void Invalidate ();

[Export ("showPickerWithCompletionHandler:")]
void ShowPicker (ASAccessorySessionCompletionHandler completionHandler);

[Export ("showPickerForDisplayItems:completionHandler:")]
void ShowPicker (ASPickerDisplayItem [] displayItems, ASAccessorySessionCompletionHandler completionHandler);

[Export ("finishAuthorization:settings:completionHandler:")]
void FinishAuthorization (ASAccessory accessory, ASAccessorySettings settings, ASAccessorySessionCompletionHandler completionHandler);

[Export ("removeAccessory:completionHandler:")]
void RemoveAccessory (ASAccessory accessory, ASAccessorySessionCompletionHandler completionHandler);

[Export ("renameAccessory:options:completionHandler:")]
void RenameAccessory (ASAccessory accessory, ASAccessoryRenameOptions renameOptions, ASAccessorySessionCompletionHandler completionHandler);
rolfbjarne marked this conversation as resolved.
Show resolved Hide resolved
}

[BaseType (typeof (NSObject))]
[iOS (18, 0)]
[DisableDefaultCtor]
interface ASAccessorySettings {
[Export ("SSID", ArgumentSemantic.Copy), NullAllowed]
string Ssid { get; set; }
}

[BaseType (typeof (NSObject))]
[iOS (18, 0)]
[DisableDefaultCtor]
interface ASDiscoveryDescriptor {
[Export ("supportedOptions", ArgumentSemantic.Assign)]
ASAccessorySupportOptions SupportedOptions { get; set; }

[Export ("bluetoothCompanyIdentifier", ArgumentSemantic.Assign)]
ushort /* ASBluetoothCompanyIdentifier */ BluetoothCompanyIdentifier { get; set; }

[Export ("bluetoothManufacturerDataBlob", ArgumentSemantic.Copy), NullAllowed]
NSData BluetoothManufacturerDataBlob { get; set; }

[Export ("bluetoothManufacturerDataMask", ArgumentSemantic.Copy), NullAllowed]
NSData BluetoothManufacturerDataMask { get; set; }

[Export ("bluetoothNameSubstring", ArgumentSemantic.Copy), NullAllowed]
string BluetoothNameSubstring { get; set; }

[Export ("bluetoothServiceDataBlob", ArgumentSemantic.Copy), NullAllowed]
NSData BluetoothServiceDataBlob { get; set; }

[Export ("bluetoothServiceDataMask", ArgumentSemantic.Copy), NullAllowed]
NSData BluetoothServiceDataMask { get; set; }

[Export ("bluetoothServiceUUID", ArgumentSemantic.Copy), NullAllowed]
CBUUID BluetoothServiceUuid { get; set; }
[Export ("SSID", ArgumentSemantic.Copy), NullAllowed]
string Ssid { get; set; }

[Export ("SSIDPrefix", ArgumentSemantic.Copy), NullAllowed]
string SsidPrefix { get; set; }
}

[Native]
[iOS (18, 0)]
[ErrorDomain ("ASErrorDomain")]
enum ASErrorCode : long {
Success = 0,
Unknown = 1,
ActivationFailed = 100,
DiscoveryTimeout = 200,
ExtensionNotFound = 300,
Invalidated = 400,
PickerAlreadyActive = 500,
PickerRestricted = 550,
UserCancelled = 700,
UserRestricted = 750,
}

[BaseType (typeof (NSObject))]
[iOS (18, 0)]
[DisableDefaultCtor]
interface ASPickerDisplayItem {
[Export ("allowsRename", ArgumentSemantic.Assign)]
bool AllowsRename { get; set; }

[Export ("renameOptions", ArgumentSemantic.Assign)]
ASAccessoryRenameOptions RenameOptions { get; set; }

[Export ("name", ArgumentSemantic.Copy)]
NSString Name { get; set; }
rolfbjarne marked this conversation as resolved.
Show resolved Hide resolved

[Export ("productImage", ArgumentSemantic.Copy)]
UIImage ProductImage { get; set; }

[Export ("descriptor", ArgumentSemantic.Copy)]
ASDiscoveryDescriptor Descriptor { get; set; }

[Export ("initWithName:productImage:descriptor:")]
[DesignatedInitializer]
NativeHandle Constructor (string name, UIImage productImage, ASDiscoveryDescriptor descriptor);
}

[BaseType (typeof (ASPickerDisplayItem))]
[iOS (18, 0)]
[DisableDefaultCtor]
interface ASMigrationDisplayItem {
[Export ("peripheralIdentifier", ArgumentSemantic.Copy), NullAllowed]
NSUuid PeripheralIdentifier { get; set; }

[Export ("hotspotSSID", ArgumentSemantic.Copy), NullAllowed]
string HotspotSsid { get; set; }

}
}

#endif // !NET
3 changes: 3 additions & 0 deletions src/build/generator-frameworks.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ partial class Frameworks {
internal readonly HashSet<string> iosframeworks = new HashSet<string> {
"Accelerate",
"Accessibility",
"AccessorySetupKit",
"Accounts",
"AddressBook",
"AddressBookUI",
Expand Down Expand Up @@ -561,6 +562,7 @@ partial class Frameworks {
};
bool? _Accelerate;
bool? _Accessibility;
bool? _AccessorySetupKit;
bool? _Accounts;
bool? _AddressBook;
bool? _AddressBookUI;
Expand Down Expand Up @@ -731,6 +733,7 @@ partial class Frameworks {
bool? _XKit;
public bool HaveAccelerate { get { if (!_Accelerate.HasValue) _Accelerate = GetValue ("Accelerate"); return _Accelerate.Value; } }
public bool HaveAccessibility { get { if (!_Accessibility.HasValue) _Accessibility = GetValue ("Accessibility"); return _Accessibility.Value; } }
public bool HaveAccessorySetupKit { get { if (!_AccessorySetupKit.HasValue) _AccessorySetupKit = GetValue ("AccessorySetupKit"); return _AccessorySetupKit.Value; } }
public bool HaveAccounts { get { if (!_Accounts.HasValue) _Accounts = GetValue ("Accounts"); return _Accounts.Value; } }
public bool HaveAddressBook { get { if (!_AddressBook.HasValue) _AddressBook = GetValue ("AddressBook"); return _AddressBook.Value; } }
public bool HaveAddressBookUI { get { if (!_AddressBookUI.HasValue) _AddressBookUI = GetValue ("AddressBookUI"); return _AddressBookUI.Value; } }
Expand Down
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -2195,6 +2195,7 @@ IOS_FRAMEWORKS = \
AVKit \
AVRouting \
Accounts \
AccessorySetupKit \
AdServices \
AdSupport \
AddressBook \
Expand Down
1 change: 1 addition & 0 deletions src/rsp/dotnet/ios-defines-dotnet.rsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-d:HAS_ACCELERATE
-d:HAS_ACCESSIBILITY
-d:HAS_ACCESSORYSETUPKIT
-d:HAS_ACCOUNTS
-d:HAS_ADDRESSBOOK
-d:HAS_ADDRESSBOOKUI
Expand Down
1 change: 1 addition & 0 deletions src/rsp/ios-defines.rsp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-d:HAS_ACCELERATE
-d:HAS_ACCESSIBILITY
-d:HAS_ACCESSORYSETUPKIT
-d:HAS_ACCOUNTS
-d:HAS_ADDRESSBOOK
-d:HAS_ADDRESSBOOKUI
Expand Down
67 changes: 67 additions & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,31 @@ F:Accessibility.AXHearingDeviceEar.Right
F:Accessibility.AXNumericDataAxisDescriptorScale.Linear
F:Accessibility.AXNumericDataAxisDescriptorScale.Ln
F:Accessibility.AXNumericDataAxisDescriptorScale.Log10
F:AccessorySetupKit.ASAccessoryEventType.AccessoryAdded
F:AccessorySetupKit.ASAccessoryEventType.AccessoryChanged
F:AccessorySetupKit.ASAccessoryEventType.AccessoryRemoved
F:AccessorySetupKit.ASAccessoryEventType.Activated
F:AccessorySetupKit.ASAccessoryEventType.Invalidated
F:AccessorySetupKit.ASAccessoryEventType.MigrationComplete
F:AccessorySetupKit.ASAccessoryEventType.PickerDidDismiss
F:AccessorySetupKit.ASAccessoryEventType.PickerDidPresent
F:AccessorySetupKit.ASAccessoryEventType.Unknown
F:AccessorySetupKit.ASAccessoryRenameOptions.Ssid
F:AccessorySetupKit.ASAccessoryState.Authorized
F:AccessorySetupKit.ASAccessoryState.AwaitingAuthorization
F:AccessorySetupKit.ASAccessoryState.Unauthorized
F:AccessorySetupKit.ASAccessorySupportOptions.BluetoothPairingLE
F:AccessorySetupKit.ASAccessorySupportOptions.BluetoothTransportBridging
F:AccessorySetupKit.ASErrorCode.ActivationFailed
F:AccessorySetupKit.ASErrorCode.DiscoveryTimeout
F:AccessorySetupKit.ASErrorCode.ExtensionNotFound
F:AccessorySetupKit.ASErrorCode.Invalidated
F:AccessorySetupKit.ASErrorCode.PickerAlreadyActive
F:AccessorySetupKit.ASErrorCode.PickerRestricted
F:AccessorySetupKit.ASErrorCode.Success
F:AccessorySetupKit.ASErrorCode.Unknown
F:AccessorySetupKit.ASErrorCode.UserCancelled
F:AccessorySetupKit.ASErrorCode.UserRestricted
F:Accounts.ACAccountCredentialRenewResult.Failed
F:Accounts.ACAccountCredentialRenewResult.Rejected
F:Accounts.ACAccountCredentialRenewResult.Renewed
Expand Down Expand Up @@ -15523,6 +15548,7 @@ F:ObjCRuntime.Class.ThrowOnInitFailure
F:ObjCRuntime.Constants.AccelerateImageLibrary
F:ObjCRuntime.Constants.AccelerateLibrary
F:ObjCRuntime.Constants.AccessibilityLibrary
F:ObjCRuntime.Constants.AccessorySetupKitLibrary
F:ObjCRuntime.Constants.AccountsLibrary
F:ObjCRuntime.Constants.AddressBookLibrary
F:ObjCRuntime.Constants.AddressBookUILibrary
Expand Down Expand Up @@ -20908,6 +20934,14 @@ M:Accessibility.AXNumericDataAxisDescriptor.#ctor(Foundation.NSAttributedString,
M:Accessibility.AXNumericDataAxisDescriptor.#ctor(System.String,System.Double,System.Double,Foundation.NSNumber[],System.Func{System.Double,Foundation.NSString})
M:Accessibility.AXNumericDataAxisDescriptor.Copy(Foundation.NSZone)
M:Accessibility.AXPrefers.HorizontalTextEnabled
M:AccessorySetupKit.ASAccessorySession.Activate(CoreFoundation.DispatchQueue,System.Action{AccessorySetupKit.ASAccessoryEvent})
M:AccessorySetupKit.ASAccessorySession.FinishAuthorization(AccessorySetupKit.ASAccessory,AccessorySetupKit.ASAccessorySettings,AccessorySetupKit.ASAccessorySessionCompletionHandler)
M:AccessorySetupKit.ASAccessorySession.Invalidate
M:AccessorySetupKit.ASAccessorySession.RemoveAccessory(AccessorySetupKit.ASAccessory,AccessorySetupKit.ASAccessorySessionCompletionHandler)
M:AccessorySetupKit.ASAccessorySession.RenameAccessory(AccessorySetupKit.ASAccessory,AccessorySetupKit.ASAccessoryRenameOptions,AccessorySetupKit.ASAccessorySessionCompletionHandler)
M:AccessorySetupKit.ASAccessorySession.ShowPicker(AccessorySetupKit.ASAccessorySessionCompletionHandler)
M:AccessorySetupKit.ASAccessorySession.ShowPicker(AccessorySetupKit.ASPickerDisplayItem[],AccessorySetupKit.ASAccessorySessionCompletionHandler)
M:AccessorySetupKit.ASPickerDisplayItem.#ctor(System.String,UIKit.UIImage,AccessorySetupKit.ASDiscoveryDescriptor)
M:Accounts.ACAccount.#ctor(Accounts.ACAccountType)
M:Accounts.ACAccount.EncodeTo(Foundation.NSCoder)
M:Accounts.ACAccountCredential.#ctor(System.String,System.String,Foundation.NSDate)
Expand Down Expand Up @@ -51721,6 +51755,33 @@ P:Accessibility.IAXCustomContentProvider.AccessibilityCustomContent
P:Accessibility.IAXCustomContentProvider.AccessibilityCustomContentHandler
P:Accessibility.IAXDataAxisDescriptor.AttributedTitle
P:Accessibility.IAXDataAxisDescriptor.Title
P:AccessorySetupKit.ASAccessory.BluetoothIdentifier
P:AccessorySetupKit.ASAccessory.Descriptor
P:AccessorySetupKit.ASAccessory.DisplayName
P:AccessorySetupKit.ASAccessory.Ssid
P:AccessorySetupKit.ASAccessory.State
P:AccessorySetupKit.ASAccessoryEvent.Accessory
P:AccessorySetupKit.ASAccessoryEvent.Error
P:AccessorySetupKit.ASAccessoryEvent.EventType
P:AccessorySetupKit.ASAccessorySession.Accessories
P:AccessorySetupKit.ASAccessorySettings.Ssid
P:AccessorySetupKit.ASDiscoveryDescriptor.BluetoothCompanyIdentifier
P:AccessorySetupKit.ASDiscoveryDescriptor.BluetoothManufacturerDataBlob
P:AccessorySetupKit.ASDiscoveryDescriptor.BluetoothManufacturerDataMask
P:AccessorySetupKit.ASDiscoveryDescriptor.BluetoothNameSubstring
P:AccessorySetupKit.ASDiscoveryDescriptor.BluetoothServiceDataBlob
P:AccessorySetupKit.ASDiscoveryDescriptor.BluetoothServiceDataMask
P:AccessorySetupKit.ASDiscoveryDescriptor.BluetoothServiceUuid
P:AccessorySetupKit.ASDiscoveryDescriptor.Ssid
P:AccessorySetupKit.ASDiscoveryDescriptor.SsidPrefix
P:AccessorySetupKit.ASDiscoveryDescriptor.SupportedOptions
P:AccessorySetupKit.ASMigrationDisplayItem.HotspotSsid
P:AccessorySetupKit.ASMigrationDisplayItem.PeripheralIdentifier
P:AccessorySetupKit.ASPickerDisplayItem.AllowsRename
P:AccessorySetupKit.ASPickerDisplayItem.Descriptor
P:AccessorySetupKit.ASPickerDisplayItem.Name
P:AccessorySetupKit.ASPickerDisplayItem.ProductImage
P:AccessorySetupKit.ASPickerDisplayItem.RenameOptions
P:Accounts.ACAccount.AccountDescription
P:Accounts.ACAccount.AccountType
P:Accounts.ACAccount.Credential
Expand Down Expand Up @@ -76307,6 +76368,12 @@ T:Accessibility.IAXChart
T:Accessibility.IAXCustomContentProvider
T:Accessibility.IAXDataAxisDescriptor
T:Accessibility.ValueDescriptionProviderHandler
T:AccessorySetupKit.ASAccessoryEventType
T:AccessorySetupKit.ASAccessoryRenameOptions
T:AccessorySetupKit.ASAccessorySessionCompletionHandler
T:AccessorySetupKit.ASAccessoryState
T:AccessorySetupKit.ASAccessorySupportOptions
T:AccessorySetupKit.ASErrorCode
T:Accounts.AccountStoreOptions
T:Accounts.ACFacebookAudience
T:Accounts.ACLinkedInKey
Expand Down
1 change: 1 addition & 0 deletions tests/mtouch/RegistrarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ public void MT4134 ()
new { Framework = "Cinematic", Version = "17.0" },
new { Framework = "Symbols", Version = "17.0" },
new { Framework = "SensitiveContentAnalysis", Version = "17.0" },
new { Framework = "AccessorySetupKit", Version = "18.0" },
};
foreach (var framework in invalidFrameworks)
mtouch.AssertError (4134, $"Your application is using the '{framework.Framework}' framework, which isn't included in the iOS SDK you're using to build your app (this framework was introduced in iOS {framework.Version}, while you're building with the iOS {mtouch.Sdk} SDK.) Please select a newer SDK in your app's iOS Build options.");
Expand Down
Loading