[Xcode12][NearbyInteraction] New framework, updated through beta 4 (#9336)

* add new framework for xcode12
This commit is contained in:
Whitney Schmidt 2020-08-10 16:06:02 -04:00 коммит произвёл GitHub
Родитель 9405c5e46b
Коммит 6ff4eb6c97
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 193 добавлений и 27 удалений

Просмотреть файл

@ -149,6 +149,7 @@ namespace ObjCRuntime {
public const string AppClipLibrary = "/System/Library/Frameworks/AppClip.framework/AppClip";
public const string MediaSetupLibrary = "/System/Library/Frameworks/MediaSetup.framework/MediaSetup";
public const string MLComputeLibrary = "/System/Library/Frameworks/MLCompute.framework/MLCompute";
public const string NearbyInteractionLibrary = "/System/Library/Frameworks/NearbyInteraction.framework/NearbyInteraction";
public const string SensorKitLibrary = "/System/Library/Frameworks/SensorKit.framework/SensorKit";
public const string UniformTypeIdentifiersLibrary = "/System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers";
}

Просмотреть файл

@ -175,6 +175,7 @@ namespace ObjCRuntime {
public const string AccessibilityLibrary = "/System/Library/Frameworks/Accessibility.framework/Accessibility";
public const string ClassKitLibrary = "/System/Library/Frameworks/ClassKit.framework/ClassKit";
public const string MLComputeLibrary = "/System/Library/Frameworks/MLCompute.framework/MLCompute";
public const string NearbyInteractionLibrary = "/System/Library/Frameworks/NearbyInteraction.framework/NearbyInteraction";
public const string ReplayKitLibrary = "/System/Library/Frameworks/ReplayKit.framework/ReplayKit";
public const string UniformTypeIdentifiersLibrary = "/System/Library/Frameworks/UniformTypeIdentifiers.framework/UniformTypeIdentifiers";
public const string UserNotificationsUILibrary = "/System/Library/Frameworks/UserNotificationsUI.framework/UserNotificationsUI";

Просмотреть файл

@ -0,0 +1,35 @@
//
// NearbyInteraction enums
//
// Authors:
// Whitney Schmidt <whschm@microsoft.com>
//
// Copyright 2020 Microsoft Inc.
//
using ObjCRuntime;
using Foundation;
using System;
namespace NearbyInteraction {
[NoWatch, NoTV, NoMac, iOS (14,0)]
[Native]
public enum NIErrorCode : long
{
UnsupportedPlatform = -5889,
InvalidConfiguration = -5888,
SessionFailed = -5887,
ResourceUsageTimeout = -5886,
ActiveSessionsLimitExceeded = -5885,
UserDidNotAllow = -5884,
}
[NoWatch, NoTV, NoMac, iOS (14,0)]
[Native]
public enum NINearbyObjectRemovalReason : long
{
Timeout,
PeerEnded,
}
}

Просмотреть файл

@ -1197,7 +1197,11 @@ NETWORK_SOURCES = \
Network/NWWebSocketOptions.cs \
Network/NWWebSocketRequest.cs \
Network/NWWebSocketResponse.cs \
# NearbyInteraction
NEARBYINTERACTION_API_SOURCES = \
NearbyInteraction/Enums.cs \
# NetworkExtension
NETWORKEXTENSION_API_SOURCES = \
@ -1881,6 +1885,7 @@ MAC_FRAMEWORKS = \
MobileCoreServices \
ModelIO \
MultipeerConnectivity \
NearbyInteraction \
NetworkExtension \
NotificationCenter \
OpenGL \
@ -1981,6 +1986,7 @@ IOS_FRAMEWORKS = \
MobileCoreServices \
ModelIO \
MultipeerConnectivity \
NearbyInteraction \
NetworkExtension \
NewsstandKit \
NotificationCenter \

136
src/nearbyinteraction.cs Normal file
Просмотреть файл

@ -0,0 +1,136 @@
//
// NearbyInteraction bindings
//
// Authors:
// Whitney Schmidt <whschm@microsoft.com>
//
// Copyright 2020 Microsoft Inc.
//
using ObjCRuntime;
using Foundation;
using CoreFoundation;
using System;
using Vector3 = global::OpenTK.Vector3;
namespace NearbyInteraction {
[NoWatch, NoTV, NoMac, iOS (14, 0)]
[Static]
interface NIErrorDomain
{
[Field ("NIErrorDomain")]
NSString Domain { get; }
}
[NoWatch, NoTV, NoMac, iOS (14,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface NIConfiguration : NSCopying, NSSecureCoding {}
[NoWatch, NoTV, NoMac, iOS (14,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface NIDiscoveryToken : NSCopying, NSSecureCoding {}
[NoWatch, NoTV, NoMac, iOS (14,0)]
[BaseType (typeof (NIConfiguration))]
[DisableDefaultCtor]
interface NINearbyPeerConfiguration
{
[Export ("peerDiscoveryToken", ArgumentSemantic.Copy)]
NIDiscoveryToken PeerDiscoveryToken { get; }
[Export ("initWithPeerToken:")]
IntPtr Constructor (NIDiscoveryToken peerToken);
}
[NoWatch, NoTV, NoMac, iOS (14,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
partial interface NINearbyObject : NSCopying, NSSecureCoding
{
[Export ("discoveryToken", ArgumentSemantic.Copy)]
NIDiscoveryToken DiscoveryToken { get; }
[Export ("distance")]
float Distance { get; }
[Export ("direction")]
Vector3 Direction {
[MarshalDirective (NativePrefix = "xamarin_simd__", Library = "__Internal")]
get;
}
[Field ("NINearbyObjectDistanceNotAvailable")]
float DistanceNotAvailable { get; }
// TODO: https://github.com/xamarin/maccore/issues/2274
// We do not have generator support to trampoline Vector3 -> vector_float3 for Fields
// There is support for Vector3 -> vector_float3 for properties
// error BI1014: bgen: Unsupported type for Fields: global::OpenTK.Vector3 for 'NearbyInteraction.NINearbyObjectDistance DirectionNotAvailable'.
// extern simd_float3 NINearbyObjectDirectionNotAvailable __attribute__((availability(ios, introduced=14.0))) __attribute__((availability(macos, unavailable))) __attribute__((availability(watchos, unavailable))) __attribute__((availability(tvos, unavailable))) __attribute__((visibility("default"))) __attribute__((availability(swift, unavailable)));
// [Unavailable (PlatformName.Swift)]
// [NoWatch, NoTV, NoMac, iOS (14, 0)]
// [Field ("NINearbyObjectDirectionNotAvailable")]
// [unsupported ExtVector: float __attribute__((ext_vector_type(3)))] NINearbyObjectDirectionNotAvailable { get; }
}
[NoWatch, NoTV, NoMac, iOS (14,0)]
[BaseType (typeof (NSObject))]
interface NISession
{
[Static]
[Export ("supported")]
bool IsSupported { [Bind ("isSupported")] get; }
[Wrap ("WeakDelegate")]
[NullAllowed]
INISessionDelegate Delegate { get; set; }
[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
NSObject WeakDelegate { get; set; }
[NullAllowed, Export ("delegateQueue", ArgumentSemantic.Strong)]
DispatchQueue DelegateQueue { get; set; }
[NullAllowed, Export ("discoveryToken", ArgumentSemantic.Copy)]
NIDiscoveryToken DiscoveryToken { get; }
[NullAllowed, Export ("configuration", ArgumentSemantic.Copy)]
NIConfiguration Configuration { get; }
[Export ("runWithConfiguration:")]
void Run (NIConfiguration configuration);
[Export ("pause")]
void Pause ();
[Export ("invalidate")]
void Invalidate ();
}
interface INISessionDelegate {}
[NoWatch, NoTV, NoMac, iOS (14,0)]
[Protocol]
[Model (AutoGeneratedName = true)]
[BaseType (typeof (NSObject))]
interface NISessionDelegate
{
[Export ("session:didUpdateNearbyObjects:")]
void DidSessionUpdateNearbyObjects (NISession session, NINearbyObject[] nearbyObjects);
[Export ("session:didRemoveNearbyObjects:withReason:")]
void DidSessionRemoveNearbyObjects (NISession session, NINearbyObject[] nearbyObjects, NINearbyObjectRemovalReason reason);
[Export ("sessionWasSuspended:")]
void SessionWasSuspended (NISession session);
[Export ("sessionSuspensionEnded:")]
void SessionSuspensionEnded (NISession session);
[Export ("session:didInvalidateWithError:")]
void DidSessionInvalidate (NISession session, NSError error);
}
}

Просмотреть файл

@ -68,6 +68,13 @@ namespace Introspection {
return true;
case "NEPacketTunnelProvider":
return true;
// On iOS 14 (beta 4) we get: [NISimulator] To simulate Nearby Interaction distance and direction, launch two or more simulators and
// move the simulator windows around the screen.
// The same error occurs when trying to default init NISession in Xcode.
// It seems that it is only possible to create a NISession when there are two devices or sims running, which makes sense given the description of
// NISession from Apple API docs: "An object that identifies a unique connection between two peer devices"
case "NISession":
return true;
case "NSUnitDispersion": // -init should never be called on NSUnit!
case "NSUnitVolume": // -init should never be called on NSUnit!
case "NSUnitDuration": // -init should never be called on NSUnit!

Просмотреть файл

@ -0,0 +1,3 @@
## TODO: https://github.com/xamarin/maccore/issues/2274
## We do not have generator support to trampoline Vector3 -> vector_float3 for Fields
!missing-field! NINearbyObjectDirectionNotAvailable not bound

Просмотреть файл

@ -1,26 +0,0 @@
!missing-enum! NIErrorCode not bound
!missing-enum! NINearbyObjectRemovalReason not bound
!missing-field! NIErrorDomain not bound
!missing-field! NINearbyObjectDirectionNotAvailable not bound
!missing-field! NINearbyObjectDistanceNotAvailable not bound
!missing-protocol! NISessionDelegate not bound
!missing-selector! +NISession::isSupported not bound
!missing-selector! NINearbyObject::direction not bound
!missing-selector! NINearbyObject::discoveryToken not bound
!missing-selector! NINearbyObject::distance not bound
!missing-selector! NINearbyPeerConfiguration::initWithPeerToken: not bound
!missing-selector! NINearbyPeerConfiguration::peerDiscoveryToken not bound
!missing-selector! NISession::configuration not bound
!missing-selector! NISession::delegate not bound
!missing-selector! NISession::delegateQueue not bound
!missing-selector! NISession::discoveryToken not bound
!missing-selector! NISession::invalidate not bound
!missing-selector! NISession::pause not bound
!missing-selector! NISession::runWithConfiguration: not bound
!missing-selector! NISession::setDelegate: not bound
!missing-selector! NISession::setDelegateQueue: not bound
!missing-type! NIConfiguration not bound
!missing-type! NIDiscoveryToken not bound
!missing-type! NINearbyObject not bound
!missing-type! NINearbyPeerConfiguration not bound
!missing-type! NISession not bound

Просмотреть файл

@ -1,2 +1,3 @@
## not available on macOS as of Xcode12 beta 4
!missing-enum! NIErrorCode not bound
!missing-enum! NINearbyObjectRemovalReason not bound

Просмотреть файл

@ -341,6 +341,7 @@ public class Frameworks : Dictionary <string, Framework>
{ "AppClip", "AppClip", 14,0 },
{ "MediaSetup", "MediaSetup", new Version (14, 0), NotAvailableInSimulator /* no headers in beta 3 */ },
{ "MLCompute", "MLCompute", new Version (14,0), NotAvailableInSimulator },
{ "NearbyInteraction", "NearbyInteraction", 14,0 },
{ "SensorKit", "SensorKit", 14,0 },
{ "UniformTypeIdentifiers", "UniformTypeIdentifiers", 14,0 },

Просмотреть файл

@ -165,6 +165,7 @@ SIMLAUNCHER_FRAMEWORKS = \
-weak_framework AppClip \
-weak_framework SensorKit \
-weak_framework UniformTypeIdentifiers \
-weak_framework NearbyInteraction \
# keep the above list of weak_framework
# 1. grouped by iOS versions;