Search in sources :

Example 1 with DsAPIImpl

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.impl.DsAPIImpl in project smarthome by eclipse.

the class ConnectionManagerImpl method init.

private void init(Config config, boolean acceptAllCerts) {
    this.config = config;
    this.transport = new HttpTransportImpl(this, acceptAllCerts);
    this.digitalSTROMClient = new DsAPIImpl(transport);
    if (this.genAppToken) {
        this.onNotAuthenticated();
    }
}
Also used : HttpTransportImpl(org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.impl.HttpTransportImpl) DsAPIImpl(org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.impl.DsAPIImpl)

Example 2 with DsAPIImpl

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.impl.DsAPIImpl in project smarthome by eclipse.

the class BridgeMDNSDiscoveryParticipant method getThingUID.

@Override
public ThingUID getThingUID(ServiceInfo service) {
    if (service.getApplication().contains("dssweb")) {
        String hostAddress = service.getName() + "." + service.getDomain() + ".";
        DsAPI digitalSTROMClient = new DsAPIImpl(hostAddress, Config.DEFAULT_CONNECTION_TIMEOUT, Config.DEFAULT_READ_TIMEOUT, true);
        Map<String, String> dsidMap = digitalSTROMClient.getDSID(null);
        String dSID = null;
        if (dsidMap != null) {
            dSID = dsidMap.get(JSONApiResponseKeysEnum.DSID.getKey());
        }
        if (StringUtils.isNotBlank(dSID)) {
            return new ThingUID(DigitalSTROMBindingConstants.THING_TYPE_DSS_BRIDGE, dSID);
        } else {
            logger.error("Can't get server dSID to generate thing UID. Please add the server manually.");
        }
    }
    return null;
}
Also used : ThingUID(org.eclipse.smarthome.core.thing.ThingUID) DsAPI(org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.DsAPI) DsAPIImpl(org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.impl.DsAPIImpl)

Aggregations

DsAPIImpl (org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.impl.DsAPIImpl)2 DsAPI (org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.DsAPI)1 HttpTransportImpl (org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverconnection.impl.HttpTransportImpl)1 ThingUID (org.eclipse.smarthome.core.thing.ThingUID)1