本文整理汇总了Java中org.cups4j.CupsPrinter类的典型用法代码示例。如果您正苦于以下问题:Java CupsPrinter类的具体用法?Java CupsPrinter怎么用?Java CupsPrinter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CupsPrinter类属于org.cups4j包,在下文中一共展示了CupsPrinter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.cups4j.CupsPrinter; //导入依赖的package包/类
@Override
public void initialize() {
Configuration config = getThing().getConfiguration();
try {
Object obj = config.get(IppBindingConstants.PRINTER_PARAMETER_URL);
name = (String) config.get(IppBindingConstants.PRINTER_PARAMETER_NAME);
if (config.get(IppBindingConstants.PRINTER_PARAMETER_REFRESH_INTERVAL) != null) {
BigDecimal ref = (BigDecimal) config.get(IppBindingConstants.PRINTER_PARAMETER_REFRESH_INTERVAL);
refresh = ref.intValue();
}
if (obj instanceof URL) {
url = (URL) obj;
} else if (obj instanceof String) {
url = new URL((String) obj);
}
printer = new CupsPrinter(url, name, false);
} catch (MalformedURLException e) {
logger.error("malformed url {}, printer thing creation failed",
config.get(IppBindingConstants.PRINTER_PARAMETER_URL));
}
// until we get an update put the Thing offline
updateStatus(ThingStatus.OFFLINE);
deviceOnlineWatchdog();
if (this.discoveryServiceRegistry != null) {
this.discoveryServiceRegistry.addDiscoveryListener(this);
}
}