亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美女孩性生活视频| 一区二区三区免费在线观看| 不卡电影一区二区三区| 日韩国产欧美在线观看| 亚洲国产经典视频| 欧美三级日韩三级国产三级| 国产在线不卡一区| 加勒比av一区二区| 性欧美大战久久久久久久久| 亚洲国产电影在线观看| 免费观看一级欧美片| 日本特黄久久久高潮| 亚洲男人天堂av| 中文字幕一区二区视频| 国产精品免费久久| 欧美大片在线观看一区| 一区二区欧美在线观看| 中日韩av电影| 久久久久久久网| 884aa四虎影成人精品一区| 欧美嫩在线观看| 色呦呦日韩精品| 99久久综合色| 国产精品一卡二卡| 久久99国产精品久久99| 日本中文字幕一区| 午夜欧美一区二区三区在线播放| 麻豆成人久久精品二区三区小说| 亚洲午夜国产一区99re久久| 国产精品美女一区二区| 欧美xxx久久| 综合久久国产九一剧情麻豆| 国产日韩欧美高清在线| 国产调教视频一区| 亚洲图片欧美综合| 亚洲一二三专区| 亚洲精品美国一| 午夜在线电影亚洲一区| 亚洲一区免费视频| 爽好多水快深点欧美视频| 国产精品99久久久久| 国产九色精品成人porny| 美女视频网站黄色亚洲| 精品一区二区三区免费播放| 日本久久电影网| 欧美三区免费完整视频在线观看| 欧美日韩一区二区三区免费看 | 蜜臀av性久久久久蜜臀aⅴ四虎| 日本女优在线视频一区二区| 黄一区二区三区| 国产v综合v亚洲欧| 99热这里都是精品| 久久久久久久精| 亚洲视频在线一区二区| 亚洲线精品一区二区三区| 裸体歌舞表演一区二区| 波多野结衣精品在线| 91首页免费视频| av高清久久久| 久久蜜臀中文字幕| 中文字幕一区二区三区蜜月| 一级精品视频在线观看宜春院| 国产精品一区久久久久| bt欧美亚洲午夜电影天堂| 色就色 综合激情| 国产精品996| 精品日韩一区二区三区免费视频| 久久毛片高清国产| 亚洲人一二三区| 亚洲成人综合在线| 国产一区福利在线| 欧美最新大片在线看 | 亚洲大片精品永久免费| 老司机午夜精品| 国产不卡一区视频| 亚洲一区二区三区精品在线| 成人免费观看av| 91精品国产aⅴ一区二区| 久久综合九色欧美综合狠狠| 亚洲男人的天堂在线aⅴ视频| 日本欧美在线看| 国产99久久久国产精品免费看| 精品福利av导航| 天天色天天爱天天射综合| 成人av电影观看| 亚洲综合视频网| 高清成人在线观看| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | a在线欧美一区| 欧美美女激情18p| 国产喷白浆一区二区三区| 午夜视频在线观看一区| 欧美高清dvd| 亚洲第一福利一区| 91免费观看国产| 亚洲欧洲日产国产综合网| 另类小说综合欧美亚洲| 欧美日韩视频在线观看一区二区三区 | 亚洲人成精品久久久久久| 亚洲妇熟xx妇色黄| 色欧美日韩亚洲| 亚洲欧洲无码一区二区三区| 国产成人免费视频精品含羞草妖精 | 国产调教视频一区| 国产一区日韩二区欧美三区| 日韩三级.com| 亚洲一区二区在线视频| 欧美男生操女生| 蜜臂av日日欢夜夜爽一区| 6080国产精品一区二区| 国产精品白丝av| 精品福利二区三区| 久久66热re国产| 国产露脸91国语对白| 一区二区三区电影在线播| 色噜噜狠狠色综合欧洲selulu| 国产精品久久久久国产精品日日 | 久久久99精品久久| 国产一区啦啦啦在线观看| 久久亚洲一级片| 欧美日韩国产高清一区二区三区 | 欧美在线综合视频| 亚洲综合久久久久| 91成人看片片| 亚洲最新视频在线播放| 久久久精品tv| 91小宝寻花一区二区三区| 有码一区二区三区| 久久久99久久| 91黄色免费看| 日韩中文字幕麻豆| 精品日产卡一卡二卡麻豆| 尤物视频一区二区| 91精品国产福利在线观看| 国内精品不卡在线| 中文字幕av不卡| 欧美三区在线观看| 91麻豆国产福利精品| 日本欧美在线看| 国产精品天美传媒| 久久影院视频免费| 色综合中文字幕| 日日夜夜免费精品| 91久久精品一区二区三区| 韩国欧美国产1区| 亚洲日本青草视频在线怡红院 | 亚洲日穴在线视频| 日本精品视频一区二区三区| 亚洲欧洲韩国日本视频| 日韩天堂在线观看| 99久久99久久久精品齐齐| 欧美精品欧美精品系列| 在线免费观看日本欧美| 免费看日韩a级影片| 久久久亚洲精华液精华液精华液| 91麻豆国产在线观看| 综合激情网...| 色综合天天综合在线视频| 国产精品水嫩水嫩| 国产精品护士白丝一区av| 在线综合视频播放| 色婷婷亚洲精品| 91久久精品网| 国产一区在线视频| 丝袜美腿亚洲一区二区图片| 日本午夜一区二区| 亚洲同性同志一二三专区| 精品国内二区三区| 国产91精品精华液一区二区三区 | 久久精品一区二区三区不卡| 欧美色区777第一页| 99re视频精品| 欧美图区在线视频| 色哟哟亚洲精品| 成人亚洲精品久久久久软件| 91麻豆视频网站| thepron国产精品| 国产福利不卡视频| 久久网这里都是精品| 国产精品国产三级国产aⅴ无密码| 欧美大片一区二区| 欧美精品在线视频| 精品福利av导航| 精品国产免费一区二区三区四区 | 久久成人免费日本黄色| 国产精品资源在线| 91婷婷韩国欧美一区二区| 欧美精品三级日韩久久| 欧美精品一区二区高清在线观看| 中文字幕日韩一区二区| 三级不卡在线观看| 美女视频网站久久| 在线观看欧美黄色| 久久综合色婷婷| 亚洲无人区一区| 国产成人在线色| 91精品欧美久久久久久动漫| 亚洲国产精品成人综合| 日韩黄色在线观看| 一本一道久久a久久精品|