将 iPhone 加速度计设置为 ±8g 模式 [英] Set iPhone accelerometer to ±8g mode

查看:20
本文介绍了将 iPhone 加速度计设置为 ±8g 模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将 iPhone 加速度计设置为在 ±8g 范围内接收数据?(据我所知 ST LIS331DLH 安装在 iPhone 上的加速度计支持这个模式)

Is it possible to set iPhone accelerometer to receive data in the ±8g range? (as far as I know ST LIS331DLH accelerometer installed on iPhone supports this mode)

我们不仅要研究标准 API,还要研究

We are looking not only into standard API, but also

  • 未记录的功能
  • 可能的 iOS 黑客
  • 硬件修补

无论如何要将加速度计范围扩展到超出标准±2g

Anyway to extend accelerometer range beyond standard ±2g

推荐答案

我的答案"包含对 Evgeny 问题的直接回答.但是,我发现了一堆未记录的函数,它们可能会有所帮助.

My "answer" doesn't contain direct answer to Evgeny's question. However I found a bunch of undocumented functions which probably can help.

我在 iOS SDK 中搜索了与加速度计相关的功能.似乎一切都归结为两个框架之一(其他框架依赖于其中之一):SpringBoardServices(私有)和 CoreMotion.

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 相对简单:另请参阅:SBSAccelerometer 说明

SpingBoardServices API is relatively simple: See also: SBSAccelerometer description

objective-C API:

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(方法签名未知):

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 框架底层 API 是 C++ API.我不会发布所有 API(它比 SpingBoardServices 大得多),但有最有前途的部分:

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*)

这篇关于将 iPhone 加速度计设置为 ±8g 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆