-
Notifications
You must be signed in to change notification settings - Fork 572
[AccessoryAccess] Add bindings up to Xcode 27.0 Beta 3 #25982
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
Open
dalexsoto
wants to merge
1
commit into
xcode27.0
Choose a base branch
from
dev/alex/xc27-accessoryaccess
base: xcode27.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| using System; | ||
|
|
||
| using CoreFoundation; | ||
| using Foundation; | ||
| using ObjCRuntime; | ||
|
|
||
| // 'IOUSBHostDevice' comes from the IOUSBHost framework, which macios intentionally does not bind: | ||
| // it's a low-level IOKit/DriverKit-adjacent framework whose API is almost entirely | ||
| // NS_REFINED_FOR_SWIFT (see IGNORED_MACOS_FRAMEWORKS in tests/xtro-sharpie/Makefile). The instance | ||
| // returned by AAUSBAccessory.Open is a valid IOUSBHostDevice handle; consumers that need to perform | ||
| // USB I/O on it should hand the accessory to a native/Swift XPC service using CreateXpcRepresentation. | ||
| using IOUSBHostDevice = Foundation.NSObject; | ||
|
|
||
| // 'xpc_object_t' is an opaque OS_object that's shuttled across XPC boundaries; it has no managed API | ||
| // surface of its own, so macios binds it as NSObject everywhere (see src/browserenginekit.cs). | ||
| using OS_xpc_object = Foundation.NSObject; | ||
|
|
||
| namespace AccessoryAccess { | ||
|
|
||
| [Mac (27, 0)] | ||
| [Native] | ||
| [ErrorDomain ("AAErrorDomain")] | ||
| public enum AAErrorCode : long { | ||
| Internal = 1, | ||
| AccessoryListenerAlreadyRegistered = 2, | ||
| AccessoryNotAccessible = 3, | ||
| InvalidAccessoryState = 4, | ||
| } | ||
|
|
||
| [Mac (27, 0)] | ||
| [Native] | ||
| public enum AAUSBAccessoryMatchingCriteriaInterfaceMatchingOption : long { | ||
| MatchAll, | ||
| MatchAny, | ||
| } | ||
|
|
||
| delegate void AAUSBAccessoryOpenCompletionHandler ([NullAllowed] IOUSBHostDevice device, [NullAllowed] NSError error); | ||
| delegate void AAUSBAccessoryCloseCompletionHandler ([NullAllowed] NSError error); | ||
|
|
||
| [Mac (27, 0)] | ||
| [BaseType (typeof (NSObject))] | ||
| [DisableDefaultCtor] | ||
| interface AAUSBAccessory : NSSecureCoding { | ||
| [Export ("initWithXPCRepresentation:")] | ||
| [DesignatedInitializer] | ||
| NativeHandle Constructor (OS_xpc_object xpcRepresentation); | ||
|
|
||
| [Export ("registryID")] | ||
| ulong RegistryId { get; } | ||
|
|
||
| [Export ("deviceDescriptorData")] | ||
| NSData DeviceDescriptorData { get; } | ||
|
|
||
| [NullAllowed, Export ("configurationDescriptorData")] | ||
| NSData ConfigurationDescriptorData { get; } | ||
|
|
||
| [Export ("createXPCRepresentation")] | ||
| OS_xpc_object CreateXpcRepresentation (); | ||
|
|
||
| // The completion handler receives a live IOUSBHostDevice (typed as NSObject; see the | ||
| // IOUSBHostDevice alias at the top of this file). To perform USB I/O, forward the accessory to | ||
| // a native/Swift XPC service via CreateXpcRepresentation, or bridge the handle through IOUSBHost. | ||
| [Export ("openWithServiceQueue:completionHandler:")] | ||
| [Async] | ||
| void Open ([NullAllowed] DispatchQueue serviceQueue, AAUSBAccessoryOpenCompletionHandler completionHandler); | ||
|
|
||
| [Export ("closeWithCompletionHandler:")] | ||
| [Async] | ||
| void Close (AAUSBAccessoryCloseCompletionHandler completionHandler); | ||
| } | ||
|
|
||
| interface IAAUSBAccessoryListener { } | ||
|
|
||
| [Mac (27, 0)] | ||
| [Protocol (BackwardsCompatibleCodeGeneration = false), Model] | ||
| [BaseType (typeof (NSObject))] | ||
| interface AAUSBAccessoryListener { | ||
| [Export ("usbAccessoryDidConnect:")] | ||
| void UsbAccessoryDidConnect (AAUSBAccessory usbAccessory); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Casing mismatch: "USB" in the type name and "Usb" in method name. I believe this should all be "Usb" everywhere. |
||
|
|
||
| [Export ("usbAccessoryDidDisconnect:")] | ||
| void UsbAccessoryDidDisconnect (AAUSBAccessory usbAccessory); | ||
| } | ||
|
|
||
| delegate void AAUSBAccessoryManagerRegisterListenerCompletionHandler (AAUSBAccessory [] accessories, [NullAllowed] NSError error); | ||
| delegate void AAUSBAccessoryManagerUnregisterListenerCompletionHandler (); | ||
|
|
||
| [Mac (27, 0)] | ||
| [BaseType (typeof (NSObject))] | ||
| [DisableDefaultCtor] | ||
| interface AAUSBAccessoryManager { | ||
| [Static] | ||
| [Export ("sharedManager", ArgumentSemantic.Strong)] | ||
| AAUSBAccessoryManager SharedManager { get; } | ||
|
|
||
| [Export ("registerListener:withMatchingCriteria:completionHandler:")] | ||
| [Async] | ||
| void RegisterListener (IAAUSBAccessoryListener listener, AAUSBAccessoryMatchingCriteria [] matchingCriteria, AAUSBAccessoryManagerRegisterListenerCompletionHandler completionHandler); | ||
|
|
||
| [Export ("unregisterListener:completionHandler:")] | ||
| [Async] | ||
| void UnregisterListener (IAAUSBAccessoryListener listener, AAUSBAccessoryManagerUnregisterListenerCompletionHandler completionHandler); | ||
| } | ||
|
|
||
| [Mac (27, 0)] | ||
| [BaseType (typeof (NSObject))] | ||
| [DisableDefaultCtor] | ||
| interface AAUSBAccessoryMatchingCriteria : NSCopying { | ||
| [Export ("initWithDeviceMatchingDictionary:")] | ||
| [DesignatedInitializer] | ||
| NativeHandle Constructor (NSDictionary<NSString, NSObject> dictionary); | ||
|
|
||
| [Export ("initWithDeviceMatchingDictionary:interfaceMatchingDictionaries:interfaceMatchingOption:")] | ||
| [DesignatedInitializer] | ||
| NativeHandle Constructor ([NullAllowed] NSDictionary<NSString, NSObject> deviceMatchingDictionary, NSDictionary<NSString, NSObject> [] interfaceMatchingDictionaries, AAUSBAccessoryMatchingCriteriaInterfaceMatchingOption interfaceMatchingOption); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
tests/xtro-sharpie/api-annotations-dotnet/macOS-AccessoryAccess.todo
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
IOUSBHostDeviceis a C++ class, not an Objective-C class, in which case it should be bound asIntPtrnotNSObject.