-
Notifications
You must be signed in to change notification settings - Fork 507
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
[DeviceDiscoveryExtension] Added bindings for DeviceDiscoveryExtension. #20272
Merged
rolfbjarne
merged 16 commits into
xamarin:main
from
rolfbjarne:devicediscoveryextension
Mar 14, 2024
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c565922
[DeviceDiscoveryExtension] Added support for Xcode 14 beta 1-4
fb13dd6
[DeviceDiscoveryExtension] Exposed DDDevice.NetworkEndpoint with a pr…
4dd3e7e
[DeviceDiscoveryExtension] Added suggestions
8aefa8c
[DeviceDiscoveryExtension] Added more suggestions
6efbc53
[DeviceDiscoveryExtension] Fixed NetworkEndpoint prop logic
eff333f
[DeviceDiscoveryExtension] Added suggestions
7301d45
[DeviceDiscoveryExtension] Added tests
507871f
Don't bind non-constant enum value.
rolfbjarne 765e440
Add iOS 17 API.
rolfbjarne b7af2fd
Update generated files.
rolfbjarne fe5661e
Update known failures about docs
rolfbjarne 182e2e6
Update xtro
rolfbjarne 0e68306
Auto-format source code
115fd99
Exclude from Mac Catalyst.
rolfbjarne 9e463d2
Merge remote-tracking branch 'origin/main' into devicediscoveryextension
rolfbjarne 54e55fd
Update copyright.
rolfbjarne 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 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,26 @@ | ||
// | ||
// Custom methods for DDDevice | ||
// | ||
// Authors: | ||
// Israel Soto ([email protected]) | ||
// | ||
// Copyright 2022 Microsoft Corporation. | ||
// | ||
|
||
#nullable enable | ||
|
||
using ObjCRuntime; | ||
using Foundation; | ||
using Network; | ||
using System; | ||
|
||
using nw_endpoint_t = System.IntPtr; | ||
|
||
namespace DeviceDiscoveryExtension { | ||
public partial class DDDevice { | ||
public NWEndpoint? NetworkEndpoint { | ||
get => _NetworkEndpoint != nw_endpoint_t.Zero ? new NWEndpoint (_NetworkEndpoint, false) : null; | ||
set => _NetworkEndpoint = value.GetHandle (); | ||
} | ||
} | ||
} |
This file contains 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,76 @@ | ||
// | ||
// Enums.cs | ||
// | ||
// Authors: | ||
// Israel Soto ([email protected]) | ||
// | ||
// Copyright 2022 Microsoft Corporation | ||
// | ||
|
||
using System; | ||
|
||
using ObjCRuntime; | ||
using Foundation; | ||
|
||
namespace DeviceDiscoveryExtension { | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[Native] | ||
public enum DDDeviceProtocol : long { | ||
Invalid = 0, | ||
Dial = 1, | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[Native] | ||
public enum DDDeviceCategory : long { | ||
HiFiSpeaker = 0, | ||
HiFiSpeakerMultiple = 1, | ||
TvWithMediaBox = 2, | ||
Tv = 3, | ||
LaptopComputer = 4, | ||
DesktopComputer = 5, | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[Native] | ||
public enum DDDeviceState : long { | ||
Invalid = 0, | ||
Activating = 10, | ||
Activated = 20, | ||
Authorized = 25, | ||
Invalidating = 30, | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[Native] | ||
public enum DDDeviceMediaPlaybackState : long { | ||
NoContent = 0, | ||
Paused = 1, | ||
Playing = 2, | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[ErrorDomain ("DDErrorDomain")] | ||
[Native] | ||
public enum DDErrorCode : long { | ||
Success = 0, | ||
Unknown = 350000, | ||
BadParameter = 350001, | ||
Unsupported = 350002, | ||
Timeout = 350003, | ||
Internal = 350004, | ||
MissingEntitlement = 350005, | ||
Permission = 350006, | ||
// Next, // don't bind 'Next', it's not static and we'd have to break compat if it were ever to change | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[Native] | ||
public enum DDEventType : long { | ||
Unknown = 0, | ||
DeviceFound = 40, | ||
DeviceLost = 41, | ||
DeviceChanged = 42, | ||
} | ||
} |
This file contains 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 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,106 @@ | ||
// | ||
// DeviceDiscoveryExtension C# bindings | ||
// | ||
// Authors: | ||
// Israel Soto <[email protected]> | ||
// | ||
// Copyright 2022 Microsoft Corporation. | ||
// | ||
|
||
using System; | ||
using ObjCRuntime; | ||
using Foundation; | ||
using UniformTypeIdentifiers; | ||
|
||
using nw_endpoint_t = System.IntPtr; | ||
|
||
#if !NET | ||
using NativeHandle = System.IntPtr; | ||
#endif | ||
|
||
namespace DeviceDiscoveryExtension { | ||
|
||
[Static] | ||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
interface DDDeviceProtocolStrings { | ||
[Field ("DDDeviceProtocolStringInvalid")] | ||
NSString Invalid { get; } | ||
|
||
[Field ("DDDeviceProtocolStringDIAL")] | ||
NSString Dial { get; } | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[BaseType (typeof (NSObject))] | ||
[DisableDefaultCtor] | ||
interface DDDevice { | ||
[Export ("initWithDisplayName:category:protocolType:identifier:")] | ||
[DesignatedInitializer] | ||
NativeHandle Constructor (string displayName, DDDeviceCategory category, UTType protocolType, string identifier); | ||
|
||
[NullAllowed, Export ("bluetoothIdentifier", ArgumentSemantic.Strong)] | ||
NSUuid BluetoothIdentifier { get; set; } | ||
|
||
[Export ("category", ArgumentSemantic.Assign)] | ||
DDDeviceCategory Category { get; set; } | ||
|
||
[Export ("displayName")] | ||
string DisplayName { get; set; } | ||
|
||
[Export ("identifier")] | ||
string Identifier { get; set; } | ||
|
||
[Internal] | ||
[Export ("networkEndpoint", ArgumentSemantic.Strong)] | ||
nw_endpoint_t _NetworkEndpoint { get; set; } | ||
|
||
[Export ("protocol", ArgumentSemantic.Assign)] | ||
DDDeviceProtocol Protocol { get; set; } | ||
|
||
[Export ("protocolType", ArgumentSemantic.Strong)] | ||
UTType ProtocolType { get; set; } | ||
|
||
[Export ("state", ArgumentSemantic.Assign)] | ||
DDDeviceState State { get; set; } | ||
|
||
[NullAllowed, Export ("txtRecordData", ArgumentSemantic.Copy)] | ||
NSData TxtRecordData { get; set; } | ||
|
||
[Export ("url", ArgumentSemantic.Copy)] | ||
NSUrl Url { get; set; } | ||
|
||
[Export ("mediaPlaybackState", ArgumentSemantic.Assign)] | ||
DDDeviceMediaPlaybackState MediaPlaybackState { get; set; } | ||
|
||
[NullAllowed, Export ("mediaContentTitle")] | ||
string MediaContentTitle { get; set; } | ||
|
||
[NullAllowed, Export ("mediaContentSubtitle")] | ||
string MediaContentSubtitle { get; set; } | ||
|
||
[iOS (17, 0)] | ||
[Export ("supportsGrouping")] | ||
bool SupportsGrouping { get; set; } | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[BaseType (typeof (NSObject))] | ||
[DisableDefaultCtor] | ||
interface DDDeviceEvent { | ||
[Export ("initWithEventType:device:")] | ||
NativeHandle Constructor (DDEventType type, DDDevice device); | ||
|
||
[Export ("device", ArgumentSemantic.Strong)] | ||
DDDevice Device { get; } | ||
|
||
[Export ("eventType", ArgumentSemantic.Assign)] | ||
DDEventType EventType { get; } | ||
} | ||
|
||
[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV] | ||
[BaseType (typeof (NSObject))] | ||
interface DDDiscoverySession { | ||
[Export ("reportEvent:")] | ||
void ReportEvent (DDDeviceEvent inEvent); | ||
} | ||
} |
This file contains 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 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 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.
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 this is from a past PR, but should the copyright headers be updated?
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.
Good point.
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.
Fixed now.