Skip to content

Instantly share code, notes, and snippets.

@bored-engineer
Forked from TooTallNate/mobiledevice.js
Created September 23, 2011 01:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bored-engineer/1236538 to your computer and use it in GitHub Desktop.
Save bored-engineer/1236538 to your computer and use it in GitHub Desktop.
half-attempt at using the MobileDevice framework with NodObjC
var $ = require('NodObjC')
, ffi = require('node-ffi')
$.import('MobileDevice')
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([
['unknown0', 'uint32']
, ['unknown1', 'uint32']
, ['unknown2', 'uint32']
, ['callback', 'pointer']
, ['unknown3', 'uint32']
])
// create an instance of am_device_notification
var notif = new am_device_notification()
notif.unknown0 = 0 // <- idk what's supposed to go in these
$.AMDeviceNotificationSubscribe(cb, 0, 0, null, notif.ref());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment