Skip to content

Commit e90eeb9

Browse files
committed
fix access denied after fast app restart
1 parent 11899bf commit e90eeb9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

LighthouseV2PowerControl/Program.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,13 @@ private static async Task GetGattCharacteristicsAsync()
141141
for (int i = 0; i < serviceList.Count; ++i)
142142
{
143143
if (serviceList[i].Uuid != service) continue;
144-
GattCharacteristicsResult gattRes = await serviceList[i].GetCharacteristicsForUuidAsync(characteristic);
144+
GattCharacteristicsResult gattRes;
145+
do
146+
{
147+
gattRes = await serviceList[i].GetCharacteristicsForUuidAsync(characteristic);
148+
}
149+
while (gattRes.Status == GattCommunicationStatus.AccessDenied);
150+
145151
if (gattRes.Status == GattCommunicationStatus.Success)
146152
{
147153
var openStatus = await serviceList[i].OpenAsync(GattSharingMode.SharedReadAndWrite);

0 commit comments

Comments
 (0)