You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/06/06 11:04:44 UTC
[1/9] incubator-mynewt-core git commit: bletiny - Enable debug
logging by default.
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/upf54 [created] f23cbb59a
bletiny - Enable debug logging by default.
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/3ef1ed73
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/3ef1ed73
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/3ef1ed73
Branch: refs/heads/upf54
Commit: 3ef1ed7357b1b533956a8c2bbeb85c5f5066db03
Parents: 3e67101
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:22:34 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:22:34 2016 +0800
----------------------------------------------------------------------
apps/bletiny/pkg.yml | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3ef1ed73/apps/bletiny/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/bletiny/pkg.yml b/apps/bletiny/pkg.yml
index 614f76f..361840b 100644
--- a/apps/bletiny/pkg.yml
+++ b/apps/bletiny/pkg.yml
@@ -31,6 +31,3 @@ pkg.deps:
- libs/shell
pkg.cflags:
- # Reduce the log level from DEBUG to INFO. This is necessary to fit
- # bletiny on the nRF51dk.
- - "-DLOG_LEVEL=1"
[6/9] incubator-mynewt-core git commit: BLE Host - Add comment about
ltk endianness.
Posted by cc...@apache.org.
BLE Host - Add comment about ltk endianness.
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/8ae96fb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8ae96fb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8ae96fb4
Branch: refs/heads/upf54
Commit: 8ae96fb44b8a70d9d9c71c3e23a34684dd68d666
Parents: 3d79b9b
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:27:37 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:27:37 2016 +0800
----------------------------------------------------------------------
net/nimble/host/src/ble_sm_priv.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8ae96fb4/net/nimble/host/src/ble_sm_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_sm_priv.h b/net/nimble/host/src/ble_sm_priv.h
index 6d40e04..9362e29 100644
--- a/net/nimble/host/src/ble_sm_priv.h
+++ b/net/nimble/host/src/ble_sm_priv.h
@@ -260,7 +260,7 @@ struct ble_sm_proc {
uint8_t confirm_peer[16];
uint8_t randm[16];
uint8_t rands[16];
- uint8_t ltk[16];
+ uint8_t ltk[16]; /* Little endian. */
struct ble_sm_keys our_keys;
struct ble_sm_keys peer_keys;
[2/9] incubator-mynewt-core git commit: bletiny - default bd addr =
01:08:07:01:01:01
Posted by cc...@apache.org.
bletiny - default bd addr = 01:08:07:01:01:01
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/79253547
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/79253547
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/79253547
Branch: refs/heads/upf54
Commit: 79253547776a9adf9b891472f15d5ed0d6aa1b3f
Parents: 3ef1ed7
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:25:07 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:25:07 2016 +0800
----------------------------------------------------------------------
apps/bletiny/src/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/79253547/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index ea988bf..6d7ea26 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -72,7 +72,7 @@ uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
uint8_t g_host_adv_len;
/** Our public address. Note: this is in reverse byte order. */
-static uint8_t bletiny_addr[6] = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a};
+static uint8_t bletiny_addr[6] = {0x01, 0x01, 0x01, 0x07, 0x08, 0x01};
/* Create a mbuf pool of BLE mbufs */
#define MBUF_NUM_MBUFS (16)
[7/9] incubator-mynewt-core git commit: BLE - Increase max dflt tx
mtu; enable param req.
Posted by cc...@apache.org.
BLE - Increase max dflt tx mtu; enable param req.
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/e38c2ad0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e38c2ad0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e38c2ad0
Branch: refs/heads/upf54
Commit: e38c2ad0503d457c0917450866c87afd3c8293e1
Parents: 8ae96fb
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:28:16 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:28:16 2016 +0800
----------------------------------------------------------------------
net/nimble/include/nimble/nimble_opt.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e38c2ad0/net/nimble/include/nimble/nimble_opt.h
----------------------------------------------------------------------
diff --git a/net/nimble/include/nimble/nimble_opt.h b/net/nimble/include/nimble/nimble_opt.h
index b173343..4aad463 100644
--- a/net/nimble/include/nimble/nimble_opt.h
+++ b/net/nimble/include/nimble/nimble_opt.h
@@ -292,7 +292,7 @@
#endif
#ifndef NIMBLE_OPT_LL_CONN_INIT_MAX_TX_BYTES
-#define NIMBLE_OPT_LL_CONN_INIT_MAX_TX_BYTES (27)
+#define NIMBLE_OPT_LL_CONN_INIT_MAX_TX_BYTES (251)
#endif
/* The number of slots that will be allocated to each connection */
@@ -331,7 +331,7 @@
* This is implemented in the controller but is disabled by default.
*/
#ifndef BLE_LL_CFG_FEAT_CONN_PARAM_REQ
-#define BLE_LL_CFG_FEAT_CONN_PARAM_REQ (0)
+#define BLE_LL_CFG_FEAT_CONN_PARAM_REQ (1)
#endif
/*
[3/9] incubator-mynewt-core git commit: bletiny - increase mbufs to
32 (was:16).
Posted by cc...@apache.org.
bletiny - increase mbufs to 32 (was:16).
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/f77f9796
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f77f9796
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f77f9796
Branch: refs/heads/upf54
Commit: f77f97968fe3beaa0f3da6e67f61427118eff82d
Parents: 7925354
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:25:33 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:25:33 2016 +0800
----------------------------------------------------------------------
apps/bletiny/src/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f77f9796/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index 6d7ea26..8e7c457 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -75,7 +75,7 @@ uint8_t g_host_adv_len;
static uint8_t bletiny_addr[6] = {0x01, 0x01, 0x01, 0x07, 0x08, 0x01};
/* Create a mbuf pool of BLE mbufs */
-#define MBUF_NUM_MBUFS (16)
+#define MBUF_NUM_MBUFS (32)
#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)
#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
[4/9] incubator-mynewt-core git commit: Preserve stack on assert
failue when debugging.
Posted by cc...@apache.org.
Preserve stack on assert failue when debugging.
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/3d92d5ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/3d92d5ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/3d92d5ed
Branch: refs/heads/upf54
Commit: 3d92d5ed1fb09b0783b454a3adb0c68516725f8a
Parents: f77f979
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:25:59 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:25:59 2016 +0800
----------------------------------------------------------------------
libs/os/src/arch/cortex_m4/os_fault.c | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3d92d5ed/libs/os/src/arch/cortex_m4/os_fault.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/cortex_m4/os_fault.c b/libs/os/src/arch/cortex_m4/os_fault.c
index 9bc1db4..3a33f7a 100644
--- a/libs/os/src/arch/cortex_m4/os_fault.c
+++ b/libs/os/src/arch/cortex_m4/os_fault.c
@@ -118,6 +118,12 @@ __assert_func(const char *file, int line, const char *func, const char *e)
(void)sr;
console_blocking_mode();
console_printf("Assert %s; failed in %s:%d\n", e ? e : "", file, line);
+ if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) {
+ /*
+ * If debugger is attached, breakpoint here.
+ */
+ asm("bkpt");
+ }
SCB->ICSR = SCB_ICSR_NMIPENDSET_Msk;
asm("isb");
system_reset();
[8/9] incubator-mynewt-core git commit: bletiny - Require all fields
for store add sec.
Posted by cc...@apache.org.
bletiny - Require all fields for store add sec.
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/b6e799f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/b6e799f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/b6e799f1
Branch: refs/heads/upf54
Commit: b6e799f166de0b5b4d679dba0e8b160a165c07a8
Parents: e38c2ad
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:43:21 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:43:21 2016 +0800
----------------------------------------------------------------------
apps/bletiny/src/cmd.c | 62 ++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b6e799f1/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index f64879a..ec9e34b 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -1714,20 +1714,17 @@ cmd_write(int argc, char **argv)
/*****************************************************************************
* store *
*****************************************************************************/
-#define BLETINY_CMD_KEYSTORE_ENTRY_TYPE_MST_SEC 0
-#define BLETINY_CMD_KEYSTORE_ENTRY_TYPE_SLV_SEC 1
-#define BLETINY_CMD_KEYSTORE_ENTRY_TYPE_CCCD_SEC 2
static struct kv_pair cmd_keystore_entry_type[] = {
- { "msec", BLE_STORE_OBJ_TYPE_MST_SEC },
- { "ssec", BLE_STORE_OBJ_TYPE_SLV_SEC },
- { "cccd", BLE_STORE_OBJ_TYPE_CCCD },
+ { "msec", BLE_STORE_OBJ_TYPE_MST_SEC },
+ { "ssec", BLE_STORE_OBJ_TYPE_SLV_SEC },
+ { "cccd", BLE_STORE_OBJ_TYPE_CCCD },
{ NULL }
};
static struct kv_pair cmd_keystore_addr_type[] = {
- { "public", BLE_ADDR_TYPE_PUBLIC },
- { "random", BLE_ADDR_TYPE_RANDOM },
+ { "public", BLE_ADDR_TYPE_PUBLIC },
+ { "random", BLE_ADDR_TYPE_RANDOM },
{ NULL }
};
@@ -1735,41 +1732,38 @@ static int
cmd_keystore_parse_keydata(int argc, char **argv, union ble_store_key *out,
int *obj_type)
{
- int type;
int rc;
memset(out, 0, sizeof(*out));
- type = parse_arg_kv("type", cmd_keystore_entry_type);
- *obj_type = type;
-
- switch (type) {
- case BLE_STORE_OBJ_TYPE_MST_SEC:
- case BLE_STORE_OBJ_TYPE_SLV_SEC:
- /* try to parse by address and type */
- out->sec.peer_addr_type =
- parse_arg_kv("addr_type", cmd_keystore_addr_type);
- rc = parse_arg_mac("addr", out->sec.peer_addr);
+ *obj_type = parse_arg_kv("type", cmd_keystore_entry_type);
- if (rc || out->sec.peer_addr_type < 0) {
+ switch (*obj_type) {
+ case BLE_STORE_OBJ_TYPE_MST_SEC:
+ case BLE_STORE_OBJ_TYPE_SLV_SEC:
+ rc = parse_arg_kv("addr_type", cmd_keystore_addr_type);
+ if (rc < 0) {
+ return EINVAL;
+ }
- out->sec.peer_addr_type = BLE_STORE_ADDR_TYPE_NONE;
+ rc = parse_arg_mac("addr", out->sec.peer_addr);
+ if (rc != 0) {
+ return rc;
+ }
- out->sec.ediv = parse_arg_uint16("ediv", &rc);
- if (rc != 0) {
- return rc;
- }
+ out->sec.ediv = parse_arg_uint16("ediv", &rc);
+ if (rc != 0) {
+ return rc;
+ }
- out->sec.rand_num = parse_arg_uint64("rand", &rc);
- if (rc != 0) {
- return rc;
- }
- }
+ out->sec.rand_num = parse_arg_uint64("rand", &rc);
+ if (rc != 0) {
+ return rc;
+ }
+ return 0;
- break;
- default:
- return -1;
+ default:
+ return -1;
}
- return 0;
}
static int
[5/9] incubator-mynewt-core git commit: BLE Ctrl - Enable LL log by
default.
Posted by cc...@apache.org.
BLE Ctrl - Enable LL log by default.
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/3d79b9bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/3d79b9bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/3d79b9bc
Branch: refs/heads/upf54
Commit: 3d79b9bc46ee02c1806c4c20390295755c3a66f4
Parents: 3d92d5e
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:26:22 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:26:22 2016 +0800
----------------------------------------------------------------------
net/nimble/controller/include/controller/ble_ll.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3d79b9bc/net/nimble/controller/include/controller/ble_ll.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll.h b/net/nimble/controller/include/controller/ble_ll.h
index 81cba53..f0e0b8e 100644
--- a/net/nimble/controller/include/controller/ble_ll.h
+++ b/net/nimble/controller/include/controller/ble_ll.h
@@ -361,7 +361,7 @@ int ble_ll_rand_start(void);
* XXX: temporary LL debug log. Will get removed once we transition to real
* log
*/
-#undef BLE_LL_LOG
+#define BLE_LL_LOG 1
#include "console/console.h"
#define BLE_LL_LOG_ID_PHY_SETCHAN (1)
[9/9] incubator-mynewt-core git commit: bletiny - fix deadlock for
"disc full" + empty svc
Posted by cc...@apache.org.
bletiny - fix deadlock for "disc full" + empty svc
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/f23cbb59
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f23cbb59
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f23cbb59
Branch: refs/heads/upf54
Commit: f23cbb59a11aafb5d9e63df4afe44dc1077c441f
Parents: b6e799f
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Jun 6 18:59:31 2016 +0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Jun 6 18:59:31 2016 +0800
----------------------------------------------------------------------
apps/bletiny/src/bletiny.h | 3 +++
apps/bletiny/src/main.c | 35 +++++++++++++----------------------
apps/bletiny/src/misc.c | 25 +++++++++++++++++++++++++
3 files changed, 41 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f23cbb59/apps/bletiny/src/bletiny.h
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/bletiny.h b/apps/bletiny/src/bletiny.h
index 77fb706..88f9dc5 100644
--- a/apps/bletiny/src/bletiny.h
+++ b/apps/bletiny/src/bletiny.h
@@ -201,5 +201,8 @@ int store_write(int obj_type, union ble_store_value *val);
/** Misc. */
void print_bytes(uint8_t *bytes, int len);
+int svc_is_empty(struct bletiny_svc *svc);
+uint16_t chr_end_handle(struct bletiny_svc *svc, struct bletiny_chr *chr);
+int chr_is_empty(struct bletiny_svc *svc, struct bletiny_chr *chr);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f23cbb59/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index 8e7c457..b586ce0 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
#include <assert.h>
#include <string.h>
#include <stdio.h>
@@ -732,10 +733,8 @@ static void
bletiny_disc_full_dscs(uint16_t conn_handle)
{
struct bletiny_conn *conn;
- struct bletiny_chr *next_chr;
struct bletiny_chr *chr;
struct bletiny_svc *svc;
- uint16_t end_handle;
int rc;
conn = bletiny_conn_find(conn_handle);
@@ -748,27 +747,19 @@ bletiny_disc_full_dscs(uint16_t conn_handle)
SLIST_FOREACH(svc, &conn->svcs, next) {
SLIST_FOREACH(chr, &svc->chrs, next) {
- if (SLIST_EMPTY(&chr->dscs)) {
- next_chr = SLIST_NEXT(chr, next);
- if (next_chr != NULL) {
- end_handle = next_chr->chr.decl_handle - 1;
- } else {
- end_handle = svc->svc.end_handle;
+ if (!chr_is_empty(svc, chr) &&
+ SLIST_EMPTY(&chr->dscs) &&
+ bletiny_full_disc_prev_chr_def <= chr->chr.decl_handle) {
+
+ rc = bletiny_disc_all_dscs(conn_handle,
+ chr->chr.decl_handle,
+ chr_end_handle(svc, chr));
+ if (rc != 0) {
+ bletiny_full_disc_complete(rc);
}
- if (end_handle > chr->chr.value_handle &&
- bletiny_full_disc_prev_chr_def <= chr->chr.decl_handle) {
-
- rc = bletiny_disc_all_dscs(conn_handle,
- chr->chr.decl_handle,
- end_handle);
- if (rc != 0) {
- bletiny_full_disc_complete(rc);
- }
-
- bletiny_full_disc_prev_chr_def = chr->chr.value_handle;
- return;
- }
+ bletiny_full_disc_prev_chr_def = chr->chr.value_handle;
+ return;
}
}
}
@@ -793,7 +784,7 @@ bletiny_disc_full_chrs(uint16_t conn_handle)
}
SLIST_FOREACH(svc, &conn->svcs, next) {
- if (SLIST_EMPTY(&svc->chrs)) {
+ if (!svc_is_empty(svc) && SLIST_EMPTY(&svc->chrs)) {
rc = bletiny_disc_all_chrs(conn_handle, svc->svc.start_handle,
svc->svc.end_handle);
if (rc != 0) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f23cbb59/apps/bletiny/src/misc.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/misc.c b/apps/bletiny/src/misc.c
index 52c76b0..934d9cd 100644
--- a/apps/bletiny/src/misc.c
+++ b/apps/bletiny/src/misc.c
@@ -66,3 +66,28 @@ print_uuid(void *uuid128)
u8p[7], u8p[6], u8p[5], u8p[4],
u8p[3], u8p[2], u8p[1], u8p[0]);
}
+
+int
+svc_is_empty(struct bletiny_svc *svc)
+{
+ return svc->svc.end_handle < svc->svc.start_handle;
+}
+
+uint16_t
+chr_end_handle(struct bletiny_svc *svc, struct bletiny_chr *chr)
+{
+ struct bletiny_chr *next_chr;
+
+ next_chr = SLIST_NEXT(chr, next);
+ if (next_chr != NULL) {
+ return next_chr->chr.decl_handle - 1;
+ } else {
+ return svc->svc.end_handle;
+ }
+}
+
+int
+chr_is_empty(struct bletiny_svc *svc, struct bletiny_chr *chr)
+{
+ return chr_end_handle(svc, chr) <= chr->chr.value_handle;
+}