-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Interface to the Kinect device. -- @package freenect @version 1.2.1 -- | Foreign functions, some helpers some from Freenect C lib. module Freenect.FFI data ContextStruct data DeviceStruct data RawTiltState freenect_init :: Ptr (Ptr ContextStruct) -> CInt -> IO CInt freenect_shutdown :: Ptr ContextStruct -> IO CInt freenect_num_devices :: Ptr ContextStruct -> IO CInt freenect_process_events :: Ptr ContextStruct -> IO CInt freenect_select_subdevices :: Ptr ContextStruct -> CInt -> IO () freenect_set_log_level :: Ptr ContextStruct -> CInt -> IO () freenect_close_device :: Ptr DeviceStruct -> IO CInt freenect_open_device :: Ptr ContextStruct -> Ptr (Ptr DeviceStruct) -> CInt -> IO CInt type DepthCallback = Ptr DeviceStruct -> Ptr Word16 -> Word32 -> IO () freenect_set_depth_callback :: Ptr DeviceStruct -> (FunPtr DepthCallback) -> IO () wrapDepthCallback :: DepthCallback -> IO (FunPtr DepthCallback) type VideoCallback = Ptr DeviceStruct -> Ptr Word8 -> Word32 -> IO () freenect_set_video_callback :: Ptr DeviceStruct -> (FunPtr VideoCallback) -> IO () wrapVideoCallback :: VideoCallback -> IO (FunPtr VideoCallback) freenect_start_depth :: Ptr DeviceStruct -> IO CInt freenect_stop_depth :: Ptr DeviceStruct -> IO CInt freenect_start_video :: Ptr DeviceStruct -> IO CInt freenect_stop_video :: Ptr DeviceStruct -> IO CInt freenect_set_led :: Ptr DeviceStruct -> CInt -> IO CInt freenect_set_flag :: Ptr DeviceStruct -> CInt -> CInt -> IO CInt freenect_set_tilt_degs :: Ptr DeviceStruct -> CDouble -> IO CInt freenect_update_tilt_state :: Ptr DeviceStruct -> IO CInt freenect_get_tilt_state :: Ptr DeviceStruct -> IO (Ptr RawTiltState) freenect_get_tilt_degs :: Ptr RawTiltState -> IO CDouble freenect_get_mks_accel :: Ptr RawTiltState -> Ptr CDouble -> Ptr CDouble -> Ptr CDouble -> IO () freenect_start_audio :: Ptr DeviceStruct -> IO CInt freenect_stop_audio :: Ptr DeviceStruct -> IO CInt type AudioInCallback = Ptr DeviceStruct -> CInt -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word16 -> Ptr CUChar -> IO () freenect_set_audio_in_callback :: Ptr DeviceStruct -> (FunPtr AudioInCallback) -> IO () wrapAudioInCallback :: AudioInCallback -> IO (FunPtr AudioInCallback) new_freenect_context :: IO (Ptr (Ptr ContextStruct)) new_freenect_device :: IO (Ptr (Ptr DeviceStruct)) process_events_timeout :: Ptr ContextStruct -> CInt -> IO CInt data FrameMode find_video_mode_freenect :: Word32 -> Word32 -> IO (Ptr FrameMode) set_freenect_video_mode :: Ptr DeviceStruct -> Ptr FrameMode -> IO CInt get_freenect_video_resolution :: Ptr DeviceStruct -> IO CInt find_depth_mode_freenect :: Word32 -> Word32 -> IO (Ptr FrameMode) set_freenect_depth_mode :: Ptr DeviceStruct -> Ptr FrameMode -> IO CInt get_freenect_depth_resolution :: Ptr DeviceStruct -> IO CInt -- | Interface to the Kinect device. -- -- See the package archive for example programs. module Freenect -- | Initialize a Freenect context. Throws exception if already -- initialized. initialize :: Context -> IO () -- | Create a new Freenect context. Must be initialized before use. newContext :: IO Context -- | Shutdown a Freenect context. shutdown :: Context -> IO () -- | Count the number of devices on a Freenect context. countDevices :: Context -> IO Integer -- | Do something with an initialized context, and free the context at the -- end of the comutation, or on exception. withContext :: (Context -> IO a) -> IO a -- | Process events. processEvents :: Context -> IO () processEventsTimeout :: Context -> Int -> IO () -- | Set which subdevices any subsequent calls to openDevice should open. -- This will not affect devices which have already been opened. The -- default behavior, should you choose not to call this function at all, -- is to open all supported subdevices - motor, cameras, and audio, if -- supported on the platform. selectSubdevices :: Context -> [Subdevice] -> IO () -- | Create a new device. newDevice :: IO Device -- | Open a Kinect device. openDevice :: Context -> Device -> Integer -> IO () -- | Close a device. closeDevice :: Device -> IO () -- | Do something with an initialized context, and free the context at the -- end of the comutation, or on exception. withDevice :: Context -> Integer -> (Device -> IO a) -> IO a -- | Set the logging level for the specified context. setLogLevel :: LogLevel -> Context -> IO () -- | Set callback for video information received event. setVideoCallback :: Device -> (Vector Word8 -> Word32 -> IO ()) -> IO () -- | Start the video information stream for a device. startVideo :: Device -> IO () -- | Start the video information stream for a device. stopVideo :: Device -> IO () -- | Set callback for depth information received event. setDepthCallback :: Device -> (Vector Word16 -> Word32 -> IO ()) -> IO () -- | Start the depth information stream for a device. startDepth :: Device -> IO () -- | Stop the depth information stream for a device. stopDepth :: Device -> IO () -- | Set the tilt degrees for a device. setTiltDegrees :: Double -> Device -> IO () -- | Get the tilt degrees for a device getTiltDegrees :: Device -> IO Double -- | Get the accelaretion for (x, y, z) axes from the internal tilt state getAcceleration :: Device -> IO (Double, Double, Double) -- | Sets the current LED state for the specified device setLed :: Device -> Led -> IO () setVideoMode :: Device -> Resolution -> VideoFormat -> IO () -- | Sets the current depth mode for the specified device. The mode cannot -- be changed while streaming is active. setDepthMode :: Device -> Resolution -> DepthFormat -> IO () -- | Sets a specific device flag for depth and video cameras. The bool -- value defines to enable or disable the given flag. The specific camera -- has to be started with startVideo/startDepth before Freenect accepts -- these flags (seems to be a small bug for me, an issue is written at -- libfreenect) setFlag :: Device -> Flag -> Bool -> IO () -- | A Freenect context. data Context -- | A Freenect device. data Device -- | Freenect exception type. data FreenectException -- | There was a problem initializing. InitFail :: FreenectException -- | There was a problem shutting down. ShutdownFail :: FreenectException -- | There was a problem closing the device. CloseDeviceFail :: FreenectException -- | Trying to initialize a context that was already initialized. AlreadyInitializedContext :: FreenectException -- | Trying to open a device that was already opened. AlreadyOpenedDevice :: FreenectException -- | Attempt to use an uninitialized context. UseOfUninitializedContext :: FreenectException -- | Attempt to use an uninitialized device. UseOfUninitializedDevice :: FreenectException -- | Call to process events failed. ProcessEvents :: CInt -> FreenectException -- | Opening a device failed. OpenDeviceFailed :: Integer -> FreenectException -- | Problem starting the video stream. StartVideoProblem :: FreenectException -- | Problem stopping the video stream StopVideoProblem :: FreenectException -- | Problem starting the depth stream. StartDepthProblem :: FreenectException -- | Problem stopping the depth stream StopDepthProblem :: FreenectException -- | Unable to set the tilt. UnableToSetTilt :: FreenectException -- | Unable to set active led UnableToSetLed :: FreenectException -- | Failed to enable a specific device flag UnableToSetFlag :: FreenectException -- | Unable to set the video mode. SetVideoMode :: FreenectException -- | TODO, not used: You didn't set the video mode. VideoModeNotSet :: FreenectException -- | Unable to set the depth mode. SetDepthMode :: FreenectException -- | TODO, not used: You didn't set the depth mode. DepthModeNotSet :: FreenectException -- | Problem starting the audio stream StartAudioProblem :: FreenectException -- | Problem stopping the audio stream StopAudioProblem :: FreenectException -- | A sub-device (motor, camera and audio), if supported on the platform. data Subdevice Motor :: Subdevice Camera :: Subdevice Audio :: Subdevice -- | Message logging levels. data LogLevel -- | Crashing/non-recoverable errors LogFatal :: LogLevel -- | Major errors LogError :: LogLevel -- | Warning messages LogWarning :: LogLevel -- | Important messages LogNotice :: LogLevel -- | Normal messages LogInfo :: LogLevel -- | Useful development messages LogDebug :: LogLevel -- | Slightly less useful messages LogSpew :: LogLevel -- | EVERYTHING. May slow performance. LogFlood :: LogLevel data Led Off :: Led Green :: Led Red :: Led Yellow :: Led BlinkGreen :: Led BlinkRedYellow :: Led data Flag AutoExposure :: Flag AutoWhiteBalance :: Flag RawColor :: Flag MirrorDepth :: Flag MirrorVideo :: Flag data Resolution Low :: Resolution Medium :: Resolution High :: Resolution data VideoFormat RGB :: VideoFormat Bayer :: VideoFormat EightBitIR :: VideoFormat TenBitIR :: VideoFormat TenBitPackedIR :: VideoFormat YUVRGB :: VideoFormat YUVRaw :: VideoFormat data DepthFormat ElevenBit :: DepthFormat TenBit :: DepthFormat ElevenBitPacked :: DepthFormat TenBitPacked :: DepthFormat -- | Set callback for incoming audio events. setAudioInCallback :: Device -> (Int -> Vector Word32 -> Vector Word32 -> Vector Word32 -> Vector Word32 -> Vector Word16 -> IO ()) -> IO () -- | Start the audio information stream for a device. startAudio :: Device -> IO () -- | Stop the audio information stream for a device. stopAudio :: Device -> IO () instance Typeable FreenectException instance Show a => Show (Resource a) instance Show FreenectException instance Show Subdevice instance Eq Subdevice instance Show LogLevel instance Eq LogLevel instance Enum LogLevel instance Enum Resolution instance Show Resolution instance Eq Resolution instance Ord Resolution instance Enum VideoFormat instance Show VideoFormat instance Eq VideoFormat instance Enum DepthFormat instance Show DepthFormat instance Eq DepthFormat instance Enum Led instance Show Led instance Eq Led instance Show Flag instance Eq Flag instance Exception FreenectException