Пример #1
0
void CSensorAndroidBuiltIn::closePort()
{
    if (m_pSensor && m_pSensorEventQueue) {
        ASensorEventQueue_disableSensor(m_pSensorEventQueue, m_pSensor);
    }
    if (m_pSensorManager && m_pSensorEventQueue) {
        ASensorManager_destroyEventQueue(m_pSensorManager, m_pSensorEventQueue);
    }

    strcpy(m_strVendor, "");
    strcpy(m_strSensor, "");

    m_pSensorManager = NULL;
    m_pSensor = NULL;
    m_pSensorEventQueue = NULL;
    m_pLooper = NULL;

    m_fResolution = 0.0f;
    m_minDelayMsec = 0;

    memset(m_xyz, 0x00, sizeof(float) * 3);
    memset(m_strSensor, 0x00, _MAX_PATH);
    memset(m_strVendor, 0x00, _MAX_PATH);

    setType();
    setPort();

}
Пример #2
0
void orxFASTCALL orxJoystick_Android_Exit()
{
  /* Was initialized? */
  if (sstJoystick.u32Flags & orxJOYSTICK_KU32_STATIC_FLAG_READY)
  {
    if(sstJoystick.accelerometerSensor != NULL)
    {
      /* Removes event handler */
      orxEvent_RemoveHandler(orxEVENT_TYPE_SYSTEM, orxJoystick_Android_AccelerometerEventHandler);
      orxEvent_RemoveHandler(orxANDROID_EVENT_TYPE_SURFACE, orxJoystick_Android_AccelerometerEventHandler);
      orxEvent_RemoveHandler(orxANDROID_EVENT_TYPE_ACCELERATE, orxJoystick_Android_AccelerometerEventHandler);

      disableSensorManager();

      /* destroy event queue */
      ASensorManager_destroyEventQueue(sstJoystick.sensorManager, sstJoystick.sensorEventQueue);
    }

    orxEvent_RemoveHandler(orxANDROID_EVENT_TYPE_JOYSTICK, orxJoystick_Android_JoystickEventHandler);

    /* Cleans static controller */
    orxMemory_Zero(&sstJoystick, sizeof(orxJOYSTICK_STATIC));
  }

  return;
}
Пример #3
0
static int
SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
{
    struct sensor_hwdata *hwdata;

    hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata));
    if (hwdata == NULL) {
        return SDL_OutOfMemory();
    }

    hwdata->asensor = SDL_sensors[device_index].asensor;
    hwdata->eventqueue = ASensorManager_createEventQueue(SDL_sensor_manager, SDL_sensor_looper, LOOPER_ID_USER, NULL, NULL);
    if (!hwdata->eventqueue) {
        SDL_free(hwdata);
        return SDL_SetError("Couldn't create sensor event queue");
    }

    if (ASensorEventQueue_enableSensor(hwdata->eventqueue, hwdata->asensor) < 0) {
        ASensorManager_destroyEventQueue(SDL_sensor_manager, hwdata->eventqueue);
        SDL_free(hwdata);
        return SDL_SetError("Couldn't enable sensor");
    }

    /* FIXME: What rate should we set for this sensor? 60 FPS? Let's try the default rate for now... */

    sensor->hwdata = hwdata;
    return 0;
}
Пример #4
0
static void
SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
{
    if (sensor->hwdata) {
        ASensorEventQueue_disableSensor(sensor->hwdata->eventqueue, sensor->hwdata->asensor);
        ASensorManager_destroyEventQueue(SDL_sensor_manager, sensor->hwdata->eventqueue);
        SDL_free(sensor->hwdata);
        sensor->hwdata = NULL;
    }
}
Пример #5
0
void EventLoop::deactivate()
{
	if (enabled_)
	{
		activity_->onDeactivate();
		enabled_ = false;

		if (sensorEventQueue_ != 0)
		{
			ASensorManager_destroyEventQueue(sensorManager_,
											 sensorEventQueue_);
			sensorEventQueue_ = 0;
		}
		sensorManager_ = 0;
	}
}
Пример #6
0
	void EventLoop::deactivate()
	{
		Pegas_log_info("EventLoop::deactivate");

		if(mEnabled)
		{
			mActivityHandler->onDeactivate();
			mEnabled = false;

			if (mSensorEventQueue != NULL)
			{
				ASensorManager_destroyEventQueue(mSensorManager, mSensorEventQueue);
				mSensorEventQueue = NULL;
			}
			mSensorManager = NULL;
		}
	}
Пример #7
0
void xl_ekf_context_release(xl_ekf_context * ctx) {
    ASensorManager_destroyEventQueue(ctx->sensor_manager ,ctx->event_queue);
    pthread_mutex_destroy(ctx->lock);
    free(ctx->lock);
    free(ctx);
}
Пример #8
0
void SensorImpl::cleanup()
{
    // Detach the sensor events queue from the looper and destroy it
    ASensorManager_destroyEventQueue(sensorManager, sensorEventQueue);
}
Пример #9
0
 void SensorImpl::deInit()
 {
     ASensorManager_destroyEventQueue(ns_sensorManager, ns_sensorEventQueue);
 }
Пример #10
0
void GoAndroid_destroyManager() {
  ASensorManager* manager = ASensorManager_getInstance();
  ASensorManager_destroyEventQueue(manager, queue);
  ALooper_release(looper);
}