本文整理匯總了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);
}
}