本文整理汇总了Java中com.tinkerforge.NotConnectedException类的典型用法代码示例。如果您正苦于以下问题:Java NotConnectedException类的具体用法?Java NotConnectedException怎么用?Java NotConnectedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotConnectedException类属于com.tinkerforge包,在下文中一共展示了NotConnectedException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deviceDisconnected
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Override
public void deviceDisconnected(
final TinkerforgeStackAgent tinkerforgeStackAgent,
final Device device) {
if (TinkerforgeDevice.areEqual(this.barometer, device)) {
this.barometer.removeAltitudeListener(this);
try {
try {
this.barometer.setAltitudeCallbackPeriod(0);
} catch (com.tinkerforge.TimeoutException ex) {
Logger.getLogger(BarometerApplication.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (final NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.barometer = null;
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:21,代码来源:BarometerApplication.java
示例2: setChipType
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void setChipType(int chipType) throws TimeoutException, NotConnectedException {
if (getDevice() != null) {
synchronized (this) {
while (this.sendState != LedStrip.SendState.FREE) {
try {
this.wait(250);
} catch (final InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
this.sendState = LedStrip.SendState.MAINTENANCE;
}
getDevice().setChipType(chipType);
synchronized (this) {
this.sendState = LedStrip.SendState.FREE;
this.notifyAll();
}
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:21,代码来源:LedStrip.java
示例3: enableDevice
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void enableDevice(D device) {
try {
if (!this.getIdentityString().equals(stackApplication.digestIdentityString(device))) {
return;
}
} catch (TimeoutException | NotConnectedException ex) {
return;
}
if (this.device != null) {
return;
}
this.device = device;
addDeviceListeners();
getStatus(DeviceHandlerReadyStatus.class).update(ENABLED, true);
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:17,代码来源:ADeviceHandler.java
示例4: deviceDisconnected
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Override
public void deviceDisconnected(
final TinkerforgeStackAgent tinkerforgeStackAgent,
final Device device) {
if (TinkerforgeDevice.areEqual(this.imuBrick, device)) {
this.imuBrick.removeQuaternionListener(this.sensorFusionApplication);
this.imuBrick.removeAccelerationListener(this.sensorFusionApplication);
try {
this.imuBrick.setQuaternionPeriod(0);
this.imuBrick.setAccelerationPeriod(0);
this.imuBrick.ledsOn();
} catch (TimeoutException | NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.imuBrick = null;
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:19,代码来源:IMUApplication.java
示例5: deviceConnected
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Override
public void deviceConnected(
final TinkerforgeStackAgent tinkerforgeStackAgent,
final Device device) {
if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.SoundIntensity) {
if (this.soundIntensity == null) {
this.soundIntensity = (BrickletSoundIntensity) device;
this.soundIntensity
.addIntensityReachedListener(this);
try {
try {
this.soundIntensity.setDebouncePeriod(this.debouncePeriod * 1000);
this.soundIntensity.setIntensityCallbackThreshold('>', this.intensityThreshold, this.intensityThreshold);
} catch (com.tinkerforge.TimeoutException ex) {
Logger.getLogger(SoundIntensityApplication.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (final NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:26,代码来源:SoundIntensityApplication.java
示例6: getIlluminance
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
private int getIlluminance(Illuminance illuminanceConfig) {
BrickletAmbientLightWrapper brickletAmbientLight = brickletAmbientLightWrapperService.getBrickletAmbientLight(
illuminanceConfig);
int illuminance;
try {
illuminance = brickletAmbientLight.getIlluminance();
brickletAmbientLight.disconnect();
} catch (TimeoutException | NotConnectedException exception) {
throw new IlluminanceConnectionException("Error getting sensor value:", exception);
}
return illuminance;
}
开发者ID:synyx,项目名称:sybil,代码行数:18,代码来源:IlluminanceService.java
示例7: getPixelsWithNotConnectedException
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Test(expected = LEDStripConnectionException.class)
public void getPixelsWithNotConnectedException() throws Exception {
// setup
// set up exception through reflection
Constructor<NotConnectedException> constructor;
constructor = NotConnectedException.class.getDeclaredConstructor();
constructor.setAccessible(true);
NotConnectedException exception = constructor.newInstance();
when(brickletLEDStripMock.getRGBValues(anyInt(), anyShort())).thenThrow(exception);
when(ledStripRepository.get("one")).thenReturn(new LEDStrip("one", "abc", 30, "abrick"));
// execution
sut.getPixels("one");
}
开发者ID:synyx,项目名称:sybil,代码行数:19,代码来源:LEDStripServiceUnitTest.java
示例8: MockConsumer
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public MockConsumer(final MockEndpoint endpoint, Processor processor) {
super(endpoint, processor);
// init Bricklet
device = new Device(endpoint.getUid(), new IPConnection()) {
@Override
public Identity getIdentity() throws TimeoutException, NotConnectedException {
LOG.trace("getIdentity()");
Identity identity = new Identity();
identity.uid = endpoint.getUid();
identity.connectedUid = "XYZ";
identity.position = 'a';
identity.hardwareVersion[0] = 1;
identity.hardwareVersion[1] = 2;
identity.hardwareVersion[2] = 3;
identity.firmwareVersion[0] = 4;
identity.firmwareVersion[1] = 5;
identity.firmwareVersion[2] = 6;
identity.deviceIdentifier = 233;
return identity;
}
};
}
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:27,代码来源:MockConsumer.java
示例9: activate
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Activate
public void activate() throws TimeoutException, NotConnectedException {
this.df = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.ENGLISH);
this.buffer = new ChatBuffer((message) -> printMessage(message));
IPConnection ipcon = tinkerConnect.getConnection();
lcd = new BrickletLCD20x4("rV1", ipcon);
lcd.backlightOn();
lcd.clearDisplay();
lcd.addButtonPressedListener((button) -> buttonPressed(button));
}
开发者ID:cschneider,项目名称:osgi-chat,代码行数:12,代码来源:LCDWriter.java
示例10: disconnect
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated NOT
*/
public void disconnect() {
try {
ipConnection.disconnect();
if (connectThread != null)
connectThread.interrupt();
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(logger,
TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
}
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:15,代码来源:MBrickdImpl.java
示例11: fullStop
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void fullStop(){
try {
dc1.fullBrake();
dc2.fullBrake();
} catch (TimeoutException | NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:11,代码来源:MotorApplication.java
示例12: setVelocityDC1
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void setVelocityDC1(int velocity){
if(dc1==null)return;
try {
dc1.setVelocity((short)velocity);
} catch (TimeoutException | NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:10,代码来源:MotorApplication.java
示例13: setVelocityDC2
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void setVelocityDC2(int velocity){
if(dc2==null)return;
try {
dc2.setVelocity((short)velocity);
} catch (TimeoutException | NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:10,代码来源:MotorApplication.java
示例14: deviceConnected
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Override
public void deviceConnected(
final TinkerforgeStackAgent tinkerforgeStackAgent,
final Device device) {
if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.Barometer) {
if (this.barometer == null) {
this.barometer = (BrickletBarometer) device;
this.barometer
.addAltitudeListener(this);
// Turn averaging of in the Barometer Bricklet to make sure that
// the data is without delay
try {
try {
this.barometer
.setAveraging((short) 0, (short) 0, (short) 0);
this.barometer
.setAltitudeCallbackPeriod(this.updatePeriodeInMilliseconds);
} catch (com.tinkerforge.TimeoutException ex) {
Logger.getLogger(BarometerApplication.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (final NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:30,代码来源:BarometerApplication.java
示例15: deviceDisconnected
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Override
public void deviceDisconnected(TinkerforgeStackAgent tinkerforgeStackAgent, Device device) {
try {
String digestedIdentityString = digestIdentityString(device);
ADeviceHandler deviceHandler = this.deviceHandlers.get(digestedIdentityString);
if (deviceHandler == null) {
return;
}
deviceHandler.disableDevice(device);
} catch (TimeoutException | NotConnectedException ex) {
Logger.getLogger(MQTTTinkerforgeStackHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:14,代码来源:MQTTTinkerforgeStackHandler.java
示例16: addDeviceListeners
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
@Override
protected void addDeviceListeners() {
getDevice().addFrameRenderedListener(this);
try {
this.setup();
} catch (TimeoutException | NotConnectedException ex) {
Logger.getLogger(LedStrip.class.getName()).log(Level.SEVERE, null, ex);
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:10,代码来源:LedStrip.java
示例17: setFrameDurationInMilliseconds
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void setFrameDurationInMilliseconds(
final int frameDurationInMilliseconds) throws TimeoutException, NotConnectedException {
if (frameDurationInMilliseconds < 1) {
throw new IllegalArgumentException();
}
this.frameDurationInMilliseconds = frameDurationInMilliseconds;
if (getDevice() != null) {
getDevice()
.setFrameDuration(this.frameDurationInMilliseconds);
}
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:14,代码来源:LedStrip.java
示例18: executeIntent
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void executeIntent(DustDensityCallbackThresholdIntent intent) throws TimeoutException, NotConnectedException {
char option = intent.getValue(DustDetector.THRESHOLD_OPTION, Character.class);
if (option == 's') {
option = '<';
}
if (option == 'g') {
option = '>';
}
int min = intent.getValue(DustDetector.THRESHOLD_MIN, Integer.class);
int max = intent.getValue(DustDetector.THRESHOLD_MAX, Integer.class);
getDevice().setDustDensityCallbackThreshold(option, min, max);
getStatus(DustDensityCallbackThresholdStatus.class).update(intent);
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:14,代码来源:DustDetector.java
示例19: reset
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
private void reset(Brick brick) {
IPConnection ipConnection = connect(brick.getName());
BrickMaster brickMaster = new BrickMaster(brick.getUid(), ipConnection);
try {
brickMaster.reset();
ipConnection.disconnect();
} catch (NotConnectedException | TimeoutException exception) {
throw new BrickConnectionException("Error resetting brick:", exception);
}
}
开发者ID:synyx,项目名称:sybil,代码行数:14,代码来源:BrickService.java
示例20: executeIntent
import com.tinkerforge.NotConnectedException; //导入依赖的package包/类
public void executeIntent(ObjectTemperatureCallbackThresholdIntent intent) throws TimeoutException, NotConnectedException {
char option = intent.getValue(TemperatureIR.THRESHOLD_OPTION, Character.class);
if (option == 's') {
option = '<';
}
if (option == 'g') {
option = '>';
}
short min = intent.getValue(TemperatureIR.THRESHOLD_MIN, Short.class);
short max = intent.getValue(TemperatureIR.THRESHOLD_MAX, Short.class);
getDevice().setObjectTemperatureCallbackThreshold(option, min, max);
getStatus(ObjectTemperatureCallbackThresholdStatus.class).update(intent);
}
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:14,代码来源:TemperatureIR.java
注:本文中的com.tinkerforge.NotConnectedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论