本文整理匯總了Java中org.openhab.binding.homematic.internal.model.HmDevice.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java HmDevice.getType方法的具體用法?Java HmDevice.getType怎麽用?Java HmDevice.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openhab.binding.homematic.internal.model.HmDevice
的用法示例。
在下文中一共展示了HmDevice.getType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDeviceName
import org.openhab.binding.homematic.internal.model.HmDevice; //導入方法依賴的package包/類
/**
* Returns the device name for the given device type.
*/
public static String getDeviceName(HmDevice device) {
if (device.isGatewayExtras()) {
return getDescription(HmDevice.TYPE_GATEWAY_EXTRAS);
}
String deviceDescription = null;
boolean isTeam = device.getType().endsWith("-Team");
String type = isTeam ? StringUtils.remove(device.getType(), "-Team") : device.getType();
deviceDescription = getDescription(type);
if (deviceDescription != null && isTeam) {
deviceDescription += " Team";
}
return deviceDescription == null ? "No Description" : deviceDescription;
}
示例2: generateThingTypeUID
import org.openhab.binding.homematic.internal.model.HmDevice; //導入方法依賴的package包/類
/**
* Generates the ThingTypeUID for the given device. If it's a Homegear device, add a prefix because a Homegear
* device has more datapoints.
*/
public static ThingTypeUID generateThingTypeUID(HmDevice device) {
if (!device.isGatewayExtras() && device.getGatewayId().equals(HmGatewayInfo.ID_HOMEGEAR)) {
return new ThingTypeUID(BINDING_ID, String.format("HG-%s", device.getType()));
} else {
return new ThingTypeUID(BINDING_ID, device.getType());
}
}