/* * @brief Register to all sensors and get the error codes */ void registerSensors() { for (int type=1; type<=SENSOR_TYPES; type++) { gSensorError[type] = maSensorStart(type, SENSOR_RATE_NORMAL); } }
/** * Processes Compass Requests from PhoneGap JavaScript */ void PhoneGapSensors::processCompassRequest( MAUtil::String callbackID, bool isWatched) { int res = maSensorStart(SENSOR_TYPE_COMPASS, SENSOR_RATE_NORMAL); if (res < 0) { mMessageHandler->callError( callbackID, PHONEGAP_CALLBACK_STATUS_ERROR, "MoSync: Failed to Start Compass"); return; } mCompassWatchStarted = isWatched; mCompassWatchCallBack = callbackID; }
/** * Processes Accelerometer Requests from PhoneGap JavaScript */ void PhoneGapSensors::processAcelerometerRequest( MAUtil::String callbackID, bool isWatched) { //Enable accelerometer which is supported in PhoneGap int res = maSensorStart(SENSOR_TYPE_ACCELEROMETER, SENSOR_RATE_NORMAL); if(res < 0) { mMessageHandler->callError( callbackID, PHONEGAP_CALLBACK_STATUS_ERROR, "MoSync: Failed to Start Accelerometer"); return; } mAccelerometerWatchCallBack = callbackID; mAccelerometerWatchStarted = isWatched; }