http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1c14f3f/net/nimble/host/src/ble_att_svr.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_svr.c 
b/net/nimble/host/src/ble_att_svr.c
index cdd02a8..332f097 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -97,9 +97,9 @@ ble_att_svr_next_id(void)
  * @return 0 on success, non-zero error code on failure.
  */
 int
-ble_att_svr_register(const uint8_t *uuid, uint8_t flags, uint8_t min_key_size,
-                     uint16_t *handle_id,  ble_att_svr_access_fn *cb,
-                     void *cb_arg)
+ble_att_svr_register(const ble_uuid_t *uuid, uint8_t flags,
+                     uint8_t min_key_size, uint16_t *handle_id,
+                     ble_att_svr_access_fn *cb, void *cb_arg)
 {
     struct ble_att_svr_entry *entry;
 
@@ -108,7 +108,7 @@ ble_att_svr_register(const uint8_t *uuid, uint8_t flags, 
uint8_t min_key_size,
         return BLE_HS_ENOMEM;
     }
 
-    memcpy(&entry->ha_uuid, uuid, sizeof entry->ha_uuid);
+    entry->ha_uuid = uuid;
     entry->ha_flags = flags;
     entry->ha_min_key_size = min_key_size;
     entry->ha_handle_id = ble_att_svr_next_id();
@@ -124,28 +124,6 @@ ble_att_svr_register(const uint8_t *uuid, uint8_t flags, 
uint8_t min_key_size,
     return 0;
 }
 
-int
-ble_att_svr_register_uuid16(uint16_t uuid16, uint8_t flags,
-                            uint8_t min_key_size, uint16_t *handle_id,
-                            ble_att_svr_access_fn *cb, void *cb_arg)
-{
-    uint8_t uuid128[16];
-    int rc;
-
-    rc = ble_uuid_16_to_128(uuid16, uuid128);
-    if (rc != 0) {
-        return rc;
-    }
-
-    rc = ble_att_svr_register(uuid128, flags, min_key_size, handle_id, cb,
-                              cb_arg);
-    if (rc != 0) {
-        return rc;
-    }
-
-    return 0;
-}
-
 uint16_t
 ble_att_svr_prev_handle(void)
 {
@@ -198,7 +176,7 @@ ble_att_svr_find_by_handle(uint16_t handle_id)
  * @return                      0 on success; BLE_HS_ENOENT on not found.
  */
 struct ble_att_svr_entry *
-ble_att_svr_find_by_uuid(struct ble_att_svr_entry *prev, const uint8_t *uuid,
+ble_att_svr_find_by_uuid(struct ble_att_svr_entry *prev, const ble_uuid_t 
*uuid,
                          uint16_t end_handle)
 {
     struct ble_att_svr_entry *entry;
@@ -213,7 +191,7 @@ ble_att_svr_find_by_uuid(struct ble_att_svr_entry *prev, 
const uint8_t *uuid,
          entry != NULL && entry->ha_handle_id <= end_handle;
          entry = STAILQ_NEXT(entry, ha_next)) {
 
-        if (memcmp(entry->ha_uuid, uuid, sizeof entry->ha_uuid) == 0) {
+        if (ble_uuid_cmp(entry->ha_uuid, uuid) == 0) {
             return entry;
         }
     }
@@ -819,7 +797,6 @@ ble_att_svr_fill_info(struct ble_att_find_info_req *req, 
struct os_mbuf *om,
                       uint16_t mtu, uint8_t *format)
 {
     struct ble_att_svr_entry *ha;
-    uint16_t uuid16;
     uint8_t *buf;
     int num_entries;
     int entry_sz;
@@ -835,9 +812,7 @@ ble_att_svr_fill_info(struct ble_att_find_info_req *req, 
struct os_mbuf *om,
             goto done;
         }
         if (ha->ha_handle_id >= req->bafq_start_handle) {
-            uuid16 = ble_uuid_128_to_16(ha->ha_uuid);
-
-            if (uuid16 != 0) {
+            if (ha->ha_uuid->type == BLE_UUID_TYPE_16) {
                 if (*format == 0) {
                     *format = BLE_ATT_FIND_INFO_RSP_FORMAT_16BIT;
                 } else if (*format != BLE_ATT_FIND_INFO_RSP_FORMAT_16BIT) {
@@ -869,19 +844,7 @@ ble_att_svr_fill_info(struct ble_att_find_info_req *req, 
struct os_mbuf *om,
 
             htole16(buf + 0, ha->ha_handle_id);
 
-            switch (*format) {
-            case BLE_ATT_FIND_INFO_RSP_FORMAT_16BIT:
-                htole16(buf + 2, uuid16);
-                break;
-
-            case BLE_ATT_FIND_INFO_RSP_FORMAT_128BIT:
-                memcpy(buf + 2, ha->ha_uuid, sizeof ha->ha_uuid);
-                break;
-
-            default:
-                BLE_HS_DBG_ASSERT(0);
-                break;
-            }
+            ble_uuid_flat(ha->ha_uuid, buf + 2);
 
             num_entries++;
         }
@@ -1047,25 +1010,48 @@ ble_att_svr_fill_type_value_entry(struct os_mbuf *om, 
uint16_t first,
 }
 
 static int
-ble_att_svr_is_valid_find_group_type(uint16_t uuid16)
+ble_att_svr_is_valid_find_group_type(const ble_uuid_t *uuid)
 {
+    uint16_t uuid16;
+
+    uuid16 = ble_uuid_u16(uuid);
+
     return uuid16 == BLE_ATT_UUID_PRIMARY_SERVICE ||
            uuid16 == BLE_ATT_UUID_SECONDARY_SERVICE ||
            uuid16 == BLE_ATT_UUID_CHARACTERISTIC;
 }
 
 static int
-ble_att_svr_is_valid_group_end(uint16_t uuid16_group, uint16_t uuid16)
+ble_att_svr_is_valid_group_end(const ble_uuid_t *uuid_group,
+                               const ble_uuid_t *uuid)
 {
-    switch (uuid16_group) {
+    uint16_t uuid16;
+
+    /* Grouping is defined only for 16-bit UUIDs, so any attribute ends group
+     * for non-16-bit UUIDs.
+     */
+    if (uuid_group->type != BLE_UUID_TYPE_16) {
+        return 1;
+    }
+
+    /* Grouping is defined only for 16-bit UUIDs, so non-16-bit UUID attribute
+     * cannot end group.
+     */
+    if (uuid->type != BLE_UUID_TYPE_16) {
+        return 0;
+    }
+
+    switch (ble_uuid_u16(uuid_group)) {
     case BLE_ATT_UUID_PRIMARY_SERVICE:
     case BLE_ATT_UUID_SECONDARY_SERVICE:
+        uuid16 = ble_uuid_u16(uuid);
+
         /* Only Primary or Secondary Service types end service group. */
         return uuid16 == BLE_ATT_UUID_PRIMARY_SERVICE ||
                uuid16 == BLE_ATT_UUID_SECONDARY_SERVICE;
     case BLE_ATT_UUID_CHARACTERISTIC:
         /* Any valid grouping type ends characteristic group */
-        return ble_att_svr_is_valid_find_group_type(uuid16);
+        return ble_att_svr_is_valid_find_group_type(uuid);
     default:
         /* Any attribute type ends group of non-grouping type */
         return 1;
@@ -1097,14 +1083,15 @@ ble_att_svr_fill_type_value(uint16_t conn_handle,
     struct ble_att_svr_entry *ha;
     uint8_t buf[16];
     uint16_t attr_len;
-    uint16_t uuid16;
     uint16_t first;
     uint16_t prev;
+    ble_uuid16_t attr_type;
     int any_entries;
     int rc;
 
     first = 0;
     prev = 0;
+    attr_type = (ble_uuid16_t) BLE_UUID16_INIT(req->bavq_attr_type);
     rc = 0;
 
     /* Iterate through the attribute list, keeping track of the current
@@ -1121,11 +1108,9 @@ ble_att_svr_fill_type_value(uint16_t conn_handle,
             break;
         }
 
-        uuid16 = ble_uuid_128_to_16(ha->ha_uuid);
-
         /* With group in progress, check if current attribute ends it. */
         if (first) {
-            if (!ble_att_svr_is_valid_group_end(req->bavq_attr_type, uuid16)) {
+            if (!ble_att_svr_is_valid_group_end(&attr_type.u, ha->ha_uuid)) {
                 prev = ha->ha_handle_id;
                 continue;
             }
@@ -1149,7 +1134,7 @@ ble_att_svr_fill_type_value(uint16_t conn_handle,
         /* Compare the attribute type and value to the request fields to
          * determine if this attribute matches.
          */
-        if (uuid16 == req->bavq_attr_type) {
+        if (ble_uuid_cmp(ha->ha_uuid, &attr_type.u) == 0) {
             rc = ble_att_svr_read_flat(conn_handle, ha, 0, sizeof buf, buf,
                                        &attr_len, out_att_err);
             if (rc != 0) {
@@ -1292,7 +1277,7 @@ done:
 static int
 ble_att_svr_build_read_type_rsp(uint16_t conn_handle,
                                 struct ble_att_read_type_req *req,
-                                uint8_t *uuid128,
+                                const ble_uuid_t *uuid,
                                 struct os_mbuf **rxom,
                                 struct os_mbuf **out_txom,
                                 uint8_t *att_err,
@@ -1337,7 +1322,7 @@ ble_att_svr_build_read_type_rsp(uint16_t conn_handle,
     /* Find all matching attributes, writing a record for each. */
     entry = NULL;
     while (1) {
-        entry = ble_att_svr_find_by_uuid(entry, uuid128, req->batq_end_handle);
+        entry = ble_att_svr_find_by_uuid(entry, uuid, req->batq_end_handle);
         if (entry == NULL) {
             rc = BLE_HS_ENOENT;
             break;
@@ -1416,9 +1401,8 @@ ble_att_svr_rx_read_type(uint16_t conn_handle, struct 
os_mbuf **rxom)
     struct ble_att_read_type_req req;
     struct os_mbuf *txom;
     uint16_t err_handle;
-    uint16_t uuid16;
     uint16_t pktlen;
-    uint8_t uuid128[16];
+    ble_uuid_any_t uuid;
     uint8_t att_err;
     int rc;
 
@@ -1453,30 +1437,15 @@ ble_att_svr_rx_read_type(uint16_t conn_handle, struct 
os_mbuf **rxom)
         goto done;
     }
 
-    switch ((*rxom)->om_len) {
-    case BLE_ATT_READ_TYPE_REQ_SZ_16:
-        uuid16 = le16toh((*rxom)->om_data + 5);
-        rc = ble_uuid_16_to_128(uuid16, uuid128);
-        if (rc != 0) {
-            att_err = BLE_ATT_ERR_ATTR_NOT_FOUND;
-            err_handle = 0;
-            rc = BLE_HS_EBADDATA;
-            goto done;
-        }
-        break;
-
-    case BLE_ATT_READ_TYPE_REQ_SZ_128:
-        memcpy(uuid128, (*rxom)->om_data + 5, 16);
-        break;
-
-    default:
+    rc = ble_uuid_init_from_mbuf(&uuid, *rxom, 5, (*rxom)->om_len - 5);
+    if (rc != 0) {
         att_err = BLE_ATT_ERR_INVALID_PDU;
         err_handle = 0;
         rc = BLE_HS_EMSGSIZE;
         goto done;
     }
 
-    rc = ble_att_svr_build_read_type_rsp(conn_handle, &req, uuid128,
+    rc = ble_att_svr_build_read_type_rsp(conn_handle, &req, &uuid.u,
                                          rxom, &txom, &att_err, &err_handle);
     if (rc != 0) {
         goto done;
@@ -1714,57 +1683,45 @@ done:
 }
 
 static int
-ble_att_svr_is_valid_read_group_type(uint8_t *uuid128)
+ble_att_svr_is_valid_read_group_type(const ble_uuid_t *uuid)
 {
     uint16_t uuid16;
 
-    uuid16 = ble_uuid_128_to_16(uuid128);
+    uuid16 = ble_uuid_u16(uuid);
 
     return uuid16 == BLE_ATT_UUID_PRIMARY_SERVICE ||
            uuid16 == BLE_ATT_UUID_SECONDARY_SERVICE;
 }
 
 static int
-ble_att_svr_service_uuid(struct ble_att_svr_entry *entry, uint16_t *uuid16,
-                         uint8_t *uuid128, uint8_t *out_att_err)
+ble_att_svr_service_uuid(struct ble_att_svr_entry *entry,
+                         ble_uuid_any_t *uuid, uint8_t *out_att_err)
 {
+    uint8_t val[16];
     uint16_t attr_len;
     int rc;
 
-    rc = ble_att_svr_read_flat(BLE_HS_CONN_HANDLE_NONE, entry, 0, 16, uuid128,
+    rc = ble_att_svr_read_flat(BLE_HS_CONN_HANDLE_NONE, entry, 0, sizeof(val), 
val,
                                &attr_len, out_att_err);
     if (rc != 0) {
         return rc;
     }
 
-    switch (attr_len) {
-    case 16:
-        *uuid16 = 0;
-        return 0;
-
-    case 2:
-        *uuid16 = le16toh(uuid128);
-        if (*uuid16 == 0) {
-            return BLE_HS_EINVAL;
-        }
-        return 0;
+    rc = ble_uuid_init_from_buf(uuid, val, attr_len);
 
-    default:
-        return BLE_HS_EINVAL;
-    }
+    return rc;
 }
 
 static int
 ble_att_svr_read_group_type_entry_write(struct os_mbuf *om, uint16_t mtu,
                                         uint16_t start_group_handle,
                                         uint16_t end_group_handle,
-                                        uint16_t service_uuid16,
-                                        uint8_t *service_uuid128)
+                                        const ble_uuid_t *service_uuid)
 {
     uint8_t *buf;
     int len;
 
-    if (service_uuid16 != 0) {
+    if (service_uuid->type == BLE_UUID_TYPE_16) {
         len = BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_16;
     } else {
         len = BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_128;
@@ -1780,11 +1737,7 @@ ble_att_svr_read_group_type_entry_write(struct os_mbuf 
*om, uint16_t mtu,
 
     htole16(buf + 0, start_group_handle);
     htole16(buf + 2, end_group_handle);
-    if (service_uuid16 != 0) {
-        htole16(buf + 4, service_uuid16);
-    } else {
-        memcpy(buf + 4, service_uuid128, 16);
-    }
+    ble_uuid_flat(service_uuid, buf + 4);
 
     return 0;
 }
@@ -1795,7 +1748,7 @@ ble_att_svr_read_group_type_entry_write(struct os_mbuf 
*om, uint16_t mtu,
 static int
 ble_att_svr_build_read_group_type_rsp(uint16_t conn_handle,
                                       struct ble_att_read_group_type_req *req,
-                                      uint8_t *group_uuid128,
+                                      const ble_uuid_t *group_uuid,
                                       struct os_mbuf **rxom,
                                       struct os_mbuf **out_txom,
                                       uint8_t *att_err,
@@ -1806,15 +1759,13 @@ ble_att_svr_build_read_group_type_rsp(uint16_t 
conn_handle,
     struct os_mbuf *txom;
     uint16_t start_group_handle;
     uint16_t end_group_handle;
-    uint16_t service_uuid16;
     uint16_t mtu;
-    uint8_t service_uuid128[16];
+    ble_uuid_any_t service_uuid;
     void *rsp_buf;
     int rc;
 
     /* Silence warnings. */
     rsp_buf = NULL;
-    service_uuid16 = 0;
     end_group_handle = 0;
 
     *att_err = 0;
@@ -1858,7 +1809,7 @@ ble_att_svr_build_read_group_type_rsp(uint16_t 
conn_handle,
                  */
                 rc = ble_att_svr_read_group_type_entry_write(
                     txom, mtu, start_group_handle, end_group_handle,
-                    service_uuid16, service_uuid128);
+                    &service_uuid.u);
                 start_group_handle = 0;
                 end_group_handle = 0;
                 if (rc != 0) {
@@ -1875,10 +1826,9 @@ ble_att_svr_build_read_group_type_rsp(uint16_t 
conn_handle,
 
         if (start_group_handle == 0) {
             /* We are looking for the start of a group. */
-            if (memcmp(entry->ha_uuid, group_uuid128, 16) == 0) {
+            if (ble_uuid_cmp(entry->ha_uuid, group_uuid) == 0) {
                 /* Found a group start.  Read the group UUID. */
-                rc = ble_att_svr_service_uuid(entry, &service_uuid16,
-                                              service_uuid128, att_err);
+                rc = ble_att_svr_service_uuid(entry, &service_uuid, att_err);
                 if (rc != 0) {
                     *err_handle = entry->ha_handle_id;
                     goto done;
@@ -1890,7 +1840,7 @@ ble_att_svr_build_read_group_type_rsp(uint16_t 
conn_handle,
                  */
                 switch (rsp.bagp_length) {
                 case 0:
-                    if (service_uuid16 != 0) {
+                    if (service_uuid.u.type == BLE_UUID_TYPE_16) {
                         rsp.bagp_length = BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_16;
                     } else {
                         rsp.bagp_length = BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_128;
@@ -1898,14 +1848,14 @@ ble_att_svr_build_read_group_type_rsp(uint16_t 
conn_handle,
                     break;
 
                 case BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_16:
-                    if (service_uuid16 == 0) {
+                    if (service_uuid.u.type != BLE_UUID_TYPE_16) {
                         rc = 0;
                         goto done;
                     }
                     break;
 
                 case BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_128:
-                    if (service_uuid16 != 0) {
+                    if (service_uuid.u.type == BLE_UUID_TYPE_16) {
                         rc = 0;
                         goto done;
                     }
@@ -1939,9 +1889,10 @@ done:
                 end_group_handle = 0xffff;
             }
 
-            rc = ble_att_svr_read_group_type_entry_write(
-                txom, mtu, start_group_handle, end_group_handle,
-                service_uuid16, service_uuid128);
+            rc = ble_att_svr_read_group_type_entry_write(txom, mtu,
+                                                         start_group_handle,
+                                                         end_group_handle,
+                                                         &service_uuid.u);
             if (rc == BLE_HS_ENOMEM) {
                 *att_err = BLE_ATT_ERR_INSUFFICIENT_RES;
             }
@@ -1975,10 +1926,11 @@ ble_att_svr_rx_read_group_type(uint16_t conn_handle, 
struct os_mbuf **rxom)
 
     struct ble_att_read_group_type_req req;
     struct os_mbuf *txom;
-    uint8_t uuid128[16];
+    ble_uuid_any_t uuid;
     uint16_t err_handle;
     uint16_t pktlen;
     uint8_t att_err;
+    int om_uuid_len;
     int rc;
 
     /* Initialize some values in case of early error. */
@@ -2011,8 +1963,11 @@ ble_att_svr_rx_read_group_type(uint16_t conn_handle, 
struct os_mbuf **rxom)
         goto done;
     }
 
-    rc = ble_uuid_extract(*rxom, BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
-                          uuid128);
+    om_uuid_len = OS_MBUF_PKTHDR(*rxom)->omp_len -
+                  BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ;
+    rc = ble_uuid_init_from_mbuf(&uuid, *rxom,
+                                 BLE_ATT_READ_GROUP_TYPE_REQ_BASE_SZ,
+                                 om_uuid_len);
     if (rc != 0) {
         att_err = BLE_ATT_ERR_INVALID_PDU;
         err_handle = req.bagq_start_handle;
@@ -2020,14 +1975,14 @@ ble_att_svr_rx_read_group_type(uint16_t conn_handle, 
struct os_mbuf **rxom)
         goto done;
     }
 
-    if (!ble_att_svr_is_valid_read_group_type(uuid128)) {
+    if (!ble_att_svr_is_valid_read_group_type(&uuid.u)) {
         att_err = BLE_ATT_ERR_UNSUPPORTED_GROUP;
         err_handle = req.bagq_start_handle;
         rc = BLE_HS_ENOTSUP;
         goto done;
     }
 
-    rc = ble_att_svr_build_read_group_type_rsp(conn_handle, &req, uuid128,
+    rc = ble_att_svr_build_read_group_type_rsp(conn_handle, &req, &uuid.u,
                                                rxom, &txom, &att_err,
                                                &err_handle);
     if (rc != 0) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1c14f3f/net/nimble/host/src/ble_gattc.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gattc.c b/net/nimble/host/src/ble_gattc.c
index 7cdee07..e448c8b 100644
--- a/net/nimble/host/src/ble_gattc.c
+++ b/net/nimble/host/src/ble_gattc.c
@@ -113,7 +113,7 @@ struct ble_gattc_proc {
         } disc_all_svcs;
 
         struct {
-            uint8_t service_uuid[16];
+            ble_uuid_any_t service_uuid;
             uint16_t prev_handle;
             ble_gatt_disc_svc_fn *cb;
             void *cb_arg;
@@ -138,7 +138,7 @@ struct ble_gattc_proc {
         } disc_all_chrs;
 
         struct {
-            uint8_t chr_uuid[16];
+            ble_uuid_any_t chr_uuid;
             uint16_t prev_handle;
             uint16_t end_handle;
             ble_gatt_chr_fn *cb;
@@ -160,7 +160,7 @@ struct ble_gattc_proc {
         } read;
 
         struct {
-            uint8_t chr_uuid[16];
+            ble_uuid_any_t chr_uuid;
             uint16_t start_handle;
             uint16_t end_handle;
             ble_gatt_attr_fn *cb;
@@ -491,24 +491,20 @@ ble_gattc_log_proc_init(char *name)
 }
 
 static void
-ble_gattc_log_uuid(const void *uuid128)
+ble_gattc_log_uuid(const ble_uuid_t *uuid)
 {
-    const uint8_t *u8p;
+    char buf[BLE_UUID_STR_LEN];
 
-    u8p = uuid128;
-    BLE_HS_LOG(INFO, "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-                     "%02x%02x%02x%02x%02x%02x%02x%02x",
-               u8p[15], u8p[14], u8p[13], u8p[12],
-               u8p[11], u8p[10], u8p[9], u8p[8],
-               u8p[7], u8p[6], u8p[5], u8p[4],
-               u8p[3], u8p[2], u8p[1], u8p[0]);
+    ble_uuid_to_str(uuid, buf);
+
+    BLE_HS_LOG(INFO, "%s", buf);
 }
 
 static void
 ble_gattc_log_disc_svc_uuid(struct ble_gattc_proc *proc)
 {
     ble_gattc_log_proc_init("discover service by uuid; uuid=");
-    ble_gattc_log_uuid(proc->disc_svc_uuid.service_uuid);
+    ble_gattc_log_uuid(&proc->disc_svc_uuid.service_uuid.u);
     BLE_HS_LOG(INFO, "\n");
 }
 
@@ -537,7 +533,7 @@ ble_gattc_log_disc_chr_uuid(struct ble_gattc_proc *proc)
     BLE_HS_LOG(INFO, "start_handle=%d end_handle=%d uuid=",
                proc->disc_chr_uuid.prev_handle + 1,
                proc->disc_chr_uuid.end_handle);
-    ble_gattc_log_uuid(proc->disc_chr_uuid.chr_uuid);
+    ble_gattc_log_uuid(&proc->disc_chr_uuid.chr_uuid.u);
     BLE_HS_LOG(INFO, "\n");
 }
 
@@ -559,20 +555,12 @@ ble_gattc_log_read(uint16_t att_handle)
 
 static void
 ble_gattc_log_read_uuid(uint16_t start_handle, uint16_t end_handle,
-                        const uint8_t *uuid128)
+                        const ble_uuid_t *uuid)
 {
-    uint16_t uuid16;
-
     ble_gattc_log_proc_init("read by uuid; ");
     BLE_HS_LOG(INFO, "start_handle=%d end_handle=%d uuid=",
                start_handle, end_handle);
-
-    uuid16 = ble_uuid_128_to_16(uuid128);
-    if (uuid16 != 0) {
-        BLE_HS_LOG(INFO, "0x%04x", uuid16);
-    } else {
-        ble_gattc_log_uuid(uuid128);
-    }
+    ble_gattc_log_uuid(uuid);
     BLE_HS_LOG(INFO, "\n");
 }
 
@@ -1394,17 +1382,14 @@ static int
 ble_gattc_disc_all_svcs_tx(struct ble_gattc_proc *proc)
 {
     struct ble_att_read_group_type_req req;
-    uint8_t uuid128[16];
+    ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_PRIMARY_SERVICE);
     int rc;
 
     ble_gattc_dbg_assert_proc_not_inserted(proc);
 
-    rc = ble_uuid_16_to_128(BLE_ATT_UUID_PRIMARY_SERVICE, uuid128);
-    BLE_HS_DBG_ASSERT_EVAL(rc == 0);
-
     req.bagq_start_handle = proc->disc_all_svcs.prev_handle + 1;
     req.bagq_end_handle = 0xffff;
-    rc = ble_att_clt_tx_read_group_type(proc->conn_handle, &req, uuid128);
+    rc = ble_att_clt_tx_read_group_type(proc->conn_handle, &req, &uuid.u);
     if (rc != 0) {
         return rc;
     }
@@ -1455,7 +1440,6 @@ ble_gattc_disc_all_svcs_rx_adata(struct ble_gattc_proc 
*proc,
                                  struct ble_att_read_group_type_adata *adata)
 {
     struct ble_gatt_svc service;
-    uint16_t uuid16;
     int cbrc;
     int rc;
 
@@ -1463,17 +1447,14 @@ ble_gattc_disc_all_svcs_rx_adata(struct ble_gattc_proc 
*proc,
 
     switch (adata->value_len) {
     case 2:
-        uuid16 = le16toh(adata->value);
-        rc = ble_uuid_16_to_128(uuid16, service.uuid128);
+    case 16:
+        rc = ble_uuid_init_from_buf(&service.uuid, adata->value, 
adata->value_len);
         if (rc != 0) {
+            rc = BLE_HS_EBADDATA;
             goto done;
         }
         break;
 
-    case 16:
-        memcpy(service.uuid128, adata->value, 16);
-        break;
-
     default:
         rc = BLE_HS_EBADDATA;
         goto done;
@@ -1636,7 +1617,7 @@ static int
 ble_gattc_disc_svc_uuid_tx(struct ble_gattc_proc *proc)
 {
     struct ble_att_find_type_value_req req;
-    uint16_t uuid16;
+    uint8_t val[16];
     int rc;
 
     ble_gattc_dbg_assert_proc_not_inserted(proc);
@@ -1645,17 +1626,9 @@ ble_gattc_disc_svc_uuid_tx(struct ble_gattc_proc *proc)
     req.bavq_end_handle = 0xffff;
     req.bavq_attr_type = BLE_ATT_UUID_PRIMARY_SERVICE;
 
-
-    uuid16 = ble_uuid_128_to_16(proc->disc_svc_uuid.service_uuid);
-    if (uuid16 != 0){
-        rc = ble_att_clt_tx_find_type_value(proc->conn_handle, &req,
-                                            &uuid16, 2);
-    } else {
-        rc = ble_att_clt_tx_find_type_value(proc->conn_handle, &req,
-                                            proc->disc_svc_uuid.service_uuid,
-                                            16);
-    }
-
+    ble_uuid_flat(&proc->disc_svc_uuid.service_uuid.u, val);
+    rc = ble_att_clt_tx_find_type_value(proc->conn_handle, &req, val,
+                                        
ble_uuid_length(&proc->disc_svc_uuid.service_uuid.u));
     if (rc != 0) {
         return rc;
     }
@@ -1721,7 +1694,7 @@ ble_gattc_disc_svc_uuid_rx_hinfo(struct ble_gattc_proc 
*proc,
 
     service.start_handle = hinfo->attr_handle;
     service.end_handle = hinfo->group_end_handle;
-    memcpy(service.uuid128, proc->disc_svc_uuid.service_uuid, 16);
+    service.uuid = proc->disc_svc_uuid.service_uuid;
 
     rc = 0;
 
@@ -1779,7 +1752,7 @@ ble_gattc_disc_svc_uuid_rx_complete(struct ble_gattc_proc 
*proc, int status)
  * @return                      0 on success; nonzero on failure.
  */
 int
-ble_gattc_disc_svc_by_uuid(uint16_t conn_handle, const void *svc_uuid128,
+ble_gattc_disc_svc_by_uuid(uint16_t conn_handle, const ble_uuid_t *uuid,
                            ble_gatt_disc_svc_fn *cb, void *cb_arg)
 {
 #if !MYNEWT_VAL(BLE_GATT_DISC_SVC_UUID)
@@ -1799,7 +1772,7 @@ ble_gattc_disc_svc_by_uuid(uint16_t conn_handle, const 
void *svc_uuid128,
 
     proc->op = BLE_GATT_OP_DISC_SVC_UUID;
     proc->conn_handle = conn_handle;
-    memcpy(proc->disc_svc_uuid.service_uuid, svc_uuid128, 16);
+    ble_uuid_to_any(uuid, &proc->disc_svc_uuid.service_uuid);
     proc->disc_svc_uuid.prev_handle = 0x0000;
     proc->disc_svc_uuid.cb = cb;
     proc->disc_svc_uuid.cb_arg = cb_arg;
@@ -1874,7 +1847,7 @@ ble_gattc_find_inc_svcs_tx(struct ble_gattc_proc *proc)
 {
     struct ble_att_read_type_req read_type_req;
     struct ble_att_read_req read_req;
-    uint8_t uuid128[16];
+    ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_INCLUDE);
     int rc;
 
     ble_gattc_dbg_assert_proc_not_inserted(proc);
@@ -1885,11 +1858,8 @@ ble_gattc_find_inc_svcs_tx(struct ble_gattc_proc *proc)
             proc->find_inc_svcs.prev_handle + 1;
         read_type_req.batq_end_handle = proc->find_inc_svcs.end_handle;
 
-        rc = ble_uuid_16_to_128(BLE_ATT_UUID_INCLUDE, uuid128);
-        BLE_HS_DBG_ASSERT_EVAL(rc == 0);
-
         rc = ble_att_clt_tx_read_type(proc->conn_handle,
-                                      &read_type_req, uuid128);
+                                      &read_type_req, &uuid.u);
         if (rc != 0) {
             return rc;
         }
@@ -1950,16 +1920,15 @@ ble_gattc_find_inc_svcs_rx_read_rsp(struct 
ble_gattc_proc *proc, int status,
                                     struct os_mbuf **om)
 {
     struct ble_gatt_svc service;
-    uint16_t om_len;
     int rc;
 
     ble_gattc_dbg_assert_proc_not_inserted(proc);
 
-    rc = ble_hs_mbuf_to_flat(*om, service.uuid128, 16, &om_len);
+    rc = ble_uuid_init_from_mbuf(&service.uuid, *om, 0, 16);
     os_mbuf_free_chain(*om);
     *om = NULL;
 
-    if (rc != 0 || om_len != 16) {
+    if (rc != 0) {
         /* Invalid UUID. */
         rc = BLE_HS_EBADDATA;
         goto err;
@@ -2009,7 +1978,6 @@ ble_gattc_find_inc_svcs_rx_adata(struct ble_gattc_proc 
*proc,
                                  struct ble_att_read_type_adata *adata)
 {
     struct ble_gatt_svc service;
-    uint16_t uuid16;
     int call_cb;
     int cbrc;
     int rc;
@@ -2043,13 +2011,7 @@ ble_gattc_find_inc_svcs_rx_adata(struct ble_gattc_proc 
*proc,
     case BLE_GATTS_INC_SVC_LEN_UUID:
         service.start_handle = le16toh(adata->value + 0);
         service.end_handle = le16toh(adata->value + 2);
-        uuid16 = le16toh(adata->value + 4);
-        rc = ble_uuid_16_to_128(uuid16, service.uuid128);
-        if (rc != 0) {
-            rc = BLE_HS_EBADDATA;
-            goto done;
-        }
-
+        ble_uuid_init_from_buf(&service.uuid, adata->value + 4, 2);
         break;
 
     default:
@@ -2218,18 +2180,15 @@ static int
 ble_gattc_disc_all_chrs_tx(struct ble_gattc_proc *proc)
 {
     struct ble_att_read_type_req req;
-    uint8_t uuid128[16];
+    ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_CHARACTERISTIC);
     int rc;
 
     ble_gattc_dbg_assert_proc_not_inserted(proc);
 
-    rc = ble_uuid_16_to_128(BLE_ATT_UUID_CHARACTERISTIC, uuid128);
-    BLE_HS_DBG_ASSERT_EVAL(rc == 0);
-
     req.batq_start_handle = proc->disc_all_chrs.prev_handle + 1;
     req.batq_end_handle = proc->disc_all_chrs.end_handle;
 
-    rc = ble_att_clt_tx_read_type(proc->conn_handle, &req, uuid128);
+    rc = ble_att_clt_tx_read_type(proc->conn_handle, &req, &uuid.u);
     if (rc != 0) {
         return rc;
     }
@@ -2280,7 +2239,6 @@ ble_gattc_disc_all_chrs_rx_adata(struct ble_gattc_proc 
*proc,
                                  struct ble_att_read_type_adata *adata)
 {
     struct ble_gatt_chr chr;
-    uint16_t uuid16;
     int cbrc;
     int rc;
 
@@ -2291,18 +2249,15 @@ ble_gattc_disc_all_chrs_rx_adata(struct ble_gattc_proc 
*proc,
 
     switch (adata->value_len) {
     case BLE_GATT_CHR_DECL_SZ_16:
-        uuid16 = le16toh(adata->value + 3);
-        rc = ble_uuid_16_to_128(uuid16, chr.uuid128);
+    case BLE_GATT_CHR_DECL_SZ_128:
+        rc = ble_uuid_init_from_buf(&chr.uuid, adata->value + 3,
+                                    adata->value_len - 3);
         if (rc != 0) {
             rc = BLE_HS_EBADDATA;
             goto done;
         }
         break;
 
-    case BLE_GATT_CHR_DECL_SZ_128:
-        memcpy(chr.uuid128, adata->value + 3, 16);
-        break;
-
     default:
         rc = BLE_HS_EBADDATA;
         goto done;
@@ -2471,18 +2426,15 @@ static int
 ble_gattc_disc_chr_uuid_tx(struct ble_gattc_proc *proc)
 {
     struct ble_att_read_type_req req;
-    uint8_t uuid128[16];
+    ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_CHARACTERISTIC);
     int rc;
 
     ble_gattc_dbg_assert_proc_not_inserted(proc);
 
-    rc = ble_uuid_16_to_128(BLE_ATT_UUID_CHARACTERISTIC, uuid128);
-    BLE_HS_DBG_ASSERT_EVAL(rc == 0);
-
     req.batq_start_handle = proc->disc_chr_uuid.prev_handle + 1;
     req.batq_end_handle = proc->disc_chr_uuid.end_handle;
 
-    rc = ble_att_clt_tx_read_type(proc->conn_handle, &req, uuid128);
+    rc = ble_att_clt_tx_read_type(proc->conn_handle, &req, &uuid.u);
     if (rc != 0) {
         return rc;
     }
@@ -2533,7 +2485,6 @@ ble_gattc_disc_chr_uuid_rx_adata(struct ble_gattc_proc 
*proc,
                                  struct ble_att_read_type_adata *adata)
 {
     struct ble_gatt_chr chr;
-    uint16_t uuid16;
     int cbrc;
     int rc;
 
@@ -2544,18 +2495,15 @@ ble_gattc_disc_chr_uuid_rx_adata(struct ble_gattc_proc 
*proc,
 
     switch (adata->value_len) {
     case BLE_GATT_CHR_DECL_SZ_16:
-        uuid16 = le16toh(adata->value + 3);
-        rc = ble_uuid_16_to_128(uuid16, chr.uuid128);
+    case BLE_GATT_CHR_DECL_SZ_128:
+        rc = ble_uuid_init_from_buf(&chr.uuid, adata->value + 3,
+                                    adata->value_len - 3);
         if (rc != 0) {
             rc = BLE_HS_EBADDATA;
             goto done;
         }
         break;
 
-    case BLE_GATT_CHR_DECL_SZ_128:
-        memcpy(chr.uuid128, adata->value + 3, 16);
-        break;
-
     default:
         rc = BLE_HS_EBADDATA;
         goto done;
@@ -2578,7 +2526,7 @@ done:
     if (rc != 0) {
         /* Failure. */
         cbrc = ble_gattc_disc_chr_uuid_cb(proc, rc, 0, NULL);
-    } else if (memcmp(chr.uuid128, proc->disc_chr_uuid.chr_uuid, 16) == 0) {
+    } else if (ble_uuid_cmp(&chr.uuid.u, &proc->disc_chr_uuid.chr_uuid.u) == 
0) {
         /* Requested characteristic discovered. */
         cbrc = ble_gattc_disc_chr_uuid_cb(proc, 0, 0, &chr);
     } else {
@@ -2643,7 +2591,7 @@ ble_gattc_disc_chr_uuid_rx_complete(struct ble_gattc_proc 
*proc, int status)
  */
 int
 ble_gattc_disc_chrs_by_uuid(uint16_t conn_handle, uint16_t start_handle,
-                            uint16_t end_handle, const void *uuid128,
+                            uint16_t end_handle, const ble_uuid_t *uuid,
                             ble_gatt_chr_fn *cb, void *cb_arg)
 {
 #if !MYNEWT_VAL(BLE_GATT_DISC_CHR_UUID)
@@ -2663,7 +2611,7 @@ ble_gattc_disc_chrs_by_uuid(uint16_t conn_handle, 
uint16_t start_handle,
 
     proc->op = BLE_GATT_OP_DISC_CHR_UUID;
     proc->conn_handle = conn_handle;
-    memcpy(proc->disc_chr_uuid.chr_uuid, uuid128, 16);
+    ble_uuid_to_any(uuid, &proc->disc_chr_uuid.chr_uuid);
     proc->disc_chr_uuid.prev_handle = start_handle - 1;
     proc->disc_chr_uuid.end_handle = end_handle;
     proc->disc_chr_uuid.cb = cb;
@@ -2812,7 +2760,7 @@ ble_gattc_disc_all_dscs_rx_idata(struct ble_gattc_proc 
*proc,
 
 done:
     dsc.handle = idata->attr_handle;
-    memcpy(dsc.uuid128, idata->uuid128, 16);
+    dsc.uuid = idata->uuid;
 
     cbrc = ble_gattc_disc_all_dscs_cb(proc, rc, 0, &dsc);
     if (rc != 0 || cbrc != 0) {
@@ -3185,7 +3133,7 @@ ble_gattc_read_uuid_tx(struct ble_gattc_proc *proc)
     req.batq_end_handle = proc->read_uuid.end_handle;
 
     rc = ble_att_clt_tx_read_type(proc->conn_handle, &req,
-                                  proc->read_uuid.chr_uuid);
+                                  &proc->read_uuid.chr_uuid.u);
     if (rc != 0) {
         return rc;
     }
@@ -3211,7 +3159,7 @@ ble_gattc_read_uuid_tx(struct ble_gattc_proc *proc)
  */
 int
 ble_gattc_read_by_uuid(uint16_t conn_handle, uint16_t start_handle,
-                       uint16_t end_handle, const void *uuid128,
+                       uint16_t end_handle, const ble_uuid_t *uuid,
                        ble_gatt_attr_fn *cb, void *cb_arg)
 {
 #if !MYNEWT_VAL(BLE_GATT_READ_UUID)
@@ -3231,13 +3179,13 @@ ble_gattc_read_by_uuid(uint16_t conn_handle, uint16_t 
start_handle,
 
     proc->op = BLE_GATT_OP_READ_UUID;
     proc->conn_handle = conn_handle;
-    memcpy(proc->read_uuid.chr_uuid, uuid128, 16);
+    ble_uuid_to_any(uuid, &proc->read_uuid.chr_uuid);
     proc->read_uuid.start_handle = start_handle;
     proc->read_uuid.end_handle = end_handle;
     proc->read_uuid.cb = cb;
     proc->read_uuid.cb_arg = cb_arg;
 
-    ble_gattc_log_read_uuid(start_handle, end_handle, uuid128);
+    ble_gattc_log_read_uuid(start_handle, end_handle, uuid);
     rc = ble_gattc_read_uuid_tx(proc);
     if (rc != 0) {
         goto done;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1c14f3f/net/nimble/host/src/ble_gatts.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gatts.c b/net/nimble/host/src/ble_gatts.c
index 4a5ddfb..58ca631 100644
--- a/net/nimble/host/src/ble_gatts.c
+++ b/net/nimble/host/src/ble_gatts.c
@@ -28,6 +28,17 @@
 #define BLE_GATTS_INCLUDE_SZ    6
 #define BLE_GATTS_CHR_MAX_SZ    19
 
+static const ble_uuid_t *uuid_pri =
+    BLE_UUID16_DECLARE(BLE_ATT_UUID_PRIMARY_SERVICE);
+static const ble_uuid_t *uuid_sec =
+    BLE_UUID16_DECLARE(BLE_ATT_UUID_SECONDARY_SERVICE);
+static const ble_uuid_t *uuid_inc =
+    BLE_UUID16_DECLARE(BLE_ATT_UUID_INCLUDE);
+static const ble_uuid_t *uuid_chr =
+    BLE_UUID16_DECLARE(BLE_ATT_UUID_CHARACTERISTIC);
+static const ble_uuid_t *uuid_ccc =
+    BLE_UUID16_DECLARE(BLE_GATT_DSC_CLT_CFG_UUID16);
+
 static const struct ble_gatt_svc_def **ble_gatts_svc_defs;
 static int ble_gatts_num_svc_defs;
 
@@ -73,9 +84,7 @@ ble_gatts_svc_access(uint16_t conn_handle, uint16_t 
attr_handle,
                      void *arg)
 {
     const struct ble_gatt_svc_def *svc;
-    uint16_t uuid16;
     uint8_t *buf;
-    int rc;
 
     STATS_INC(ble_gatts_stats, svc_def_reads);
 
@@ -83,20 +92,13 @@ ble_gatts_svc_access(uint16_t conn_handle, uint16_t 
attr_handle,
 
     svc = arg;
 
-    uuid16 = ble_uuid_128_to_16(svc->uuid128);
-    if (uuid16 != 0) {
-        buf = os_mbuf_extend(*om, 2);
-        if (buf == NULL) {
-            return BLE_ATT_ERR_INSUFFICIENT_RES;
-        }
-        htole16(buf, uuid16);
-    } else {
-        rc = os_mbuf_append(*om, svc->uuid128, 16);
-        if (rc != 0) {
-            return BLE_ATT_ERR_INSUFFICIENT_RES;
-        }
+    buf = os_mbuf_extend(*om, ble_uuid_length(svc->uuid));
+    if (buf == NULL) {
+        return BLE_ATT_ERR_INSUFFICIENT_RES;
     }
 
+    ble_uuid_flat(svc->uuid, buf);
+
     return 0;
 }
 
@@ -123,7 +125,7 @@ ble_gatts_inc_access(uint16_t conn_handle, uint16_t 
attr_handle,
     htole16(buf + 2, entry->end_group_handle);
 
     /* Only include the service UUID if it has a 16-bit representation. */
-    uuid16 = ble_uuid_128_to_16(entry->svc->uuid128);
+    uuid16 = ble_uuid_u16(entry->svc->uuid);
     if (uuid16 != 0) {
         buf = os_mbuf_extend(*om, 2);
         if (buf == NULL) {
@@ -228,7 +230,6 @@ ble_gatts_chr_def_access(uint16_t conn_handle, uint16_t 
attr_handle,
                          void *arg)
 {
     const struct ble_gatt_chr_def *chr;
-    uint16_t uuid16;
     uint8_t *buf;
 
     STATS_INC(ble_gatts_stats, chr_def_reads);
@@ -247,28 +248,20 @@ ble_gatts_chr_def_access(uint16_t conn_handle, uint16_t 
attr_handle,
     /* The value attribute is always immediately after the declaration. */
     htole16(buf + 1, attr_handle + 1);
 
-    uuid16 = ble_uuid_128_to_16(chr->uuid128);
-    if (uuid16 != 0) {
-        buf = os_mbuf_extend(*om, 2);
-        if (buf == NULL) {
-            return BLE_ATT_ERR_INSUFFICIENT_RES;
-        }
-        htole16(buf, uuid16);
-    } else {
-        buf = os_mbuf_extend(*om, 16);
-        if (buf == NULL) {
-            return BLE_ATT_ERR_INSUFFICIENT_RES;
-        }
-        memcpy(buf, chr->uuid128, 16);
+    buf = os_mbuf_extend(*om, ble_uuid_length(chr->uuid));
+    if (buf == NULL) {
+        return BLE_ATT_ERR_INSUFFICIENT_RES;
     }
 
+    ble_uuid_flat(chr->uuid, buf);
+
     return 0;
 }
 
 static int
 ble_gatts_chr_is_sane(const struct ble_gatt_chr_def *chr)
 {
-    if (chr->uuid128 == NULL) {
+    if (chr->uuid == NULL) {
         return 0;
     }
 
@@ -423,8 +416,8 @@ ble_gatts_register_inc(struct ble_gatts_svc_entry *entry)
     BLE_HS_DBG_ASSERT(entry->handle != 0);
     BLE_HS_DBG_ASSERT(entry->end_group_handle != 0xffff);
 
-    rc = ble_att_svr_register_uuid16(BLE_ATT_UUID_INCLUDE, BLE_ATT_F_READ, 0,
-                                     &handle, ble_gatts_inc_access, entry);
+    rc = ble_att_svr_register(uuid_inc, BLE_ATT_F_READ, 0, &handle,
+                              ble_gatts_inc_access, entry);
     if (rc != 0) {
         return rc;
     }
@@ -490,7 +483,7 @@ ble_gatts_dsc_access(uint16_t conn_handle, uint16_t 
attr_handle,
 static int
 ble_gatts_dsc_is_sane(const struct ble_gatt_dsc_def *dsc)
 {
-    if (dsc->uuid128 == NULL) {
+    if (dsc->uuid == NULL) {
         return 0;
     }
 
@@ -516,7 +509,7 @@ ble_gatts_register_dsc(const struct ble_gatt_svc_def *svc,
         return BLE_HS_EINVAL;
     }
 
-    rc = ble_att_svr_register(dsc->uuid128, dsc->att_flags, dsc->min_key_size,
+    rc = ble_att_svr_register(dsc->uuid, dsc->att_flags, dsc->min_key_size,
                               &dsc_handle, ble_gatts_dsc_access, (void *)dsc);
     if (rc != 0) {
         return rc;
@@ -744,15 +737,9 @@ ble_gatts_clt_cfg_access(uint16_t conn_handle, uint16_t 
attr_handle,
 static int
 ble_gatts_register_clt_cfg_dsc(uint16_t *att_handle)
 {
-    uint8_t uuid128[16];
     int rc;
 
-    rc = ble_uuid_16_to_128(BLE_GATT_DSC_CLT_CFG_UUID16, uuid128);
-    if (rc != 0) {
-        return rc;
-    }
-
-    rc = ble_att_svr_register(uuid128, BLE_ATT_F_READ | BLE_ATT_F_WRITE, 0,
+    rc = ble_att_svr_register(uuid_ccc, BLE_ATT_F_READ | BLE_ATT_F_WRITE, 0,
                               att_handle, ble_gatts_clt_cfg_access, NULL);
     if (rc != 0) {
         return rc;
@@ -790,9 +777,8 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
     /* Register characteristic definition attribute (cast away const on
      * callback arg).
      */
-    rc = ble_att_svr_register_uuid16(BLE_ATT_UUID_CHARACTERISTIC,
-                                     BLE_ATT_F_READ, 0, &def_handle,
-                                     ble_gatts_chr_def_access, (void *)chr);
+    rc = ble_att_svr_register(uuid_chr, BLE_ATT_F_READ, 0, &def_handle,
+                              ble_gatts_chr_def_access, (void *)chr);
     if (rc != 0) {
         return rc;
     }
@@ -801,7 +787,7 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
      * arg).
      */
     att_flags = ble_gatts_att_flags_from_chr_flags(chr->flags);
-    rc = ble_att_svr_register(chr->uuid128, att_flags, chr->min_key_size,
+    rc = ble_att_svr_register(chr->uuid, att_flags, chr->min_key_size,
                               &val_handle, ble_gatts_chr_val_access,
                               (void *)chr);
     if (rc != 0) {
@@ -832,7 +818,7 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
 
     /* Register each descriptor. */
     if (chr->descriptors != NULL) {
-        for (dsc = chr->descriptors; dsc->uuid128 != NULL; dsc++) {
+        for (dsc = chr->descriptors; dsc->uuid != NULL; dsc++) {
             rc = ble_gatts_register_dsc(svc, chr, dsc, def_handle, register_cb,
                                         cb_arg);
             if (rc != 0) {
@@ -847,15 +833,15 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
 }
 
 static int
-ble_gatts_svc_type_to_uuid(uint8_t svc_type, uint16_t *out_uuid16)
+ble_gatts_svc_type_to_uuid(uint8_t svc_type, const ble_uuid_t **uuid)
 {
     switch (svc_type) {
     case BLE_GATT_SVC_TYPE_PRIMARY:
-        *out_uuid16 = BLE_ATT_UUID_PRIMARY_SERVICE;
+        *uuid = uuid_pri;
         return 0;
 
     case BLE_GATT_SVC_TYPE_SECONDARY:
-        *out_uuid16 = BLE_ATT_UUID_SECONDARY_SERVICE;
+        *uuid = uuid_sec;
         return 0;
 
     default:
@@ -872,7 +858,7 @@ ble_gatts_svc_is_sane(const struct ble_gatt_svc_def *svc)
         return 0;
     }
 
-    if (svc->uuid128 == NULL) {
+    if (svc->uuid == NULL) {
         return 0;
     }
 
@@ -886,7 +872,7 @@ ble_gatts_register_svc(const struct ble_gatt_svc_def *svc,
 {
     const struct ble_gatt_chr_def *chr;
     struct ble_gatt_register_ctxt register_ctxt;
-    uint16_t uuid16;
+    const ble_uuid_t *uuid;
     int idx;
     int rc;
     int i;
@@ -900,15 +886,15 @@ ble_gatts_register_svc(const struct ble_gatt_svc_def *svc,
     }
 
     /* Prevent spurious maybe-uninitialized gcc warning. */
-    uuid16 = 0;
+    uuid = NULL;
 
-    rc = ble_gatts_svc_type_to_uuid(svc->type, &uuid16);
+    rc = ble_gatts_svc_type_to_uuid(svc->type, &uuid);
     BLE_HS_DBG_ASSERT_EVAL(rc == 0);
 
     /* Register service definition attribute (cast away const on callback
      * arg).
      */
-    rc = ble_att_svr_register_uuid16(uuid16, BLE_ATT_F_READ, 0, out_handle,
+    rc = ble_att_svr_register(uuid, BLE_ATT_F_READ, 0, out_handle,
                                      ble_gatts_svc_access, (void *)svc);
     if (rc != 0) {
         return rc;
@@ -936,7 +922,7 @@ ble_gatts_register_svc(const struct ble_gatt_svc_def *svc,
 
     /* Register each characteristic. */
     if (svc->characteristics != NULL) {
-        for (chr = svc->characteristics; chr->uuid128 != NULL; chr++) {
+        for (chr = svc->characteristics; chr->uuid != NULL; chr++) {
             rc = ble_gatts_register_chr(svc, chr, register_cb, cb_arg);
             if (rc != 0) {
                 return rc;
@@ -1137,7 +1123,7 @@ ble_gatts_start(void)
     struct ble_att_svr_entry *ha;
     struct ble_gatt_chr_def *chr;
     uint16_t allowed_flags;
-    uint8_t uuid128[16];
+    ble_uuid16_t uuid = BLE_UUID16_INIT(BLE_ATT_UUID_CHARACTERISTIC);
     int num_elems;
     int idx;
     int rc;
@@ -1200,11 +1186,9 @@ ble_gatts_start(void)
     }
 
     /* Fill the cache. */
-    rc = ble_uuid_16_to_128(BLE_ATT_UUID_CHARACTERISTIC, uuid128);
-    BLE_HS_DBG_ASSERT_EVAL(rc == 0);
     idx = 0;
     ha = NULL;
-    while ((ha = ble_att_svr_find_by_uuid(ha, uuid128, 0xffff)) != NULL) {
+    while ((ha = ble_att_svr_find_by_uuid(ha, &uuid.u, 0xffff)) != NULL) {
         chr = ha->ha_cb_arg;
         allowed_flags = ble_gatts_chr_clt_cfg_allowed(chr);
         if (allowed_flags != 0) {
@@ -1710,14 +1694,14 @@ ble_gatts_bonding_restored(uint16_t conn_handle)
 }
 
 static struct ble_gatts_svc_entry *
-ble_gatts_find_svc_entry(const void *uuid128)
+ble_gatts_find_svc_entry(const ble_uuid_t *uuid)
 {
     struct ble_gatts_svc_entry *entry;
     int i;
 
     for (i = 0; i < ble_gatts_num_svc_entries; i++) {
         entry = ble_gatts_svc_entries + i;
-        if (memcmp(uuid128, entry->svc->uuid128, 16) == 0) {
+        if (ble_uuid_cmp(uuid, entry->svc->uuid) == 0) {
             return entry;
         }
     }
@@ -1726,7 +1710,7 @@ ble_gatts_find_svc_entry(const void *uuid128)
 }
 
 static int
-ble_gatts_find_svc_chr_attr(const void *svc_uuid128, const void *chr_uuid128,
+ble_gatts_find_svc_chr_attr(const ble_uuid_t *svc_uuid, const ble_uuid_t 
*chr_uuid,
                             struct ble_gatts_svc_entry **out_svc_entry,
                             struct ble_att_svr_entry **out_att_chr)
 {
@@ -1734,9 +1718,8 @@ ble_gatts_find_svc_chr_attr(const void *svc_uuid128, 
const void *chr_uuid128,
     struct ble_att_svr_entry *att_svc;
     struct ble_att_svr_entry *next;
     struct ble_att_svr_entry *cur;
-    uint16_t uuid16;
 
-    svc_entry = ble_gatts_find_svc_entry(svc_uuid128);
+    svc_entry = ble_gatts_find_svc_entry(svc_uuid);
     if (svc_entry == NULL) {
         return BLE_HS_ENOENT;
     }
@@ -1759,10 +1742,9 @@ ble_gatts_find_svc_chr_attr(const void *svc_uuid128, 
const void *chr_uuid128,
             return BLE_HS_ENOENT;
         }
 
-        uuid16 = ble_uuid_128_to_16(cur->ha_uuid);
-        if (uuid16 == BLE_ATT_UUID_CHARACTERISTIC &&
+        if (ble_uuid_u16(cur->ha_uuid) == BLE_ATT_UUID_CHARACTERISTIC &&
             next != NULL &&
-            memcmp(next->ha_uuid, chr_uuid128, 16) == 0) {
+            ble_uuid_cmp(next->ha_uuid, chr_uuid) == 0) {
 
             if (out_svc_entry != NULL) {
                 *out_svc_entry = svc_entry;
@@ -1790,11 +1772,11 @@ ble_gatts_find_svc_chr_attr(const void *svc_uuid128, 
const void *chr_uuid128,
  *                                  not be found.
  */
 int
-ble_gatts_find_svc(const void *uuid128, uint16_t *out_handle)
+ble_gatts_find_svc(const ble_uuid_t *uuid, uint16_t *out_handle)
 {
     struct ble_gatts_svc_entry *entry;
 
-    entry = ble_gatts_find_svc_entry(uuid128);
+    entry = ble_gatts_find_svc_entry(uuid);
     if (entry == NULL) {
         return BLE_HS_ENOENT;
     }
@@ -1823,13 +1805,13 @@ ble_gatts_find_svc(const void *uuid128, uint16_t 
*out_handle)
  *                                  characteristic could not be found.
  */
 int
-ble_gatts_find_chr(const void *svc_uuid128, const void *chr_uuid128,
+ble_gatts_find_chr(const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid,
                    uint16_t *out_def_handle, uint16_t *out_val_handle)
 {
     struct ble_att_svr_entry *att_chr;
     int rc;
 
-    rc = ble_gatts_find_svc_chr_attr(svc_uuid128, chr_uuid128, NULL, &att_chr);
+    rc = ble_gatts_find_svc_chr_attr(svc_uuid, chr_uuid, NULL, &att_chr);
     if (rc != 0) {
         return rc;
     }
@@ -1859,8 +1841,8 @@ ble_gatts_find_chr(const void *svc_uuid128, const void 
*chr_uuid128,
  *                                  found.
  */
 int
-ble_gatts_find_dsc(const void *svc_uuid128, const void *chr_uuid128,
-                   const void *dsc_uuid128, uint16_t *out_handle)
+ble_gatts_find_dsc(const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid,
+                   const ble_uuid_t *dsc_uuid, uint16_t *out_handle)
 {
     struct ble_gatts_svc_entry *svc_entry;
     struct ble_att_svr_entry *att_chr;
@@ -1868,7 +1850,7 @@ ble_gatts_find_dsc(const void *svc_uuid128, const void 
*chr_uuid128,
     uint16_t uuid16;
     int rc;
 
-    rc = ble_gatts_find_svc_chr_attr(svc_uuid128, chr_uuid128, &svc_entry,
+    rc = ble_gatts_find_svc_chr_attr(svc_uuid, chr_uuid, &svc_entry,
                                      &att_chr);
     if (rc != 0) {
         return rc;
@@ -1886,13 +1868,13 @@ ble_gatts_find_dsc(const void *svc_uuid128, const void 
*chr_uuid128,
             return BLE_HS_ENOENT;
         }
 
-        uuid16 = ble_uuid_128_to_16(cur->ha_uuid);
+        uuid16 = ble_uuid_u16(cur->ha_uuid);
         if (uuid16 == BLE_ATT_UUID_CHARACTERISTIC) {
             /* Reached end of characteristic without a match. */
             return BLE_HS_ENOENT;
         }
 
-        if (memcmp(cur->ha_uuid, dsc_uuid128, 16) == 0) {
+        if (ble_uuid_cmp(cur->ha_uuid, dsc_uuid) == 0) {
             if (out_handle != NULL) {
                 *out_handle = cur->ha_handle_id;
                 return 0;
@@ -1988,7 +1970,7 @@ ble_gatts_count_resources(const struct ble_gatt_svc_def 
*svcs,
         }
 
         if (svc->characteristics != NULL) {
-            for (c = 0; svc->characteristics[c].uuid128 != NULL; c++) {
+            for (c = 0; svc->characteristics[c].uuid != NULL; c++) {
                 chr = svc->characteristics + c;
 
                 if (!ble_gatts_chr_is_sane(chr)) {
@@ -2020,7 +2002,7 @@ ble_gatts_count_resources(const struct ble_gatt_svc_def 
*svcs,
                 }
 
                 if (chr->descriptors != NULL) {
-                    for (d = 0; chr->descriptors[d].uuid128 != NULL; d++) {
+                    for (d = 0; chr->descriptors[d].uuid != NULL; d++) {
                         if (!ble_gatts_dsc_is_sane(chr->descriptors + d)) {
                             BLE_HS_DBG_ASSERT(0);
                             return BLE_HS_EINVAL;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1c14f3f/net/nimble/host/src/ble_uuid.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_uuid.c b/net/nimble/host/src/ble_uuid.c
index 1640e9c..2399018 100644
--- a/net/nimble/host/src/ble_uuid.c
+++ b/net/nimble/host/src/ble_uuid.c
@@ -18,6 +18,7 @@
  */
 
 #include <inttypes.h>
+#include <stdio.h>
 #include <string.h>
 #include <errno.h>
 #include "os/os_mbuf.h"
@@ -30,127 +31,194 @@ static uint8_t ble_uuid_base[16] = {
     0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
-/**
- * Attempts to convert the supplied 128-bit UUID into its shortened 16-bit
- * form.
- *
- * @param uuid128                   The 128-bit UUID to attempt to convert.
- *                                      This must point to 16 contiguous bytes.
- *
- * @return                          A positive 16-bit unsigned integer on
- *                                      success;
- *                                  0 if the UUID cannot be represented in 16
- *                                      bits.
- */
-uint16_t
-ble_uuid_128_to_16(const void *uuid128)
+#if MYNEWT_VAL(BLE_HS_DEBUG)
+static int verify_uuid(const ble_uuid_t *uuid)
 {
-    const uint8_t *u8ptr;
-    uint16_t uuid16;
-    int rc;
-
-    u8ptr = uuid128;
-
-    /* The UUID can only be converted if the final 96 bits of its big endian
-     * representation are equal to the base UUID.
-     */
-    rc = memcmp(u8ptr, ble_uuid_base, sizeof ble_uuid_base - 4);
-    if (rc != 0) {
+    switch (uuid->type) {
+    case BLE_UUID_TYPE_16:
+    case BLE_UUID_TYPE_32:
         return 0;
+    case BLE_UUID_TYPE_128:
+        if (memcmp(BLE_UUID128(uuid)->value, ble_uuid_base, 12) != 0) {
+            return 0;
+        }
+        break;
     }
 
-    if (u8ptr[14] != 0 || u8ptr[15] != 0) {
-        /* This UUID has a 32-bit form, but not a 16-bit form. */
-        return 0;
-    }
+    return BLE_HS_EBADDATA;
+}
+#endif
 
-    uuid16 = le16toh(u8ptr + 12);
-    if (uuid16 == 0) {
+int
+ble_uuid_init_from_buf(ble_uuid_any_t *uuid, const void *buf, size_t len)
+{
+    switch (len) {
+    case 2:
+        uuid->u.type = BLE_UUID_TYPE_16;
+        uuid->u16.value = le16toh(buf);
+        return 0;
+    case 4:
+        uuid->u.type = BLE_UUID_TYPE_32;
+        uuid->u32.value = le32toh(buf);
+        return 0;
+    case 16:
+        uuid->u.type = BLE_UUID_TYPE_128;
+        memcpy(uuid->u128.value, buf, 16);
         return 0;
     }
 
-    return uuid16;
+    return BLE_HS_EINVAL;
 }
 
-/**
- * Expands a 16-bit UUID into its 128-bit form.
- *
- * @param uuid16                The 16-bit UUID to convert.
- * @param out_uuid128           On success, the resulting 128-bit UUID gets
- *                                  written here.
- *
- * @return                      0 on success;
- *                              BLE_HS_EINVAL if uuid16 is not a valid 16-bit
- *                                  UUID.
- */
 int
-ble_uuid_16_to_128(uint16_t uuid16, void *out_uuid128)
+ble_uuid_cmp(const ble_uuid_t *uuid1, const ble_uuid_t *uuid2)
 {
-    uint8_t *u8ptr;
+    BLE_HS_DBG_ASSERT(verify_uuid(uuid1) == 0);
+    BLE_HS_DBG_ASSERT(verify_uuid(uuid2) == 0);
+
+    switch (uuid1->type) {
+    case BLE_UUID_TYPE_16:
+        return (int) BLE_UUID16(uuid1)->value - (int) BLE_UUID16(uuid2)->value;
+    case BLE_UUID_TYPE_32:
+        return (int) BLE_UUID32(uuid1)->value - (int) BLE_UUID32(uuid2)->value;
+    case BLE_UUID_TYPE_128:
+        return memcmp(BLE_UUID128(uuid1)->value, BLE_UUID128(uuid2)->value, 
16);
+    }
 
-    if (uuid16 == 0) {
-        return BLE_HS_EINVAL;
+    BLE_HS_DBG_ASSERT(0);
+
+    return 0;
+}
+
+char *
+ble_uuid_to_str(const ble_uuid_t *uuid, char *dst)
+{
+    const uint8_t *u8p;
+
+    switch (uuid->type) {
+    case BLE_UUID_TYPE_16:
+        sprintf(dst, "0x%04" PRIx16, BLE_UUID16(uuid)->value);
+        break;
+    case BLE_UUID_TYPE_32:
+        sprintf(dst, "0x%08" PRIx32, BLE_UUID32(uuid)->value);
+        break;
+    case BLE_UUID_TYPE_128:
+        u8p = BLE_UUID128(uuid)->value;
+
+        sprintf(dst, 
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x",
+                u8p[15], u8p[14], u8p[13], u8p[12],
+                u8p[11], u8p[10],  u8p[9],  u8p[8],
+                 u8p[7],  u8p[6],  u8p[5],  u8p[4],
+                 u8p[3],  u8p[2],  u8p[1],  u8p[0]);
+        break;
+    default:
+        dst[0] = '\0';
+        break;
     }
 
-    u8ptr = out_uuid128;
+    return dst;
+}
 
-    memcpy(u8ptr, ble_uuid_base, 16);
-    htole16(u8ptr + 12, uuid16);
+uint16_t
+ble_uuid_u16(const ble_uuid_t *uuid)
+{
+    BLE_HS_DBG_ASSERT(verify_uuid(uuid) == 0);
 
-    return 0;
+    return uuid->type == BLE_UUID_TYPE_16 ? BLE_UUID16(uuid)->value : 0;
 }
 
+/* APIs below are private (ble_uuid_priv.h) */
+
 int
-ble_uuid_append(struct os_mbuf *om, const void *uuid128)
+ble_uuid_init_from_mbuf(ble_uuid_any_t *uuid, struct os_mbuf *om, int off,
+                          int len)
 {
-    uint16_t uuid16;
-    void *buf;
+    uint8_t val[16];
     int rc;
 
-    uuid16 = ble_uuid_128_to_16(uuid128);
-    if (uuid16 != 0) {
-        buf = os_mbuf_extend(om, 2);
-        if (buf == NULL) {
-            return BLE_HS_ENOMEM;
-        }
+    rc = os_mbuf_copydata(om, off, len, val);
+    if (rc != 0) {
+        return rc;
+    }
 
-        htole16(buf, uuid16);
-    } else {
-        rc = os_mbuf_append(om, uuid128, 16);
-        if (rc != 0) {
-            return BLE_HS_ENOMEM;
-        }
+    rc = ble_uuid_init_from_buf(uuid, val, len);
+
+    return rc;
+}
+
+int
+ble_uuid_to_any(const ble_uuid_t *uuid, ble_uuid_any_t *uuid_any)
+{
+    BLE_HS_DBG_ASSERT(verify_uuid(uuid) == 0);
+
+    uuid_any->u.type = uuid->type;
+
+    switch (uuid->type) {
+    case BLE_UUID_TYPE_16:
+        uuid_any->u16.value = BLE_UUID16(uuid)->value;
+        break;
+
+    case BLE_UUID_TYPE_32:
+        uuid_any->u32.value = BLE_UUID32(uuid)->value;
+        break;
+
+    case BLE_UUID_TYPE_128:
+        memcpy(uuid_any->u128.value, BLE_UUID128(uuid)->value, 16);
+        break;
+    default:
+        return BLE_HS_EINVAL;
     }
 
     return 0;
 }
 
 int
-ble_uuid_extract(struct os_mbuf *om, int off, void *uuid128)
+ble_uuid_to_mbuf(const ble_uuid_t *uuid, struct os_mbuf *om)
 {
-    uint16_t uuid16;
-    int remlen;
-    int rc;
+    int len;
+    void *buf;
 
-    remlen = OS_MBUF_PKTHDR(om)->omp_len - off;
-    switch (remlen) {
-    case 2:
-        rc = os_mbuf_copydata(om, off, 2, &uuid16);
-        BLE_HS_DBG_ASSERT_EVAL(rc == 0);
+    BLE_HS_DBG_ASSERT(verify_uuid(uuid) == 0);
 
-        uuid16 = le16toh(&uuid16);
-        rc = ble_uuid_16_to_128(uuid16, uuid128);
-        if (rc != 0) {
-            return rc;
-        }
-        return 0;
+    len = ble_uuid_length(uuid);
 
-    case 16:
-        rc = os_mbuf_copydata(om, off, 16, uuid128);
-        BLE_HS_DBG_ASSERT_EVAL(rc == 0);
-        return 0;
+    buf = os_mbuf_extend(om, len);
+    if (buf == NULL) {
+        return BLE_HS_ENOMEM;
+    }
+
+    ble_uuid_flat(uuid, buf);
 
+    return 0;
+}
+
+int
+ble_uuid_flat(const ble_uuid_t *uuid, void *dst)
+{
+    BLE_HS_DBG_ASSERT(verify_uuid(uuid) == 0);
+
+    switch (uuid->type) {
+    case BLE_UUID_TYPE_16:
+        htole16(dst, BLE_UUID16(uuid)->value);
+        break;
+    case BLE_UUID_TYPE_32:
+        memcpy(dst, ble_uuid_base, 16);
+        htole32(dst + 12, BLE_UUID32(uuid)->value);
+        break;
+    case BLE_UUID_TYPE_128:
+        memcpy(dst, BLE_UUID128(uuid)->value, 16);
+        break;
     default:
-        return BLE_HS_EMSGSIZE;
+        return BLE_HS_EINVAL;
     }
+
+    return 0;
+}
+
+int
+ble_uuid_length(const ble_uuid_t *uuid)
+{
+    BLE_HS_DBG_ASSERT(verify_uuid(uuid) == 0);
+
+    return uuid->type >> 3;
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1c14f3f/net/nimble/host/src/ble_uuid_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_uuid_priv.h 
b/net/nimble/host/src/ble_uuid_priv.h
index bd01388..d334516 100644
--- a/net/nimble/host/src/ble_uuid_priv.h
+++ b/net/nimble/host/src/ble_uuid_priv.h
@@ -20,14 +20,19 @@
 #ifndef H_BLE_UUID_PRIV_
 #define H_BLE_UUID_PRIV_
 
+#include "host/ble_uuid.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct os_mbuf;
 
-int ble_uuid_append(struct os_mbuf *om, const void *uuid128);
-int ble_uuid_extract(struct os_mbuf *om, int off, void *uuid128);
+int ble_uuid_init_from_mbuf(ble_uuid_any_t *uuid, struct os_mbuf *om, int off, 
int len);
+int ble_uuid_to_any(const ble_uuid_t *uuid, ble_uuid_any_t *uuid_any);
+int ble_uuid_to_mbuf(const ble_uuid_t *uuid, struct os_mbuf *om);
+int ble_uuid_flat(const ble_uuid_t *uuid, void *dst);
+int ble_uuid_length(const ble_uuid_t *uuid);
 
 #ifdef __cplusplus
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1c14f3f/net/nimble/host/test/src/ble_att_svr_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_att_svr_test.c 
b/net/nimble/host/test/src/ble_att_svr_test.c
index c24693f..839b2b4 100644
--- a/net/nimble/host/test/src/ble_att_svr_test.c
+++ b/net/nimble/host/test/src/ble_att_svr_test.c
@@ -206,80 +206,67 @@ ble_att_svr_test_misc_attr_fn_r_group(uint16_t 
conn_handle,
 }
 
 static void
-ble_att_svr_test_misc_register_uuid128(uint8_t *uuid128, uint8_t flags,
+ble_att_svr_test_misc_register_uuid(const ble_uuid_t *uuid, uint8_t flags,
                                        uint16_t expected_handle,
                                        ble_att_svr_access_fn *fn)
 {
     uint16_t handle;
     int rc;
 
-    rc = ble_att_svr_register(uuid128, flags, 0, &handle, fn, NULL);
+    rc = ble_att_svr_register(uuid, flags, 0, &handle, fn, NULL);
     TEST_ASSERT_FATAL(rc == 0);
     TEST_ASSERT_FATAL(handle == expected_handle);
 }
 
 static void
-ble_att_svr_test_misc_register_uuid16(uint16_t uuid16, uint8_t flags,
-                                      uint16_t expected_handle,
-                                      ble_att_svr_access_fn *fn)
-{
-    uint8_t uuid128[16];
-    int rc;
-
-    rc = ble_uuid_16_to_128(uuid16, uuid128);
-    TEST_ASSERT_FATAL(rc == 0);
-
-    ble_att_svr_test_misc_register_uuid128(uuid128, flags, expected_handle,
-                                           fn);
-}
-
-static void
 ble_att_svr_test_misc_register_group_attrs(void)
 {
     /* Service 0x1122 from 1 to 5 */
     /* Service 0x2233 from 6 to 10 */
     /* Service 010203...0f from 11 to 24 */
 
+    static const ble_uuid16_t uuid_svc =
+        BLE_UUID16_INIT(BLE_ATT_UUID_PRIMARY_SERVICE);
+    static const ble_uuid16_t uuid_inc =
+        BLE_UUID16_INIT(BLE_ATT_UUID_INCLUDE);
+    static const ble_uuid16_t uuid_chr =
+        BLE_UUID16_INIT(BLE_ATT_UUID_CHARACTERISTIC);
+    static ble_uuid16_t uuids[24];
+
     int i;
 
     /* Service 0x1122 from 1 to 5 */
-    ble_att_svr_test_misc_register_uuid16(
-        BLE_ATT_UUID_PRIMARY_SERVICE, HA_FLAG_PERM_RW, 1,
-        ble_att_svr_test_misc_attr_fn_r_group);
+    ble_att_svr_test_misc_register_uuid(&uuid_svc.u, HA_FLAG_PERM_RW, 1,
+                                        ble_att_svr_test_misc_attr_fn_r_group);
     for (i = 2; i <= 5; i++) {
         if ((i - 2) % 2 == 0) {
-            ble_att_svr_test_misc_register_uuid16(
-                BLE_ATT_UUID_CHARACTERISTIC, HA_FLAG_PERM_RW, i,
-                ble_att_svr_test_misc_attr_fn_r_group);
+            ble_att_svr_test_misc_register_uuid(&uuid_chr.u, HA_FLAG_PERM_RW, 
i,
+                                                
ble_att_svr_test_misc_attr_fn_r_group);
         } else {
-            ble_att_svr_test_misc_register_uuid16(
-                i, HA_FLAG_PERM_RW, i,
+            uuids[i] = *BLE_UUID16(BLE_UUID16_DECLARE(i));
+            ble_att_svr_test_misc_register_uuid(&uuids[i].u, HA_FLAG_PERM_RW, 
i,
                 ble_att_svr_test_misc_attr_fn_r_group);
         }
     }
 
     /* Service 0x2233 from 6 to 10 */
-    ble_att_svr_test_misc_register_uuid16(
-        BLE_ATT_UUID_PRIMARY_SERVICE, HA_FLAG_PERM_RW, 6,
-        ble_att_svr_test_misc_attr_fn_r_group);
+    ble_att_svr_test_misc_register_uuid(&uuid_svc.u, HA_FLAG_PERM_RW, 6,
+                                        ble_att_svr_test_misc_attr_fn_r_group);
     for (i = 7; i <= 10; i++) {
-        ble_att_svr_test_misc_register_uuid16(
-            BLE_ATT_UUID_INCLUDE, HA_FLAG_PERM_RW, i,
-            ble_att_svr_test_misc_attr_fn_r_group);
+        ble_att_svr_test_misc_register_uuid(&uuid_inc.u, HA_FLAG_PERM_RW, i,
+                                            
ble_att_svr_test_misc_attr_fn_r_group);
     }
 
     /* Service 010203...0f from 11 to 24 */
-    ble_att_svr_test_misc_register_uuid16(
-        BLE_ATT_UUID_PRIMARY_SERVICE, HA_FLAG_PERM_RW, 11,
-        ble_att_svr_test_misc_attr_fn_r_group);
+    ble_att_svr_test_misc_register_uuid(&uuid_svc.u, HA_FLAG_PERM_RW, 11,
+                                        ble_att_svr_test_misc_attr_fn_r_group);
     for (i = 12; i <= 24; i++) {
         if ((i - 12) % 2 == 0) {
-            ble_att_svr_test_misc_register_uuid16(
-                BLE_ATT_UUID_CHARACTERISTIC, HA_FLAG_PERM_RW, i,
-                ble_att_svr_test_misc_attr_fn_r_group);
+            ble_att_svr_test_misc_register_uuid(&uuid_chr.u, HA_FLAG_PERM_RW, 
i,
+                                                
ble_att_svr_test_misc_attr_fn_r_group);
         } else {
-            ble_att_svr_test_misc_register_uuid16(
-                i, HA_FLAG_PERM_RW, i,
+            uuids[i] = *BLE_UUID16(BLE_UUID16_DECLARE(i));
+            ble_att_svr_test_misc_register_uuid(&uuids[i].u, HA_FLAG_PERM_RW, 
i,
                 ble_att_svr_test_misc_attr_fn_r_group);
         }
     }
@@ -788,8 +775,10 @@ TEST_CASE(ble_att_svr_test_read)
     struct os_mbuf *om;
     uint16_t attr_handle;
     uint16_t conn_handle;
-    uint8_t uuid_sec[16] = {1};
-    uint8_t uuid[16] = {0};
+    const ble_uuid_t *uuid_sec = BLE_UUID128_DECLARE( \
+        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    const ble_uuid_t *uuid = BLE_UUID128_DECLARE( \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, );
     int rc;
 
     conn_handle = ble_att_svr_test_misc_init(0);
@@ -864,7 +853,8 @@ TEST_CASE(ble_att_svr_test_read_blob)
 {
     uint16_t attr_handle;
     uint16_t conn_handle;
-    uint8_t uuid[16] = {0};
+    const ble_uuid_t *uuid = BLE_UUID128_DECLARE( \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
     int rc;
 
     conn_handle = ble_att_svr_test_misc_init(0);
@@ -932,12 +922,12 @@ TEST_CASE(ble_att_svr_test_read_mult)
     ble_att_svr_test_attr_r_2 = attrs[1].value;
     ble_att_svr_test_attr_r_2_len = attrs[1].value_len;
 
-    rc = ble_att_svr_register(BLE_UUID16(0x1111), HA_FLAG_PERM_RW, 0,
+    rc = ble_att_svr_register(BLE_UUID16_DECLARE(0x1111), HA_FLAG_PERM_RW, 0,
                               &attrs[0].handle,
                               ble_att_svr_test_misc_attr_fn_r_1, NULL);
     TEST_ASSERT(rc == 0);
 
-    rc = ble_att_svr_register(BLE_UUID16(0x2222), HA_FLAG_PERM_RW, 0,
+    rc = ble_att_svr_register(BLE_UUID16_DECLARE(0x2222), HA_FLAG_PERM_RW, 0,
                               &attrs[1].handle,
                               ble_att_svr_test_misc_attr_fn_r_2, NULL);
     TEST_ASSERT(rc == 0);
@@ -987,9 +977,12 @@ TEST_CASE(ble_att_svr_test_write)
     struct ble_hs_conn *conn;
     uint16_t conn_handle;
     uint16_t attr_handle;
-    uint8_t uuid_sec[16] = {2};
-    uint8_t uuid_rw[16] = {0};
-    uint8_t uuid_r[16] = {1};
+    const ble_uuid_t *uuid_sec = BLE_UUID128_DECLARE( \
+        2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    const ble_uuid_t *uuid_rw = BLE_UUID128_DECLARE( \
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+    const ble_uuid_t *uuid_r = BLE_UUID128_DECLARE( \
+        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
     int rc;
 
     static const uint8_t attr_val[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
@@ -1076,12 +1069,11 @@ TEST_CASE(ble_att_svr_test_find_info)
     uint16_t handle1;
     uint16_t handle2;
     uint16_t handle3;
-    uint8_t uuid1[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-    uint8_t uuid2[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
-    uint8_t uuid3[16] = {
-        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
-        0x00, 0x10, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00
-    };
+    const ble_uuid_t *uuid1 =
+        BLE_UUID128_DECLARE(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13, 14, 
15);
+    const ble_uuid_t *uuid2 =
+        BLE_UUID128_DECLARE(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16);
+    const ble_uuid_t *uuid3 = BLE_UUID16_DECLARE(0x000f);
     int rc;
 
     conn_handle = ble_att_svr_test_misc_init(128);
@@ -1120,7 +1112,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     ble_hs_test_util_verify_tx_find_info_rsp(
         ((struct ble_hs_test_util_att_info_entry[]) { {
             .handle = handle1,
-            .uuid128 = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
+            .uuid = BLE_UUID128_DECLARE(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
         }, {
             .handle = 0,
         } }));
@@ -1135,10 +1127,10 @@ TEST_CASE(ble_att_svr_test_find_info)
     ble_hs_test_util_verify_tx_find_info_rsp(
         ((struct ble_hs_test_util_att_info_entry[]) { {
             .handle = handle1,
-            .uuid128 = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
+            .uuid = BLE_UUID128_DECLARE(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
         }, {
             .handle = handle2,
-            .uuid128 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16},
+            .uuid = 
BLE_UUID128_DECLARE(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16),
         }, {
             .handle = 0,
         } }));
@@ -1153,10 +1145,10 @@ TEST_CASE(ble_att_svr_test_find_info)
     ble_hs_test_util_verify_tx_find_info_rsp(
         ((struct ble_hs_test_util_att_info_entry[]) { {
             .handle = handle1,
-            .uuid128 = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},
+            .uuid = BLE_UUID128_DECLARE(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15),
         }, {
             .handle = handle2,
-            .uuid128 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16},
+            .uuid = 
BLE_UUID128_DECLARE(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16),
         }, {
             .handle = 0,
         } }));
@@ -1167,7 +1159,7 @@ TEST_CASE(ble_att_svr_test_find_info)
     ble_hs_test_util_verify_tx_find_info_rsp(
         ((struct ble_hs_test_util_att_info_entry[]) { {
             .handle = handle3,
-            .uuid16 = 0x000f,
+            .uuid = BLE_UUID16_DECLARE(0x000f),
         }, {
             .handle = 0,
         } }));
@@ -1183,15 +1175,10 @@ TEST_CASE(ble_att_svr_test_find_type_value)
     uint16_t handle4;
     uint16_t handle5;
     uint16_t handle_desc;
-    uint8_t uuid1[16] = {
-        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
-        0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00
-    }; /* 0x2800 (Primary Service) */
-    uint8_t uuid2[16] = {
-        0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
-        0x00, 0x10, 0x00, 0x00, 0x03, 0x28, 0x00, 0x00
-    }; /* 0x2803 (Characteristic) */
-    uint8_t uuid3[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 
};
+    const ble_uuid_t *uuid1 = BLE_UUID16_DECLARE(0x2800);
+    const ble_uuid_t *uuid2 = BLE_UUID16_DECLARE(0x2803);
+    const ble_uuid_t *uuid3 =
+        BLE_UUID128_DECLARE(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
15);
     int rc;
 
     conn_handle = ble_att_svr_test_misc_init(128);
@@ -1530,7 +1517,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
         ((struct ble_hs_test_util_att_group_type_entry[]) { {
             .start_handle = 1,
             .end_handle = 5,
-            .uuid16 = 0x1122,
+            .uuid = BLE_UUID16_DECLARE(0x1122),
         }, {
             .start_handle = 0,
         } }));
@@ -1543,11 +1530,11 @@ TEST_CASE(ble_att_svr_test_read_group_type)
         ((struct ble_hs_test_util_att_group_type_entry[]) { {
             .start_handle = 1,
             .end_handle = 5,
-            .uuid16 = 0x1122,
+            .uuid = BLE_UUID16_DECLARE(0x1122),
         }, {
             .start_handle = 6,
             .end_handle = 10,
-            .uuid16 = 0x2233,
+            .uuid = BLE_UUID16_DECLARE(0x2233),
         }, {
             .start_handle = 0,
         } }));
@@ -1560,11 +1547,11 @@ TEST_CASE(ble_att_svr_test_read_group_type)
         ((struct ble_hs_test_util_att_group_type_entry[]) { {
             .start_handle = 1,
             .end_handle = 5,
-            .uuid16 = 0x1122,
+            .uuid = BLE_UUID16_DECLARE(0x1122),
         }, {
             .start_handle = 6,
             .end_handle = 10,
-            .uuid16 = 0x2233,
+            .uuid = BLE_UUID16_DECLARE(0x2233),
         }, {
             .start_handle = 0,
         } }));
@@ -1577,7 +1564,7 @@ TEST_CASE(ble_att_svr_test_read_group_type)
         ((struct ble_hs_test_util_att_group_type_entry[]) { {
             .start_handle = 11,
             .end_handle = 0xffff,
-            .uuid128 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16},
+            .uuid = 
BLE_UUID128_DECLARE(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16),
         }, {
             .start_handle = 0,
         } }));
@@ -1600,27 +1587,32 @@ TEST_CASE(ble_att_svr_test_prep_write)
     }
 
     /* Register two writable attributes. */
-    ble_att_svr_test_misc_register_uuid16(0x1234, HA_FLAG_PERM_RW, 1,
+    ble_att_svr_test_misc_register_uuid(BLE_UUID16_DECLARE(0x1234),
+                                          HA_FLAG_PERM_RW, 1,
                                           ble_att_svr_test_misc_attr_fn_w_1);
-    ble_att_svr_test_misc_register_uuid16(0x8989, HA_FLAG_PERM_RW, 2,
+    ble_att_svr_test_misc_register_uuid(BLE_UUID16_DECLARE(0x8989),
+                                          HA_FLAG_PERM_RW, 2,
                                           ble_att_svr_test_misc_attr_fn_w_2);
 
     /* 3: not writable. */
-    ble_att_svr_test_misc_register_uuid16(0xabab, BLE_ATT_F_READ, 3,
+    ble_att_svr_test_misc_register_uuid(BLE_UUID16_DECLARE(0xabab),
+                                          BLE_ATT_F_READ, 3,
                                           ble_att_svr_test_misc_attr_fn_r_1);
     /* 4: Encryption required. */
-    ble_att_svr_test_misc_register_uuid16(
-        0xabac, BLE_ATT_F_WRITE | BLE_ATT_F_WRITE_ENC, 4,
+    ble_att_svr_test_misc_register_uuid(
+        BLE_UUID16_DECLARE(0xabac), BLE_ATT_F_WRITE | BLE_ATT_F_WRITE_ENC, 4,
         ble_att_svr_test_misc_attr_fn_w_1);
 
     /* 5: Encryption+authentication required. */
-    ble_att_svr_test_misc_register_uuid16(
-        0xabad, BLE_ATT_F_WRITE | BLE_ATT_F_WRITE_ENC | BLE_ATT_F_WRITE_AUTHEN,
+    ble_att_svr_test_misc_register_uuid(
+        BLE_UUID16_DECLARE(0xabad),
+        BLE_ATT_F_WRITE | BLE_ATT_F_WRITE_ENC | BLE_ATT_F_WRITE_AUTHEN,
         5, ble_att_svr_test_misc_attr_fn_w_1);
 
     /* 6: Write callback always fails. */
-    ble_att_svr_test_misc_register_uuid16(
-        0xabae, BLE_ATT_F_WRITE, 6, ble_att_svr_test_misc_attr_fn_w_fail);
+    ble_att_svr_test_misc_register_uuid(
+        BLE_UUID16_DECLARE(0xabae), BLE_ATT_F_WRITE, 6,
+        ble_att_svr_test_misc_attr_fn_w_fail);
 
     /*** Empty write succeeds. */
     ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
@@ -1780,7 +1772,8 @@ TEST_CASE(ble_att_svr_test_prep_write_tmo)
     }
 
     /* Register a writable attribute. */
-    ble_att_svr_test_misc_register_uuid16(0x1234, HA_FLAG_PERM_RW, 1,
+    ble_att_svr_test_misc_register_uuid(BLE_UUID16_DECLARE(0x1234),
+                                          HA_FLAG_PERM_RW, 1,
                                           ble_att_svr_test_misc_attr_fn_w_1);
 
     /* Ensure timer is not set. */
@@ -1853,9 +1846,9 @@ TEST_CASE(ble_att_svr_test_oom)
     conn_handle = ble_att_svr_test_misc_init(0);
 
     /* Register an attribute (primary service) for incoming read commands. */
-    ble_att_svr_test_misc_register_uuid16(BLE_ATT_UUID_PRIMARY_SERVICE,
-                                          HA_FLAG_PERM_RW, 1,
-                                          ble_att_svr_test_misc_attr_fn_rw_1);
+    ble_att_svr_test_misc_register_uuid(
+        BLE_UUID16_DECLARE(BLE_ATT_UUID_PRIMARY_SERVICE),
+        HA_FLAG_PERM_RW, 1, ble_att_svr_test_misc_attr_fn_rw_1);
     ble_att_svr_test_attr_w_1_len = 2;
     ble_att_svr_test_attr_w_1[0] = 0x12;
     ble_att_svr_test_attr_w_1[1] = 0x34;
@@ -1883,7 +1876,7 @@ TEST_CASE(ble_att_svr_test_oom)
     ble_hs_test_util_tx_all();
     ble_hs_test_util_verify_tx_find_info_rsp(
         (struct ble_hs_test_util_att_info_entry[]) {
-            { .handle = 1, .uuid16 = BLE_ATT_UUID_PRIMARY_SERVICE },
+            { .handle = 1, .uuid = 
BLE_UUID16_DECLARE(BLE_ATT_UUID_PRIMARY_SERVICE) },
             { 0 },
         });
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/b1c14f3f/net/nimble/host/test/src/ble_gatt_conn_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_conn_test.c 
b/net/nimble/host/test/src/ble_gatt_conn_test.c
index 4add074..0bb37ea 100644
--- a/net/nimble/host/test/src/ble_gatt_conn_test.c
+++ b/net/nimble/host/test/src/ble_gatt_conn_test.c
@@ -389,7 +389,7 @@ TEST_CASE(ble_gatt_conn_test_disconnect)
     ble_gatt_conn_test_util_init();
 
     /*** Register an attribute to allow indicatations to be sent. */
-    rc = ble_att_svr_register(BLE_UUID16(0x1212), BLE_ATT_F_READ, 0,
+    rc = ble_att_svr_register(BLE_UUID16_DECLARE(0x1212), BLE_ATT_F_READ, 0,
                               &attr_handle,
                               ble_gatt_conn_test_attr_cb, NULL);
     TEST_ASSERT(rc == 0);
@@ -413,7 +413,7 @@ TEST_CASE(ble_gatt_conn_test_disconnect)
     TEST_ASSERT_FATAL(rc == 0);
 
     disc_svc_uuid_arg.exp_conn_handle = 1;
-    rc = ble_gattc_disc_svc_by_uuid(1, BLE_UUID16(0x1111),
+    rc = ble_gattc_disc_svc_by_uuid(1, BLE_UUID16_DECLARE(0x1111),
                                     ble_gatt_conn_test_disc_svc_uuid_cb,
                                     &disc_svc_uuid_arg);
     TEST_ASSERT_FATAL(rc == 0);
@@ -437,7 +437,7 @@ TEST_CASE(ble_gatt_conn_test_disconnect)
                                  &disc_all_dscs_arg);
 
     disc_chr_uuid_arg.exp_conn_handle = 2;
-    rc = ble_gattc_disc_chrs_by_uuid(2, 2, 0xffff, BLE_UUID16(0x2222),
+    rc = ble_gattc_disc_chrs_by_uuid(2, 2, 0xffff, BLE_UUID16_DECLARE(0x2222),
                                      ble_gatt_conn_test_disc_chr_uuid_cb,
                                      &disc_chr_uuid_arg);
 
@@ -447,7 +447,7 @@ TEST_CASE(ble_gatt_conn_test_disconnect)
     TEST_ASSERT_FATAL(rc == 0);
 
     read_uuid_arg.exp_conn_handle = 2;
-    rc = ble_gattc_read_by_uuid(2, 1, 0xffff, BLE_UUID16(0x3333),
+    rc = ble_gattc_read_by_uuid(2, 1, 0xffff, BLE_UUID16_DECLARE(0x3333),
                                 ble_gatt_conn_test_read_uuid_cb,
                                 &read_uuid_arg);
     TEST_ASSERT_FATAL(rc == 0);
@@ -614,7 +614,7 @@ TEST_CASE(ble_gatt_conn_test_timeout)
     TEST_ASSERT(ticks_from_now == BLE_HS_FOREVER);
 
     /*** Register an attribute to allow indicatations to be sent. */
-    rc = ble_att_svr_register(BLE_UUID16(0x1212), BLE_ATT_F_READ, 0,
+    rc = ble_att_svr_register(BLE_UUID16_DECLARE(0x1212), BLE_ATT_F_READ, 0,
                               &attr_handle,
                               ble_gatt_conn_test_attr_cb, NULL);
     TEST_ASSERT(rc == 0);
@@ -634,7 +634,7 @@ TEST_CASE(ble_gatt_conn_test_timeout)
 
     /*** Discover services by UUID. */
     ble_hs_test_util_create_conn(1, peer_addr, NULL, NULL);
-    rc = ble_gattc_disc_svc_by_uuid(1, BLE_UUID16(0x1111),
+    rc = ble_gattc_disc_svc_by_uuid(1, BLE_UUID16_DECLARE(0x1111),
                                     ble_gatt_conn_test_disc_svc_uuid_cb,
                                     &disc_svc_uuid_arg);
     TEST_ASSERT_FATAL(rc == 0);
@@ -666,7 +666,7 @@ TEST_CASE(ble_gatt_conn_test_timeout)
 
     /*** Discover characteristics by UUID. */
     ble_hs_test_util_create_conn(1, peer_addr, NULL, NULL);
-    rc = ble_gattc_disc_chrs_by_uuid(1, 2, 0xffff, BLE_UUID16(0x2222),
+    rc = ble_gattc_disc_chrs_by_uuid(1, 2, 0xffff, BLE_UUID16_DECLARE(0x2222),
                                      ble_gatt_conn_test_disc_chr_uuid_cb,
                                      &disc_all_dscs_arg);
     TEST_ASSERT_FATAL(rc == 0);
@@ -681,7 +681,7 @@ TEST_CASE(ble_gatt_conn_test_timeout)
 
     /*** Read by UUID. */
     ble_hs_test_util_create_conn(1, peer_addr, NULL, NULL);
-    rc = ble_gattc_read_by_uuid(1, 1, 0xffff, BLE_UUID16(0x3333),
+    rc = ble_gattc_read_by_uuid(1, 1, 0xffff, BLE_UUID16_DECLARE(0x3333),
                                 ble_gatt_conn_test_read_uuid_cb,
                                 &read_uuid_arg);
     TEST_ASSERT_FATAL(rc == 0);

Reply via email to