本文整理汇总了Java中org.eclipse.smarthome.core.library.types.StringType类的典型用法代码示例。如果您正苦于以下问题:Java StringType类的具体用法?Java StringType怎么用?Java StringType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringType类属于org.eclipse.smarthome.core.library.types包,在下文中一共展示了StringType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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()));
}
示例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();
}
}
}
示例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:
}
}
示例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;
}
}
示例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);
}
示例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();
}
}
示例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);
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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());
}
}
}
示例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());
}
示例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);
}
}
}