Skip to content

Instantly share code, notes, and snippets.

@bored-engineer
Created September 27, 2011 20:51
Show Gist options
  • Save bored-engineer/1246211 to your computer and use it in GitHub Desktop.
Save bored-engineer/1246211 to your computer and use it in GitHub Desktop.
MobileDevice NoObjC attempt.
var $ = require('NodObjC')
, ffi = require('node-ffi')
$.import('MobileDevice');
$.import('CoreFoundation')
function callback (info, foo) {
console.log('inside callback!')
}
// Get a function pointer to the callback function above
var cb = new ffi.Callback([ 'void', ['pointer', 'pointer']], callback)
, cb_ptr = cb.getPointer()
// Define am_device_notification
var am_device_notification = ffi.Struct([
['uint32', 'unknown0'],
['uint32', 'unknown1'],
['uint32', 'unknown2'],
['pointer', 'callback'],
['uint32', 'unknown3']
])
// create an instance of am_device_notification
var notif = new am_device_notification()
notif.unknown0 = 0 // <- idk what's supposed to go in these
//console.log($.AMDeviceNotificationSubscribe)
//console.log($.AMDeviceNotificationSubscribe.type);
$.AMDeviceNotificationSubscribe(cb_ptr, 0, 0, null, notif.ref());
$.CFRunLoopRun()
@bored-engineer
Copy link
Author

We should pull am_device_notification from the Header too... since that's possible now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment