Class CHHapticEngine

  • All Implemented Interfaces:
    NSObject

    public class CHHapticEngine
    extends NSObject
    CHHapticEngine Represents the connection with the haptic server.
    • Constructor Detail

      • CHHapticEngine

        protected CHHapticEngine​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • capabilitiesForHardware

        public static CHHapticDeviceCapability capabilitiesForHardware()
        capabilitiesForHardware Get the protocol that describes haptic and audio capabilities on this device. Detailed description on the capability protocol is in CHHapticDeviceCapability.h.
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • createAdvancedPlayerWithPatternError

        public CHHapticAdvancedPatternPlayer createAdvancedPlayerWithPatternError​(CHHapticPattern pattern,
                                                                                  org.moe.natj.general.ptr.Ptr<NSError> outError)
        createAdvancedPlayerWithPattern:error Factory method for creating a CHHapticAdvancedPatternPlayer from a CHHapticPattern.
        Parameters:
        pattern - The pattern to be played.
      • createPlayerWithPatternError

        public CHHapticPatternPlayer createPlayerWithPatternError​(CHHapticPattern pattern,
                                                                  org.moe.natj.general.ptr.Ptr<NSError> outError)
        createPlayerWithPattern:error Factory method for creating a CHHapticPatternPlayer from a CHHapticPattern.
        Parameters:
        pattern - The pattern to be played.
      • currentTime

        public double currentTime()
        [@property] currentTime The absolute time from which all current and future event times may be calculated. The units are seconds.
      • 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()
      • initAndReturnError

        public CHHapticEngine initAndReturnError​(org.moe.natj.general.ptr.Ptr<NSError> error)
        initAndReturnError: Create an instance of the CHHapticEngine. More than one instance may exist within a process. Each will function independently of the others. CHHapticEngines created using this method will be associated with the device's internal haptics hardware system, if one exists. For systems without internal haptics, this method will fail with the error `CHHapticErrorCodeNotSupported`. To access engine instances associated with external game controllers, see the GameController framework documentation for the `hapticEngines` property on the GCController class.
      • initWithAudioSessionError

        public CHHapticEngine initWithAudioSessionError​(AVAudioSession audioSession,
                                                        org.moe.natj.general.ptr.Ptr<NSError> error)
        initWithAudioSession:error Create an instance of an CHHapticEngine and associate it with an audio session. If 'audioSession' is nil, the engine will create its own. More than one instance may exist within a process. Each will function independently of the others, but all CHHapticEngines which share an audio session will have identical audio behavior with regard to interruptions, etc. CHHapticEngines created using this method will be associated with the device's internal haptics hardware system, if one exists. For systems without internal haptics, this method will fail with the error `CHHapticErrorCodeNotSupported`. To access engine instances associated with external game controllers, see the GameController framework documentation for the `hapticEngines` property on the GCController class.
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isAutoShutdownEnabled

        public boolean isAutoShutdownEnabled()
        [@property] autoShutdownEnabled When auto shutdown is enabled, the haptic engine can start and stop the hardware dynamically, to conserve power. To conserve power, it is advised that the client stop the haptic engine when not in use. But when auto shutdown is enabled, the haptic engine will stop the hardware if it was running idle for a certain duration, and restart it later when required. Note that, because this operation is dynamic, it may affect the start times of the pattern players (e.g. `CHHapticPatternplayer`), if the engine has to resume from its shutdown state. This feature is disabled by default, but the client can enable it if needed.
      • isMutedForAudio

        public boolean isMutedForAudio()
        [@property] isMutedForAudio When set to YES, the CHHapticEngine mutes audio playback from its players. Default is NO.
      • isMutedForHaptics

        public boolean isMutedForHaptics()
        [@property] isMutedForHaptics When set to YES, the CHHapticEngine mutes haptic playback from its players. Default is NO.
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • notifyWhenPlayersFinished

        public void notifyWhenPlayersFinished​(CHHapticEngine.Block_notifyWhenPlayersFinished finishedHandler)
        notifyWhenPlayersFinished: Tell the engine to asynchronously call the passed-in handler when all active pattern players associated with this engine have stopped. If additional players are started after this call is made, they will delay the callback. If no players are active or the engine is stopped, the callback will happen immediately.
        Parameters:
        finishedHandler - The block that will be called asynchronously. The return value of this block determines the action the engine will take when the block finishes (see `CHHapticEngineFinishedHandler`).
      • playPatternFromDataError

        public boolean playPatternFromDataError​(NSData data,
                                                org.moe.natj.general.ptr.Ptr<NSError> outError)
        playPatternFromData:error Simple one-shot call to play a pattern specified by NSData. The engine should be started prior to calling this method if low latency is desired. If this is not done, this method will start it, which can cause a significant delay.
        Parameters:
        data - The NSData containing a haptic/audio pattern dictionary.
        outError - If the operation fails, this will be set to a valid NSError describing the error.
      • playPatternFromURLError

        public boolean playPatternFromURLError​(NSURL fileURL,
                                               org.moe.natj.general.ptr.Ptr<NSError> outError)
        playPatternFromURL:error Simple one-shot call to play a pattern specified by a URL. The engine should be started prior to calling this method if low latency is desired. If this is not done, this method will start it, which can cause a significant delay.
        Parameters:
        fileURL - The URL of the file containing a haptic/audio pattern dictionary.
        outError - If the operation fails, this will be set to a valid NSError describing the error.
      • playsHapticsOnly

        public boolean playsHapticsOnly()
        [@property] playsHapticsOnly If set to YES, the CHHapticEngine will ignore all events of type CHHapticEventTypeAudio and play only haptic events. This behavior change will only take effect after the engine is stopped and restarted. The default is NO.
      • registerAudioResourceOptionsError

        public long registerAudioResourceOptionsError​(NSURL resourceURL,
                                                      NSDictionary<?,​?> options,
                                                      org.moe.natj.general.ptr.Ptr<NSError> outError)
        registerAudioResource:options:error Register an external audio file for use as a custom waveform.
        Parameters:
        resourceURL - A URL referencing the location of the audio file to be registered.
        options - A dictionary containing key/value pairs describing how this resource should be played.
        outError - If register operation fails, this will be set to a valid NSError describing the error.
      • resetHandler

        public CHHapticEngine.Block_resetHandler_ret resetHandler()
        [@property] resetHandler This block will called asynchronously if the haptic engine has to reset itself after a server failure. In response to this handler being called, the client must release all haptic pattern players and recreate them. All CHHapticPattern objects and CHHapticEngine properties will have been preserved. In general, callbacks arrive on a non-main thread and it is the client's responsibility to handle it in a thread-safe manner.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setAutoShutdownEnabled

        public void setAutoShutdownEnabled​(boolean value)
        [@property] autoShutdownEnabled When auto shutdown is enabled, the haptic engine can start and stop the hardware dynamically, to conserve power. To conserve power, it is advised that the client stop the haptic engine when not in use. But when auto shutdown is enabled, the haptic engine will stop the hardware if it was running idle for a certain duration, and restart it later when required. Note that, because this operation is dynamic, it may affect the start times of the pattern players (e.g. `CHHapticPatternplayer`), if the engine has to resume from its shutdown state. This feature is disabled by default, but the client can enable it if needed.
      • setIsMutedForAudio

        public void setIsMutedForAudio​(boolean value)
        [@property] isMutedForAudio When set to YES, the CHHapticEngine mutes audio playback from its players. Default is NO.
      • setIsMutedForHaptics

        public void setIsMutedForHaptics​(boolean value)
        [@property] isMutedForHaptics When set to YES, the CHHapticEngine mutes haptic playback from its players. Default is NO.
      • setPlaysHapticsOnly

        public void setPlaysHapticsOnly​(boolean value)
        [@property] playsHapticsOnly If set to YES, the CHHapticEngine will ignore all events of type CHHapticEventTypeAudio and play only haptic events. This behavior change will only take effect after the engine is stopped and restarted. The default is NO.
      • setResetHandler

        public void setResetHandler​(CHHapticEngine.Block_setResetHandler value)
        [@property] resetHandler This block will called asynchronously if the haptic engine has to reset itself after a server failure. In response to this handler being called, the client must release all haptic pattern players and recreate them. All CHHapticPattern objects and CHHapticEngine properties will have been preserved. In general, callbacks arrive on a non-main thread and it is the client's responsibility to handle it in a thread-safe manner.
      • setStoppedHandler

        public void setStoppedHandler​(CHHapticEngine.Block_setStoppedHandler value)
        [@property] stoppedHandler The engine will call this block when it has stopped due to external causes (such as an audio session interruption or the app going into the background). It will NOT be called if the client calls stopWithCompletionHandler:. In general, callbacks arrive on a non-main thread and it is the client's responsibility to handle it in a thread-safe manner.
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • startAndReturnError

        public boolean startAndReturnError​(org.moe.natj.general.ptr.Ptr<NSError> outError)
        startAndReturnError: Start the engine and block until the engine has started. This method will return NO upon failure, and outError will be set to a valid NSError describing the error.
      • startWithCompletionHandler

        public void startWithCompletionHandler​(CHHapticEngine.Block_startWithCompletionHandler completionHandler)
        startWithCompletionHandler: Asynchronously start the engine. The handler will be called when the operation completes. The handler is guaranteed to be called on either success or failure.
      • stopWithCompletionHandler

        public void stopWithCompletionHandler​(CHHapticEngine.Block_stopWithCompletionHandler completionHandler)
        stopWithCompletionHandler: Asynchronously stop the engine. The handler will be called when the operation completes. The handler is guaranteed to be called on either success or failure.
      • stoppedHandler

        public CHHapticEngine.Block_stoppedHandler_ret stoppedHandler()
        [@property] stoppedHandler The engine will call this block when it has stopped due to external causes (such as an audio session interruption or the app going into the background). It will NOT be called if the client calls stopWithCompletionHandler:. In general, callbacks arrive on a non-main thread and it is the client's responsibility to handle it in a thread-safe manner.
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • unregisterAudioResourceError

        public boolean unregisterAudioResourceError​(long resourceID,
                                                    org.moe.natj.general.ptr.Ptr<NSError> outError)
        unregisterAudioResource:error Unregister and remove a previously-registered audio resource.
        Parameters:
        resourceID - The resource ID that was returned when the resource was registered.
        outError - If the unregister operation fails, this will be set to a valid NSError describing the error.
      • version_static

        public static long version_static()