+
+void OCPrintCALogBuffer(LogLevel level, const char *tag, const uint8_t *buffer,
+ uint16_t bufferSize, uint8_t isHeader)
+{
+ if (!buffer || !tag || (bufferSize == 0))
+ {
+ return;
+ }
+
+ // No idea why the static initialization won't work here, it seems the compiler is convinced
+ // that this is a variable-sized object.
+ char lineBuffer[S_LINE_BUFFER_SIZE];
+ int lineIndex = 0;
+ int i;
+ for (i = 0; i < bufferSize; i++)
+ {
+ // Format the buffer data into a line
+ snprintf(&lineBuffer[lineIndex*3], sizeof(lineBuffer)-lineIndex*3, "%02X ", buffer[i]);
+ lineIndex++;
+ // Output 50 values per line
+ if (((i+1)%50) == 0)
+ {
+ if (1 == isHeader)
+ {
+ OCLogv(level, tag, "| Analyzer(Header) | %s", lineBuffer);
+ }
+ else
+ {
+ OCLogv(level, tag, "| Analyzer(Body) | %s", lineBuffer);
+ }
+ memset(lineBuffer, 0, sizeof lineBuffer);
+ lineIndex = 0;
+ }
+ }
+
+ if (bufferSize % 50)
+ {
+ if (1 == isHeader)
+ {
+ OCLogv(level, tag, "| Analyzer(Header) | %s", lineBuffer);
+ }
+ else
+ {
+ OCLogv(level, tag, "| Analyzer(Body) | %s", lineBuffer);
+ }
+ }
+}
+
+void OCSetLogLevel(LogLevel level, bool hidePrivateLogEntries)
+{
+ g_level = level;
+ g_hidePrivateLogEntries = hidePrivateLogEntries;
+}
+
+bool OCGetPrivateLogLevel()
+{
+ return g_hidePrivateLogEntries;
+}
+