Add io_mac files from wiic, update wiiuse definitions

-Used io_mac.h/.m from wiic and added them to CMakeLists
-Define WIIUSE_MAC on wiiuse.h and wiiuse_internal.h
-Implemented wiiuse_poll when WIIUSE_MAC is defined
-Added Mac-specific includes to wiiuse.h and wiiuse_internal.h
-Added Mac-specific members to wiimote_t on wiiuse.h
-Added Mac-specific WM_DEV_CLASS definitions to wiiuse_internal.h
-Modified wiiuse_poll for use with Mac
-Added init and cleanup functions to io_mac.m
This commit is contained in:
Juan Sebastian Casallas
2011-11-22 20:37:49 +01:00
parent bc205d42b7
commit 257b94659d
6 changed files with 999 additions and 5 deletions

View File

@@ -76,6 +76,9 @@
#elif defined(__linux)
#define WIIUSE_PLATFORM
#define WIIUSE_BLUEZ
#elif defined(__APPLE__)
#define WIIUSE_PLATFORM
#define WIIUSE_MAC
#else
#error "Platform not yet supported!"
#endif
@@ -89,6 +92,11 @@
/* nix */
#include <bluetooth/bluetooth.h>
#endif
#ifdef WIIUSE_MAC
/* mac */
#include <CoreFoundation/CoreFoundation.h> /*CFRunLoops and CFNumberRef in Bluetooth classes*/
#include <IOBluetooth/IOBluetoothUserLib.h> /*IOBluetoothDeviceRef and IOBluetoothL2CAPChannelRef*/
#endif
#ifndef WCONST
#define WCONST const
@@ -688,7 +696,6 @@ typedef struct wiimote_t {
/** @name Linux-specific (BlueZ) members */
/** @{ */
WCONST bdaddr_t bdaddr; /**< bt address */
WCONST char bdaddr_str[18]; /**< readable bt address */
WCONST int out_sock; /**< output socket */
WCONST int in_sock; /**< input socket */
/** @} */
@@ -705,6 +712,25 @@ typedef struct wiimote_t {
WCONST byte exp_timeout; /**< timeout for expansion handshake */
/** @} */
#endif
#ifdef WIIUSE_MAC
/** @name Mac OS X-specific members */
/** @{ */
WCONST IOBluetoothDeviceRef device; /** Device reference object */
WCONST CFStringRef address; /** MacOS-like device address string */
WCONST IOBluetoothL2CAPChannelRef inputCh; /** Input L2CAP channel */
WCONST IOBluetoothL2CAPChannelRef outputCh; /** Output L2CAP channel */
WCONST IOBluetoothUserNotificationRef disconnectionRef; /** Disconnection Notification Reference **/
WCONST void* connectionHandler; /** Wiimote connection handler for MACOSX **/
/** @} */
#endif
#if defined(WIIUSE_BLUEZ) || defined(WIIUSE_MAC)
/** @name Linux (BlueZ) and Mac OS X shared members */
/** @{ */
WCONST char bdaddr_str[18]; /**< readable bt address */
/** @} */
#endif
WCONST int state; /**< various state flags */
WCONST byte leds; /**< currently lit leds */