Package apple.multipeerconnectivity
Class MCSession
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.multipeerconnectivity.MCSession
-
- All Implemented Interfaces:
NSObject
public class MCSession extends NSObject
MCSession A MCSession facilitates communication among all peers in a multipeer session. To start a multipeer session with remote peers, a MCPeerID that represents the local peer needs to be supplied to the init method. Once a peer is added to the session on both sides, the delegate callback -session:peer:didChangeState: will be called with MCSessionStateConnected state for the remote peer. Data messages can be sent to a connected peer with the -sendData: toPeers:withMode:error: method. The receiver of data messages will receive a delegate callback -session:didReceiveData:fromPeer:. Resources referenced by NSURL (e.g. a file) can be sent to a connected peer with the -sendResourceAtURL:toPeer:withTimeout:completionHandler: method. The completionHandler will be called when the resource is fully received by the remote peer, or if an error occurred during transmission. The receiver of data messages will receive a delegate callbacks -session:didStartReceivingResourceWithName:fromPeer: withProgress: when it starts receiving the resource and -session: didFinishReceivingResourceWithName:fromPeer:atURL:withError: when the resource has been fully received. A byte stream can be sent to a connected peer with the -startStreamWithName:toPeer:error: method. On success, an NSOutputStream object is returned, and can be used to send bytes to the remote peer once the stream is properly set up. The receiver of the byte stream will receive a delegate callback -session:didReceiveStream: withName:fromPeer: Delegate calls occur on a private serial queue. If your app needs to perform an action on a particular run loop or operation queue, its delegate method should explicitly dispatch or schedule that work.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMCSession.Block_nearbyConnectionDataForPeerWithCompletionHandlerstatic interfaceMCSession.Block_sendResourceAtURLWithNameToPeerWithCompletionHandler-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Block_accessibilityActivateBlock_ret, NSObject.Block_accessibilityActivationPointBlock_ret, NSObject.Block_accessibilityAttributedHintBlock_ret, NSObject.Block_accessibilityAttributedLabelBlock_ret, NSObject.Block_accessibilityAttributedUserInputLabelsBlock_ret, NSObject.Block_accessibilityAttributedValueBlock_ret, NSObject.Block_accessibilityContainerTypeBlock_ret, NSObject.Block_accessibilityCustomActionsBlock_ret, NSObject.Block_accessibilityCustomRotorsBlock_ret, NSObject.Block_accessibilityDecrementBlock_ret, NSObject.Block_accessibilityElementsBlock_ret, NSObject.Block_accessibilityElementsHiddenBlock_ret, NSObject.Block_accessibilityFrameBlock_ret, NSObject.Block_accessibilityHeaderElementsBlock_ret, NSObject.Block_accessibilityHintBlock_ret, NSObject.Block_accessibilityIdentifierBlock_ret, NSObject.Block_accessibilityIncrementBlock_ret, NSObject.Block_accessibilityLabelBlock_ret, NSObject.Block_accessibilityLanguageBlock_ret, NSObject.Block_accessibilityMagicTapBlock_ret, NSObject.Block_accessibilityNavigationStyleBlock_ret, NSObject.Block_accessibilityPathBlock_ret, NSObject.Block_accessibilityPerformEscapeBlock_ret, NSObject.Block_accessibilityRespondsToUserInteractionBlock_ret, NSObject.Block_accessibilityShouldGroupAccessibilityChildrenBlock_ret, NSObject.Block_accessibilityTextualContextBlock_ret, NSObject.Block_accessibilityTraitsBlock_ret, NSObject.Block_accessibilityUserInputLabelsBlock_ret, NSObject.Block_accessibilityValueBlock_ret, NSObject.Block_accessibilityViewIsModalBlock_ret, NSObject.Block_automationElementsBlock_ret, NSObject.Block_isAccessibilityElementBlock_ret, NSObject.Block_setAccessibilityActivateBlock, NSObject.Block_setAccessibilityActivationPointBlock, NSObject.Block_setAccessibilityAttributedHintBlock, NSObject.Block_setAccessibilityAttributedLabelBlock, NSObject.Block_setAccessibilityAttributedUserInputLabelsBlock, NSObject.Block_setAccessibilityAttributedValueBlock, NSObject.Block_setAccessibilityContainerTypeBlock, NSObject.Block_setAccessibilityCustomActionsBlock, NSObject.Block_setAccessibilityCustomRotorsBlock, NSObject.Block_setAccessibilityDecrementBlock, NSObject.Block_setAccessibilityElementsBlock, NSObject.Block_setAccessibilityElementsHiddenBlock, NSObject.Block_setAccessibilityFrameBlock, NSObject.Block_setAccessibilityHeaderElementsBlock, NSObject.Block_setAccessibilityHintBlock, NSObject.Block_setAccessibilityIdentifierBlock, NSObject.Block_setAccessibilityIncrementBlock, NSObject.Block_setAccessibilityLabelBlock, NSObject.Block_setAccessibilityLanguageBlock, NSObject.Block_setAccessibilityMagicTapBlock, NSObject.Block_setAccessibilityNavigationStyleBlock, NSObject.Block_setAccessibilityPathBlock, NSObject.Block_setAccessibilityPerformEscapeBlock, NSObject.Block_setAccessibilityRespondsToUserInteractionBlock, NSObject.Block_setAccessibilityShouldGroupAccessibilityChildrenBlock, NSObject.Block_setAccessibilityTextualContextBlock, NSObject.Block_setAccessibilityTraitsBlock, NSObject.Block_setAccessibilityUserInputLabelsBlock, NSObject.Block_setAccessibilityValueBlock, NSObject.Block_setAccessibilityViewIsModalBlock, NSObject.Block_setAutomationElementsBlock, NSObject.Block_setIsAccessibilityElementBlock, NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMCSession(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static MCSessionalloc()static MCSessionallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(@NotNull java.lang.String key)voidcancelConnectPeer(@NotNull MCPeerID peerID)Cancel connection attempt with a peer.static voidcancelPreviousPerformRequestsWithTarget(@NotNull java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(@NotNull java.lang.Object aTarget, @NotNull org.moe.natj.objc.SEL aSelector, @Nullable java.lang.Object anArgument)static @NotNull NSArray<java.lang.String>classFallbacksForKeyedArchiver()static @NotNull org.moe.natj.objc.ClassclassForKeyedUnarchiver()@NotNull NSArray<? extends MCPeerID>connectedPeers()voidconnectPeerWithNearbyConnectionData(@NotNull MCPeerID peerID, @NotNull NSData data)Connect a peer to the session once connection data is received.static java.lang.StringdebugDescription_static()@Nullable MCSessionDelegatedelegate()static java.lang.Stringdescription_static()voiddisconnect()Disconnect from the session.longencryptionPreference()static longhash_static()MCSessioninit()MCSessioninitWithPeer(@NotNull MCPeerID myPeerID)Create a session with an MCPeerID for the local peer.MCSessioninitWithPeerSecurityIdentityEncryptionPreference(@NotNull MCPeerID myPeerID, @Nullable NSArray<?> identity, long encryptionPreference)Create a session with a security configuration.static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static @NotNull NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(@NotNull java.lang.String key)@NotNull MCPeerIDmyPeerID()voidnearbyConnectionDataForPeerWithCompletionHandler(@NotNull MCPeerID peerID, @NotNull MCSession.Block_nearbyConnectionDataForPeerWithCompletionHandler completionHandler)Gets the connection data for a remote peer.static MCSessionnew_objc()static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)@Nullable NSArray<?>securityIdentity()booleansendDataToPeersWithModeError(@NotNull NSData data, @NotNull NSArray<? extends MCPeerID> peerIDs, long mode, @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)Send a data message to a list of destination peers.@Nullable NSProgresssendResourceAtURLWithNameToPeerWithCompletionHandler(@NotNull NSURL resourceURL, @NotNull java.lang.String resourceName, @NotNull MCPeerID peerID, @Nullable MCSession.Block_sendResourceAtURLWithNameToPeerWithCompletionHandler completionHandler)Send a resource referenced by an NSURL to a remote peer.voidsetDelegate(@Nullable MCSessionDelegate value)voidsetDelegate_unsafe(@Nullable MCSessionDelegate value)static voidsetVersion_static(long aVersion)@Nullable NSOutputStreamstartStreamWithNameToPeerError(@NotNull java.lang.String streamName, @NotNull MCPeerID peerID, @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)Start a named byte stream with the remote peer.static org.moe.natj.objc.Classsuperclass_static()static booleanuseStoredAccessor()Deprecated.static longversion_static()-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivateBlock, accessibilityActivationPoint, accessibilityActivationPointBlock, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedHintBlock, accessibilityAttributedLabel, accessibilityAttributedLabelBlock, accessibilityAttributedUserInputLabels, accessibilityAttributedUserInputLabelsBlock, accessibilityAttributedValue, accessibilityAttributedValueBlock, accessibilityContainerType, accessibilityContainerTypeBlock, accessibilityCustomActions, accessibilityCustomActionsBlock, accessibilityCustomRotors, accessibilityCustomRotorsBlock, accessibilityDecrement, accessibilityDecrementBlock, accessibilityDirectTouchOptions, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsBlock, accessibilityElementsHidden, accessibilityElementsHiddenBlock, accessibilityFrame, accessibilityFrameBlock, accessibilityHeaderElementsBlock, accessibilityHint, accessibilityHintBlock, accessibilityIdentifierBlock, accessibilityIncrement, accessibilityIncrementBlock, accessibilityLabel, accessibilityLabelBlock, accessibilityLanguage, accessibilityLanguageBlock, accessibilityMagicTapBlock, accessibilityNavigationStyle, accessibilityNavigationStyleBlock, accessibilityPath, accessibilityPathBlock, accessibilityPerformEscape, accessibilityPerformEscapeBlock, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityRespondsToUserInteractionBlock, accessibilityScroll, accessibilityShouldGroupAccessibilityChildrenBlock, accessibilityTextualContext, accessibilityTextualContextBlock, accessibilityTraits, accessibilityTraitsBlock, accessibilityUserInputLabels, accessibilityUserInputLabelsBlock, accessibilityValue, accessibilityValueBlock, accessibilityViewIsModal, accessibilityViewIsModalBlock, accessibilityZoomInAtPoint, accessibilityZoomOutAtPoint, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, automationElements, automationElementsBlock, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hash, indexOfAccessibilityElement, isAccessibilityElement, isAccessibilityElementBlock, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivateBlock, setAccessibilityActivationPoint, setAccessibilityActivationPointBlock, setAccessibilityAttributedHint, setAccessibilityAttributedHintBlock, setAccessibilityAttributedLabel, setAccessibilityAttributedLabelBlock, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedUserInputLabelsBlock, setAccessibilityAttributedValue, setAccessibilityAttributedValueBlock, setAccessibilityContainerType, setAccessibilityContainerTypeBlock, setAccessibilityCustomActions, setAccessibilityCustomActionsBlock, setAccessibilityCustomRotors, setAccessibilityCustomRotorsBlock, setAccessibilityDecrementBlock, setAccessibilityDirectTouchOptions, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsBlock, setAccessibilityElementsHidden, setAccessibilityElementsHiddenBlock, setAccessibilityFrame, setAccessibilityFrameBlock, setAccessibilityHeaderElementsBlock, setAccessibilityHint, setAccessibilityHintBlock, setAccessibilityIdentifierBlock, setAccessibilityIncrementBlock, setAccessibilityLabel, setAccessibilityLabelBlock, setAccessibilityLanguage, setAccessibilityLanguageBlock, setAccessibilityMagicTapBlock, setAccessibilityNavigationStyle, setAccessibilityNavigationStyleBlock, setAccessibilityPath, setAccessibilityPathBlock, setAccessibilityPerformEscapeBlock, setAccessibilityRespondsToUserInteraction, setAccessibilityRespondsToUserInteractionBlock, setAccessibilityShouldGroupAccessibilityChildrenBlock, setAccessibilityTextualContext, setAccessibilityTextualContextBlock, setAccessibilityTraits, setAccessibilityTraitsBlock, setAccessibilityUserInputLabels, setAccessibilityUserInputLabelsBlock, setAccessibilityValue, setAccessibilityValueBlock, setAccessibilityViewIsModal, setAccessibilityViewIsModalBlock, setAutomationElements, setAutomationElementsBlock, setIsAccessibilityElement, setIsAccessibilityElementBlock, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, storedValueForKey, superclass, takeStoredValueForKey, takeValueForKey, takeValueForKeyPath, takeValuesFromDictionary, unableToSetNilForKey, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, valuesForKeys, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static MCSession alloc()
-
allocWithZone
public static MCSession allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
-
automaticallyNotifiesObserversForKey
public static boolean automaticallyNotifiesObserversForKey(@NotNull @NotNull java.lang.String key)
-
cancelPreviousPerformRequestsWithTarget
public static void cancelPreviousPerformRequestsWithTarget(@NotNull @NotNull java.lang.Object aTarget)
-
cancelPreviousPerformRequestsWithTargetSelectorObject
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(@NotNull @NotNull java.lang.Object aTarget, @NotNull @NotNull org.moe.natj.objc.SEL aSelector, @Nullable @Nullable java.lang.Object anArgument)
-
classFallbacksForKeyedArchiver
@NotNull public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
-
classForKeyedUnarchiver
@NotNull public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
hash_static
public static long hash_static()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
instanceMethodSignatureForSelector
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
-
instancesRespondToSelector
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
-
isSubclassOfClass
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
-
keyPathsForValuesAffectingValueForKey
@NotNull public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(@NotNull @NotNull java.lang.String key)
-
new_objc
public static MCSession new_objc()
-
resolveClassMethod
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
-
resolveInstanceMethod
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
-
setVersion_static
public static void setVersion_static(long aVersion)
-
superclass_static
public static org.moe.natj.objc.Class superclass_static()
-
version_static
public static long version_static()
-
cancelConnectPeer
public void cancelConnectPeer(@NotNull @NotNull MCPeerID peerID)Cancel connection attempt with a peer.
-
connectPeerWithNearbyConnectionData
public void connectPeerWithNearbyConnectionData(@NotNull @NotNull MCPeerID peerID, @NotNull @NotNull NSData data)Connect a peer to the session once connection data is received.
-
delegate
@Nullable public @Nullable MCSessionDelegate delegate()
-
disconnect
public void disconnect()
Disconnect from the session.
-
encryptionPreference
public long encryptionPreference()
-
initWithPeer
public MCSession initWithPeer(@NotNull @NotNull MCPeerID myPeerID)
Create a session with an MCPeerID for the local peer.
-
initWithPeerSecurityIdentityEncryptionPreference
public MCSession initWithPeerSecurityIdentityEncryptionPreference(@NotNull @NotNull MCPeerID myPeerID, @Nullable @Nullable NSArray<?> identity, long encryptionPreference)
Create a session with a security configuration. The securityIdentity argument is an array of [ SecIdentityRef, [ zero or more additional certs ] ].
-
myPeerID
@NotNull public @NotNull MCPeerID myPeerID()
-
nearbyConnectionDataForPeerWithCompletionHandler
public void nearbyConnectionDataForPeerWithCompletionHandler(@NotNull @NotNull MCPeerID peerID, @NotNull @NotNull MCSession.Block_nearbyConnectionDataForPeerWithCompletionHandler completionHandler)Gets the connection data for a remote peer.
-
securityIdentity
@Nullable public @Nullable NSArray<?> securityIdentity()
-
sendDataToPeersWithModeError
public boolean sendDataToPeersWithModeError(@NotNull @NotNull NSData data, @NotNull @NotNull NSArray<? extends MCPeerID> peerIDs, long mode, @Nullable @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)Send a data message to a list of destination peers.
-
sendResourceAtURLWithNameToPeerWithCompletionHandler
@Nullable public @Nullable NSProgress sendResourceAtURLWithNameToPeerWithCompletionHandler(@NotNull @NotNull NSURL resourceURL, @NotNull @NotNull java.lang.String resourceName, @NotNull @NotNull MCPeerID peerID, @Nullable @Nullable MCSession.Block_sendResourceAtURLWithNameToPeerWithCompletionHandler completionHandler)
Send a resource referenced by an NSURL to a remote peer. The resource can be a file or an HTTP document. The completionHandler is called when the resource is received by the remote peer or if an error occurred. The remote peer will get a -session:didStartReceivingResourceWithName: fromPeer:withProgress callback when it starts receiving the resource and a -session:didFinishReceivingResourceWithName:fromPeer:atURL:withError: when the resource has been fully received. The primary mechanism for observing progress of the send should be to create an NSProgress using +progressWithTotalUnitCount, -becomeCurrentWithPendingUnitCount:, invoking this method, then calling -resignCurrent. This is described in the NSProgress documentation. Alternatively, if you wish to observe the progress directly instead of incorporating it into a larger operation, you may observe the NSProgress returned from this method.
-
setDelegate_unsafe
public void setDelegate_unsafe(@Nullable @Nullable MCSessionDelegate value)
-
setDelegate
public void setDelegate(@Nullable @Nullable MCSessionDelegate value)
-
startStreamWithNameToPeerError
@Nullable public @Nullable NSOutputStream startStreamWithNameToPeerError(@NotNull @NotNull java.lang.String streamName, @NotNull @NotNull MCPeerID peerID, @Nullable @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
Start a named byte stream with the remote peer.
-
useStoredAccessor
@Deprecated public static boolean useStoredAccessor()
Deprecated.
-
-