是否可以将 iPhone 加速度计设置为在 ±8g 范围内接收数据? (据我所知ST LIS331DLH iPhone上安装的加速度计支持此模式)
我们不仅在研究标准 API,还在研究
- 未记录的函数
- 可能的 iOS 黑客攻击
- 硬件修补
无论如何都要将加速度计范围扩展到标准±2g之外
最佳答案
我的“回答”不包含对 Evgeny 问题的直接回答。但是我发现了一堆可能有帮助的未记录的功能。
我在 iOS SDK 中搜索了与加速度计相关的函数。似乎一切都归结为两个框架之一(其他框架依赖其中之一):SpringBoardServices(私有(private))和 CoreMotion。
SpingBoardServices API 相对简单: 另请参阅: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(方法的签名未知):
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 框架底层 API 是 C++ API。我不会发布所有 API(它比 SpingBoardServices 大得多),但有最有前途的部分:
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*)
关于ios - 将 iPhone 加速度计设置为 ±8g 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10789211/