mesh: Add support for meshd to use RAW channel
[platform/upstream/bluez.git] / mesh / main.c
index f80fe2f..aecb8bf 100644 (file)
@@ -41,6 +41,9 @@ static const char *config_dir;
 static const char *mesh_conf_fname;
 static enum mesh_io_type io_type;
 static void *io_opts;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+bool use_raw = false;
+#endif
 
 static const struct option main_options[] = {
        { "io",         required_argument,      NULL, 'i' },
@@ -48,6 +51,9 @@ static const struct option main_options[] = {
        { "nodetach",   no_argument,            NULL, 'n' },
        { "debug",      no_argument,            NULL, 'd' },
        { "dbus-debug", no_argument,            NULL, 'b' },
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       { "use_raw",    no_argument,            NULL, 'r' },
+#endif
        { "help",       no_argument,            NULL, 'h' },
        { }
 };
@@ -142,10 +148,16 @@ static void signal_handler(uint32_t signo, void *user_data)
 static bool parse_io(const char *optarg, enum mesh_io_type *type, void **opts)
 {
        if (strstr(optarg, "generic") == optarg) {
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               struct mesh_io_opts *m_io_opts = l_new(struct mesh_io_opts, 1);
+               int *index = &(m_io_opts->index);
+               m_io_opts->use_raw = use_raw;
+               *opts = m_io_opts;
+#else
                int *index = l_new(int, 1);
-
-               *type = MESH_IO_TYPE_GENERIC;
                *opts = index;
+#endif
+               *type = MESH_IO_TYPE_GENERIC;
 
                optarg += strlen("generic");
                if (!*optarg) {
@@ -193,7 +205,11 @@ int main(int argc, char *argv[])
        for (;;) {
                int opt;
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               opt = getopt_long(argc, argv, "i:c:f:ndbhr", main_options, NULL);
+#else
                opt = getopt_long(argc, argv, "i:c:f:ndbh", main_options, NULL);
+#endif
                if (opt < 0)
                        break;
 
@@ -220,6 +236,11 @@ int main(int argc, char *argv[])
                case 'b':
                        dbus_debug = true;
                        break;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               case 'r':
+                       use_raw = true;
+                       break;
+#endif
                case 'h':
                        usage();
                        status = EXIT_SUCCESS;