是否可以将iPhone加速度计设置为接收±8g范围内的数据?(据我所知,安装在iPhone上的ST LIS331DLH加速度计支持此模式)
我们不仅在研究标准API,而且还在研究
- 未记录的函数
- 可能的 iOS 黑客攻击
- 硬件修补
无论如何,将加速度计范围扩展到标准±2g之外
我的"答案"不包含对叶甫根尼问题的直接回答。但是,我发现了一堆未记录的功能,它们可能会有所帮助。
我已经在 iOS SDK 中搜索了与加速度计相关的功能。似乎一切都归结为两个框架之一(其他框架依赖于其中一个):SpringBoardServices(私有)和CoreMotion。
SpingBoardServices API相对简单:另请参阅: SBSA加速度计说明
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*)
不幸的是,没有本机方法可以做到这一点。另一方面,如果您愿意越狱,则可以进行Cydia调整(我不记得名称),从而降低加速度计的灵敏度。如果你的灵敏度为25%,它应该能够感知±8g。 仅供参考,如果您正在从应用程序读取输出,它的范围仍然为±2g,但通过调整,您必须记住读数将缩小1/4。(意思是应用程序中的 2g = 实际空间中的 8g)。