Beispiel #1
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 public void fetchSensorValue() {
   try {
     int resistance = tinkerforgeDevice.getResistance();
     DecimalValue value = Tools.calculate(resistance);
     setSensorValue(value);
   } catch (TimeoutException e) {
     TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
   } catch (NotConnectedException e) {
     TinkerforgeErrorHandler.handleError(
         this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
   }
 }
Beispiel #2
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 public void enable() {
   tinkerforgeDevice = getMbrick().getTinkerforgeDevice();
   if (tfConfig != null) {
     if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
       setThreshold(tfConfig.getThreshold());
     }
     if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
       setCallbackPeriod(tfConfig.getCallbackPeriod());
     }
   }
   try {
     tinkerforgeDevice.setResistanceCallbackPeriod(getCallbackPeriod());
     listener = new ResistanceListener();
     tinkerforgeDevice.addResistanceListener(listener);
     fetchSensorValue();
   } catch (TimeoutException e) {
     TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
   } catch (NotConnectedException e) {
     TinkerforgeErrorHandler.handleError(
         this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
   }
 }
Beispiel #3
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 public void disable() {
   if (listener != null) {
     tinkerforgeDevice.removeResistanceListener(listener);
   }
   tinkerforgeDevice = null;
 }