My "answer" doesn't contain direct answer to Evgeny's question. However I found a bunch of undocumented functions which probably can help.
I have searched whithin iOS SDK for functions related to accelerometer. It seems like everything boils down to one of two frameworks (other frameworks rely on one of these): SpringBoardServices (Private) and CoreMotion.
SpingBoardServices API is relatively simple:
See also: SBSAccelerometer description
objective-C API:
@interface SBSAccelerometer : XXUnknownSuperclass {
id<SBSAccelerometerDelegate> _delegate;
CFRunLoopSourceRef _accelerometerEventsSource;
CFRunLoopRef _accelerometerEventsRunLoop;
double _interval;
NSLock* _lock;
BOOL _orientationEventsEnabled;
int _orientationEventsToken;
NSThread* _orientationEventsThread;
float _xThreshold;
float _yThreshold;
float _zThreshold;
}
@property(assign, nonatomic) id<SBSAccelerometerDelegate> delegate;
@property(assign, nonatomic) BOOL orientationEventsEnabled;
@property(assign, nonatomic) float zThreshold;
@property(assign, nonatomic) float yThreshold;
@property(assign, nonatomic) float xThreshold;
@property(assign, nonatomic) double updateInterval;
@property(assign, nonatomic) BOOL accelerometerEventsEnabled;
-(id)init;
-(void)dealloc;
-(void)_checkIn;
-(void)_checkOut;
-(void)_serverWasRestarted;
-(int)currentDeviceOrientation;
-(id)_orientationEventsThread;
-(void)_orientationDidChange;
@end
C-API (methods' signatures are unknown):
int SBAccelerometer_server(struct unknown *in, struct unknown *out); //returns 1 on success, 0 otherwise
int SBAccelerometer_server_routine(struct unknown *in); // retuns 0 on error;
(?) SBSetAccelerometerClientEventsEnabled(...);
(?) SBSetAccelerometerDeviceOrientationChangedEventsEnabled(...);
(?) SBSetAccelerometerRawEventsInterval(...);
(?) SBXXDeliverAccelerometerEvent(...);
(NSString* or char*) _SBXXSBAccelerometer_subsystem;
CoreMotion framework low-level API is C++ API. I won't publish all the API (it's much bigger than SpingBoardServices'), but there are most promising parts:
CLSensorFusionAccelerometerOnly::reset(float)
CLSensorNetworkProtocol::isAccelerometerPacket(__CFData const*)
CLSensorNetworkProtocol::serializeAccelerometerPacket(CLAccelerometer::Sample const&)
CLSensorNetworkProtocol::deserializeAccelerometerPacket(__CFData const*)
CLSensorInterface::setAccelerometerCallbackAndInfo(void (*)(void*, CLMotionTypeVector3 const&, double const&), void*)
You cannot change the mode with any published feature of the APIs.
I guess you'll need a jailbroken device and a way to change the accelerometer mode BEFORE any call to the SDK functions. – Selfconscious