]> git.saurik.com Git - wxWidgets.git/commitdiff
hid integration
authorRyan Norton <wxprojects@comcast.net>
Sun, 26 Sep 2004 20:35:45 +0000 (20:35 +0000)
committerRyan Norton <wxprojects@comcast.net>
Sun, 26 Sep 2004 20:35:45 +0000 (20:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29424 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/bakefiles/files.bkl
include/wx/mac/carbon/private/hid.h
src/mac/carbon/hid.cpp

index 963154d11018acb73a84b223019fe8c2a10f38fd..0c2cd3fdfc51d2fed78034f5a5d210692dcb44e5 100644 (file)
@@ -1621,6 +1621,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/mac/carbon/gauge.cpp
     src/mac/carbon/gdiobj.cpp
     src/mac/carbon/gsockosx.cpp
+    src/mac/carbon/hid.cpp
     src/mac/carbon/icon.cpp
     src/mac/carbon/listbox.cpp
     src/mac/carbon/mdi.cpp
index 2947ee357590d3f75882145b034cc5cfdc639816..ddc93c2cf2a850dec1c46d5668569969d617549d 100644 (file)
@@ -1,4 +1,18 @@
-#include <wx/wx.h>
+/////////////////////////////////////////////////////////////////////////////
+// Name:        hid.h
+// Purpose:     DARWIN HID layer for WX
+// Author:      Ryan Norton
+// Modified by:
+// Created:     11/11/2003
+// RCS-ID:      $Id$
+// Copyright:   (c) Ryan Norton
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+
+#ifdef __DARWIN__
+
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOCFPlugIn.h>
 #include <IOKit/hid/IOHIDLib.h>
@@ -60,4 +74,6 @@ class wxHIDKeyboard : public wxHIDDevice
 public:
        bool Create();
        virtual void BuildCookies(wxCFArray& Array);
-};
\ No newline at end of file
+};
+
+#endif //__DARWIN__
\ No newline at end of file
index f4ce8a1874e84bda16341859af0e1897c3532706..7b337c93404dd16f051c754f8e60e52ad22142c9 100644 (file)
@@ -1,4 +1,22 @@
-#include "hid.h"
+/////////////////////////////////////////////////////////////////////////////
+// Name:        hid.cpp
+// Purpose:     DARWIN HID layer for WX Implementation
+// Author:      Ryan Norton
+// Modified by:
+// Created:     11/11/2003
+// RCS-ID:      $Id$
+// Copyright:   (c) Ryan Norton
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#include "wx/defs.h"
+
+//DARWIN _ONLY_
+#ifdef __DARWIN__
+
+#include "wx/mac/carbon/private/hid.h"
+#include "wx/string.h"
+#include "wx/log.h"
 
 #define wxFORCECHECK_MSG(arg, msg)  \
 {\
 #define wxKERNCHECK(arg, msg) wxFORCECHECK_MSG(arg != KERN_SUCCESS, msg)
 #define wxSCHECK(arg, msg) wxFORCECHECK_MSG(arg != S_OK, msg)
 
+#ifdef __WXDEBUG___
+#      define wxVERIFY(arg)    wxASSERT(arg)
+#else
+#      define wxVERIFY(arg)    arg
+#endif
+
+/*
 void CFShowTypeIDDescription(CFTypeRef pData)
 {
        if(!pData)
        {
-               wxMessageBox("AHHH!");
+               wxASSERT(false);
                return;
        }
        
@@ -26,6 +51,7 @@ void CFShowTypeIDDescription(CFTypeRef pData)
                                                         )
                                );      
 }
+*/
 
 // ============================================================================
 // implementation
@@ -46,7 +72,7 @@ bool wxHIDDevice::Create (const int& nClass, const int& nType)
        //The call to IOServiceMatching filters down the
        //the services we want to hid services (and also eats the
        //dictionary up for us (consumes one reference))
-       wxASSERT((pDictionary = IOServiceMatching(kIOHIDDeviceKey)) != NULL );
+       wxVERIFY((pDictionary = IOServiceMatching(kIOHIDDeviceKey)) != NULL );
 
        //Here we'll filter down the services to what we want
        if (nType != -1)
@@ -73,11 +99,11 @@ bool wxHIDDevice::Create (const int& nClass, const int& nType)
        io_object_t pObject;
        while ( (pObject = IOIteratorNext(pIterator)) != NULL)
        {
-               wxASSERT(IORegistryEntryCreateCFProperties(pObject, &pDictionary,
+               wxVERIFY(IORegistryEntryCreateCFProperties(pObject, &pDictionary,
                                                                                        kCFAllocatorDefault, kNilOptions) == KERN_SUCCESS);
 
                //Just for sanity :)
-               wxASSERT(CFGetTypeID(CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey))) == CFStringGetTypeID());
+               wxVERIFY(CFGetTypeID(CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey))) == CFStringGetTypeID());
                        
                //Get [product] name
                m_szName = CFStringGetCStringPtr        (
@@ -91,7 +117,7 @@ bool wxHIDDevice::Create (const int& nClass, const int& nType)
                wxCFArray CookieArray = CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDElementKey));
                BuildCookies(CookieArray);
                if (m_ppQueue != NULL)
-                       wxASSERT((*m_ppQueue)->start(m_ppQueue) == S_OK);
+                       wxVERIFY((*m_ppQueue)->start(m_ppQueue) == S_OK);
 
                //Create the interface (good grief - long function names!)
                SInt32 nScore;
@@ -111,7 +137,7 @@ bool wxHIDDevice::Create (const int& nClass, const int& nType)
                (*ppPlugin)->Release(ppPlugin);
                
                //open the HID interface...
-               wxASSERT((*m_ppDevice)->open(m_ppDevice, 0) == S_OK);
+               wxVERIFY((*m_ppDevice)->open(m_ppDevice, 0) == S_OK);
                
                //cleanup
                CFRelease(pDictionary);
@@ -138,7 +164,7 @@ void wxHIDDevice::AddCookie(CFTypeRef Data, const int& i)
 void wxHIDDevice::AddCookieInQueue(CFTypeRef Data, const int& i)
 {
        AddCookie(Data, i);
-       wxASSERT((*m_ppQueue)->addElement(m_ppQueue, m_pCookies[i], 0) == S_OK);//3rd Param flags (none yet)
+       wxVERIFY((*m_ppQueue)->addElement(m_ppQueue, m_pCookies[i], 0) == S_OK);//3rd Param flags (none yet)
 }
        
 void wxHIDDevice::InitCookies(const size_t& dwSize, bool bQueue)
@@ -147,8 +173,8 @@ void wxHIDDevice::InitCookies(const size_t& dwSize, bool bQueue)
        if (bQueue)
        {
                wxASSERT( m_ppQueue != NULL);
-               wxASSERT(  (m_ppQueue = (*m_ppDevice)->allocQueue(m_ppDevice)) != NULL);
-               wxASSERT(  (*m_ppQueue)->create(m_ppQueue, 0, 512) == S_OK); //Param 2, flags, none yet
+               wxVERIFY(  (m_ppQueue = (*m_ppDevice)->allocQueue(m_ppDevice)) != NULL);
+               wxVERIFY(  (*m_ppQueue)->create(m_ppQueue, 0, 512) == S_OK); //Param 2, flags, none yet
        }               
 }
 
@@ -415,3 +441,5 @@ void wxHIDKeyboard::BuildCookies(wxCFArray& Array)
                }
        }
 }//end buildcookies
+
+#endif //__DARWIN__