Java BrickletTemperatureIR类代码示例(javabricklettemperatureir典型用法代码示例汇总)

本文整理汇总了Java中com.tinkerforge.BrickletTemperatureIR的典型用法代码示例。如果您正苦于以下问题:Java BrickletTemperatureIR类的具体用法?Java BrickletTemperatureIR怎么用?Java BrickletTemperatureIR使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Java BrickletTemperatureIR类代码示例(javabricklettemperatureir典型用法代码示例汇总)

BrickletTemperatureIR类属于com.tinkerforge包,在下文中一共展示了BrickletTemperatureIR类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
	IPConnection ipcon = new IPConnection(); // Create IP connection
	BrickletTemperatureIR tir = new BrickletTemperatureIR(UID, ipcon); // Create device object

	ipcon.connect(host, port); // Connect to brickd
	// Don't use device before ipcon is connected

	// Get current object and ambient temperature (unit is °C/10)
	short obj = tir.getObjectTemperature(); // Can throw com.tinkerforge.TimeoutException
	short amb = tir.getAmbientTemperature(); // Can throw com.tinkerforge.TimeoutException

	System.out.println("Object Temperature: " + obj/10.0 + " °C");
	System.out.println("Ambient Temperature: " + amb/10.0 + " °C");

	System.console().readLine("Press key to exit\n");
	ipcon.disconnect();
} 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:18,代码来源:ExampleSimple.java

示例2: deviceDisconnected

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
   public void deviceDisconnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.TemperatureIR) {
    final BrickletTemperatureIR tempIR = (BrickletTemperatureIR) device;
    tempIR.removeObjectTemperatureListener(this);
    tempIR.removeAmbientTemperatureListener(this);

    try {
	tempIR.setObjectTemperatureCallbackPeriod(500);
	tempIR.setAmbientTemperatureCallbackPeriod(500);
    } catch (final TinkerforgeException ex) {
    }

}

   } 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:19,代码来源:TemperatureApplication.java

示例3: deviceConnected

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
   public void deviceConnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.TemperatureIR) {
    final BrickletTemperatureIR tempIR = (BrickletTemperatureIR) device;
    tempIR.addObjectTemperatureListener(this);
    tempIR.addAmbientTemperatureListener(this);

    try {
	tempIR.setObjectTemperatureCallbackPeriod(500);
	tempIR.setAmbientTemperatureCallbackPeriod(500);
    } catch (final TinkerforgeException ex) {
    }

}
   } 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:18,代码来源:TemperatureApplication.java

示例4: deviceDisconnected

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
public void deviceDisconnected(
		final TinkerforgeStackAgent tinkerforgeStackAgent,
		final Device device) {
	if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.TemperatureIR) {
		final BrickletTemperatureIR tempIR = (BrickletTemperatureIR) device;
		tempIR.removeObjectTemperatureListener(this);
		tempIR.removeAmbientTemperatureListener(this);

		try {
			tempIR.setObjectTemperatureCallbackPeriod(500);
			tempIR.setAmbientTemperatureCallbackPeriod(500);
		} catch (final TinkerforgeException ex) {
		}

	}

} 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:19,代码来源:TemperatureApplication.java

示例5: deviceConnected

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
public void deviceConnected(
		final TinkerforgeStackAgent tinkerforgeStackAgent,
		final Device device) {
	if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.TemperatureIR) {
		final BrickletTemperatureIR tempIR = (BrickletTemperatureIR) device;
		tempIR.addObjectTemperatureListener(this);
		tempIR.addAmbientTemperatureListener(this);

		try {
			tempIR.setObjectTemperatureCallbackPeriod(500);
			tempIR.setAmbientTemperatureCallbackPeriod(500);
		} catch (final TinkerforgeException ex) {
		}

	}
} 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:18,代码来源:TemperatureApplication.java

示例6: TemperatureIRConsumer

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
public TemperatureIRConsumer(TemperatureIREndpoint endpoint, Processor processor) throws Exception {
    super(endpoint, processor);

    device = new BrickletTemperatureIR(endpoint.getUid(),endpoint.getSharedConnection().getConnection());
    endpoint.init(device);

    if(endpoint.getCallback()==null || endpoint.getCallback().equals("")){
        device.addAmbientTemperatureListener(this);
        device.addObjectTemperatureListener(this);
        device.addAmbientTemperatureReachedListener(this);
        device.addObjectTemperatureReachedListener(this);
        
    }else{
        String[] callbacks = endpoint.getCallback().split(",");
        for (String callback : callbacks) {
            if(callback.equals("AmbientTemperatureListener")) device.addAmbientTemperatureListener(this);
            if(callback.equals("ObjectTemperatureListener")) device.addObjectTemperatureListener(this);
            if(callback.equals("AmbientTemperatureReachedListener")) device.addAmbientTemperatureReachedListener(this);
            if(callback.equals("ObjectTemperatureReachedListener")) device.addObjectTemperatureReachedListener(this);
            
        }
    }
} 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:24,代码来源:TemperatureIRConsumer.java

示例7: ambientTemperature

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
public void ambientTemperature(short temperature) {
    LOG.trace("ambientTemperature()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE);
        exchange.getIn().setHeader("temperature", temperature);
        
        
        // ADD BODY
        exchange.getIn().setBody("ambient_temperature");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
} 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:TemperatureIRConsumer.java

示例8: objectTemperature

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
public void objectTemperature(short temperature) {
    LOG.trace("objectTemperature()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE);
        exchange.getIn().setHeader("temperature", temperature);
        
        
        // ADD BODY
        exchange.getIn().setBody("object_temperature");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
} 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:TemperatureIRConsumer.java

示例9: ambientTemperatureReached

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
public void ambientTemperatureReached(short temperature) {
    LOG.trace("ambientTemperatureReached()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletTemperatureIR.CALLBACK_AMBIENT_TEMPERATURE_REACHED);
        exchange.getIn().setHeader("temperature", temperature);
        
        
        // ADD BODY
        exchange.getIn().setBody("ambient_temperature_reached");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
} 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:TemperatureIRConsumer.java

示例10: objectTemperatureReached

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
@Override
public void objectTemperatureReached(short temperature) {
    LOG.trace("objectTemperatureReached()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletTemperatureIR.CALLBACK_OBJECT_TEMPERATURE_REACHED);
        exchange.getIn().setHeader("temperature", temperature);
        
        
        // ADD BODY
        exchange.getIn().setBody("object_temperature_reached");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
} 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:TemperatureIRConsumer.java

示例11: setTinkerforgeDevice

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setTinkerforgeDevice(BrickletTemperatureIR newTinkerforgeDevice)
{
  BrickletTemperatureIR oldTinkerforgeDevice = tinkerforgeDevice;
  tinkerforgeDevice = newTinkerforgeDevice;
  if (eNotificationRequired())
    eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_TEMPERATURE_IR__TINKERFORGE_DEVICE, oldTinkerforgeDevice, tinkerforgeDevice));
} 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:13,代码来源:MBrickletTemperatureIRImpl.java

示例12: main

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
	IPConnection ipcon = new IPConnection(); // Create IP connection
	BrickletTemperatureIR tir = new BrickletTemperatureIR(UID, ipcon); // Create device object

	ipcon.connect(host, port); // Connect to brickd
	// Don't use device before ipcon is connected

	// Set emissivity to 0.98 (emissivity of water)
	tir.setEmissivity((int)(0xFFFF*0.98));

	// Get threshold callbacks with a debounce time of 10 seconds (10000ms)
	tir.setDebouncePeriod(10000);

	// Configure threshold for "object temperature greater than 100 °C" (unit is °C/10)
	tir.setObjectTemperatureCallbackThreshold('>', (short)(100*10), (short)0);

	// Add and implement temperature reached listener 
	// (called if object temperature is greater than 100 °C)
	tir.addObjectTemperatureReachedListener(new BrickletTemperatureIR.ObjectTemperatureReachedListener() {
		public void objectTemperatureReached(short temperature) {
			System.out.println("The surface has a temperature of " + 
			                   temperature/10.0 + " °C.");
			System.out.println("The water is boiling!");
		}
	});

	System.console().readLine("Press key to exit\n");
	ipcon.disconnect();
} 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:30,代码来源:ExampleWaterBoiling.java

示例13: init

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
public void init(BrickletTemperatureIR device) throws Exception {
    if(getInit()==null) return;
    
    String[] initFunctions = getInit().split(",");
    for (String function : initFunctions) {
        callFunction(device, function, null, this);
    }
} 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:9,代码来源:TemperatureIREndpoint.java

示例14: setTinkerforgeDevice

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setTinkerforgeDevice(BrickletTemperatureIR newTinkerforgeDevice) {
    BrickletTemperatureIR oldTinkerforgeDevice = tinkerforgeDevice;
    tinkerforgeDevice = newTinkerforgeDevice;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET,
                ModelPackage.MBRICKLET_TEMPERATURE_IR__TINKERFORGE_DEVICE, oldTinkerforgeDevice,
                tinkerforgeDevice));
} 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:16,代码来源:MBrickletTemperatureIRImpl.java

示例15: eSet

import com.tinkerforge.BrickletTemperatureIR; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__LOGGER:
      setLogger((Logger)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__UID:
      setUid((String)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__POLL:
      setPoll((Boolean)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__ENABLED_A:
      setEnabledA((AtomicBoolean)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__TINKERFORGE_DEVICE:
      setTinkerforgeDevice((BrickletTemperatureIR)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__IP_CONNECTION:
      setIpConnection((IPConnection)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__CONNECTED_UID:
      setConnectedUid((String)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__POSITION:
      setPosition((Character)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__DEVICE_IDENTIFIER:
      setDeviceIdentifier((Integer)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__NAME:
      setName((String)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__BRICKD:
      setBrickd((MBrickd)newValue);
      return;
    case ModelPackage.MBRICKLET_TEMPERATURE_IR__MSUBDEVICES:
      getMsubdevices().clear();
      getMsubdevices().addAll((Collection<? extends MTemperatureIRDevice>)newValue);
      return;
  }
  super.eSet(featureID, newValue);
} 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:52,代码来源:MBrickletTemperatureIRImpl.java

本文标签属性:

示例:示例英语

代码:代码零九

java:java游戏

BrickletTemperatureIR:BrickletTemperatureIR

上一篇:客源是什么(客源的解释)(keyuan]汉语词语分开解释客源是什么)
下一篇:Java UIComponent.isCompositeComponent方法代码示例(javauicomponent.iscomponent方法的典型用法代码示例)

为您推荐