亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hid.cpp

?? 很牛的GUI源碼wxWidgets-2.8.0.zip 可在多種平臺下運行.
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/////////////////////////////////////////////////////////////////////////////// Name:        src/mac/corefoundation/hid.cpp// Purpose:     DARWIN HID layer for WX Implementation// Author:      Ryan Norton// Modified by:// Created:     11/11/2003// RCS-ID:      $Id: hid.cpp,v 1.24 2006/08/31 19:30:52 ABX Exp $// Copyright:   (c) Ryan Norton// Licence:     wxWindows licence/////////////////////////////////////////////////////////////////////////////// ===========================================================================// declarations// ===========================================================================// ---------------------------------------------------------------------------// headers// ---------------------------------------------------------------------------// For compilers that support precompilation, includes "wx.h".#include "wx/wxprec.h"#ifdef __BORLANDC__    #pragma hdrstop#endif//DARWIN _ONLY_#ifdef __DARWIN__#include "wx/mac/corefoundation/hid.h"#ifndef WX_PRECOMP    #include "wx/dynarray.h"    #include "wx/string.h"    #include "wx/log.h"    #include "wx/utils.h"    #include "wx/module.h"#endif#include "wx/mac/corefoundation/cfstring.h"// ============================================================================// implementation// ============================================================================// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//// wxHIDDevice//// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// ----------------------------------------------------------------------------// wxHIDDevice::Create////  nClass is the HID Page such as//      kHIDPage_GenericDesktop//  nType is the HID Usage such as//      kHIDUsage_GD_Joystick,kHIDUsage_GD_Mouse,kHIDUsage_GD_Keyboard//  nDev is the device number to use//// ----------------------------------------------------------------------------bool wxHIDDevice::Create (int nClass, int nType, int nDev){    //Create the mach port    if(IOMasterPort(bootstrap_port, &m_pPort) != kIOReturnSuccess)    {        wxLogSysError(wxT("Could not create mach port"));        return false;    }    //Dictionary that will hold first    //the matching dictionary for determining which kind of devices we want,    //then later some registry properties from an iterator (see below)    //    //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))    CFMutableDictionaryRef pDictionary = IOServiceMatching(kIOHIDDeviceKey);    if(pDictionary == NULL)    {        wxLogSysError( _T("IOServiceMatching(kIOHIDDeviceKey) failed") );        return false;    }    //Here we'll filter down the services to what we want    if (nType != -1)    {        CFNumberRef pType = CFNumberCreate(kCFAllocatorDefault,                                    kCFNumberIntType, &nType);        CFDictionarySetValue(pDictionary, CFSTR(kIOHIDPrimaryUsageKey), pType);        CFRelease(pType);    }    if (nClass != -1)    {        CFNumberRef pClass = CFNumberCreate(kCFAllocatorDefault,                                    kCFNumberIntType, &nClass);        CFDictionarySetValue(pDictionary, CFSTR(kIOHIDPrimaryUsagePageKey), pClass);        CFRelease(pClass);    }    //Now get the maching services    io_iterator_t pIterator;    if( IOServiceGetMatchingServices(m_pPort,                        pDictionary, &pIterator) != kIOReturnSuccess )    {        wxLogSysError(_T("No Matching HID Services"));        return false;    }    //Were there any devices matched?    if(pIterator == 0)        return false; // No devices found    //Now we iterate through them    io_object_t pObject;    while ( (pObject = IOIteratorNext(pIterator)) != 0)    {        if(--nDev != 0)        {            IOObjectRelease(pObject);            continue;        }        if ( IORegistryEntryCreateCFProperties             (                pObject,                &pDictionary,                kCFAllocatorDefault,                kNilOptions             ) != KERN_SUCCESS )        {            wxLogDebug(_T("IORegistryEntryCreateCFProperties failed"));        }        //        // Now we get the attributes of each "product" in the iterator        //        //Get [product] name        CFStringRef cfsProduct = (CFStringRef)            CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductKey));        m_szProductName =            wxMacCFStringHolder( cfsProduct,                                    false                               ).AsString();        //Get the Product ID Key        CFNumberRef cfnProductId = (CFNumberRef)            CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDProductIDKey));        if (cfnProductId)        {            CFNumberGetValue(cfnProductId, kCFNumberIntType, &m_nProductId);        }        //Get the Vendor ID Key        CFNumberRef cfnVendorId = (CFNumberRef)            CFDictionaryGetValue(pDictionary, CFSTR(kIOHIDVendorIDKey));        if (cfnVendorId)        {            CFNumberGetValue(cfnVendorId, kCFNumberIntType, &m_nManufacturerId);        }        //        // End attribute getting        //        //Create the interface (good grief - long function names!)        SInt32 nScore;        IOCFPlugInInterface** ppPlugin;        if(IOCreatePlugInInterfaceForService(pObject,                                             kIOHIDDeviceUserClientTypeID,                                             kIOCFPlugInInterfaceID, &ppPlugin,                                             &nScore) !=  kIOReturnSuccess)        {            wxLogSysError(wxT("Could not create HID Interface for product"));            return false;        }        //Now, the final thing we can check before we fall back to asserts        //(because the dtor only checks if the device is ok, so if anything        //fails from now on the dtor will delete the device anyway, so we can't break from this).        //Get the HID interface from the plugin to the mach port        if((*ppPlugin)->QueryInterface(ppPlugin,                               CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID),                               (void**) &m_ppDevice) != S_OK)        {            wxLogSysError(wxT("Could not get device interface from HID interface"));            return false;        }        //release the plugin        (*ppPlugin)->Release(ppPlugin);        //open the HID interface...        if ( (*m_ppDevice)->open(m_ppDevice, 0) != S_OK )            wxLogDebug(_T("HID device: open failed"));        //        //Now the hard part - in order to scan things we need "cookies"        //        CFArrayRef cfaCookies = (CFArrayRef)CFDictionaryGetValue(pDictionary,                                 CFSTR(kIOHIDElementKey));        BuildCookies(cfaCookies);        //cleanup        CFRelease(pDictionary);        IOObjectRelease(pObject);        //iterator cleanup        IOObjectRelease(pIterator);        return true;    }    //iterator cleanup    IOObjectRelease(pIterator);    return false; //no device}//end Create()// ----------------------------------------------------------------------------// wxHIDDevice::GetCount [static]////  Obtains the number of devices on a system for a given HID Page (nClass)// and HID Usage (nType).// ----------------------------------------------------------------------------size_t wxHIDDevice::GetCount (int nClass, int nType){    //Create the mach port    mach_port_t             pPort;    if(IOMasterPort(bootstrap_port, &pPort) != kIOReturnSuccess)    {        wxLogSysError(wxT("Could not create mach port"));        return false;    }    //Dictionary that will hold first    //the matching dictionary for determining which kind of devices we want,    //then later some registry properties from an iterator (see below)    CFMutableDictionaryRef pDictionary = IOServiceMatching(kIOHIDDeviceKey);    if(pDictionary == NULL)    {        wxLogSysError( _T("IOServiceMatching(kIOHIDDeviceKey) failed") );        return false;    }    //Here we'll filter down the services to what we want    if (nType != -1)    {        CFNumberRef pType = CFNumberCreate(kCFAllocatorDefault,                                    kCFNumberIntType, &nType);        CFDictionarySetValue(pDictionary, CFSTR(kIOHIDPrimaryUsageKey), pType);        CFRelease(pType);    }    if (nClass != -1)    {        CFNumberRef pClass = CFNumberCreate(kCFAllocatorDefault,                                    kCFNumberIntType, &nClass);        CFDictionarySetValue(pDictionary, CFSTR(kIOHIDPrimaryUsagePageKey), pClass);        CFRelease(pClass);    }    //Now get the maching services    io_iterator_t pIterator;    if( IOServiceGetMatchingServices(pPort,                                     pDictionary, &pIterator) != kIOReturnSuccess )    {        wxLogSysError(_T("No Matching HID Services"));        return false;    }    //If the iterator doesn't exist there are no devices :)    if ( !pIterator )        return 0;    //Now we iterate through them    size_t nCount = 0;    io_object_t pObject;    while ( (pObject = IOIteratorNext(pIterator)) != 0)    {        ++nCount;        IOObjectRelease(pObject);    }    //cleanup    IOObjectRelease(pIterator);    mach_port_deallocate(mach_task_self(), pPort);    return nCount;}//end Create()// ----------------------------------------------------------------------------// wxHIDDevice::AddCookie//// Adds a cookie to the internal cookie array from a CFType// ----------------------------------------------------------------------------void wxHIDDevice::AddCookie(CFTypeRef Data, int i){    CFNumberGetValue(                (CFNumberRef) CFDictionaryGetValue    ( (CFDictionaryRef) Data                                        , CFSTR(kIOHIDElementCookieKey)                                        ),                kCFNumberIntType,                &m_pCookies[i]                );}// ----------------------------------------------------------------------------// wxHIDDevice::AddCookieInQueue//// Adds a cookie to the internal cookie array from a CFType and additionally// adds it to the internal HID Queue// ----------------------------------------------------------------------------void wxHIDDevice::AddCookieInQueue(CFTypeRef Data, int i){    //3rd Param flags (none yet)    AddCookie(Data, i);    if ( (*m_ppQueue)->addElement(m_ppQueue, m_pCookies[i], 0) != S_OK )        wxLogDebug(_T("HID device: adding element failed"));}// ----------------------------------------------------------------------------// wxHIDDevice::InitCookies//// Create the internal cookie array, optionally creating a HID Queue// ----------------------------------------------------------------------------void wxHIDDevice::InitCookies(size_t dwSize, bool bQueue){    m_pCookies = new IOHIDElementCookie[dwSize];    if (bQueue)    {        wxASSERT( m_ppQueue == NULL);        m_ppQueue = (*m_ppDevice)->allocQueue(m_ppDevice);        if ( !m_ppQueue )        {            wxLogDebug(_T("HID device: allocQueue failed"));            return;        }        //Param 2, flags, none yet        if ( (*m_ppQueue)->create(m_ppQueue, 0, 512) != S_OK )        {            wxLogDebug(_T("HID device: create failed"));        }    }    //make sure that cookie array is clear    memset(m_pCookies, 0, sizeof(*m_pCookies) * dwSize);}// ----------------------------------------------------------------------------// wxHIDDevice::IsActive//// Returns true if a cookie of the device is active - for example if a key is// held down, joystick button pressed, caps lock active, etc..// ----------------------------------------------------------------------------bool wxHIDDevice::IsActive(int nIndex){    if(!HasElement(nIndex))    {        //cookie at index does not exist - getElementValue        //could return true which would be incorrect so we        //check here        return false;    }    IOHIDEventStruct Event;    (*m_ppDevice)->getElementValue(m_ppDevice, m_pCookies[nIndex], &Event);    return !!Event.value;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费成人美女在线观看| 国产精品日产欧美久久久久| 香蕉乱码成人久久天堂爱免费| 91麻豆成人久久精品二区三区| 中文字幕中文字幕在线一区| 91在线精品一区二区| 亚洲欧美激情视频在线观看一区二区三区| 99国产精品国产精品毛片| 亚洲欧美视频在线观看| 在线观看91视频| 日韩和的一区二区| 欧美成人精品二区三区99精品| 国产原创一区二区三区| 国产精品美日韩| 欧美性猛片aaaaaaa做受| 偷拍日韩校园综合在线| 26uuu色噜噜精品一区| 99久久国产综合色|国产精品| 亚洲欧美aⅴ...| 91.com在线观看| 国产成人在线视频网站| 亚洲精品伦理在线| 日韩欧美一区在线观看| 粉嫩一区二区三区在线看| 亚洲欧美日韩久久| 欧美一区二区视频网站| 国产成人av影院| 亚洲国产日产av| 精品国免费一区二区三区| 91麻豆精品在线观看| 麻豆一区二区99久久久久| 成人欧美一区二区三区1314| 欧美女孩性生活视频| 不卡av在线网| 久久国产生活片100| 中文字幕在线视频一区| 欧美一级高清片| 色婷婷激情久久| 国产不卡高清在线观看视频| 洋洋av久久久久久久一区| 久久精品一区二区三区不卡 | 成人黄色一级视频| 日本不卡的三区四区五区| 国产精品久久免费看| 日韩视频在线一区二区| 99国产精品久久| 国产精品一级黄| 日韩高清欧美激情| 亚洲欧美日韩国产手机在线| 精品日韩在线观看| 欧美精选一区二区| 91啪亚洲精品| 成人激情小说乱人伦| 久久成人免费网站| 日韩电影免费一区| 亚洲国产aⅴ成人精品无吗| 中文字幕精品—区二区四季| 欧美一区二区三区视频免费 | 日产精品久久久久久久性色| 亚洲精品国产一区二区精华液| 久久久午夜电影| 日韩女优视频免费观看| 欧美日韩激情一区二区| 在线观看视频91| 97se狠狠狠综合亚洲狠狠| 成人精品免费看| 东方欧美亚洲色图在线| 国产精品99久久久久久久vr| 精品一区二区三区视频在线观看| 三级不卡在线观看| 日韩制服丝袜av| 蜜桃久久久久久| 美女在线一区二区| 久久疯狂做爰流白浆xx| 看片网站欧美日韩| 激情综合网天天干| 国产一区在线精品| 国产剧情一区二区| 波多野结衣欧美| 99久久精品久久久久久清纯| 91丝袜美女网| 日本精品一区二区三区四区的功能| 99免费精品在线| 91丨九色porny丨蝌蚪| 色吧成人激情小说| 欧美日韩在线播放一区| 在线成人小视频| 日韩欧美黄色影院| 国产亚洲精品免费| 国产精品乱码一区二三区小蝌蚪| 中文字幕一区二区三区不卡 | 国产丶欧美丶日本不卡视频| 国产91综合网| av毛片久久久久**hd| 色综合久久综合网97色综合 | 国精品**一区二区三区在线蜜桃| 久久99精品久久只有精品| 国内精品伊人久久久久av一坑| 激情综合色播五月| 成人免费毛片嘿嘿连载视频| 成人黄色777网| 在线观看91视频| 亚洲精品在线免费播放| 国产欧美精品国产国产专区| 综合久久久久久久| 亚洲va中文字幕| 国产麻豆精品在线观看| 91在线精品一区二区| 91麻豆精品91久久久久同性| 久久香蕉国产线看观看99| 亚洲丝袜制服诱惑| 蜜桃av一区二区| 成人黄色软件下载| 欧美一卡二卡三卡四卡| 国产精品午夜春色av| 亚洲成年人影院| 粉嫩欧美一区二区三区高清影视| 欧美三级三级三级爽爽爽| 国产亚洲1区2区3区| 日韩专区欧美专区| 成人黄色777网| 欧美成人综合网站| 亚洲乱码国产乱码精品精的特点| 麻豆一区二区在线| 在线中文字幕一区| 中文字幕精品—区二区四季| 亚洲成av人片在线| 成人avav在线| 日韩亚洲国产中文字幕欧美| 亚洲品质自拍视频| 粉嫩av亚洲一区二区图片| 欧美精品在欧美一区二区少妇| 国产精品美女久久久久久久久久久 | 色狠狠一区二区三区香蕉| 欧美成人a在线| 亚洲国产精品久久艾草纯爱| 高清在线成人网| www激情久久| 三级亚洲高清视频| 色婷婷久久久久swag精品| 国产欧美精品一区二区色综合| 美洲天堂一区二卡三卡四卡视频| 日本乱人伦aⅴ精品| 国产精品福利一区| 国产成人综合视频| 久久久美女艺术照精彩视频福利播放| 香蕉久久一区二区不卡无毒影院| 91麻豆高清视频| 综合欧美亚洲日本| www.亚洲激情.com| 欧美经典一区二区| 国产一区二区电影| 欧美r级电影在线观看| 视频一区在线播放| 欧美三区免费完整视频在线观看| 亚洲色图欧美激情| 99国产欧美另类久久久精品| 国产午夜精品理论片a级大结局| 麻豆91在线看| 日韩免费观看高清完整版在线观看| 午夜精品久久久久久久99樱桃| 91豆麻精品91久久久久久| 亚洲夂夂婷婷色拍ww47 | 天堂成人国产精品一区| 在线欧美日韩国产| 亚洲精品日日夜夜| 91老师国产黑色丝袜在线| 椎名由奈av一区二区三区| 成人国产视频在线观看 | 亚洲狠狠爱一区二区三区| 91亚洲男人天堂| 亚洲六月丁香色婷婷综合久久| 91丨九色丨蝌蚪富婆spa| 136国产福利精品导航| 色哟哟在线观看一区二区三区| 国产精品国产三级国产专播品爱网| 成熟亚洲日本毛茸茸凸凹| 国产精品高潮呻吟久久| 色婷婷av久久久久久久| 亚洲午夜羞羞片| 555www色欧美视频| 久久精品噜噜噜成人av农村| 精品国产不卡一区二区三区| 国产精品99久久久久久久vr | 亚洲mv在线观看| 日韩一区二区三区四区| 精品一区二区三区在线播放| 国产日韩欧美不卡在线| 91免费视频网| 无吗不卡中文字幕| 久久精品欧美日韩| 色偷偷久久一区二区三区| 亚洲午夜成aⅴ人片| 日韩一区二区三区视频在线| 国产一区二区三区四| 亚洲品质自拍视频| 欧美不卡一二三| 色综合欧美在线视频区| 免费欧美在线视频| 国产精品毛片高清在线完整版|