本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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]);
}
示例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();
}
示例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);
}
示例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;
}
示例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");
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}