/** センサーを停止する. */
  public void stopSensor() {

    if (!mIsSensorStarted) {
      return;
    }
    mIsSensorStarted = false;
    mDevice.getSensorControl().removeSensorListener(this);
    mDevice.getSensorControl().stopStreaming();
    mSensorListener = null;
  }
  /**
   * センサーを開始する.
   *
   * @param listener リスナー
   */
  public void startSensor(final DeviceSensorListener listener) {

    if (mIsSensorStarted) {
      return;
    }

    mIsSensorStarted = true;
    mSensorListener = listener;
    SensorControl sc = mDevice.getSensorControl();
    sc.setRate(SENSOR_RATE);
    sc.enableStreaming(true);
    sc.addSensorListener(
        this,
        SensorFlag.ACCELEROMETER_NORMALIZED,
        SensorFlag.GYRO_NORMALIZED,
        SensorFlag.ATTITUDE,
        SensorFlag.QUATERNION,
        SensorFlag.LOCATOR);

    ConfigureLocatorCommand.sendCommand(
        mDevice, ConfigureLocatorCommand.ROTATE_WITH_CALIBRATE_FLAG_OFF, 0, 0, 0);
    mPreSensorTimestamp = System.currentTimeMillis();
  }