Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
GHOST_NDOFManagerCocoa.mm File Reference
#include "GHOST_NDOFManagerCocoa.h"
#include "GHOST_SystemCocoa.h"
#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 = NULL
 
#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 voidload_func (void *module, const char *func_name)
 
static bool load_driver_functions ()
 
static void unload_driver ()
 
static void DeviceAdded (uint32_t unused)
 
static void DeviceRemoved (uint32_t unused)
 
static void DeviceEvent (uint32_t unused, uint32_t msg_type, void *msg_arg)
 

Variables

static GHOST_SystemCocoaghost_system = NULL
 
static GHOST_NDOFManagerndof_manager = NULL
 
static uint16_t clientID = 0
 
static bool driver_loaded = false
 
static bool has_old_driver
 
static bool has_new_driver
 
static voidmodule
 

Macro Definition Documentation

◆ DEBUG_NDOF_DRIVER

#define DEBUG_NDOF_DRIVER   false

Definition at line 3 of file GHOST_NDOFManagerCocoa.mm.

◆ DECLARE_FUNC

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

Definition at line 74 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionClientModeTakeOver

#define kConnexionClientModeTakeOver   1

Definition at line 29 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionCmdAppSpecific

#define kConnexionCmdAppSpecific   10

Definition at line 34 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionCmdHandleAxis

#define kConnexionCmdHandleAxis   3

Definition at line 33 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionCmdHandleButtons

#define kConnexionCmdHandleButtons   2

Definition at line 32 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionCtlGetDeviceID

#define kConnexionCtlGetDeviceID   '3did'

Definition at line 36 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionMaskAll

#define kConnexionMaskAll   0x3fff

Definition at line 30 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionMaskAllButtons

#define kConnexionMaskAllButtons   0xffffffff

Definition at line 31 of file GHOST_NDOFManagerCocoa.mm.

◆ kConnexionMsgDeviceState

#define kConnexionMsgDeviceState   '3dSR'

Definition at line 35 of file GHOST_NDOFManagerCocoa.mm.

◆ LOAD_FUNC

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

Definition at line 100 of file GHOST_NDOFManagerCocoa.mm.

Typedef Documentation

◆ AddedHandler

typedef void(* AddedHandler) (uint32_t)

Definition at line 55 of file GHOST_NDOFManagerCocoa.mm.

◆ CleanupConnexionHandlers_ptr

typedef void(* CleanupConnexionHandlers_ptr) ()

Definition at line 62 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 69 of file GHOST_NDOFManagerCocoa.mm.

◆ InstallConnexionHandlers_ptr

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

Definition at line 61 of file GHOST_NDOFManagerCocoa.mm.

◆ MessageHandler

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

Definition at line 57 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 63 of file GHOST_NDOFManagerCocoa.mm.

◆ RemovedHandler

typedef void(* RemovedHandler) (uint32_t)

Definition at line 56 of file GHOST_NDOFManagerCocoa.mm.

◆ SetConnexionClientButtonMask_ptr

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

Definition at line 67 of file GHOST_NDOFManagerCocoa.mm.

◆ SetConnexionHandlers_ptr

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

Definition at line 60 of file GHOST_NDOFManagerCocoa.mm.

◆ UnregisterConnexionClient_ptr

typedef void(* UnregisterConnexionClient_ptr) (uint16_t clientID)

Definition at line 68 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()

static void DeviceAdded ( uint32_t  unused)
static

◆ DeviceEvent()

static void DeviceEvent ( uint32_t  unused,
uint32_t  msg_type,
void msg_arg 
)
static

◆ DeviceRemoved()

static void DeviceRemoved ( uint32_t  unused)
static

◆ 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 84 of file GHOST_NDOFManagerCocoa.mm.

References module.

◆ unload_driver()

static void unload_driver ( )
static

Definition at line 149 of file GHOST_NDOFManagerCocoa.mm.

References module.

Referenced by GHOST_NDOFManagerCocoa::~GHOST_NDOFManagerCocoa().

Variable Documentation

◆ clientID

uint16_t clientID = 0
static

◆ driver_loaded

bool driver_loaded = false
static

◆ ghost_system

GHOST_SystemCocoa* ghost_system = NULL
static

◆ has_new_driver

bool has_new_driver
static
Initial value:
=
false

Definition at line 24 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 22 of file GHOST_NDOFManagerCocoa.mm.

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

◆ module

void* module
static

Definition at line 102 of file GHOST_NDOFManagerCocoa.mm.

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

◆ ndof_manager

GHOST_NDOFManager* ndof_manager = NULL
static