Update ControllerListener_mac.cpp to our style guidelines
This commit is contained in:
parent
bc22754f8c
commit
c522173296
1 changed files with 59 additions and 54 deletions
|
|
@ -1,10 +1,17 @@
|
|||
#include "ControllerListener.h"
|
||||
//
|
||||
// Copyright (C) 2012 Telldus Technologies AB. All rights reserved.
|
||||
//
|
||||
// Copyright: See COPYING file that comes with this distribution
|
||||
//
|
||||
//
|
||||
#include "service/ControllerListener.h"
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/IOMessage.h>
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
#include <IOKit/usb/IOUSBLib.h>
|
||||
#include <string>
|
||||
|
||||
class TellStickData {
|
||||
public:
|
||||
|
|
@ -29,8 +36,7 @@ public:
|
|||
};
|
||||
|
||||
ControllerListener::ControllerListener(TelldusCore::EventRef event)
|
||||
:Thread()
|
||||
{
|
||||
:Thread() {
|
||||
d = new PrivateData;
|
||||
d->event = event;
|
||||
d->running = true;
|
||||
|
|
@ -61,9 +67,10 @@ void ControllerListener::run() {
|
|||
|
||||
// Race check, if destructor was called really close to thread init,
|
||||
// running might have gone false. Make sure we don't get stuck
|
||||
if(d->running)
|
||||
if (d->running) {
|
||||
CFRunLoopRun();
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerListener::PrivateData::addUsbFilter(int vid, int pid) {
|
||||
CFNumberRef numberRef;
|
||||
|
|
@ -96,7 +103,6 @@ void ControllerListener::PrivateData::addUsbFilter(int vid, int pid) {
|
|||
);
|
||||
// Iterate once to get already-present devices and arm the notification
|
||||
PrivateData::DeviceAdded(this, gAddedIter);
|
||||
|
||||
}
|
||||
|
||||
void ControllerListener::PrivateData::DeviceNotification(void *refCon, io_service_t service, natural_t messageType, void *messageArgument) {
|
||||
|
|
@ -148,7 +154,6 @@ void ControllerListener::PrivateData::DeviceAdded(void *refCon, io_iterator_t it
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
CFNumberRef vidRef = reinterpret_cast<CFNumberRef> (IORegistryEntryCreateCFProperty(usbDevice, CFSTR("idVendor"), kCFAllocatorDefault, 0));
|
||||
if (vidRef) {
|
||||
CFNumberGetValue(vidRef, kCFNumberIntType, &(tsd->vid));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue