Fixed bug in hoermann.h and prints log message into esp_logd now.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "hciemulator.h"
|
||||
#include <string>
|
||||
|
||||
#define CHECKCHANGEDSET(Target, Value, Flag) \
|
||||
if ((Target) != (Value)) \
|
||||
@@ -22,14 +23,19 @@ void LogCore(int Level, const char *msg, const unsigned char *data = NULL, size_
|
||||
}
|
||||
if (data != NULL && datalen > 0)
|
||||
{
|
||||
String newmsg(msg);
|
||||
//std::string newmsg(msg);
|
||||
char* newmsg = (char*)malloc(strlen(msg) + datalen * 3 + 1);
|
||||
strncpy(newmsg, msg, strlen(msg) + 1);
|
||||
newmsg[strlen(msg)] = '\0';
|
||||
char str[4];
|
||||
for (size_t i = 0; i < datalen; i++)
|
||||
{
|
||||
snprintf(str, sizeof(str), "%02x ", data[i]);
|
||||
newmsg += str;
|
||||
str[3] = '\0';
|
||||
strncat(newmsg, str, sizeof(str));
|
||||
}
|
||||
Serial.println(newmsg);
|
||||
ESP_LOGD(TAG, newmsg);
|
||||
free(newmsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user