本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}
}
示例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());
}
}
}
示例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());
}
}
}
示例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));
}
示例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());
}
示例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);
}
示例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);
}
示例10: getTinkerforgeDevice
import com.tinkerforge.BrickletColor; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public BrickletColor getTinkerforgeDevice() {
return tinkerforgeDevice;
}
示例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);
}