Examples of PDKAdapterUSB


Examples of com.dalsemi.onewire.adapter.PDKAdapterUSB

        throws InvalidPluginConfigurationException, Exception {

        Configuration pluginConfig = context.getDefaultPluginConfiguration();
        String port = pluginConfig.getSimple("port").getStringValue();

        DSPortAdapter adapter = new PDKAdapterUSB();
        adapter.selectPort(port);

        boolean found = false;
        adapter.beginExclusive(true);
        found = adapter.adapterDetected();
        adapter.endExclusive();

        Set<DiscoveredResourceDetails> ret = new HashSet<DiscoveredResourceDetails>();

        if (found) {
            String key = getIdForAdapter(adapter);
            String name = adapter.getAdapterName() + " on " + adapter.getPortName();
            log.info("Found " + name + "@[" + key + "]");
            String descr = "OneWire adapter (" + name + ") with key (" + key + ")";
            DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), key, name, "",
                descr, pluginConfig, null);
            ret.add(detail);
            adapter.freePort();
        }

        return ret;
    }
View Full Code Here

Examples of com.dalsemi.onewire.adapter.PDKAdapterUSB

        Configuration pluginConfig = context.getPluginConfiguration();
        String device = pluginConfig.getSimple("type").getStringValue();
        port = pluginConfig.getSimple("port").getStringValue();

        if (adapter == null) {
            adapter = new PDKAdapterUSB();
            adapter.selectPort(port);
        }
    }
View Full Code Here

Examples of com.dalsemi.onewire.adapter.PDKAdapterUSB

    public void reopenAdapter() {
        if (adapter != null) {
            try {
                adapter.freePort();
                Thread.sleep(700);
                adapter = new PDKAdapterUSB();
                adapter.selectPort(port);
            } catch (OneWireException e) {
                log.warn("Exception re-opening the adapter - is it connected?: " ,e);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.