當前位置: 首頁>>代碼示例>>Java>>正文


Java HmInterface類代碼示例

本文整理匯總了Java中org.openhab.binding.homematic.internal.model.HmInterface的典型用法代碼示例。如果您正苦於以下問題:Java HmInterface類的具體用法?Java HmInterface怎麽用?Java HmInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HmInterface類屬於org.openhab.binding.homematic.internal.model包,在下文中一共展示了HmInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setDatapointValue

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
@Override
public void setDatapointValue(HmDatapoint dp, String datapointName, Object value) throws HomematicClientException {
	HmInterface hmInterface = dp.getChannel().getDevice().getHmInterface();
	if (hmInterface == HmInterface.VIRTUALDEVICES) {
		String groupName = HmInterface.VIRTUALDEVICES + "." + dp.getChannel().getAddress() + "." + datapointName;
		if (dp.isIntegerValue() && value instanceof Double) {
			value = ((Number) value).intValue();
		}
		String strValue = ObjectUtils.toString(value);
		if (dp.isStringValue()) {
			strValue = "\"" + strValue + "\"";
		}

		HmResult result = sendScriptByName("setVirtualGroup", HmResult.class, new String[] { "group_name",
				"group_state" }, new String[] { groupName, strValue });
		if (!result.isValid()) {
			throw new HomematicClientException("Unable to set CCU group " + groupName);
		}
	} else {
		super.setDatapointValue(dp, datapointName, value);
	}
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:23,代碼來源:CcuClient.java

示例2: getRssiInfo

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public Map<String, HmRssiInfo> getRssiInfo(HmInterface hmInterface) throws HomematicClientException {
	BinRpcRequest request = new BinRpcRequest("rssiInfo");
	Map<String, HmRssiInfo> rssiList = new HashMap<String, HmRssiInfo>();
	Object[] result = sendMessage(hmInterface, request);
	if (result != null && result.length > 0 && result[0] instanceof Map) {
		Map<String, ?> devices = (Map<String, ?>) result[0];
		for (String sourceDevice : devices.keySet()) {
			Map<String, Object[]> targetDevices = (Map<String, Object[]>) devices.get(sourceDevice);
			for (String targetDevice : targetDevices.keySet()) {
				if (targetDevice.equals(context.getServerId().getAddress())) {
					Integer rssiDevice = (Integer) targetDevices.get(targetDevice)[0];
					Integer rssiPeer = (Integer) targetDevices.get(targetDevice)[1];
					HmRssiInfo rssiInfo = new HmRssiInfo(sourceDevice, rssiDevice, rssiPeer);
					rssiList.put(rssiInfo.getAddress(), rssiInfo);
				}
			}
		}
	}
	return rssiList;
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:26,代碼來源:BinRpcClient.java

示例3: parseDevice

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * Parses the device informations into the binding model.
 */
@SuppressWarnings("unchecked")
private HmDevice parseDevice(Map<String, ?> deviceData) throws IllegalAccessException {
	HmDevice device = new HmDevice();

	FieldUtils.writeField(device, "address", deviceData.get("ADDRESS"), true);
	FieldUtils.writeField(device, "type", deviceData.get("TYPE"), true);
	FieldUtils.writeField(device, "hmInterface", HmInterface.HOMEGEAR, true);

	Object[] channelList = (Object[]) deviceData.get("CHANNELS");
	for (int i = 0; i < channelList.length; i++) {
		Map<String, ?> channelData = (Map<String, ?>) channelList[i];
		device.addChannel(parseChannel(device, channelData));
	}

	return device;
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:20,代碼來源:HomegearClient.java

示例4: setChannelDatapointValues

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * Sets all datapoint values for the given channel.
 */
public void setChannelDatapointValues(HmChannel channel, HmParamsetType paramsetType) throws IOException {
    RpcRequest<T> request = createRpcRequest("getParamset");
    request.addArg(getRpcAddress(channel.getDevice().getAddress()) + ":" + channel.getNumber());
    request.addArg(paramsetType.toString());
    if (channel.getDevice().getHmInterface() == HmInterface.CUXD && paramsetType == HmParamsetType.VALUES) {
        setChannelDatapointValues(channel);
    } else {
        try {
            new GetParamsetParser(channel, paramsetType).parse(sendMessage(config.getRpcPort(channel), request));
        } catch (UnknownRpcFailureException ex) {
            if (paramsetType == HmParamsetType.VALUES) {
                logger.debug(
                        "RpcResponse unknown RPC failure (-1 Failure), fetching values with another API method for device: {}, channel: {}, paramset: {}",
                        channel.getDevice().getAddress(), channel.getNumber(), paramsetType);
                setChannelDatapointValues(channel);
            } else {
                throw ex;
            }
        }
    }
}
 
開發者ID:openhab,項目名稱:openhab2-addons,代碼行數:25,代碼來源:RpcClient.java

示例5: stopServers

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * Stops the Homematic RPC server.
 */
private void stopServers() {
    for (HmInterface hmInterface : availableInterfaces.keySet()) {
        try {
            getRpcClient(hmInterface).release(hmInterface);
        } catch (IOException ex) {
            // recoverable exception, therefore only debug
            logger.debug("Unable to release the connection to the gateway with id '{}': {}", id, ex.getMessage(),
                    ex);
        }
    }

    for (TransferMode mode : rpcServers.keySet()) {
        rpcServers.get(mode).shutdown();
    }
    rpcServers.clear();
}
 
開發者ID:openhab,項目名稱:openhab2-addons,代碼行數:20,代碼來源:AbstractHomematicGateway.java

示例6: setDatapointValue

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
@Override
public void setDatapointValue(HmDatapoint dp, String datapointName, Object value) throws HomematicClientException {
    HmInterface hmInterface = dp.getChannel().getDevice().getHmInterface();
    if (hmInterface == HmInterface.VIRTUALDEVICES) {
        String groupName = HmInterface.VIRTUALDEVICES + "." + dp.getChannel().getAddress() + "." + datapointName;
        if (dp.isIntegerValue() && value instanceof Double) {
            value = ((Number) value).intValue();
        }
        String strValue = ObjectUtils.toString(value);
        if (dp.isStringValue()) {
            strValue = "\"" + strValue + "\"";
        }

        HmResult result = sendScriptByName("setVirtualGroup", HmResult.class,
                new String[] { "group_name", "group_state" }, new String[] { groupName, strValue });
        if (!result.isValid()) {
            throw new HomematicClientException("Unable to set CCU group " + groupName);
        }
    } else {
        super.setDatapointValue(dp, datapointName, value);
    }
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:23,代碼來源:CcuClient.java

示例7: getRssiInfo

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public Map<String, HmRssiInfo> getRssiInfo(HmInterface hmInterface) throws HomematicClientException {
    BinRpcRequest request = new BinRpcRequest("rssiInfo");
    Map<String, HmRssiInfo> rssiList = new HashMap<String, HmRssiInfo>();
    Object[] result = sendMessage(hmInterface, request);
    if (result != null && result.length > 0 && result[0] instanceof Map) {
        Map<String, ?> devices = (Map<String, ?>) result[0];
        for (String sourceDevice : devices.keySet()) {
            Map<String, Object[]> targetDevices = (Map<String, Object[]>) devices.get(sourceDevice);
            for (String targetDevice : targetDevices.keySet()) {
                if (targetDevice.equals(context.getServerId().getAddress())) {
                    Integer rssiDevice = (Integer) targetDevices.get(targetDevice)[0];
                    Integer rssiPeer = (Integer) targetDevices.get(targetDevice)[1];
                    HmRssiInfo rssiInfo = new HmRssiInfo(sourceDevice, rssiDevice, rssiPeer);
                    rssiList.put(rssiInfo.getAddress(), rssiInfo);
                }
            }
        }
    }
    return rssiList;
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:26,代碼來源:BinRpcClient.java

示例8: parseDevice

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * Parses the device informations into the binding model.
 */
@SuppressWarnings("unchecked")
private HmDevice parseDevice(Map<String, ?> deviceData) throws IllegalAccessException {
    HmDevice device = new HmDevice();

    FieldUtils.writeField(device, "address", deviceData.get("ADDRESS"), true);
    FieldUtils.writeField(device, "type", deviceData.get("TYPE"), true);
    FieldUtils.writeField(device, "hmInterface", HmInterface.HOMEGEAR, true);

    Object[] channelList = (Object[]) deviceData.get("CHANNELS");
    for (int i = 0; i < channelList.length; i++) {
        Map<String, ?> channelData = (Map<String, ?>) channelList[i];
        device.addChannel(parseChannel(device, channelData));
    }

    return device;
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:20,代碼來源:HomegearClient.java

示例9: registerCallback

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void registerCallback() throws HomematicClientException {
	rpcClient.init(getDefaultInterface());
	rpcClient.init(HmInterface.WIRED);
	rpcClient.init(HmInterface.CUXD);
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:10,代碼來源:CcuClient.java

示例10: releaseCallback

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void releaseCallback() throws HomematicClientException {
	rpcClient.release(getDefaultInterface());
	rpcClient.release(HmInterface.WIRED);
	rpcClient.release(HmInterface.CUXD);
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:10,代碼來源:CcuClient.java

示例11: init

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void init(HmInterface hmInterface) throws HomematicClientException {
	BinRpcRequest request = new BinRpcRequest("init");
	request.addArg(context.getConfig().getBinRpcCallbackUrl());
	request.addArg(hmInterface.toString());
	sendMessage(hmInterface, request);
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:11,代碼來源:BinRpcClient.java

示例12: release

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void release(HmInterface hmInterface) throws HomematicClientException {
	BinRpcRequest request = new BinRpcRequest("init");
	request.addArg(context.getConfig().getBinRpcCallbackUrl());
	sendMessage(hmInterface, request);
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:10,代碼來源:BinRpcClient.java

示例13: getAllSystemVariables

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public Map<String, ?> getAllSystemVariables(HmInterface hmInterface) throws HomematicClientException {
	BinRpcRequest request = new BinRpcRequest("getAllSystemVariables");
	return (Map<String, ?>) sendMessage(hmInterface, request)[0];
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:10,代碼來源:BinRpcClient.java

示例14: getDeviceDescription

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public Map<String, String> getDeviceDescription(HmInterface hmInterface, String address)
		throws HomematicClientException {
	BinRpcRequest request = new BinRpcRequest("getDeviceDescription");
	request.addArg(address);
	Object[] result = sendMessage(hmInterface, request);
	if (result != null && result.length > 0 && result[0] instanceof Map) {
		return (Map<String, String>) result[0];
	}
	return null;
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:16,代碼來源:BinRpcClient.java

示例15: getServerId

import org.openhab.binding.homematic.internal.model.HmInterface; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public ServerId getServerId(HmInterface hmInterface) throws HomematicClientException {
	Map<String, String> deviceDescription = getDeviceDescription(hmInterface, "BidCoS-RF");
	ServerId serverId = new ServerId(deviceDescription.get("TYPE"));
	serverId.setVersion(deviceDescription.get("FIRMWARE"));
	serverId.setAddress(deviceDescription.get("INTERFACE"));
	return serverId;
}
 
開發者ID:andrey-desman,項目名稱:openhab-hdl,代碼行數:12,代碼來源:BinRpcClient.java


注:本文中的org.openhab.binding.homematic.internal.model.HmInterface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。