本文整理汇总了Java中org.openhab.binding.pulseaudio.internal.PulseaudioClient类的典型用法代码示例。如果您正苦于以下问题:Java PulseaudioClient类的具体用法?Java PulseaudioClient怎么用?Java PulseaudioClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PulseaudioClient类属于org.openhab.binding.pulseaudio.internal包,在下文中一共展示了PulseaudioClient类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClient
import org.openhab.binding.pulseaudio.internal.PulseaudioClient; //导入依赖的package包/类
public PulseaudioClient getClient() {
return client;
}
示例2: initialize
import org.openhab.binding.pulseaudio.internal.PulseaudioClient; //导入依赖的package包/类
@Override
public void initialize() {
logger.debug("Initializing Pulseaudio handler.");
Configuration conf = this.getConfig();
if (conf.get(BRIDGE_PARAMETER_HOST) != null) {
this.host = String.valueOf(conf.get(BRIDGE_PARAMETER_HOST));
}
if (conf.get(BRIDGE_PARAMETER_PORT) != null) {
this.port = ((BigDecimal) conf.get(BRIDGE_PARAMETER_PORT)).intValue();
}
if (conf.get(BRIDGE_PARAMETER_REFRESH_INTERVAL) != null) {
this.refreshInterval = ((BigDecimal) conf.get(BRIDGE_PARAMETER_REFRESH_INTERVAL)).intValue();
}
if (host != null && !host.isEmpty()) {
Runnable connectRunnable = new Runnable() {
@Override
public void run() {
try {
client = new PulseaudioClient(host, port);
if (client.isConnected()) {
updateStatus(ThingStatus.ONLINE);
logger.info("Established connection to Pulseaudio server on Host '{}':'{}'.", host, port);
startAutomaticRefresh();
}
} catch (IOException e) {
logger.error("Couldn't connect to Pulsaudio server [Host '{}':'{}']: {}", host, port,
e.getLocalizedMessage());
updateStatus(ThingStatus.OFFLINE);
}
}
};
scheduler.schedule(connectRunnable, 0, TimeUnit.SECONDS);
} else {
logger.warn(
"Couldn't connect to Pulseaudio server because of missing connection parameters [Host '{}':'{}'].",
host, port);
updateStatus(ThingStatus.OFFLINE);
}
}