use of org.eclipse.smarthome.binding.homematic.internal.communicator.parser.GetDeviceDescriptionParser in project smarthome by eclipse.
the class RpcClient method getDeviceDescription.
/**
* Returns some infos of the gateway.
*/
private GetDeviceDescriptionParser getDeviceDescription(HmInterface hmInterface) throws IOException {
RpcRequest<T> request = createRpcRequest("getDeviceDescription");
request.addArg("BidCoS-RF");
return new GetDeviceDescriptionParser().parse(sendMessage(config.getRpcPort(hmInterface), request));
}
use of org.eclipse.smarthome.binding.homematic.internal.communicator.parser.GetDeviceDescriptionParser in project smarthome by eclipse.
the class RpcClient method getGatewayInfo.
/**
* Tries to identify the gateway and returns the GatewayInfo.
*/
public HmGatewayInfo getGatewayInfo(String id) throws IOException {
boolean isHomegear = false;
GetDeviceDescriptionParser ddParser;
ListBidcosInterfacesParser biParser;
try {
ddParser = getDeviceDescription(HmInterface.RF);
isHomegear = StringUtils.equalsIgnoreCase(ddParser.getType(), "Homegear");
} catch (IOException ex) {
// can't load gateway infos via RF interface
ddParser = new GetDeviceDescriptionParser();
}
try {
biParser = listBidcosInterfaces(HmInterface.RF);
} catch (IOException ex) {
biParser = listBidcosInterfaces(HmInterface.HMIP);
}
HmGatewayInfo gatewayInfo = new HmGatewayInfo();
gatewayInfo.setAddress(biParser.getGatewayAddress());
if (isHomegear) {
gatewayInfo.setId(HmGatewayInfo.ID_HOMEGEAR);
gatewayInfo.setType(ddParser.getType());
gatewayInfo.setFirmware(ddParser.getFirmware());
} else if ((StringUtils.startsWithIgnoreCase(biParser.getType(), "CCU") || StringUtils.startsWithIgnoreCase(biParser.getType(), "HMIP_CCU") || StringUtils.startsWithIgnoreCase(ddParser.getType(), "HM-RCV-50") || config.isCCUType()) && !config.isNoCCUType()) {
gatewayInfo.setId(HmGatewayInfo.ID_CCU);
String type = StringUtils.isBlank(biParser.getType()) ? "CCU" : biParser.getType();
gatewayInfo.setType(type);
gatewayInfo.setFirmware(ddParser.getFirmware() != null ? ddParser.getFirmware() : biParser.getFirmware());
} else {
gatewayInfo.setId(HmGatewayInfo.ID_DEFAULT);
gatewayInfo.setType(biParser.getType());
gatewayInfo.setFirmware(biParser.getFirmware());
}
if (gatewayInfo.isCCU() || config.hasRfPort()) {
gatewayInfo.setRfInterface(hasInterface(HmInterface.RF, id));
}
if (gatewayInfo.isCCU() || config.hasWiredPort()) {
gatewayInfo.setWiredInterface(hasInterface(HmInterface.WIRED, id));
}
if (gatewayInfo.isCCU() || config.hasHmIpPort()) {
gatewayInfo.setHmipInterface(hasInterface(HmInterface.HMIP, id));
}
if (gatewayInfo.isCCU() || config.hasCuxdPort()) {
gatewayInfo.setCuxdInterface(hasInterface(HmInterface.CUXD, id));
}
if (gatewayInfo.isCCU() || config.hasGroupPort()) {
gatewayInfo.setGroupInterface(hasInterface(HmInterface.GROUP, id));
}
return gatewayInfo;
}
Aggregations