当前位置: 首页>>代码示例>>Java>>正文


Java BrickMaster类代码示例

本文整理汇总了Java中com.tinkerforge.BrickMaster的典型用法代码示例。如果您正苦于以下问题:Java BrickMaster类的具体用法?Java BrickMaster怎么用?Java BrickMaster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BrickMaster类属于com.tinkerforge包,在下文中一共展示了BrickMaster类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
	IPConnection ipcon = new IPConnection(); // Create IP connection
	BrickMaster master = new BrickMaster(UID, ipcon); // Create device object

	ipcon.connect(host, port); // Connect to brickd
	// Don't use device before ipcon is connected

	// Get voltage and current from stack (in mV/mA)
	int voltage = master.getStackVoltage();
	int current = master.getStackCurrent();

	System.out.println("Stack Voltage: " + voltage/1000.0 + " V");
	System.out.println("Stack Current: " + current/1000.0 + " A");

	System.console().readLine("Press key to exit\n");
	ipcon.disconnect();
}
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:18,代码来源:ExampleStackStatus.java

示例2: stackCurrent

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
public void stackCurrent(int current) {
    LOG.trace("stackCurrent()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickMaster.CALLBACK_STACK_CURRENT);
        exchange.getIn().setHeader("current", current);
        
        
        // ADD BODY
        exchange.getIn().setBody("stack_current");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:MasterConsumer.java

示例3: stackVoltage

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
public void stackVoltage(int voltage) {
    LOG.trace("stackVoltage()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickMaster.CALLBACK_STACK_VOLTAGE);
        exchange.getIn().setHeader("voltage", voltage);
        
        
        // ADD BODY
        exchange.getIn().setBody("stack_voltage");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:MasterConsumer.java

示例4: usbVoltage

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
public void usbVoltage(int voltage) {
    LOG.trace("usbVoltage()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickMaster.CALLBACK_USB_VOLTAGE);
        exchange.getIn().setHeader("voltage", voltage);
        
        
        // ADD BODY
        exchange.getIn().setBody("usb_voltage");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:MasterConsumer.java

示例5: stackCurrentReached

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
public void stackCurrentReached(int current) {
    LOG.trace("stackCurrentReached()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickMaster.CALLBACK_STACK_CURRENT_REACHED);
        exchange.getIn().setHeader("current", current);
        
        
        // ADD BODY
        exchange.getIn().setBody("stack_current_reached");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:MasterConsumer.java

示例6: stackVoltageReached

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
public void stackVoltageReached(int voltage) {
    LOG.trace("stackVoltageReached()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickMaster.CALLBACK_STACK_VOLTAGE_REACHED);
        exchange.getIn().setHeader("voltage", voltage);
        
        
        // ADD BODY
        exchange.getIn().setBody("stack_voltage_reached");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:MasterConsumer.java

示例7: usbVoltageReached

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
public void usbVoltageReached(int voltage) {
    LOG.trace("usbVoltageReached()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickMaster.CALLBACK_USB_VOLTAGE_REACHED);
        exchange.getIn().setHeader("voltage", voltage);
        
        
        // ADD BODY
        exchange.getIn().setBody("usb_voltage_reached");;
        
        getProcessor().process(exchange);
    } catch (Exception e) {
        getExceptionHandler().handleException("Error processing exchange", exchange, e);
    } finally {
        if (exchange != null && exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }
}
 
开发者ID:eddi888,项目名称:camel-tinkerforge,代码行数:26,代码来源:MasterConsumer.java

示例8: deviceConnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
public void deviceConnected(final TinkerforgeStackAgent satckAgent,
		final Device device) {
	if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.Master) {
		try {
			final BrickMaster master = ((BrickMaster) device);
			if (master.isWifiPresent()) {
				master.setWifiPowerMode(BrickMaster.WIFI_POWER_MODE_LOW_POWER);
			}
		} catch (final Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:15,代码来源:LightApplication.java

示例9: deviceDisconnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
   public void deviceDisconnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
if (device instanceof BrickMaster) {
    this.masterDisconnect((BrickMaster) device);
}
   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:9,代码来源:MasterBrickApplication.java

示例10: deviceConnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
   public void deviceConnected(final TinkerforgeStackAgent satckAgent,
    final Device device) {
if (device instanceof BrickMaster) {
    this.masterConnect((BrickMaster) device);
}

   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:9,代码来源:MasterBrickApplication.java

示例11: deviceConnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
   public void deviceConnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
System.out.println("Device connected: "
	+ TinkerforgeDevice.toString(device));
if (device instanceof BrickMaster) {
    BrickMaster master = (BrickMaster) device;
    this.masterConnect(master);
    System.out.println(master);
}

   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:14,代码来源:MasterBrickApplication.java

示例12: deviceDisconnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
   public void deviceDisconnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
if (device instanceof BrickMaster) {
    this.masterDisconnect((BrickMaster) device);
}

   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:10,代码来源:MasterBrickApplication.java

示例13: deviceConnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
   public void deviceConnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
if (device instanceof BrickMaster) {
    this.masterConnect((BrickMaster) device);
}

   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:10,代码来源:MasterBrickApplication.java

示例14: deviceDisconnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
   public void deviceDisconnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
System.out.println("Disconnection of device: " + device);
if (device instanceof BrickMaster) {
    this.masterDisconnect((BrickMaster) device);
}
if (device instanceof BrickletMotionDetector) {
    this.motionDetectorDisconnect((BrickletMotionDetector) device);
}

   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:14,代码来源:MasterBrickAndMotionBrickletApplication.java

示例15: deviceConnected

import com.tinkerforge.BrickMaster; //导入依赖的package包/类
@Override
   public void deviceConnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
System.out.println("Connection of device: " + device);

if (device instanceof BrickMaster) {
    this.masterConnect((BrickMaster) device);
}
if (device instanceof BrickletMotionDetector) {
    this.motionDetectionConnect((BrickletMotionDetector) device);
}

   }
 
开发者ID:knr1,项目名称:ch.bfh.mobicomp,代码行数:15,代码来源:MasterBrickAndMotionBrickletApplication.java


注:本文中的com.tinkerforge.BrickMaster类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。