From c6f6e4f3174d2e3fa5c7276893aeabfa5bf709d9 Mon Sep 17 00:00:00 2001 From: Greg Date: Fri, 6 Dec 2019 14:22:16 -0500 Subject: [PATCH] Working version with old BleConnect code instead of Blessed. --- Ble.jar | Bin 7134 -> 10815 bytes BleConnect.java | 10 +++++++--- ble_android.go | 23 ++++++++++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Ble.jar b/Ble.jar index 9b04446f4411766a8f9954dd63e1d212ea23949e..f52d79bf5ce4459f68a91f1d2aab02e582056cd2 100644 GIT binary patch literal 10815 zcmbt)WmH^Cvo-{Gg1fuB6N0--aCZw5JS4$AxC|0(aCZq#aCdiicl(Ik_ax_j=lpnY z&6>6Ltf_i-@2>9Z+EtH&G#EG<2sAV_NUejvJjibX0|E{rE2<($FDWO+_}B{q0tTWW z4F&yO{&0zmfg%Z;^>+*&J zgOn_tr0j@OJ~)i}Hug8%L~LsFYfN&AEg%io7AE>SCV3plgw?6Ti38}5Q540OmWe#y zL-hIkeH5@DAkQQF`y+ro|LgdU@t+l-ek!=Ub@>-1xWAOlEdC7*=}$#NYm*FCJ)MLg%yfvTpH;4m$wG@ zrX{5r`FKi4i{FuXAVtMr9-(A=Gi{kYQJpmPkI2h`)m?2iL^~cfHtZ#ZNQ1mB)9pg# zV>M_MLl5EjV${@r*c)JZTeUzo3!z$t@S2zwdr8l_DVGVMrTE#X5Z_%}*7Ig92|{!DU&$ zw=L0&Kk;xeyU_)HkdkIh4#gCE2us@tg)Ds^3aZg)l}RQ%y_3dl_aI;M4=;#pf@``EpjowP~~F23K61gkp633vEM& z7Y(VVgb(HmJaWi?_*GW2Cke(zULySp8~(8`@UowVE_G3eU(!uq*NePRid`6w2w3)f!BD>OkIF{5o?Os zOA=qXHp_q~02{xCImstBSBj^TDaSy!9p7KK>Y!^Z1l}l2o%_yV$>Ofp0-{X=Mnu&= z-A)zI|K&El8eCX=l>@wqUiDeZ2TBk8n*jQ4mHmNtEYwoJQOiaMsue~o3C~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Dc^P@3!!7)CDvu^V| z$SWoZ)gM5A#gN3wDa_~e*MmfSWH4Eum{7He$^ELB@8{=KZhZ4>7;I_a^!+4RAv!_7 zH;Fi~t#b{{1a{P5s?+Y9P_wv?>s~g2eu*-7fP)3IS+#MPqsEQs<6eG?mgU^@q4h68 z^0=3O0*?px=RW@bY9Nm?$)D|Cy2qnv@>l2|g^Nd#+0>|$R zu!rG4d-5;PZ*s`r10MyE-;MLnz~AJNKL_@Y z4b;ar>F@UX|APO$T=Lg||FN<4XG$HUKP}{OK7XP7XCL;jlz%+t{h1Q)L4^8eKp$iC sZz%uSANwoiAG7W8eE7TRVEh-#-%g9l@<_;!pvO$fd&o^X;>WxH0Y*1Gj{pDw diff --git a/BleConnect.java b/BleConnect.java index 909857c..604c404 100644 --- a/BleConnect.java +++ b/BleConnect.java @@ -124,21 +124,24 @@ public class BleConnect extends Fragment { private final BluetoothGattCallback gattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { + BluetoothDevice device = gatt.getDevice(); + String addr = device.getAddress(); switch (newState) { case BluetoothProfile.STATE_CONNECTED: { - BluetoothDevice device = gatt.getDevice(); Log.d("gio", "Connected"); - String addr = device.getAddress(); Log.d("gio", "Address = " + addr); - onConnect(gatt, device.getAddress()); + onConnect(gatt, addr); break; } case BluetoothProfile.STATE_DISCONNECTED: { Log.d("gio", "Disconnected"); + onDisconnect(gatt, addr); + gatt.close(); break; } default: { Log.d("gio", "onConnectionStateChange: unknown state"); + gatt.close(); break; } } @@ -260,6 +263,7 @@ public class BleConnect extends Fragment { static private native void updateState(int s); static private native void onScan(String name, String id, int rssi, BluetoothDevice dev); static private native void onConnect(BluetoothGatt gatt, String id); + static private native void onDisconnect(BluetoothGatt gatt, String id); static private native void onDiscoverService(String id, String uuid, BluetoothGattService serv); static private native void onDiscoverCharacteristic(String id, String suuid, BluetoothGattService serv, String cuuid, BluetoothGattCharacteristic chr); static private native void characteristicChanged(String id, String cuuid, BluetoothGattCharacteristic chr, byte[] value, int length); diff --git a/ble_android.go b/ble_android.go index 50b710f..8baf4c0 100644 --- a/ble_android.go +++ b/ble_android.go @@ -274,7 +274,24 @@ func goOnScan(cname, cid *C.char, rssi C.int, dev C.jobject) { func goOnConnect(gatt C.jobject, cid *C.char) { id := C.GoString(cid) - peripheral := gBLE.retrievePeripheral(id) + var peripheral Peripheral + found := false + + gBLE.peripherals.Lock() + for n, item := range gBLE.peripherals.items { + if item.p.Identifier == id { + peripheral = item.p + peripheral.gatt = gatt + gBLE.peripherals.items[n].p = peripheral + found = true + break + } + } + gBLE.peripherals.Unlock() + + if !found { + log.Printf("Go: peripheral not found!") + } if peripheral.gatt == 0 { log.Printf("goOnConnect(): gatt == null") @@ -291,8 +308,8 @@ func goOnDisconnect(p C.jobject, cid *C.char) { peripheral := gBLE.retrievePeripheral(id) - if peripheral.peripheral == 0 { - log.Printf("goOnDisconnect(): peripheral == null") + if peripheral.device == 0 { + log.Printf("goOnDisconnect(): device == null") } go func() {