Performance improvements (do not parse addresses or locations unless

location tracking is enabled). Allow profiling option. Add some
comments and clean-ups to types/*.go.
This commit is contained in:
gmp
2019-05-11 23:03:56 -04:00
parent 49fd749fe3
commit 8de87cddb7
24 changed files with 132 additions and 219 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ func app() {
func main() {
//Run our app in an autorelease pool just for fun
go ns.Autorelease(app)
go ns.Autoreleasepool(app)
select { }
}
+5 -1
View File
@@ -30,9 +30,12 @@ func updateState(c *ns.CBCentralManager) {
func discoverPeripheral(c *ns.CBCentralManager, p *ns.CBPeripheral, d *ns.NSDictionary, rssi *ns.NSNumber) {
fmt.Printf("Did discover peripheral\n")
c.StopScan()
if peripheral != nil {
peripheral.Release()
}
peripheral = p
peripheral.Retain()
c.ConnectPeripheral(p,nil)
c.ConnectPeripheral(peripheral,nil)
}
func connectPeripheral(c *ns.CBCentralManager, p *ns.CBPeripheral) {
@@ -106,6 +109,7 @@ func main() {
queue := ns.DispatchQueueCreate(ns.CharWithGoString("st.wow.gitlab.ble"),nil)
cd = ns.BleDelegateAlloc()
cd.CentralManagerDidUpdateStateCallback(updateState)
cd.CentralManagerDidDiscoverPeripheralCallback(discoverPeripheral)
cd.CentralManagerDidConnectPeripheralCallback(connectPeripheral)