From 7c07076ad303d268969b2d478055a1cd3a0eb1b7 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Tue, 9 Dec 2014 23:44:34 +0000 Subject: [PATCH] dispatch l2cap and rfcomm packets in java client --- .../com/bluekitchen/btstack/BTstackClient.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/java/src/com/bluekitchen/btstack/BTstackClient.java b/java/src/com/bluekitchen/btstack/BTstackClient.java index ffb25569a..e95dde11a 100644 --- a/java/src/com/bluekitchen/btstack/BTstackClient.java +++ b/java/src/com/bluekitchen/btstack/BTstackClient.java @@ -77,11 +77,20 @@ public class BTstackClient { packetHandler.handlePacket(new BTstackEventDaemonDisconnect()); return; } - if (packet.getPacketType() == Packet.HCI_EVENT_PACKET){ - packetHandler.handlePacket(EventFactory.eventForPacket(packet)); - continue; + switch (packet.getPacketType()){ + case Packet.HCI_EVENT_PACKET: + packetHandler.handlePacket(EventFactory.eventForPacket(packet)); + break; + case Packet.L2CAP_DATA_PACKET: + packetHandler.handlePacket(new L2CAPDataPacket(packet)); + break; + case Packet.RFCOMM_DATA_PACKET: + packetHandler.handlePacket(new RFCOMMDataPacket(packet)); + break; + default: + packetHandler.handlePacket(packet); + break; } - packetHandler.handlePacket(packet); } System.out.println("Rx Thread: Interrupted"); }