5

There is a compiled command line application here that does this.

Is there a Cocoa API to query this data?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
rennat
  • 2,529
  • 3
  • 26
  • 30

2 Answers2

4

There isn't a Cocoa API for the motion sensor. It's only available through calls to IOKit. It's described in Mac OS X Internals.

SSteve
  • 10,550
  • 5
  • 46
  • 72
  • 2
    A better link is [this one](http://osxbook.com/software/sms/) which is the author's page about the sudden motion sensor with sample code. – Rob Keniger Aug 12 '11 at 01:25
4

You can try SMSLib, which is an open-source Objective-C library for accessing the sudden motion sensor.

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134