Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop abfe99483 -> dd29d7785


bletiny: Add svcchg command

This command allows to send service changed indications from console.
Currently this needs to be handled from application and is required
for PTS qualification.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/0457e02c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0457e02c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0457e02c

Branch: refs/heads/develop
Commit: 0457e02c3328a571e6b1d4d47b62c035ddfe1c37
Parents: 20304fe
Author: Szymon Janc <[email protected]>
Authored: Wed Dec 21 16:42:23 2016 +0100
Committer: Szymon Janc <[email protected]>
Committed: Wed Dec 21 17:15:55 2016 +0100

----------------------------------------------------------------------
 apps/bletiny/src/cmd.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0457e02c/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index f315136..8e8ae9f 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -31,6 +31,7 @@
 #include "host/ble_sm.h"
 #include "host/ble_eddystone.h"
 #include "host/ble_hs_id.h"
+#include "services/gatt/ble_svc_gatt.h"
 #include "../src/ble_l2cap_priv.h"
 #include "../src/ble_hs_priv.h"
 
@@ -3312,6 +3313,49 @@ cmd_help(int argc, char **argv)
 }
 
 /*****************************************************************************
+ * $svcch                                                                    *
+ *****************************************************************************/
+
+static void
+bletiny_svcchg_help(void)
+{
+    console_printf("Available svcchg params: \n");
+    help_cmd_uint16("start");
+    help_cmd_uint16("end");
+}
+
+static int
+cmd_svcchg(int argc, char **argv)
+{
+    uint16_t start;
+    uint16_t end;
+    int rc;
+
+    if (argc > 1 && strcmp(argv[1], "help") == 0) {
+        bletiny_svcchg_help();
+        return 0;
+    }
+
+    start = parse_arg_uint16("start", &rc);
+    if (rc != 0) {
+        console_printf("invalid 'start' parameter\n");
+        help_cmd_uint16("start");
+        return rc;
+    }
+
+    end = parse_arg_uint16("end", &rc);
+    if (rc != 0) {
+        console_printf("invalid 'end' parameter\n");
+        help_cmd_uint16("end");
+        return rc;
+    }
+
+    ble_svc_gatt_changed(start, end);
+
+    return 0;
+}
+
+/*****************************************************************************
  * $init                                                                     *
  *****************************************************************************/
 
@@ -3338,6 +3382,7 @@ static struct cmd_entry cmd_b_entries[] = {
     { "tx",         cmd_tx },
     { "wl",         cmd_wl },
     { "write",      cmd_write },
+    { "svcchg",     cmd_svcchg },
     { NULL, NULL }
 };
 

Reply via email to