本文整理汇总了Java中org.eclipse.smarthome.core.library.types.StringType类的典型用法代码示例。如果您正苦于以下问题:Java StringType类的具体用法?Java StringType怎么用?Java StringType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringType类属于org.eclipse.smarthome.core.library.types包,在下文中一共展示了StringType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fetchNewCalls
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
private void fetchNewCalls() throws FreeboxException {
List<CallEntry> callEntries = fbClient.getCallManager().getCallEntries();
for (CallEntry call: callEntries) {
if (call.is_new_()) {
updateState(new ChannelUID(getThing().getUID(), CALLNUMBER),
new StringType(call.getNumber()));
updateState(new ChannelUID(getThing().getUID(), CALLDURATION),
new DecimalType(call.getDuration()));
updateState(new ChannelUID(getThing().getUID(), CALLTIMESTAMP),
new DateTimeType(call.getTimeStamp()));
updateState(new ChannelUID(getThing().getUID(), CALLSTATUS),
new StringType(call.getType()));
updateState(new ChannelUID(getThing().getUID(), CALLNAME),
new StringType(call.getName()));
call.setNew(false);
fbClient.getCallManager().setCallEntry(call);
}
}
}
开发者ID:Neulinet,项目名称:Zoo,代码行数:21,代码来源:FreeboxHandler.java
示例2: fetchSystemConfig
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
private void fetchSystemConfig() throws FreeboxException {
SystemConfiguration systemConfiguration = fbClient.getSystemManager().getConfiguration();
updateState(new ChannelUID(getThing().getUID(), FWVERSION),
new StringType(systemConfiguration.getFirmware_version()));
long newUptime = systemConfiguration.getUptimeVal();
updateState(new ChannelUID(getThing().getUID(), RESTARTED),
newUptime < uptime ? OnOffType.ON : OnOffType.OFF );
uptime = newUptime;
updateState(new ChannelUID(getThing().getUID(), UPTIME),
new DecimalType(uptime));
updateState(new ChannelUID(getThing().getUID(), TEMPCPUM),
new DecimalType(systemConfiguration.getTemp_cpum()));
updateState(new ChannelUID(getThing().getUID(), TEMPCPUB),
new DecimalType(systemConfiguration.getTemp_cpub()));
updateState(new ChannelUID(getThing().getUID(), TEMPSWITCH),
new DecimalType(systemConfiguration.getTemp_sw()));
updateState(new ChannelUID(getThing().getUID(), FANSPEED),
new DecimalType(systemConfiguration.getFan_rpm()));
}
开发者ID:Neulinet,项目名称:Zoo,代码行数:23,代码来源:FreeboxHandler.java
示例3: playRadio
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
public void playRadio(Command command) {
List<SonosEntry> stations = getFavoriteRadios();
SonosEntry theEntry = null;
if (command instanceof StringType) {
String station = command.toString();
// search for the appropriate radio based on its name (title)
for (SonosEntry someStation : stations) {
if (someStation.getTitle().equals(station)) {
theEntry = someStation;
break;
}
}
// set the URI of the group coordinator
if (theEntry != null) {
ZonePlayerHandler coordinator = getHandlerByName(getCoordinator());
coordinator.setCurrentURI(theEntry);
coordinator.play();
}
}
}
开发者ID:Neulinet,项目名称:Zoo,代码行数:24,代码来源:ZonePlayerHandler.java
示例4: updateSensorDateState
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
private void updateSensorDateState(DataType dataType, String data) {
switch (dataType) {
case HUMIDITY:
updateState(humidityChannel, new DecimalType(data));
break;
case TEMPERATURE:
updateState(tempChannel, new DecimalType(data));
break;
case RAINRATE:
updateState(rainRateChannel, new DecimalType(data));
break;
case RAINTOTAL:
updateState(raintTotChannel, new DecimalType(data));
break;
case WINDAVERAGE:
updateState(windAverageChannel, new DecimalType(data));
break;
case WINDDIRECTION:
updateState(windDirectionChannel, new StringType(data));
break;
case WINDGUST:
updateState(windGuestChannel, new DecimalType(data));
break;
default:
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:27,代码来源:TelldusDevicesHandler.java
示例5: getSubscription
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
protected Optional<ServiceSubscription<Launcher.AppInfoListener>> getSubscription(ConnectableDevice device,
String channelId, LGWebOSHandler handler) {
if (device.hasCapability(Launcher.RunningApp_Subscribe)) {
return Optional.of(getControl(device).subscribeRunningApp(new Launcher.AppInfoListener() {
@Override
public void onError(ServiceCommandError error) {
logger.debug("{} {} {}", error.getCode(), error.getPayload(), error.getMessage());
}
@Override
public void onSuccess(AppInfo appInfo) {
handler.postUpdate(channelId, new StringType(appInfo.getId()));
}
}));
} else {
return null;
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:LauncherApplication.java
示例6: sendInputSourceCommand
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
public boolean sendInputSourceCommand(Command command, int zone) throws CommandTypeNotSupportedException {
AvrCommand commandToSend = null;
if (command == IncreaseDecreaseType.INCREASE) {
commandToSend = RequestResponseFactory.getIpControlCommand(SimpleCommandType.INPUT_CHANGE_CYCLIC, zone);
} else if (command == IncreaseDecreaseType.DECREASE) {
commandToSend = RequestResponseFactory.getIpControlCommand(SimpleCommandType.INPUT_CHANGE_REVERSE, zone);
} else if (command instanceof StringType) {
String inputSourceValue = ((StringType) command).toString();
commandToSend = RequestResponseFactory.getIpControlCommand(ParameterizedCommandType.INPUT_CHANNEL_SET, zone)
.setParameter(inputSourceValue);
} else {
throw new CommandTypeNotSupportedException("Command type not supported.");
}
return sendCommand(commandToSend);
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:19,代码来源:StreamAvrConnection.java
示例7: zoneStateChanged
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
public void zoneStateChanged(ZoneControlState msg) {
boolean inputChanged = !msg.inputID.equals(zoneState.inputID);
zoneState = msg;
updateStatus(ThingStatus.ONLINE);
updateState(grpZone(YamahaReceiverBindingConstants.CHANNEL_POWER),
zoneState.power ? OnOffType.ON : OnOffType.OFF);
updateState(grpZone(YamahaReceiverBindingConstants.CHANNEL_INPUT), new StringType(zoneState.inputID));
updateState(grpZone(YamahaReceiverBindingConstants.CHANNEL_SURROUND),
new StringType(zoneState.surroundProgram));
updateState(grpZone(YamahaReceiverBindingConstants.CHANNEL_VOLUME), new PercentType((int) zoneState.volume));
updateState(grpZone(YamahaReceiverBindingConstants.CHANNEL_MUTE),
zoneState.mute ? OnOffType.ON : OnOffType.OFF);
// If the input changed
if (inputChanged) {
inputChanged();
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:20,代码来源:YamahaZoneThingHandler.java
示例8: updatePlayerState
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
/**
* Updates the state of player
*
* @param player the player to update
*/
private void updatePlayerState(PlayerData player) {
State playerLevel = new DecimalType(player.getLevel());
State playerLevelPercentage = new DecimalType(player.getExperience());
State playerTotalExperience = new DecimalType(player.getTotalExperience());
State playerHealth = new DecimalType(player.getHealth());
State playerWalkSpeed = new DecimalType(player.getWalkSpeed());
DecimalType longitude = new DecimalType(player.getLocation().getX());
DecimalType latitude = new DecimalType(player.getLocation().getY());
DecimalType altitude = new DecimalType(player.getLocation().getY());
State playerLocation = new PointType(latitude, longitude, altitude);
State playerGameMode = new StringType(player.getGameMode());
updateState(MinecraftBindingConstants.CHANNEL_PLAYER_LEVEL_PERCENTAGE, playerLevelPercentage);
updateState(MinecraftBindingConstants.CHANNEL_PLAYER_TOTAL_EXPERIENCE, playerTotalExperience);
updateState(MinecraftBindingConstants.CHANNEL_PLAYER_LEVEL, playerLevel);
updateState(MinecraftBindingConstants.CHANNEL_PLAYER_HEALTH, playerHealth);
updateState(MinecraftBindingConstants.CHANNEL_PLAYER_WALK_SPEED, playerWalkSpeed);
updateState(MinecraftBindingConstants.CHANNEL_PLAYER_LOCATION, playerLocation);
updateState(MinecraftBindingConstants.CHANNEL_PLAYER_GAME_MODE, playerGameMode);
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:26,代码来源:MinecraftPlayerHandler.java
示例9: handleMMChange
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
/**
* Helper method to handle any media management change. If the channel is the INFO text channel, we delegate to
* {@link #handleMMInfoText(String)} instead. This helper method will simply get the next MM identifier and send the
* json representation out for the channel change (this ensures unique messages for each MM notification)
*
* @param channelId a non-null, non-empty channelId
* @param value the value for the channel
* @throws IllegalArgumentException if channelID is null or empty
*/
private void handleMMChange(String channelId, String value) {
if (StringUtils.isEmpty(channelId)) {
throw new NullArgumentException("channelId cannot be null or empty");
}
final AtomicInteger ai = mmSeqNbrs.get(channelId);
if (ai == null) {
logger.error("Channel {} does not have an ID configuration - programmer error!", channelId);
} else {
if (channelId.equals(RioConstants.CHANNEL_SOURCEMMINFOTEXT)) {
value = handleMMInfoText(value);
if (value == null) {
return;
}
}
final int id = ai.getAndIncrement();
final String json = gson.toJson(new IdValue(id, value));
stateChanged(channelId, new StringType(json));
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:33,代码来源:RioSourceProtocol.java
示例10: handleSystemNotification
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
/**
* Handles any system notifications returned by the russound system
*
* @param m a non-null matcher
* @param resp a possibly null, possibly empty response
*/
void handleSystemNotification(Matcher m, String resp) {
if (m == null) {
throw new IllegalArgumentException("m (matcher) cannot be null");
}
if (m.groupCount() == 2) {
final String key = m.group(1).toLowerCase();
final String value = m.group(2);
switch (key) {
case SYS_LANG:
stateChanged(RioConstants.CHANNEL_SYSLANG, new StringType(value));
break;
case SYS_STATUS:
stateChanged(RioConstants.CHANNEL_SYSSTATUS, "ON".equals(value) ? OnOffType.ON : OnOffType.OFF);
break;
default:
logger.warn("Unknown system notification: '{}'", resp);
break;
}
} else {
logger.warn("Invalid System Notification response: '{}'", resp);
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:32,代码来源:RioSystemProtocol.java
示例11: deviceInformationUpdate
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
public void deviceInformationUpdate(List<DeviceInformation> deviceInformationList) {
DeviceInformation deviceInformationRecord = getDeviceInformationRecord(deviceInformationList);
if (deviceInformationRecord != null) {
deviceId = deviceInformationRecord.getId();
if (deviceInformationRecord.getDeviceStatus() == 200) {
updateStatus(ThingStatus.ONLINE);
} else {
updateStatus(ThingStatus.OFFLINE);
}
updateState(BATTERY_STATUS, new StringType(deviceInformationRecord.getBatteryStatus()));
Double batteryLevel = deviceInformationRecord.getBatteryLevel();
if (batteryLevel != Double.NaN) {
updateState(BATTERY_LEVEL, new DecimalType(deviceInformationRecord.getBatteryLevel() * 100));
}
if (deviceInformationRecord.getLocation() != null) {
updateLocationRelatedStates(deviceInformationRecord);
}
} else {
updateStatus(ThingStatus.OFFLINE);
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:27,代码来源:ICloudDeviceHandler.java
示例12: getSubscription
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
protected Optional<ServiceSubscription<ChannelListener>> getSubscription(ConnectableDevice device, String channelId,
LGWebOSHandler handler) {
if (device.hasCapability(TVControl.Channel_Subscribe)) {
return Optional.of(getControl(device).subscribeCurrentChannel(new ChannelListener() {
@Override
public void onError(ServiceCommandError error) {
logger.debug("{} {} {}", error.getCode(), error.getPayload(), error.getMessage());
}
@Override
public void onSuccess(ChannelInfo channelInfo) {
handler.postUpdate(channelId, new StringType(channelInfo.getName()));
}
}));
} else {
return null;
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:TVControlChannelName.java
示例13: updateFeedbackChannel
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
private void updateFeedbackChannel(byte[] buffer) {
String channelId;
if (serialPort.equals(CommandType.SERIAL1)) {
channelId = CHANNEL_SL_M1_RECEIVE;
} else if (serialPort.equals(CommandType.SERIAL2)) {
channelId = CHANNEL_SL_M2_RECEIVE;
} else {
logger.warn("Unknown serial port; can't update feedback channel: {}", serialPort);
return;
}
Channel channel = getThing().getChannel(channelId);
if (channel != null && isLinked(channelId)) {
logger.debug("Updating feedback channel for port {}", serialPort);
try {
String encodedReply = URLEncoder.encode(new String(buffer, CHARSET), CHARSET);
logger.debug("encodedReply='{}'", encodedReply);
updateState(channel.getUID(), new StringType(encodedReply));
} catch (UnsupportedEncodingException e) {
logger.warn("Exception while encoding data read from serial device: {}", e.getMessage());
}
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:23,代码来源:GlobalCacheHandler.java
示例14: updateCurrentItemState
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
private void updateCurrentItemState(PlaylistItem currentItem) {
logger.debug("{}: PlaylistItem changed to {}", speaker.getName(), currentItem);
updateState(CURRENT_ARTIST, new StringType(currentItem.getArtist()));
updateState(CURRENT_ALBUM, new StringType(currentItem.getAlbum()));
updateState(CURRENT_TITLE, new StringType(currentItem.getTitle()));
updateState(CURRENT_GENRE, new StringType(currentItem.getGenre()));
updateDuration(currentItem.getDurationInMs());
updateState(CURRENT_URL, new StringType(currentItem.getUrl()));
updateCoverArtState(currentItem.getThumbnailUrl());
try {
updateState(CURRENT_USER_DATA, new StringType(String.valueOf(currentItem.getUserData())));
} catch (SpeakerException e) {
logger.warn("Unable to update current user data: {}", e.getMessage(), e);
}
logger.debug("MediaType: {}", currentItem.getMediaType());
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:18,代码来源:AllPlayHandler.java
示例15: handleFanSmartmode
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
private void handleFanSmartmode(Command command) {
logger.debug("Handling fan smartmode command {}", command);
// <mac;SMARTMODE;SET;OFF/COOLING/HEATING>
if (command instanceof StringType) {
if (command.equals(OFF)) {
sendCommand(macAddress, ";SMARTMODE;STATE;SET;OFF");
} else if (command.equals(COOLING)) {
sendCommand(macAddress, ";SMARTMODE;STATE;SET;COOLING");
} else if (command.equals(HEATING)) {
sendCommand(macAddress, ";SMARTMODE;STATE;SET;HEATING");
} else {
logger.debug("Unknown fan smartmode command: {}", command);
}
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:17,代码来源:BigAssFanHandler.java
示例16: onDeviceStateChanged
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
public void onDeviceStateChanged(ThingUID bridge, AbstractAudioDeviceConfig device) {
if (device.getPaName().equals(name)) {
updateStatus(ThingStatus.ONLINE);
logger.debug("Updating states of {} id: {}", device, PulseaudioBindingConstants.VOLUME_CHANNEL);
updateState(PulseaudioBindingConstants.VOLUME_CHANNEL, new PercentType(device.getVolume()));
updateState(PulseaudioBindingConstants.MUTE_CHANNEL, device.isMuted() ? OnOffType.ON : OnOffType.OFF);
updateState(PulseaudioBindingConstants.STATE_CHANNEL,
device.getState() != null ? new StringType(device.getState().toString()) : new StringType("-"));
if (device instanceof SinkInput) {
updateState(PulseaudioBindingConstants.ROUTE_TO_SINK_CHANNEL,
((SinkInput) device).getSink() != null
? new StringType(((SinkInput) device).getSink().getPaName())
: new StringType("-"));
}
if (device instanceof Sink && ((Sink) device).isCombinedSink()) {
updateState(PulseaudioBindingConstants.SLAVES_CHANNEL,
new StringType(StringUtils.join(((Sink) device).getCombinedSinkNames(), ",")));
}
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:22,代码来源:PulseaudioHandler.java
示例17: refresh
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
public void refresh() {
ThingUID thinguid = getThing().getUID();
String on = query("o");
if (on != null) {
updateState(new ChannelUID(thinguid, ON), "1".equals(on) ? OnOffType.ON : OnOffType.OFF);
}
updateState(new ChannelUID(thinguid, CURRENT_TEMP), new DecimalType(query("a")));
updateState(new ChannelUID(thinguid, SET_TEMP), new DecimalType(query("t")));
String mode = modeNumToStr.get(query("m"));
if (mode != null) {
updateState(new ChannelUID(thinguid, MODE), new StringType(mode));
}
String louvre = query("s");
if (louvre != null) {
updateState(new ChannelUID(thinguid, LOUVRE), new StringType(louvre));
}
String fan = fanNumToStr.get(query("f"));
if (fan != null) {
updateState(new ChannelUID(thinguid, FAN), new StringType(fan));
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:23,代码来源:HVACHandler.java
示例18: handleSuperSequenceStatus
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
/**
* Handles the super sequence response
*
* @param m the non-null {@link Matcher} that matched the response
* @param resp the possibly null, possibly empty actual response
*/
private void handleSuperSequenceStatus(Matcher m, String resp) {
if (m == null) {
throw new IllegalArgumentException("m (matcher) cannot be null");
}
if (m.groupCount() == 5) {
try {
final int nextStep = Integer.parseInt(m.group(2));
final int nextMin = Integer.parseInt(m.group(3));
final int nextSec = Integer.parseInt(m.group(4));
_callback.stateChanged(PrgConstants.CHANNEL_SUPERSEQUENCESTATUS, new StringType(m.group(1)));
_callback.stateChanged(PrgConstants.CHANNEL_SUPERSEQUENCENEXTSTEP, new DecimalType(nextStep));
_callback.stateChanged(PrgConstants.CHANNEL_SUPERSEQUENCENEXTMIN, new DecimalType(nextMin));
_callback.stateChanged(PrgConstants.CHANNEL_SUPERSEQUENCENEXTSEC, new DecimalType(nextSec));
} catch (NumberFormatException e) {
logger.error("Invalid volume response (can't parse number): '{}'", resp);
}
} else {
logger.error("Invalid format volume response: '{}'", resp);
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:27,代码来源:PrgProtocolHandler.java
示例19: convertFromState
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
public void convertFromState(String channelId, Type type) throws RFXComUnsupportedChannelException {
switch (channelId) {
case CHANNEL_COMMAND:
if ((type instanceof OnOffType) && (subType == SubType.X10_SECURITY_REMOTE)) {
status = (type == OnOffType.ON ? Status.ARM_AWAY_DELAYED : Status.DISARM);
} else {
throw new RFXComUnsupportedChannelException("Channel " + channelId + " does not accept " + type);
}
break;
case CHANNEL_STATUS:
if (type instanceof StringType) {
status = Status.valueOf(type.toString());
} else {
throw new RFXComUnsupportedChannelException("Channel " + channelId + " does not accept " + type);
}
break;
default:
throw new RFXComUnsupportedChannelException("Channel " + channelId + " is not relevant here");
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:27,代码来源:RFXComSecurity1Message.java
示例20: convertToState
import org.eclipse.smarthome.core.library.types.StringType; //导入依赖的package包/类
@Override
public State convertToState(String channelId) throws RFXComUnsupportedChannelException {
switch (channelId) {
case CHANNEL_TEMPERATURE:
return new DecimalType(temperature);
case CHANNEL_HUMIDITY:
return new DecimalType(humidity);
case CHANNEL_HUMIDITY_STATUS:
return new StringType(humidityStatus.toString());
default:
return super.convertToState(channelId);
}
}
开发者ID:openhab,项目名称:openhab2-addons,代码行数:17,代码来源:RFXComTemperatureHumidityMessage.java
注:本文中的org.eclipse.smarthome.core.library.types.StringType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论