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


Java BrickletPiezoSpeaker類代碼示例

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


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

示例1: PiezoSpeakerConsumer

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
public PiezoSpeakerConsumer(PiezoSpeakerEndpoint endpoint, Processor processor) throws Exception {
    super(endpoint, processor);

    device = new BrickletPiezoSpeaker(endpoint.getUid(),endpoint.getSharedConnection().getConnection());
    endpoint.init(device);

    if(endpoint.getCallback()==null || endpoint.getCallback().equals("")){
        device.addBeepFinishedListener(this);
        device.addMorseCodeFinishedListener(this);
        
    }else{
        String[] callbacks = endpoint.getCallback().split(",");
        for (String callback : callbacks) {
            if(callback.equals("BeepFinishedListener")) device.addBeepFinishedListener(this);
            if(callback.equals("MorseCodeFinishedListener")) device.addMorseCodeFinishedListener(this);
            
        }
    }
}
 
開發者ID:eddi888,項目名稱:camel-tinkerforge,代碼行數:20,代碼來源:PiezoSpeakerConsumer.java

示例2: beepFinished

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
@Override
public void beepFinished() {
    LOG.trace("beepFinished()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletPiezoSpeaker.CALLBACK_BEEP_FINISHED);
        
        
        // ADD BODY
        exchange.getIn().setBody("beep_finished");;
        
        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,代碼行數:25,代碼來源:PiezoSpeakerConsumer.java

示例3: morseCodeFinished

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
@Override
public void morseCodeFinished() {
    LOG.trace("morseCodeFinished()");
    
    Exchange exchange = null;
    try {
        exchange = createExchange();
        
        // ADD HEADER
        exchange.getIn().setHeader("fireBy", BrickletPiezoSpeaker.CALLBACK_MORSE_CODE_FINISHED);
        
        
        // ADD BODY
        exchange.getIn().setBody("morse_code_finished");;
        
        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,代碼行數:25,代碼來源:PiezoSpeakerConsumer.java

示例4: main

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
public static void main(String args[]) throws Exception {
	IPConnection ipcon = new IPConnection(); // Create IP connection
	BrickletPiezoSpeaker ps = new BrickletPiezoSpeaker(UID, ipcon); // Create device object

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

	// Make 2 second beep with a frequency of 1kHz
	ps.beep(2000, 1000);

	System.console().readLine("Press key to exit\n");
}
 
開發者ID:knr1,項目名稱:ch.bfh.mobicomp,代碼行數:13,代碼來源:ExampleBeep.java

示例5: main

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
public static void main(String args[]) throws Exception {
	IPConnection ipcon = new IPConnection(); // Create IP connection
	BrickletPiezoSpeaker ps = new BrickletPiezoSpeaker(UID, ipcon); // Create device object

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

	// Morse SOS with a frequency of 2kHz
	ps.morseCode("... --- ...", 2000);

	System.console().readLine("Press key to exit\n");
}
 
開發者ID:knr1,項目名稱:ch.bfh.mobicomp,代碼行數:13,代碼來源:ExampleMorseCode.java

示例6: deviceConnected

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
@Override
   public void deviceConnected(
    final TinkerforgeStackAgent tinkerforgeStackAgent,
    final Device device) {
if (TinkerforgeDevice.getDevice(device) == TinkerforgeDevice.PiezoSpeaker) {
    if (this.speaker == null) {
	this.speaker = (BrickletPiezoSpeaker) device;
    }
}

   }
 
開發者ID:knr1,項目名稱:ch.bfh.mobicomp,代碼行數:12,代碼來源:PlaySoundApplication.java

示例7: init

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
public void init(BrickletPiezoSpeaker device) throws Exception {
    if(getInit()==null) return;
    
    String[] initFunctions = getInit().split(",");
    for (String function : initFunctions) {
        callFunction(device, function, null, this);
    }
}
 
開發者ID:eddi888,項目名稱:camel-tinkerforge,代碼行數:9,代碼來源:PiezoSpeakerEndpoint.java

示例8: callFunction

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
public Object callFunction(BrickletPiezoSpeaker device, String function, Message m, Endpoint e) throws Exception{
    Object response = null;
    switch (function) {
            
        case "beep":
            device.beep(
                    getValue(long.class, "duration", m, getDuration()),
                    getValue(int.class, "frequency", m, getFrequency())
                );
            break;

        case "morseCode":
            device.morseCode(
                    getValue(String.class, "morse", m, getMorse()),
                    getValue(int.class, "frequency2", m, getFrequency2())
                );
            break;

        case "calibrate":
            response = device.calibrate();
            break;

        case "getIdentity":
            response = device.getIdentity();
            break;


        default: throw new Exception("unknown function '"+function+"'");
        
    }
    
    return response;
}
 
開發者ID:eddi888,項目名稱:camel-tinkerforge,代碼行數:34,代碼來源:PiezoSpeakerEndpoint.java

示例9: setTinkerforgeDevice

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void setTinkerforgeDevice(BrickletPiezoSpeaker newTinkerforgeDevice) {
    BrickletPiezoSpeaker oldTinkerforgeDevice = tinkerforgeDevice;
    tinkerforgeDevice = newTinkerforgeDevice;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET,
                ModelPackage.MBRICKLET_PIEZO_SPEAKER__TINKERFORGE_DEVICE, oldTinkerforgeDevice, tinkerforgeDevice));
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:15,代碼來源:MBrickletPiezoSpeakerImpl.java

示例10: PiezoSpeakerProducer

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
public PiezoSpeakerProducer(PiezoSpeakerEndpoint endpoint) throws UnknownHostException, AlreadyConnectedException, IOException {
    super(endpoint);
    device = new BrickletPiezoSpeaker(endpoint.getUid(),endpoint.getSharedConnection().getConnection());
}
 
開發者ID:eddi888,項目名稱:camel-tinkerforge,代碼行數:5,代碼來源:PiezoSpeakerProducer.java

示例11: eSet

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__LOGGER:
            setLogger((Logger) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__UID:
            setUid((String) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__POLL:
            setPoll((Boolean) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__ENABLED_A:
            setEnabledA((AtomicBoolean) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__TINKERFORGE_DEVICE:
            setTinkerforgeDevice((BrickletPiezoSpeaker) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__IP_CONNECTION:
            setIpConnection((IPConnection) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__CONNECTED_UID:
            setConnectedUid((String) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__POSITION:
            setPosition((Character) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__DEVICE_IDENTIFIER:
            setDeviceIdentifier((Integer) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__NAME:
            setName((String) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__BRICKD:
            setBrickd((MBrickd) newValue);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__SWITCH_STATE:
            setSwitchState((OnOffValue) newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:49,代碼來源:MBrickletPiezoSpeakerImpl.java

示例12: eUnset

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public void eUnset(int featureID) {
    switch (featureID) {
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__LOGGER:
            setLogger(LOGGER_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__UID:
            setUid(UID_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__POLL:
            setPoll(POLL_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__ENABLED_A:
            setEnabledA(ENABLED_A_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__TINKERFORGE_DEVICE:
            setTinkerforgeDevice((BrickletPiezoSpeaker) null);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__IP_CONNECTION:
            setIpConnection(IP_CONNECTION_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__CONNECTED_UID:
            setConnectedUid(CONNECTED_UID_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__POSITION:
            setPosition(POSITION_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__DEVICE_IDENTIFIER:
            setDeviceIdentifier(DEVICE_IDENTIFIER_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__NAME:
            setName(NAME_EDEFAULT);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__BRICKD:
            setBrickd((MBrickd) null);
            return;
        case ModelPackage.MBRICKLET_PIEZO_SPEAKER__SWITCH_STATE:
            setSwitchState(SWITCH_STATE_EDEFAULT);
            return;
    }
    super.eUnset(featureID);
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:49,代碼來源:MBrickletPiezoSpeakerImpl.java

示例13: getTinkerforgeDevice

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
public BrickletPiezoSpeaker getTinkerforgeDevice() {
    return tinkerforgeDevice;
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:11,代碼來源:MBrickletPiezoSpeakerImpl.java

示例14: enable

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * 
 * @generated NOT
 */
@Override
public void enable() {
    tinkerforgeDevice = new BrickletPiezoSpeaker(getUid(), getIpConnection());
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:10,代碼來源:MBrickletPiezoSpeakerImpl.java

示例15: createTinkerBrickletPiezoSpeakerFromString

import com.tinkerforge.BrickletPiezoSpeaker; //導入依賴的package包/類
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public BrickletPiezoSpeaker createTinkerBrickletPiezoSpeakerFromString(EDataType eDataType, String initialValue) {
    return (BrickletPiezoSpeaker) super.createFromString(eDataType, initialValue);
}
 
開發者ID:openhab,項目名稱:openhab1-addons,代碼行數:10,代碼來源:ModelFactoryImpl.java


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