MCPcopy Create free account
hub / github.com/XCSoar/XCSoar / close

Method close

android/src/HM10Port.java:201–225  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

199 }
200
201 @Override
202 public void close() {
203 safeDestruct.beginShutdown();
204
205 shutdown = true;
206 writeBuffer.clear();
207 gatt.disconnect();
208 synchronized (gattStateSync) {
209 long waitUntil = System.currentTimeMillis() + DISCONNECT_TIMEOUT;
210 while (gattState != BluetoothGatt.STATE_DISCONNECTED) {
211 long timeToWait = waitUntil - System.currentTimeMillis();
212 if (timeToWait <= 0) {
213 break;
214 }
215 try {
216 gattStateSync.wait(timeToWait);
217 } catch (InterruptedException e) {
218 break;
219 }
220 }
221 }
222 gatt.close();
223
224 safeDestruct.finishShutdown();
225 }
226
227 @Override
228 public int getState() {

Callers

nothing calls this directly

Calls 3

beginShutdownMethod · 0.80
finishShutdownMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected