summaryrefslogtreecommitdiff
path: root/mesh/util.h
diff options
context:
space:
mode:
authorBrian Gix <brian.gix@intel.com>2017-08-14 11:20:50 -0700
committerMarcel Holtmann <marcel@holtmann.org>2017-08-21 12:40:35 +0200
commit846af2a2290d790b83bb08df1c813de1af9f426f (patch)
tree336764c2ac39d2de546688648617fe7094d5e221 /mesh/util.h
parent1a1204666e226efe03d1dab919c112804fd68419 (diff)
downloadbluez-846af2a2290d790b83bb08df1c813de1af9f426f.tar.gz
mesh: define APIs for Bluetooth Mesh
Diffstat (limited to 'mesh/util.h')
-rw-r--r--mesh/util.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/mesh/util.h b/mesh/util.h
new file mode 100644
index 000000000..8212b53bb
--- /dev/null
+++ b/mesh/util.h
@@ -0,0 +1,71 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2017 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __MESH_UTIL_H
+#define __MESH_UTIL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdbool.h>
+
+#include "node.h"
+
+#define OP_UNRELIABLE 0x0100
+
+struct menu_entry {
+ const char *cmd;
+ const char *arg;
+ void (*func) (const char *arg);
+ const char *desc;
+};
+
+bool cmd_menu_init(const struct menu_entry *cmd_table);
+void cmd_menu_main(bool forced);
+bool add_cmd_menu(const char *name, const struct menu_entry *cmd_table);
+bool switch_cmd_menu(const char *name);
+void set_menu_prompt(const char *prefix, const char * node);
+void process_menu_cmd(const char *cmd, const char *arg);
+void print_cmd_menu(const struct menu_entry *cmd_table);
+void cmd_menu_cleanup(void);
+void print_byte_array(const char *prefix, const void *ptr, int len);
+bool str2hex(const char *str, uint16_t in_len, uint8_t *out_buf,
+ uint16_t out_len);
+size_t hex2str(uint8_t *in, size_t in_len, char *out,
+ size_t out_len);
+uint16_t mesh_opcode_set(uint32_t opcode, uint8_t *buf);
+bool mesh_opcode_get(const uint8_t *buf, uint16_t sz, uint32_t *opcode, int *n);
+const char *mesh_status_str(uint8_t status);
+void print_model_pub(uint16_t ele_addr, uint32_t mod_id,
+ struct mesh_publication *pub);
+void swap_u256_bytes(uint8_t *u256);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MESH_UTIL_H */