当前位置: 首页>>代码示例>>Java>>正文


Java BrickletColor类代码示例

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


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

示例1: ColorConsumer

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

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

    if(endpoint.getCallback()==null || endpoint.getCallback().equals("")){
        device.addColorListener(this);
        device.addColorReachedListener(this);
        device.addIlluminanceListener(this);
        device.addColorTemperatureListener(this);
        
    }else{
        String[] callbacks = endpoint.getCallback().split(",");
        for (String callback : callbacks) {
            if(callback.equals("ColorListener")) device.addColorListener(this);
            if(callback.equals("ColorReachedListener")) device.addColorReachedListener(this);
            if(callback.equals("IlluminanceListener")) device.addIlluminanceListener(this);
            if(callback.equals("ColorTemperatureListener")) device.addColorTemperatureListener(this);
            
        }
    }
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:24,代码来源:ColorConsumer.java

示例2: executeIntent

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
public void executeIntent(LightIntent intent) throws TimeoutException, NotConnectedException {
boolean isLightOn = intent.getValue(LIGHT_ON, Boolean.class);
if (isLightOn) {
    getDevice().lightOn();
} else {
    getDevice().lightOff();
}
getStatus(LightStatus.class).update(LIGHT_ON, getDevice().isLightOn() == BrickletColor.LIGHT_ON);
   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:10,代码来源:Color.java

示例3: init

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
public void init(BrickletColor 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,代码来源:ColorEndpoint.java

示例4: color

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
@Override
public void color(int r, int g, int b, int c) {
    LOG.trace("color()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletColor.CALLBACK_COLOR);
        exchange.getIn().setHeader("r", r);
        exchange.getIn().setHeader("g", g);
        exchange.getIn().setHeader("b", b);
        exchange.getIn().setHeader("c", c);
        
        
        // ADD BODY
        exchange.getIn().setBody("color");;
        
        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,代码行数:29,代码来源:ColorConsumer.java

示例5: colorReached

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
@Override
public void colorReached(int r, int g, int b, int c) {
    LOG.trace("colorReached()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletColor.CALLBACK_COLOR_REACHED);
        exchange.getIn().setHeader("r", r);
        exchange.getIn().setHeader("g", g);
        exchange.getIn().setHeader("b", b);
        exchange.getIn().setHeader("c", c);
        
        
        // ADD BODY
        exchange.getIn().setBody("color_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,代码行数:29,代码来源:ColorConsumer.java

示例6: setTinkerforgeDevice

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

示例7: ColorProducer

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
public ColorProducer(ColorEndpoint endpoint) throws UnknownHostException, AlreadyConnectedException, IOException {
    super(endpoint);
    device = new BrickletColor(endpoint.getUid(),endpoint.getSharedConnection().getConnection());
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:5,代码来源:ColorProducer.java

示例8: eSet

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case ModelPackage.MBRICKLET_COLOR__LOGGER:
            setLogger((Logger) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__UID:
            setUid((String) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__POLL:
            setPoll((Boolean) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__ENABLED_A:
            setEnabledA((AtomicBoolean) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__TINKERFORGE_DEVICE:
            setTinkerforgeDevice((BrickletColor) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__IP_CONNECTION:
            setIpConnection((IPConnection) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__CONNECTED_UID:
            setConnectedUid((String) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__POSITION:
            setPosition((Character) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__DEVICE_IDENTIFIER:
            setDeviceIdentifier((Integer) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__NAME:
            setName((String) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__BRICKD:
            setBrickd((MBrickd) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__MSUBDEVICES:
            getMsubdevices().clear();
            getMsubdevices().addAll((Collection<? extends BrickletColorDevice>) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__TF_CONFIG:
            setTfConfig((BrickletColorConfiguration) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__GAIN:
            setGain((Short) newValue);
            return;
        case ModelPackage.MBRICKLET_COLOR__INTEGRATION_TIME:
            setIntegrationTime((Short) newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:60,代码来源:MBrickletColorImpl.java

示例9: eUnset

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void eUnset(int featureID) {
    switch (featureID) {
        case ModelPackage.MBRICKLET_COLOR__LOGGER:
            setLogger(LOGGER_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__UID:
            setUid(UID_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__POLL:
            setPoll(POLL_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__ENABLED_A:
            setEnabledA(ENABLED_A_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__TINKERFORGE_DEVICE:
            setTinkerforgeDevice((BrickletColor) null);
            return;
        case ModelPackage.MBRICKLET_COLOR__IP_CONNECTION:
            setIpConnection(IP_CONNECTION_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__CONNECTED_UID:
            setConnectedUid(CONNECTED_UID_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__POSITION:
            setPosition(POSITION_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__DEVICE_IDENTIFIER:
            setDeviceIdentifier(DEVICE_IDENTIFIER_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__NAME:
            setName(NAME_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__BRICKD:
            setBrickd((MBrickd) null);
            return;
        case ModelPackage.MBRICKLET_COLOR__MSUBDEVICES:
            getMsubdevices().clear();
            return;
        case ModelPackage.MBRICKLET_COLOR__TF_CONFIG:
            setTfConfig((BrickletColorConfiguration) null);
            return;
        case ModelPackage.MBRICKLET_COLOR__GAIN:
            setGain(GAIN_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_COLOR__INTEGRATION_TIME:
            setIntegrationTime(INTEGRATION_TIME_EDEFAULT);
            return;
    }
    super.eUnset(featureID);
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:58,代码来源:MBrickletColorImpl.java

示例10: getTinkerforgeDevice

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public BrickletColor getTinkerforgeDevice() {
    return tinkerforgeDevice;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:11,代码来源:MBrickletColorImpl.java

示例11: createTinkerBrickletColorFromString

import com.tinkerforge.BrickletColor; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public BrickletColor createTinkerBrickletColorFromString(EDataType eDataType, String initialValue) {
    return (BrickletColor) super.createFromString(eDataType, initialValue);
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:10,代码来源:ModelFactoryImpl.java


注:本文中的com.tinkerforge.BrickletColor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。