Ejemplo n.º 1
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 public void enable() {
   setCallbackPeriod(10);
   if (tfConfig != null) {
     logger.trace("got configuration");
     if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
       logger.trace("found callbackPeriod");
       setCallbackPeriod(tfConfig.getCallbackPeriod());
     }
   }
   logger.trace("callbackPeriod is {}", getCallbackPeriod());
   tinkerforgeDevice = new BrickletJoystick(getUid(), getIpConnection());
 }
Ejemplo n.º 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);
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 @Override
 public void enable() {
   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 = new BrickletDustDetector(getUid(), getIpConnection());
     tinkerforgeDevice.setDustDensityCallbackPeriod(getCallbackPeriod());
     listener = new DustDensityListener();
     tinkerforgeDevice.addDustDensityListener(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);
   }
 }