List of usage examples for android.hardware Sensor getName
public String getName()
From source file:org.wso2.carbon.iot.android.sense.event.streams.speed.SpeedDataReader.java
private void collectSensorData() { for (Sensor sensor : sensorList) { try {//from w w w.j av a2s .com if (senseDataStruct.containsKey(sensor.getName())) { SensorData sensorInfo = senseDataStruct.get(sensor.getName()); sensorVector.add(sensorInfo); Log.d(TAG, "Sensor Name " + sensor.getName() + ", Type " + sensor.getType() + " " + ", sensorValue :" + sensorInfo.getSensorValues()); } } catch (Throwable e) { Log.d(TAG, "error on sensors"); } } mSensorManager.unregisterListener(this); }
From source file:org.jitsi.android.gui.call.ProximitySensorFragment.java
/** * {@inheritDoc}//w ww . j a v a2 s . co m */ @Override public void onResume() { super.onResume(); SensorManager manager = JitsiApplication.getSensorManager(); // Skips if the sensor has been already attached if (proximitySensor != null) { // Re-registers the listener as it might have been // unregistered in onPause() manager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_UI); return; } List<Sensor> sensors = manager.getSensorList(Sensor.TYPE_ALL); logger.trace("Device has " + sensors.size() + " sensors"); for (Sensor s : sensors) { logger.trace("Sensor " + s.getName() + " type: " + s.getType()); } this.proximitySensor = manager.getDefaultSensor(Sensor.TYPE_PROXIMITY); if (proximitySensor == null) { return; } logger.info("Using proximity sensor: " + proximitySensor.getName()); sensorDisabled = false; manager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_UI); }
From source file:org.wso2.carbon.iot.android.sense.ActivitySelectSensor.java
/** * This method will unregister all the registered sensors. * *//*from w w w. j a va 2 s. c om*/ public void unregisterSensors() { if (sensors.size() > 0) { for (Sensor s : sensors) { System.out.println(s.getName() + " Unregistered!"); sensorManager.unregisterListener(sensorReader, s); } } }
From source file:ch.bfh.sensordataprocessor.sensor.SensorSelectorFragment.java
/** * hide the list of sensors and show the sensor display fragment * add these changes to the backstack/*from ww w .ja va 2 s. c om*/ */ private void showSensorFragment(Sensor sensor) { sensorDisplay.displaySensor(sensor); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); ft.hide(this); ft.show(sensorDisplay); ft.addToBackStack("Showing sensor: " + sensor.getName()); ft.commit(); }
From source file:at.amartinz.hardware.sensors.BaseSensor.java
@Override public void onAccuracyChanged(Sensor sensor, int accuracy) { if (Constants.DEBUG) { Log.d(this.getClass().getSimpleName(), String.format("onAccuracyChanged: %s (%s), %s", sensor.getName(), sensor.getVendor(), accuracy)); }//from w w w. ja va 2s . com }
From source file:com.configurer.easyscreenlock.service.ForegroundSensorService.java
public void showAvailableSensors() { try {// w w w .ja v a 2 s . c o m List<Sensor> list = mSensorManager.getSensorList(Sensor.TYPE_ALL); if (list != null) { Log.i(TAG, list.size() + " Available Sensors"); for (Sensor s : list) { Log.i(TAG, "Name : " + s.getName() + ", Type : " + s.getType()); } System.out.println("-done-"); } else { Log.w(TAG, "You have no sensors"); } } catch (Exception e) { Log.e(TAG, e.getMessage()); } }
From source file:com.wso2.mobile.mdm.api.DeviceInfo.java
/** *Returns all the sensors available on the device as a List *//*from w w w. j a v a 2s . c o m*/ public void getAllSensors() { SensorManager sm = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); List<Sensor> list = sm.getSensorList(Sensor.TYPE_ALL); if (CommonUtilities.DEBUG_MODE_ENABLED) { for (Sensor s : list) { Log.d("SENSORS", s.getName()); } } }
From source file:devbox.com.br.minercompanion.ProfileActivity.java
@Override public void onAccuracyChanged(Sensor sensor, int accuracy) { msg.insert(0, sensor.getName() + " - " + accuracy + (accuracy==1 ? " (LOW)":(accuracy==2 ? " (MED)":(accuracy==2 ? " (HIGH)" : "NULL"))) + "\n"); //ligthText.setText(msg); //ligthText.invalidate(); }
From source file:ch.bfh.sensordataprocessor.sensor.SensorDisplayFragment.java
public void displaySensor(Sensor sensor) { if (BuildConfig.DEBUG) { Log.d(TAG, "display the sensor"); }/*from w w w.j a va 2 s . co m*/ this.sensor = sensor; name.setText(sensor.getName()); type.setText(String.valueOf(sensor.getType())); maxRange.setText(String.valueOf(sensor.getMaximumRange())); minDelay.setText(String.valueOf(sensor.getMinDelay())); power.setText(String.valueOf(sensor.getPower())); resolution.setText(String.valueOf(sensor.getResolution())); vendor.setText(String.valueOf(sensor.getVendor())); version.setText(String.valueOf(sensor.getVersion())); sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL); }
From source file:com.sitewhere.android.example.ExampleFragment.java
@Override public void onAccuracyChanged(Sensor sensor, int accuracy) { Log.d(TAG, "Sensor accuracy changed for " + sensor.getName() + "."); }