Bug fix for Android (C variable name conflict).

This commit is contained in:
Greg Pomerantz 2021-11-15 15:42:35 -05:00
parent a6cc776a0d
commit 6da0474e59

View File

@ -326,7 +326,7 @@ func goOnDiscoverService(cid, cuuid *C.char, serv C.jobject) {
} }
//export goOnDiscoverCharacteristic //export goOnDiscoverCharacteristic
func goOnDiscoverCharacteristic(cid, csuuid *C.char, serv C.jobject, ccuuid *C.char, char C.jobject) { func goOnDiscoverCharacteristic(cid, csuuid *C.char, serv C.jobject, ccuuid *C.char, characteristic C.jobject) {
id := C.GoString(cid) id := C.GoString(cid)
suuid := C.GoString(csuuid) suuid := C.GoString(csuuid)
cuuid := C.GoString(ccuuid) cuuid := C.GoString(ccuuid)
@ -339,34 +339,34 @@ func goOnDiscoverCharacteristic(cid, csuuid *C.char, serv C.jobject, ccuuid *C.c
service: serv, service: serv,
} }
characteristic := Characteristic{ ch := Characteristic{
UUID: cuuid, UUID: cuuid,
characteristic: char, characteristic: characteristic,
} }
gBLE.events <- DiscoverCharacteristicEvent{ gBLE.events <- DiscoverCharacteristicEvent{
Peripheral: peripheral, Peripheral: peripheral,
Service: service, Service: service,
Characteristic: characteristic, Characteristic: ch,
Gatt: gatt.Characteristic{cuuid}, Gatt: gatt.Characteristic{cuuid},
} }
} }
//export goOnCharacteristicChanged //export goOnCharacteristicChanged
func goOnCharacteristicChanged(cid, ccuuid *C.char, char C.jobject, cvalue *C.char, length C.jint) { func goOnCharacteristicChanged(cid, ccuuid *C.char, characteristic C.jobject, cvalue *C.char, length C.jint) {
id := C.GoString(cid) id := C.GoString(cid)
cuuid := C.GoString(ccuuid) cuuid := C.GoString(ccuuid)
peripheral := gBLE.retrievePeripheral(id) peripheral := gBLE.retrievePeripheral(id)
characteristic := Characteristic{ ch := Characteristic{
UUID: cuuid, UUID: cuuid,
characteristic: char, characteristic: characteristic,
} }
gBLE.events <- UpdateValueEvent{ gBLE.events <- UpdateValueEvent{
Peripheral: peripheral, Peripheral: peripheral,
Characteristic: characteristic, Characteristic: ch,
Data: C.GoBytes(unsafe.Pointer(cvalue), length), Data: C.GoBytes(unsafe.Pointer(cvalue), length),
} }
} }