diff --git a/tools/mesh/agent.c b/tools/mesh/agent.c
index 08e4985..0ec76f3 100644
--- a/tools/mesh/agent.c
+++ b/tools/mesh/agent.c
#include <stdbool.h>
#include <inttypes.h>
-#include <glib.h>
-
#include <lib/bluetooth.h>
#include "src/shared/shell.h"
-#include "tools/mesh/util.h"
#include "tools/mesh/agent.h"
struct input_request {
pending_request.user_data = NULL;
}
+static bool str2hex(const char *str, uint16_t in_len, uint8_t *out,
+ uint16_t out_len)
+{
+ uint16_t i;
+
+ if (in_len < out_len * 2)
+ return false;
+
+ for (i = 0; i < out_len; i++) {
+ if (sscanf(&str[i * 2], "%02hhx", &out[i]) != 1)
+ return false;
+ }
+
+ return true;
+}
+
static void response_hexadecimal(const char *input, void *user_data)
{
uint8_t buf[MAX_HEXADECIMAL_OOB_LEN];
return false;
bt_shell_printf("Request hexadecimal key (hex %d octets)\n", len);
- bt_shell_prompt_input("mesh", "Enter key (hex number):", response_hexadecimal,
- NULL);
+ bt_shell_prompt_input("mesh", "Enter key (hex number):",
+ response_hexadecimal, NULL);
return true;
}
static bool request_decimal(uint16_t len)
{
bt_shell_printf("Request decimal key (0 - %d)\n", power_ten(len) - 1);
- bt_shell_prompt_input("mesh", "Enter Numeric key:", response_decimal, NULL);
+ bt_shell_prompt_input("mesh-agent", "Enter Numeric key:",
+ response_decimal, NULL);
return true;
}
return false;
bt_shell_printf("Request ASCII key (max characters %d)\n", len);
- bt_shell_prompt_input("mesh", "Enter key (ascii string):", response_ascii,
- NULL);
+ bt_shell_prompt_input("mesh", "Enter key (ascii string):",
+ response_ascii, NULL);
return true;
}
bool result;
if (pending_request.type != NONE)
- return FALSE;
+ return false;
switch (type) {
case HEXADECIMAL: