Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99bfee1cbd |
@@ -1,12 +1,10 @@
|
||||
package st.wow.git.ble;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Runnable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothGatt;
|
||||
import android.bluetooth.BluetoothGattCharacteristic;
|
||||
@@ -20,9 +18,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.Manifest;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.welie.blessed.BluetoothCentral;
|
||||
import com.welie.blessed.BluetoothCentralCallback;
|
||||
@@ -40,21 +36,6 @@ public class BlessedConnect extends Fragment {
|
||||
Log.d("gio", "BlessedConnect()");
|
||||
}
|
||||
|
||||
public void register(View view) {
|
||||
Log.d("gio", "BlessedConnect: register()");
|
||||
Context ctx = view.getContext();
|
||||
Handler handler = new Handler(ctx.getMainLooper());
|
||||
BlessedConnect inst = this;
|
||||
handler.post(new Runnable() {
|
||||
public void run() {
|
||||
Activity act = (Activity)ctx;
|
||||
FragmentTransaction ft = act.getFragmentManager().beginTransaction();
|
||||
ft.add(inst, "BlessedConnect");
|
||||
ft.commitNow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override public void onAttach(Context ctx) {
|
||||
super.onAttach(ctx);
|
||||
Log.d("gio", "BlessedConnect: onAttach()");
|
||||
@@ -63,7 +44,6 @@ public class BlessedConnect extends Fragment {
|
||||
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_REQUEST);
|
||||
}
|
||||
central = new BluetoothCentral(ctx, centralCallback, null);
|
||||
System.loadLibrary("gio");
|
||||
installComplete(this);
|
||||
}
|
||||
|
||||
|
||||
+12
-14
@@ -223,13 +223,9 @@ func NewBLE() *BLE {
|
||||
}
|
||||
|
||||
//Enable
|
||||
func (b *BLE) Enable(view uintptr) {
|
||||
func (b *BLE) Enable(w *app.Window) {
|
||||
log.Printf("ble.Enable()")
|
||||
setJVM(app.JavaVM())
|
||||
runInJVM(func(env *JNIEnv) {
|
||||
log.Printf("ble.Enable(): inside runInJVM()")
|
||||
C.registerFragment(env, (C.jobject)(unsafe.Pointer(view)))
|
||||
})
|
||||
w.RegisterFragment("st/wow/git/ble/BlessedConnect")
|
||||
}
|
||||
|
||||
// Go callbacks from Java
|
||||
@@ -241,6 +237,8 @@ func Java_st_wow_git_ble_BlessedConnect_installComplete(env *C.JNIEnv, class C.j
|
||||
log.Printf("BlessedConnect object is nil!")
|
||||
}
|
||||
gBLE.handle.BlessedConnect = (C.NewGlobalRef)(env,b)
|
||||
h := app.PlatformHandle()
|
||||
setJVM(h.JVM)
|
||||
if C.enabled(env, gBLE.handle.BlessedConnect) == C.JNI_TRUE {
|
||||
gBLE.handle.state = STATE_ON
|
||||
gBLE.ready = true
|
||||
@@ -326,7 +324,7 @@ func goOnDiscoverService(cid, cuuid *C.char, serv C.jobject) {
|
||||
}
|
||||
|
||||
//export goOnDiscoverCharacteristic
|
||||
func goOnDiscoverCharacteristic(cid, csuuid *C.char, serv C.jobject, ccuuid *C.char, characteristic C.jobject) {
|
||||
func goOnDiscoverCharacteristic(cid, csuuid *C.char, serv C.jobject, ccuuid *C.char, char C.jobject) {
|
||||
id := C.GoString(cid)
|
||||
suuid := C.GoString(csuuid)
|
||||
cuuid := C.GoString(ccuuid)
|
||||
@@ -339,34 +337,34 @@ func goOnDiscoverCharacteristic(cid, csuuid *C.char, serv C.jobject, ccuuid *C.c
|
||||
service: serv,
|
||||
}
|
||||
|
||||
ch := Characteristic{
|
||||
characteristic := Characteristic{
|
||||
UUID: cuuid,
|
||||
characteristic: characteristic,
|
||||
characteristic: char,
|
||||
}
|
||||
|
||||
gBLE.events <- DiscoverCharacteristicEvent{
|
||||
Peripheral: peripheral,
|
||||
Service: service,
|
||||
Characteristic: ch,
|
||||
Characteristic: characteristic,
|
||||
Gatt: gatt.Characteristic{cuuid},
|
||||
}
|
||||
}
|
||||
|
||||
//export goOnCharacteristicChanged
|
||||
func goOnCharacteristicChanged(cid, ccuuid *C.char, characteristic C.jobject, cvalue *C.char, length C.jint) {
|
||||
func goOnCharacteristicChanged(cid, ccuuid *C.char, char C.jobject, cvalue *C.char, length C.jint) {
|
||||
id := C.GoString(cid)
|
||||
cuuid := C.GoString(ccuuid)
|
||||
|
||||
peripheral := gBLE.retrievePeripheral(id)
|
||||
|
||||
ch := Characteristic{
|
||||
characteristic := Characteristic{
|
||||
UUID: cuuid,
|
||||
characteristic: characteristic,
|
||||
characteristic: char,
|
||||
}
|
||||
|
||||
gBLE.events <- UpdateValueEvent{
|
||||
Peripheral: peripheral,
|
||||
Characteristic: ch,
|
||||
Characteristic: characteristic,
|
||||
Data: C.GoBytes(unsafe.Pointer(cvalue), length),
|
||||
}
|
||||
}
|
||||
|
||||
+11
-10
@@ -8,6 +8,8 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"gioui.org/app"
|
||||
|
||||
"git.wow.st/gmp/ble/gatt"
|
||||
"git.wow.st/gmp/ble/ns"
|
||||
)
|
||||
@@ -156,7 +158,7 @@ func (p Peripheral) DiscoverCharacteristics(serv Service) {
|
||||
|
||||
//SetNotifyValue subscribes to a characteristic
|
||||
func (p Peripheral) SetNotifyValue(c Characteristic) {
|
||||
p.p.SetNotifyValue((ns.BOOL)(true), c)
|
||||
p.p.SetNotifyValue(1, c)
|
||||
}
|
||||
|
||||
//NewBLE returns a pointer to a BLE struct after setting up the OS
|
||||
@@ -202,13 +204,12 @@ func NewBLE() *BLE {
|
||||
}
|
||||
|
||||
//Enable is not required for Darwin.
|
||||
func (b *BLE) Enable(v uintptr) {
|
||||
func (b *BLE) Enable(w *app.Window) {
|
||||
}
|
||||
|
||||
// Core Bluetooth callback functions
|
||||
|
||||
func didUpdateState(d ns.CBDelegate, c *ns.CBCentralManager) {
|
||||
fmt.Print("didUpdateState")
|
||||
func didUpdateState(c *ns.CBCentralManager) {
|
||||
b := cdLookup[c.Ptr()]
|
||||
st := c.CBManager.State()
|
||||
if st == (ns.CBManagerState)(ns.CBManagerStatePoweredOn) {
|
||||
@@ -231,7 +232,7 @@ func didUpdateState(d ns.CBDelegate, c *ns.CBCentralManager) {
|
||||
b.events <- UpdateStateEvent{State: b.stringState()}
|
||||
}
|
||||
|
||||
func didDiscoverPeripheral(d_ ns.CBDelegate, c *ns.CBCentralManager, p *ns.CBPeripheral, d *ns.NSDictionary, rssi *ns.NSNumber) {
|
||||
func didDiscoverPeripheral(c *ns.CBCentralManager, p *ns.CBPeripheral, d *ns.NSDictionary, rssi *ns.NSNumber) {
|
||||
b := cdLookup[c.Ptr()]
|
||||
peripheral := newPeripheral(p)
|
||||
peripheral.RSSI = (int)(rssi.IntValue())
|
||||
@@ -248,7 +249,7 @@ func _didDiscoverPeripheral(b *BLE, peripheral Peripheral) {
|
||||
}
|
||||
}
|
||||
|
||||
func didConnectPeripheral(d ns.CBDelegate, c *ns.CBCentralManager, p *ns.CBPeripheral) {
|
||||
func didConnectPeripheral(c *ns.CBCentralManager, p *ns.CBPeripheral) {
|
||||
fmt.Printf("Did connect peripheral\n")
|
||||
b := cdLookup[c.Ptr()]
|
||||
|
||||
@@ -281,7 +282,7 @@ func didConnectPeripheral(d ns.CBDelegate, c *ns.CBCentralManager, p *ns.CBPerip
|
||||
fmt.Printf("Go: didConnectPeripheral returning\n")
|
||||
}
|
||||
|
||||
func didDisconnectPeripheral(d ns.CBDelegate, c *ns.CBCentralManager, p *ns.CBPeripheral, e *ns.NSError) {
|
||||
func didDisconnectPeripheral(c *ns.CBCentralManager, p *ns.CBPeripheral, e *ns.NSError) {
|
||||
fmt.Printf("Did disconnect peripheral\n");
|
||||
b := cdLookup[c.Ptr()]
|
||||
|
||||
@@ -312,7 +313,7 @@ func didDisconnectPeripheral(d ns.CBDelegate, c *ns.CBCentralManager, p *ns.CBPe
|
||||
}()
|
||||
}
|
||||
|
||||
func didDiscoverServices(d ns.CBDelegate, p *ns.CBPeripheral, e *ns.NSError) {
|
||||
func didDiscoverServices(p *ns.CBPeripheral, e *ns.NSError) {
|
||||
b := pdLookup[p.Ptr()]
|
||||
fmt.Printf("Did discover services\n")
|
||||
p.Services().ObjectEnumerator().ForIn(func(o *ns.Id) bool {
|
||||
@@ -328,7 +329,7 @@ func didDiscoverServices(d ns.CBDelegate, p *ns.CBPeripheral, e *ns.NSError) {
|
||||
fmt.Printf("Go: didDiscoverServices returning\n")
|
||||
}
|
||||
|
||||
func didDiscoverCharacteristics(d ns.CBDelegate, p *ns.CBPeripheral, s *ns.CBService, e *ns.NSError) {
|
||||
func didDiscoverCharacteristics(p *ns.CBPeripheral, s *ns.CBService, e *ns.NSError) {
|
||||
b := pdLookup[p.Ptr()]
|
||||
fmt.Printf("Did discover characteristics\n")
|
||||
s.Characteristics().ObjectEnumerator().ForIn(func(o *ns.Id) bool {
|
||||
@@ -346,7 +347,7 @@ func didDiscoverCharacteristics(d ns.CBDelegate, p *ns.CBPeripheral, s *ns.CBSer
|
||||
fmt.Printf("Go: didDiscoverCharacteristics returning\n")
|
||||
}
|
||||
|
||||
func didUpdateValue(d ns.CBDelegate, p *ns.CBPeripheral, chr *ns.CBCharacteristic, e *ns.NSError) {
|
||||
func didUpdateValue(p *ns.CBPeripheral, chr *ns.CBCharacteristic, e *ns.NSError) {
|
||||
b := pdLookup[p.Ptr()]
|
||||
v := chr.Value()
|
||||
b.events <-UpdateValueEvent{
|
||||
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
//go:generate rm -rf blessed-android timber
|
||||
//go:generate git clone https://github.com/weliem/blessed-android
|
||||
//go:generate git -C blessed-android checkout be74941512ba08e33eb1fd6d0030ad4a4d332365
|
||||
//go:generate blessed-android/gradlew -x lint -x lintVitalRelease -x test -x check -p blessed-android build
|
||||
//go:generate blessed-android/gradlew -p blessed-android build
|
||||
//go:generate mv blessed-android/blessed/build/intermediates/full_jar/release/createFullJarRelease/full.jar ../blessed-full.jar
|
||||
//go:generate rm -rf blessed-android
|
||||
|
||||
//go:generate git clone https://github.com/JakeWharton/timber.git
|
||||
//go:generate git -C timber checkout 4.7.1
|
||||
//go:generate timber/gradlew -x lint -x lintVitalRelease -x test -x check -p timber build
|
||||
//go:generate timber/gradlew -p timber build
|
||||
//go:generate mv timber/timber/build/intermediates/intermediate-jars/release/classes.jar ../timber.jar
|
||||
//go:generate rm -rf timber
|
||||
|
||||
package depjars
|
||||
package main
|
||||
|
||||
@@ -2,4 +2,4 @@ module git.wow.st/gmp/ble
|
||||
|
||||
go 1.13
|
||||
|
||||
require gioui.org v0.0.0-20200829162755-829ee4559c5a
|
||||
require gioui.org v0.0.0-20191126175243-2ca2e5462f16
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
gioui.org v0.0.0-20191126175243-2ca2e5462f16 h1:p31rtmKm51xpj2QtqGNlljAyHEP1oStU8MDRl2Dv7Gs=
|
||||
gioui.org v0.0.0-20191126175243-2ca2e5462f16/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY=
|
||||
gioui.org v0.0.0-20200612151431-2dc19a36959c h1:sGUKyRMv2bbfbsRyG8ghOI12l+WCGta+PivmznjuLgo=
|
||||
gioui.org v0.0.0-20200612151431-2dc19a36959c/go.mod h1:AHI9rFr6AEEHCb8EPVtb/p5M+NMJRKH58IOp8O3Je04=
|
||||
gioui.org v0.0.0-20200619121558-88ced59dad93 h1:Llh4Tigdbu++FrRXL/KzqDHnH2Q5LPmAEk0djh6NLwk=
|
||||
gioui.org v0.0.0-20200619121558-88ced59dad93/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
|
||||
gioui.org v0.0.0-20200829162755-829ee4559c5a h1:mciXRGzQwU0TbgCILZzl6L1nYIWU31lDGIb+8RYige8=
|
||||
gioui.org v0.0.0-20200829162755-829ee4559c5a/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
@@ -15,7 +9,6 @@ golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL
|
||||
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
@@ -26,7 +19,6 @@ golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
||||
@@ -3,24 +3,6 @@
|
||||
#include <android/log.h>
|
||||
#include "_cgo_export.h"
|
||||
|
||||
void
|
||||
registerFragment(JNIEnv *env, jobject view) {
|
||||
jclass cls = (*env)->GetObjectClass(env, view);
|
||||
jmethodID mid = (*env)->GetMethodID(env, cls, "getContext", "()Landroid/content/Context;");
|
||||
jobject ctx = (*env)->CallObjectMethod(env, view, mid);
|
||||
cls = (*env)->GetObjectClass(env, ctx);
|
||||
mid = (*env)->GetMethodID(env, cls, "getClassLoader", "()Ljava/lang/ClassLoader;");
|
||||
jobject loader = (*env)->CallObjectMethod(env, ctx, mid);
|
||||
cls = (*env)->GetObjectClass(env, loader);
|
||||
mid = (*env)->GetMethodID(env, cls, "findClass", "(Ljava/lang/String;)Ljava/lang/Class;");
|
||||
jstring str = (*env)->NewStringUTF(env, "st/wow/git/ble/BlessedConnect");
|
||||
cls = (*env)->CallObjectMethod(env, loader, mid, str);
|
||||
mid = (*env)->GetMethodID(env, cls, "<init>", "()V");
|
||||
jobject inst = (*env)->NewObject(env, cls, mid);
|
||||
mid = (*env)->GetMethodID(env, cls, "register", "(Landroid/view/View;)V");
|
||||
(*env)->CallVoidMethod(env, inst, mid, view);
|
||||
}
|
||||
|
||||
jboolean
|
||||
enabled(JNIEnv *env, jobject b) {
|
||||
jclass cls = (*env)->GetObjectClass(env, b);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <jni.h>
|
||||
|
||||
void registerFragment(JNIEnv *env, jobject view);
|
||||
jboolean enabled(JNIEnv *env, jobject p);
|
||||
void scan(JNIEnv *env, jobject b);
|
||||
void stopScan(JNIEnv *env, jobject b);
|
||||
|
||||
+16
-32
@@ -15,20 +15,27 @@ import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
//export CBDelegateCentralManagerDidUpdateState
|
||||
func CBDelegateCentralManagerDidUpdateState(o unsafe.Pointer, central unsafe.Pointer) {
|
||||
CBDelegateMux.RLock()
|
||||
cb := CBDelegateLookup[o].CentralManagerDidUpdateState
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
a1 := &CBCentralManager{}; a1.ptr = central
|
||||
cb(a1)
|
||||
}
|
||||
|
||||
//export CBDelegateCentralManagerDidConnectPeripheral
|
||||
func CBDelegateCentralManagerDidConnectPeripheral(o unsafe.Pointer, central unsafe.Pointer, peripheral unsafe.Pointer) {
|
||||
CBDelegateMux.RLock()
|
||||
cb := CBDelegateLookup[o].CentralManagerDidConnectPeripheral
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
self := CBDelegate{}
|
||||
self.ptr = o
|
||||
a1 := &CBCentralManager{}; a1.ptr = central
|
||||
a2 := &CBPeripheral{}; a2.ptr = peripheral
|
||||
cb(self, a1, a2)
|
||||
cb(a1, a2)
|
||||
}
|
||||
|
||||
//export CBDelegateCentralManagerDidDisconnectPeripheral
|
||||
@@ -37,12 +44,10 @@ func CBDelegateCentralManagerDidDisconnectPeripheral(o unsafe.Pointer, central u
|
||||
cb := CBDelegateLookup[o].CentralManagerDidDisconnectPeripheral
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
self := CBDelegate{}
|
||||
self.ptr = o
|
||||
a1 := &CBCentralManager{}; a1.ptr = central
|
||||
a2 := &CBPeripheral{}; a2.ptr = peripheral
|
||||
a3 := &NSError{}; a3.ptr = error
|
||||
cb(self, a1, a2, a3)
|
||||
cb(a1, a2, a3)
|
||||
}
|
||||
|
||||
//export CBDelegateCentralManagerDidDiscoverPeripheral
|
||||
@@ -51,26 +56,11 @@ func CBDelegateCentralManagerDidDiscoverPeripheral(o unsafe.Pointer, central uns
|
||||
cb := CBDelegateLookup[o].CentralManagerDidDiscoverPeripheral
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
self := CBDelegate{}
|
||||
self.ptr = o
|
||||
a1 := &CBCentralManager{}; a1.ptr = central
|
||||
a2 := &CBPeripheral{}; a2.ptr = peripheral
|
||||
a3 := &NSDictionary{}; a3.ptr = advertisementData
|
||||
a4 := &NSNumber{}; a4.ptr = RSSI
|
||||
cb(self, a1, a2, a3, a4)
|
||||
}
|
||||
|
||||
//export CBDelegateCentralManagerDidUpdateState
|
||||
func CBDelegateCentralManagerDidUpdateState(o unsafe.Pointer, central unsafe.Pointer) {
|
||||
fmt.Print("CentralManagerDidUpdateState")
|
||||
CBDelegateMux.RLock()
|
||||
cb := CBDelegateLookup[o].CentralManagerDidUpdateState
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
self := CBDelegate{}
|
||||
self.ptr = o
|
||||
a1 := &CBCentralManager{}; a1.ptr = central
|
||||
cb(self, a1)
|
||||
cb(a1, a2, a3, a4)
|
||||
}
|
||||
|
||||
//export CBDelegatePeripheralDidDiscoverServices
|
||||
@@ -79,11 +69,9 @@ func CBDelegatePeripheralDidDiscoverServices(o unsafe.Pointer, peripheral unsafe
|
||||
cb := CBDelegateLookup[o].PeripheralDidDiscoverServices
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
self := CBDelegate{}
|
||||
self.ptr = o
|
||||
a1 := &CBPeripheral{}; a1.ptr = peripheral
|
||||
a2 := &NSError{}; a2.ptr = error
|
||||
cb(self, a1, a2)
|
||||
cb(a1, a2)
|
||||
}
|
||||
|
||||
//export CBDelegatePeripheralDidDiscoverCharacteristicsForService
|
||||
@@ -92,12 +80,10 @@ func CBDelegatePeripheralDidDiscoverCharacteristicsForService(o unsafe.Pointer,
|
||||
cb := CBDelegateLookup[o].PeripheralDidDiscoverCharacteristicsForService
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
self := CBDelegate{}
|
||||
self.ptr = o
|
||||
a1 := &CBPeripheral{}; a1.ptr = peripheral
|
||||
a2 := &CBService{}; a2.ptr = service
|
||||
a3 := &NSError{}; a3.ptr = error
|
||||
cb(self, a1, a2, a3)
|
||||
cb(a1, a2, a3)
|
||||
}
|
||||
|
||||
//export CBDelegatePeripheralDidUpdateValueForCharacteristic
|
||||
@@ -106,10 +92,8 @@ func CBDelegatePeripheralDidUpdateValueForCharacteristic(o unsafe.Pointer, perip
|
||||
cb := CBDelegateLookup[o].PeripheralDidUpdateValueForCharacteristic
|
||||
CBDelegateMux.RUnlock()
|
||||
if cb == nil { return }
|
||||
self := CBDelegate{}
|
||||
self.ptr = o
|
||||
a1 := &CBPeripheral{}; a1.ptr = peripheral
|
||||
a2 := &CBCharacteristic{}; a2.ptr = characteristic
|
||||
a3 := &NSError{}; a3.ptr = error
|
||||
cb(self, a1, a2, a3)
|
||||
cb(a1, a2, a3)
|
||||
}
|
||||
|
||||
+53182
-52240
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,6 +1,6 @@
|
||||
inputfiles:
|
||||
- /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
|
||||
- /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreBluetooth.framework/Headers/CoreBluetooth.h
|
||||
- /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
|
||||
- /System/Library/Frameworks/CoreBluetooth.framework/Headers/CoreBluetooth.h
|
||||
|
||||
classes:
|
||||
- NSObject
|
||||
|
||||
Reference in New Issue
Block a user