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


Java PacketType类代码示例

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


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

示例1: convertPacketType

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
public static PacketType convertPacketType(String packetType)
		throws IllegalArgumentException {

	for (PacketType p : PacketType.values()) {
		if (p.toString().equals(packetType)) {
			return p;
		}
	}

	throw new IllegalArgumentException("Unknown packet type " + packetType);
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:12,代码来源:RFXComMessageFactory.java

示例2: getPacketType

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
private static PacketType getPacketType(byte packetType) {
	for (PacketType p : PacketType.values()) {
		if (p.toByte() == packetType) {
			return p;
		}
	}
	
	return PacketType.UNKNOWN;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:10,代码来源:RFXComMessageFactory.java

示例3: createMessage

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
public static RFXComMessage createMessage(PacketType packetType) throws RFXComException {

        try {
            Class<? extends RFXComMessage> cl = MESSAGE_CLASSES.get(packetType);
            if (cl == null) {
                throw new RFXComMessageNotImplementedException("Message " + packetType + " not implemented");
            }
            return cl.newInstance();
        } catch (IllegalAccessException | InstantiationException e) {
            throw new RFXComException(e);
        }
    }
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:13,代码来源:RFXComMessageFactory.java

示例4: convertPacketType

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
public static PacketType convertPacketType(String packetType) throws IllegalArgumentException {

        for (PacketType p : PacketType.values()) {
            if (p.toString().replace("_", "").equals(packetType.replace("_", ""))) {
                return p;
            }
        }

        throw new IllegalArgumentException("Unknown packet type " + packetType);
    }
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:11,代码来源:RFXComMessageFactory.java

示例5: basicBoundaryCheck

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
static void basicBoundaryCheck(PacketType packetType, RFXComMessage message) throws RFXComException {
    // This is a place where its easy to make mistakes in coding, and can result in errors, normally
    // array bounds errors
    byte[] binaryMessage = message.decodeMessage();
    assertEquals("Wrong packet length", binaryMessage[0], binaryMessage.length - 1);
    assertEquals("Wrong packet type", packetType.toByte(), binaryMessage[1]);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:8,代码来源:RFXComTestHelper.java

示例6: testLongMessage

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
@Test(expected = RFXComMessageTooLongException.class)
public void testLongMessage() throws RFXComException {
    RFXComUndecodedRFMessage msg = (RFXComUndecodedRFMessage) RFXComMessageFactory
            .createMessage(PacketType.UNDECODED_RF_MESSAGE);
    msg.subType = RFXComUndecodedRFMessage.SubType.ARC;
    msg.seqNbr = 1;
    msg.rawPayload = DatatypeConverter
            .parseHexBinary("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021");
    msg.decodeMessage();
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:11,代码来源:RFXComUndecodedRFMessageTest.java

示例7: convertPacketType

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
public static PacketType convertPacketType(String packetType) throws IllegalArgumentException {

        for (PacketType p : PacketType.values()) {
            if (p.toString().equals(packetType)) {
                return p;
            }
        }

        throw new IllegalArgumentException("Unknown packet type " + packetType);
    }
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:11,代码来源:RFXComMessageFactory.java

示例8: getPacketType

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
private static PacketType getPacketType(byte packetType) {
    for (PacketType p : PacketType.values()) {
        if (p.toByte() == packetType) {
            return p;
        }
    }

    return PacketType.UNKNOWN;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:10,代码来源:RFXComMessageFactory.java

示例9: basicBoundaryCheck

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
static void basicBoundaryCheck(PacketType packetType) throws RFXComException {
    RFXComMessageInterface intf = RFXComMessageFactory.getMessageInterface(packetType);

    // This is a place where its easy to make mistakes in coding, and can result in errors, normally
    // array bounds errors
    byte[] message = intf.decodeMessage();
    if (message[0] != (message.length - 1)) {
        fail(intf.getClass().getName() + " wrong packet length");
    }

    if (packetType.toByte() != message[1]) {
        fail(intf.getClass().getName() + " wrong packet type");
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:15,代码来源:RFXComTestHelper.java

示例10: getPacketType

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
@Override
public PacketType getPacketType(String itemName) {
	RFXComBindingConfig config = getBindingConfig(itemName);
	return config != null ? config.packetType : null;
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:6,代码来源:RFXComGenericBindingProvider.java

示例11: checkNotImplemented

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
@Test(expected = RFXComMessageNotImplementedException.class)
public void checkNotImplemented() throws Exception {
    RFXComMessageFactory.createMessage(PacketType.GAS);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:5,代码来源:RFXComGasMessageTest.java

示例12: checkNotImplemented

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
@Test(expected = RFXComMessageNotImplementedException.class)
public void checkNotImplemented() throws Exception {
    RFXComMessageFactory.createMessage(PacketType.CAMERA1);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:5,代码来源:RFXComCamera1MessageTest.java

示例13: checkNotImplemented

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
@Test(expected = RFXComMessageNotImplementedException.class)
public void checkNotImplemented() throws Exception {
    RFXComMessageFactory.createMessage(PacketType.WATER);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:5,代码来源:RFXComWaterMessageTest.java

示例14: checkNotImplemented

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
@Test(expected = RFXComMessageNotImplementedException.class)
public void checkNotImplemented() throws Exception {
    RFXComMessageFactory.createMessage(PacketType.BAROMETRIC);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:5,代码来源:RFXComBarometricMessageTest.java

示例15: checkNotImplemented

import org.openhab.binding.rfxcom.internal.messages.RFXComBaseMessage.PacketType; //导入依赖的package包/类
@Test(expected = RFXComMessageNotImplementedException.class)
public void checkNotImplemented() throws Exception {
    RFXComMessageFactory.createMessage(PacketType.FS20);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:5,代码来源:RFXComFS20MessageTest.java


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