Evg*_*nik 28 iphone accelerometer ios
是否可以将iPhone加速度计设置为接收±8g范围内的数据?(据我所知,iPhone上安装的ST LIS331DLH加速度计支持此模式)
我们不仅关注标准API,还关注
无论如何,将加速度计范围扩展到标准±2g以上
我的"答案" 并未直接回答叶夫根尼的问题.但是我找到了一堆可能有用的无证功能.
我在iOS SDK中搜索了与加速度计相关的功能.似乎所有内容都归结为两个框架之一(其他框架依赖于其中一个框架):SpringBoardServices(Private)和CoreMotion.
SpingBoardServices API相对简单:另请参阅:SBSAccelerometer描述
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
Run Code Online (Sandbox Code Playgroud)
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;
Run Code Online (Sandbox Code Playgroud)
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*)
Run Code Online (Sandbox Code Playgroud)
不幸的是,没有本地方法可以做到这一点。另一方面,如果你愿意越狱,你可以得到一个 Cydia 调整(我不记得名字了),它可以降低加速度计的灵敏度。如果你的灵敏度为25%,它应该能够感应到\xc2\xb18g。仅供参考,如果您正在读取应用程序的输出,其范围仍为 \xc2\xb12g,但通过调整,您必须记住读数将按比例缩小 1/4。(意味着应用程序中的 2g = 实际空间中的 8g)。
\n| 归档时间: |
|
| 查看次数: |
1594 次 |
| 最近记录: |