iokit

Getting iPhone's battery level

元气小坏坏 提交于 2019-11-28 19:58:29
I have a simple question. How do I get iPhone's battery level? [UIDevice currentDevice] batteryLevel] Simple enough? However there is a little catch - I can't use UIKit . Here is what I wrote so far, but I don't think it works: // notification port IONotificationPortRef nport = IONotificationPortCreate(kIOMasterPortDefault); CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(nport), kCFRunLoopDefaultMode); CFMutableDictionaryRef matching = IOServiceMatching("IOPMPowerSource"); kern_return_t kr = IOServiceAddMatchingNotification(nport, kIOFirstMatchNotification,

IOKit Not found

孤街醉人 提交于 2019-11-28 03:50:18
So everything was fine, and then I decided to start developing on XCode 5 DP3 and iOS7 Prior to upgrading, my project compiled and ran fine on my iPhone 3GS (I made a little soft phone application); it didn't run on my iPhone 5, however; I was very confident that it was the fact that I hadn't configured it to include the armv7s architecture yet. I can build and run everything just fine on the simulators, but (and this is after configuring the app to include the armv7s architecture) I can't get it to run on either my devices. I get this error: ld: framework not found IOKit clang: error: linker

MAC address from interface on OS X (C)

萝らか妹 提交于 2019-11-28 03:45:39
问题 This might be a stupid question and I apologize if it's already been addressed here, but I've searched quite a bit without much luck. I'm trying to get my interface's hardware address in C and I'm using OS X (x86-64). I know how to get it with ifconfig , but I want my program to get it automatically for any computer, well, at least OS X computers. I found another thread that posted this link which pretty much does what I want (with some modifications), but I can't make the iokit functions

Getting iPhone's battery level

旧城冷巷雨未停 提交于 2019-11-27 20:36:40
问题 I have a simple question. How do I get iPhone's battery level? [UIDevice currentDevice] batteryLevel] Simple enough? However there is a little catch - I can't use UIKit . Here is what I wrote so far, but I don't think it works: // notification port IONotificationPortRef nport = IONotificationPortCreate(kIOMasterPortDefault); CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(nport), kCFRunLoopDefaultMode); CFMutableDictionaryRef matching = IOServiceMatching(

Using IOHIDManager to Get Modifier Key Events

扶醉桌前 提交于 2019-11-27 08:08:50
I'm trying to use IOHIDManager to get modifier key events because Cocoa flagsChanged events are lacking (difficult to differentiate between press/release, left/right if both are down, etc.) Here's the code where I create the manager and register the callback. IOHIDManagerRef hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); if (CFGetTypeID(hidManager) != IOHIDManagerGetTypeID()) return 1; CFMutableDictionaryRef capsLock = myCreateDeviceMatchingDictionary(0x07, 0x39); CFMutableDictionaryRef lctrl = myCreateDeviceMatchingDictionary(0x07, 0xE0); CFMutableDictionaryRef

IOKit Not found

狂风中的少年 提交于 2019-11-27 05:13:06
问题 So everything was fine, and then I decided to start developing on XCode 5 DP3 and iOS7 Prior to upgrading, my project compiled and ran fine on my iPhone 3GS (I made a little soft phone application); it didn't run on my iPhone 5, however; I was very confident that it was the fact that I hadn't configured it to include the armv7s architecture yet. I can build and run everything just fine on the simulators, but (and this is after configuring the app to include the armv7s architecture) I can't

Using IOHIDManager to Get Modifier Key Events

元气小坏坏 提交于 2019-11-26 17:45:19
问题 I'm trying to use IOHIDManager to get modifier key events because Cocoa flagsChanged events are lacking (difficult to differentiate between press/release, left/right if both are down, etc.) Here's the code where I create the manager and register the callback. IOHIDManagerRef hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); if (CFGetTypeID(hidManager) != IOHIDManagerGetTypeID()) return 1; CFMutableDictionaryRef capsLock = myCreateDeviceMatchingDictionary(0x07, 0x39)