From 67c0671b9976aa73994386dbeff446db7f2b8b39 Mon Sep 17 00:00:00 2001 From: JMO Date: Wed, 23 Sep 2026 08:46:56 -0700 Subject: [PATCH] Log what the lens answers the prompt page with An ack is not a render: the lens can accept the create-prompt page and display nothing, so a null check on the reply throws away the only thing that can say what it did. The page size going out and the ack payload coming back are both logged now. --- .../app/FaceclawFlashPromptCommunicator.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawFlashPromptCommunicator.java b/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawFlashPromptCommunicator.java index a0707a19..8e9657f1 100644 --- a/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawFlashPromptCommunicator.java +++ b/App_Resources/Android/src/main/java/com/faceclaw/app/FaceclawFlashPromptCommunicator.java @@ -366,9 +366,15 @@ public class FaceclawFlashPromptCommunicator implements FaceclawBleListener { int magic = allocMagic(); byte[] page = BleProtocol.buildCreatePromptPage( magic, TEXT_NAME, TEXT_CONTAINER_ID, warningText, LIST_NAME, LIST_CONTAINER_ID, ITEMS); + emitLog("prompt page attempt " + (attempt + 1) + " writing " + page.length + " bytes to " + address); pageAck = writeAndAwaitAck(address, BleProtocol.SID_EVENHUB, BleProtocol.FLAG_REQUEST, magic, page, CREATE_ACK_TIMEOUT_MS); if (pageAck == null) { emitLog("prompt page attempt " + (attempt + 1) + " unacked: " + address); + } else { + // An ack is not a render. The lens can accept the page and show + // nothing, so the payload it answers with is the only thing that + // can say why; log it rather than only null-checking it. + emitLog("prompt page ack payload (" + pageAck.length + " bytes): " + toHex(pageAck)); } } if (pageAck == null) { @@ -633,6 +639,15 @@ public class FaceclawFlashPromptCommunicator implements FaceclawBleListener { }); } + /** Ack payloads are short; hex is the only honest way to log an opaque reply. */ + private static String toHex(byte[] bytes) { + StringBuilder out = new StringBuilder(bytes.length * 2); + for (byte b : bytes) { + out.append(String.format(java.util.Locale.ROOT, "%02x", b & 255)); + } + return out.toString(); + } + private void emitState(String state, String detail) { final String safeDetail = detail == null ? "" : detail; // Listener-only until now, so a prompt that never appeared left no trace in a log.