Blender V4.3
GHOST_NDOFManagerCocoa.mm File Reference
#include "GHOST_NDOFManagerCocoa.hh"
#include "GHOST_SystemCocoa.hh"
#include <dlfcn.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  ConnexionDeviceState
 

Macros

#define DEBUG_NDOF_DRIVER   false
 
#define kConnexionClientModeTakeOver   1
 
#define kConnexionMaskAll   0x3fff
 
#define kConnexionMaskAllButtons   0xffffffff
 
#define kConnexionCmdHandleButtons   2
 
#define kConnexionCmdHandleAxis   3
 
#define kConnexionCmdAppSpecific   10
 
#define kConnexionMsgDeviceState   '3dSR'
 
#define kConnexionCtlGetDeviceID   '3did'
 
#define DECLARE_FUNC(name)   name##_ptr name = nullptr
 
#define LOAD_FUNC(name)   name = (name##_ptr)load_func(module, #name)
 

Typedefs

typedef void(* AddedHandler) (uint32_t)
 
typedef void(* RemovedHandler) (uint32_t)
 
typedef void(* MessageHandler) (uint32_t, uint32_t msg_type, void *msg_arg)
 
typedef int16_t(* SetConnexionHandlers_ptr) (MessageHandler, AddedHandler, RemovedHandler, bool)
 
typedef int16_t(* InstallConnexionHandlers_ptr) (MessageHandler, AddedHandler, RemovedHandler)
 
typedef void(* CleanupConnexionHandlers_ptr) ()
 
typedef uint16_t(* RegisterConnexionClient_ptr) (uint32_t signature, const char *name, uint16_t mode, uint32_t mask)
 
typedef void(* SetConnexionClientButtonMask_ptr) (uint16_t clientID, uint32_t buttonMask)
 
typedef void(* UnregisterConnexionClient_ptr) (uint16_t clientID)
 
typedef int16_t(* ConnexionClientControl_ptr) (uint16_t clientID, uint32_t message, int32_t param, int32_t *result)
 

Functions

 DECLARE_FUNC (SetConnexionHandlers)
 
 DECLARE_FUNC (InstallConnexionHandlers)
 
 DECLARE_FUNC (CleanupConnexionHandlers)
 
 DECLARE_FUNC (RegisterConnexionClient)
 
 DECLARE_FUNC (SetConnexionClientButtonMask)
 
 DECLARE_FUNC (UnregisterConnexionClient)
 
 DECLARE_FUNC (ConnexionClientControl)
 
static void * load_func (void *module, const char *func_name)
 
static bool load_driver_functions ()
 
static void unload_driver ()
 
static void DeviceAdded (uint32_t)
 
static void DeviceRemoved (uint32_t)
 
static void DeviceEvent (uint32_t, uint32_t msg_type, void *msg_arg)
 

Variables

static GHOST_SystemCocoaghost_system = nullptr
 
static GHOST_NDOFManagerndof_manager = nullptr
 
static uint16_t clientID = 0
 
static bool driver_loaded = false
 
static bool has_old_driver
 
static bool has_new_driver
 
static void * module
 

Macro Definition Documentation

◆ DEBUG_NDOF_DRIVER

#define DEBUG_NDOF_DRIVER   false

Definition at line 5 of file GHOST_NDOFManagerCocoa.mm.

◆ DECLARE_FUNC

#define DECLARE_FUNC ( name)    name##_ptr name = nullptr

Definition at line 76 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionClientModeTakeOver

#define kConnexionClientModeTakeOver   1

◆ kConnexionCmdAppSpecific

#define kConnexionCmdAppSpecific   10

Definition at line 36 of file GHOST_NDOFManagerCocoa.mm.

Referenced by DeviceEvent().

◆ kConnexionCmdHandleAxis

#define kConnexionCmdHandleAxis   3

Definition at line 35 of file GHOST_NDOFManagerCocoa.mm.

Referenced by DeviceEvent().

◆ kConnexionCmdHandleButtons

#define kConnexionCmdHandleButtons   2

Definition at line 34 of file GHOST_NDOFManagerCocoa.mm.

Referenced by DeviceEvent().

◆ kConnexionCtlGetDeviceID

#define kConnexionCtlGetDeviceID   '3did'

Definition at line 38 of file GHOST_NDOFManagerCocoa.mm.

Referenced by DeviceAdded().

◆ kConnexionMaskAll

#define kConnexionMaskAll   0x3fff

◆ kConnexionMaskAllButtons

#define kConnexionMaskAllButtons   0xffffffff

◆ kConnexionMsgDeviceState

#define kConnexionMsgDeviceState   '3dSR'

Definition at line 37 of file GHOST_NDOFManagerCocoa.mm.

Referenced by DeviceEvent().

◆ LOAD_FUNC

#define LOAD_FUNC ( name)    name = (name##_ptr)load_func(module, #name)

Definition at line 102 of file GHOST_NDOFManagerCocoa.mm.

Referenced by load_driver_functions().

Typedef Documentation

◆ AddedHandler

typedef void(* AddedHandler) (uint32_t)

Definition at line 57 of file GHOST_NDOFManagerCocoa.mm.

◆ CleanupConnexionHandlers_ptr

typedef void(* CleanupConnexionHandlers_ptr) ()

Definition at line 64 of file GHOST_NDOFManagerCocoa.mm.

◆ ConnexionClientControl_ptr

typedef int16_t(* ConnexionClientControl_ptr) (uint16_t clientID, uint32_t message, int32_t param, int32_t *result)

Definition at line 71 of file GHOST_NDOFManagerCocoa.mm.

◆ InstallConnexionHandlers_ptr

typedef int16_t(* InstallConnexionHandlers_ptr) (MessageHandler, AddedHandler, RemovedHandler)

Definition at line 63 of file GHOST_NDOFManagerCocoa.mm.

◆ MessageHandler

typedef void(* MessageHandler) (uint32_t, uint32_t msg_type, void *msg_arg)

Definition at line 59 of file GHOST_NDOFManagerCocoa.mm.

◆ RegisterConnexionClient_ptr

typedef uint16_t(* RegisterConnexionClient_ptr) (uint32_t signature, const char *name, uint16_t mode, uint32_t mask)

Definition at line 65 of file GHOST_NDOFManagerCocoa.mm.

◆ RemovedHandler

typedef void(* RemovedHandler) (uint32_t)

Definition at line 58 of file GHOST_NDOFManagerCocoa.mm.

◆ SetConnexionClientButtonMask_ptr

typedef void(* SetConnexionClientButtonMask_ptr) (uint16_t clientID, uint32_t buttonMask)

Definition at line 69 of file GHOST_NDOFManagerCocoa.mm.

◆ SetConnexionHandlers_ptr

typedef int16_t(* SetConnexionHandlers_ptr) (MessageHandler, AddedHandler, RemovedHandler, bool)

Definition at line 62 of file GHOST_NDOFManagerCocoa.mm.

◆ UnregisterConnexionClient_ptr

typedef void(* UnregisterConnexionClient_ptr) (uint16_t clientID)

Definition at line 70 of file GHOST_NDOFManagerCocoa.mm.

Function Documentation

◆ DECLARE_FUNC() [1/7]

DECLARE_FUNC ( CleanupConnexionHandlers )

◆ DECLARE_FUNC() [2/7]

DECLARE_FUNC ( ConnexionClientControl )

◆ DECLARE_FUNC() [3/7]

DECLARE_FUNC ( InstallConnexionHandlers )

◆ DECLARE_FUNC() [4/7]

DECLARE_FUNC ( RegisterConnexionClient )

◆ DECLARE_FUNC() [5/7]

DECLARE_FUNC ( SetConnexionClientButtonMask )

◆ DECLARE_FUNC() [6/7]

DECLARE_FUNC ( SetConnexionHandlers )

◆ DECLARE_FUNC() [7/7]

DECLARE_FUNC ( UnregisterConnexionClient )

◆ DeviceAdded()

◆ DeviceEvent()

◆ DeviceRemoved()

static void DeviceRemoved ( uint32_t )
static

Definition at line 171 of file GHOST_NDOFManagerCocoa.mm.

References printf.

Referenced by GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa().

◆ load_driver_functions()

static bool load_driver_functions ( )
static

◆ load_func()

static void * load_func ( void * module,
const char * func_name )
static

Definition at line 86 of file GHOST_NDOFManagerCocoa.mm.

References module, and printf.

◆ unload_driver()

static void unload_driver ( )
static

Definition at line 151 of file GHOST_NDOFManagerCocoa.mm.

References module.

Referenced by GHOST_NDOFManagerCocoa::~GHOST_NDOFManagerCocoa().

Variable Documentation

◆ clientID

◆ driver_loaded

◆ ghost_system

◆ has_new_driver

bool has_new_driver
static
Initial value:
=
false

Definition at line 26 of file GHOST_NDOFManagerCocoa.mm.

Referenced by GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa(), and load_driver_functions().

◆ has_old_driver

bool has_old_driver
static
Initial value:
=
false

Definition at line 24 of file GHOST_NDOFManagerCocoa.mm.

Referenced by DeviceEvent(), GHOST_NDOFManagerCocoa::GHOST_NDOFManagerCocoa(), and load_driver_functions().

◆ module

void* module
static

Definition at line 104 of file GHOST_NDOFManagerCocoa.mm.

Referenced by load_driver_functions(), load_func(), and unload_driver().

◆ ndof_manager