c# - Bluetooth Low Energy connection parameters update - device or windows causing HRESULT: 0x80070005 (E_ACCESSDENIED))? -
i'm trying write gap service (0x180) characteristics , 0x2a04
whenever try writing 0x2a04 (connection parameters) or 0x0200 (device name),
var devices = await windows.devices.enumeration.deviceinformation.findallasync(gattdeviceservice.getdeviceselectorfromshortid(0x1800)); var service = await gattdeviceservice.fromidasync(devices[0].id); var gapdata = service.getcharacteristics(new guid("00002a04-0000-1000-8000-00805f9b34fb"))[0]; var raw = await gapdata.readvalueasync(); byte[] conparas = new byte[raw.value.length]; datareader.frombuffer(raw.value).readbytes(conparas); //i can breakpoint , verify read works fine var status = await gapdata.writevalueasync(conparas.asbuffer());
and call writevalueasync(), program breaks on line , exception is
an exception of type 'system.unauthorizedaccessexception' occurred in mscorlib.dll not handled in user code
additional information: access denied. (exception hresult: 0x80070005 (e_accessdenied))
i'm not quite sure level of stack parameters being refused - don't know if parameters reaching ble device. however, can write other gatt services , read gap characteristics, believe device.
can see fool proof method discover problem coming from?
thanks thomas
i had problem before. seems microsoft doesn't writing gap.
i recommend structure gatt.xml contains "name" , "appearance" services in gap (only these 2 services) , put remaining characteristics underneath custom service or standard one.
if try writing characteristic write enabled beneath custom service should work.
summary: can't write characteristics under gap.
reference: restructuring gatt.xml of device fixed same problem me.
additional details: these "access denied" errors want check that: 1) have package manifest capabilities manually edited include services gatt.xml has. have specify custom services , standard services alike. 2) gatt.xml correctly structured. 3) caracteristic trying write exists/the device paired to.
cheers, togepi
Comments
Post a Comment