Blame view

LiveChat/SDK/include/grape/zmf_sensor.h 2.2 KB
9f17d59e   陈明泉   no message
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  #ifndef __ZMF_SENSOR_H__
  #define __ZMF_SENSOR_H__
  
  /**
   * @file zmf_motion.h
   * @brief ZMF Motion interfaces
   */
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  typedef enum {
      ZmfSensorGrvity             =1,
      ZmfSensorAcceleration       =2,
      ZmfSensorRotationRate       =4,
      ZmfSensorAttitude           =8,
      ZmfSensorLight              =16,
  } ZmfSensorType;
  
  typedef enum {
      ZmfSensorFastest,
      ZmfSensorGame,
      ZmfSensorUI,
      ZmfSensorNormal
  } ZmfSensorMode;
  
  typedef struct {
      unsigned                types;
  
      /** The elapsed millisend time from the start */
      unsigned                timeStampMs;
  
      /** The gravity acceleration vector 
       * expressed in the device's reference frame.
       */
      float                   gravity[3];
  
      /**  the total acceleration of the device
       * is equal to gravity plus the acceleration the user imparts to the device
       */
      float                   acceleration[3];
  
      float                   rotationRate[3];
  
      float                   pitch, roll, yaw;
  
      float                   brightness;
  
  } ZmfSensorData;
  
  typedef void (*ZmfSensorCallback)(void* pUser, const ZmfSensorData *sensor);
  
  int Zmf_SensorInitialize    (void*  applicationContext);
  int Zmf_SensorTerminate     (void);
  
  int Zmf_SensorGetTypes      (unsigned *sensorTypes);
  
  int Zmf_SensorStart         (unsigned sensorTypes, unsigned sensorMode);
  int Zmf_SensorStop          ();
  
  int Zmf_SensorAddCallback   (void *pUser, ZmfSensorCallback callback);
  int Zmf_SensorRemoveCallback(void *pUser);
  
  /**  Get the devices attitude at a point in time.
   * @param[out] pitch     Angle in the horizontal plane of the device, ranging from 0 to M_PI.
   * @param[out] yaw       The orientation of the device orientation, ranging from -M_PI to M_PI.
   *                       It is 0 when the device is oriented in its natural position,
   *                       M_PI_2 when its right side is at the top, M_PI or -M_PI when it is upside down,
   *                       and -M_PI_2 when its left side is to the top.
   * @param[out] roll
   */
  
  int Zmf_SensorDataGetAttitude (const ZmfSensorData *sensor, float *pitch, float *roll, float *yaw);
  
  #ifdef __cplusplus
  }
  #endif /* __cplusplus */
  
  #endif /* __ZMF_SENSOR_H__ */