Repository: incubator-mynewt-site
Updated Branches:
  refs/heads/develop b6a327e50 -> 003ca1961


Updated Air Qiuality Tutorial


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/443b202a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/443b202a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/443b202a

Branch: refs/heads/develop
Commit: 443b202af55efc1569611f54301abee2eda35897
Parents: b6a327e
Author: David G. Simmons <santa...@mac.com>
Authored: Tue Jan 31 12:31:36 2017 -0500
Committer: David G. Simmons <santa...@mac.com>
Committed: Tue Jan 31 12:32:00 2017 -0500

----------------------------------------------------------------------
 docs/os/tutorials/air_quality_ble.md    | 45 ++++++++++++++--------------
 docs/os/tutorials/air_quality_sensor.md | 26 ++++++++++------
 2 files changed, 40 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/443b202a/docs/os/tutorials/air_quality_ble.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/air_quality_ble.md 
b/docs/os/tutorials/air_quality_ble.md
index 7497d19..5d4c8f2 100644
--- a/docs/os/tutorials/air_quality_ble.md
+++ b/docs/os/tutorials/air_quality_ble.md
@@ -18,19 +18,19 @@ First, we'll define the GATT Services in 
`apps/air_quality/src/bleprph.h`.
 ```c
 /* Sensor Data */
 /* e761d2af-1c15-4fa7-af80-b5729002b340 */
-static const uint8_t gatt_svr_svc_co2_uuid[16] = {
-    0x40, 0xb3, 0x20, 0x90, 0x72, 0xb5, 0x80, 0xaf,
-    0xa7, 0x4f, 0x15, 0x1c, 0xaf, 0xd2, 0x61, 0xe7 };
+static const ble_uuid128_t gatt_svr_svc_co2_uuid =
+    BLE_UUID128_INIT(0x40, 0xb3, 0x20, 0x90, 0x72, 0xb5, 0x80, 0xaf,
+                     0xa7, 0x4f, 0x15, 0x1c, 0xaf, 0xd2, 0x61, 0xe7);
 #define CO2_SNS_TYPE          0xDEAD
 #define CO2_SNS_STRING "SenseAir K30 CO2 Sensor"
-#define CO2_SNS_VAL               0xBEAD
+#define CO2_SNS_VAL           0xBEAD
 
 uint16_t gatt_co2_val; 
 ```
 
 You can use any hex values you choose for the sensor type and sensor values, 
and you can 
 even forget the sensor type and sensor string definitions altogether but they 
make
-the results look nice in our Bleutooth App.
+the results look nice in our Bluetooth App for Mac OS X and iOS.
 
 Next we'll add those services to `apps/air_quality/src/gatt_svr.c`.
 
@@ -51,15 +51,15 @@ static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
     {
         /*** Service: Security test. */
         .type = BLE_GATT_SVC_TYPE_PRIMARY,
-        .uuid128 = gatt_svr_svc_sec_test_uuid,
+        .uuid = &gatt_svr_svc_sec_test_uuid.u,
         .characteristics = (struct ble_gatt_chr_def[]) { {
             /*** Characteristic: Random number generator. */
-            .uuid128 = gatt_svr_chr_sec_test_rand_uuid,
+            .uuid = &gatt_svr_chr_sec_test_rand_uuid.u,
             .access_cb = gatt_svr_chr_access_sec_test,
             .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_READ_ENC,
         }, {
             /*** Characteristic: Static value. */
-            .uuid128 = gatt_svr_chr_sec_test_static_uuid,
+            .uuid = &gatt_svr_chr_sec_test_static_uuid,.u
             .access_cb = gatt_svr_chr_access_sec_test,
             .flags = BLE_GATT_CHR_F_READ |
                      BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_WRITE_ENC,
@@ -70,29 +70,31 @@ static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
         {
             /*** CO2 Level Notification Service. */
             .type = BLE_GATT_SVC_TYPE_PRIMARY,
-            .uuid128 = gatt_svr_svc_co2_uuid,
+            .uuid = &gatt_svr_svc_co2_uuid.u,
             .characteristics = (struct ble_gatt_chr_def[]) { {
-                .uuid128 = BLE_UUID16(CO2_SNS_TYPE),
+                .uuid = BLE_UUID16_DECLARE(CO2_SNS_TYPE),
                 .access_cb = gatt_svr_sns_access,
                 .flags = BLE_GATT_CHR_F_READ,
             }, {
-                .uuid128 = BLE_UUID16(CO2_SNS_VAL),
+                .uuid = BLE_UUID16_DECLARE(CO2_SNS_VAL),
                 .access_cb = gatt_svr_sns_access,
                 .flags = BLE_GATT_CHR_F_NOTIFY,
             }, {
                 0, /* No more characteristics in this service. */
             } },
         },
-    {
-        0, /* No more services. */
-    },
-};
+
+        {
+            0, /* No more services. */
+        },
+    };
+            
 ```
 
 Next we need to tell the GATT Server how to handle requests for CO<sub>2</sub> 
readings :
 
 ```c
-static int
+sstatic int
 gatt_svr_sns_access(uint16_t conn_handle, uint16_t attr_handle,
                           struct ble_gatt_access_ctxt *ctxt,
                           void *arg)
@@ -100,8 +102,7 @@ gatt_svr_sns_access(uint16_t conn_handle, uint16_t 
attr_handle,
     uint16_t uuid16;
     int rc;
 
-    uuid16 = ble_uuid_128_to_16(ctxt->chr->uuid128);
-    assert(uuid16 != 0);
+    uuid16 = ble_uuid_u16(ctxt->chr->uuid);
 
     switch (uuid16) {
     case CO2_SNS_TYPE:
@@ -109,7 +110,7 @@ gatt_svr_sns_access(uint16_t conn_handle, uint16_t 
attr_handle,
         rc = os_mbuf_append(ctxt->om, CO2_SNS_STRING, sizeof CO2_SNS_STRING);
         BLEPRPH_LOG(INFO, "CO2 SENSOR TYPE READ: %s\n", CO2_SNS_STRING);
         return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
-    
+
     case CO2_SNS_VAL:
         if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
             rc = gatt_svr_chr_write(ctxt->om, 0,
@@ -122,11 +123,11 @@ gatt_svr_sns_access(uint16_t conn_handle, uint16_t 
attr_handle,
                                 sizeof gatt_co2_val);
             return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
         }
-    
+
     default:
         assert(0);
         return BLE_ATT_ERR_UNLIKELY;
-    }                              
+    }
 }
 ```
 
@@ -197,7 +198,7 @@ co2_read_event(void)
         goto err;
     }
     gatt_co2_val = value;
-    rc = ble_gatts_find_chr(gatt_svr_svc_co2_uuid, BLE_UUID16(CO2_SNS_VAL), 
NULL, &chr_val_handle);
+    rc = ble_gatts_find_chr(&gatt_svr_svc_co2_uuid.u, 
BLE_UUID16_DECLARE(CO2_SNS_VAL), NULL, &chr_val_handle);
     assert(rc == 0);
     ble_gatts_chr_updated(chr_val_handle);
     return (0);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/443b202a/docs/os/tutorials/air_quality_sensor.md
----------------------------------------------------------------------
diff --git a/docs/os/tutorials/air_quality_sensor.md 
b/docs/os/tutorials/air_quality_sensor.md
index 3e94a7e..72bc561 100644
--- a/docs/os/tutorials/air_quality_sensor.md
+++ b/docs/os/tutorials/air_quality_sensor.md
@@ -172,9 +172,11 @@ pkg.author: "Apache Mynewt 
<d...@mynewt.incubator.apache.org>"
 pkg.homepage: "http://mynewt.apache.org/";
 pkg.keywords:
 
-pkg.deps:
+pkg.deps: 
     - "@apache-mynewt-core/kernel/os"
-    - "@apache-mynewt-core/sys/log"
+    - "@apache-mynewt-core/sys/shell"
+    - "@apache-mynewt-core/sys/stats/full"
+    - "@apache-mynewt-core/sys/log/full"
     - "@apache-mynewt-core/mgmt/newtmgr"
     - "@apache-mynewt-core/mgmt/newtmgr/transport/ble"
     - "@apache-mynewt-core/net/nimble/controller"
@@ -185,7 +187,6 @@ pkg.deps:
     - "@apache-mynewt-core/net/nimble/host/store/ram"
     - "@apache-mynewt-core/net/nimble/transport/ram"
     - "@apache-mynewt-core/sys/console/full"
-    - "@apache-mynewt-core/libc/baselibc"
     - "@apache-mynewt-core/sys/sysinit"
     - "@apache-mynewt-core/sys/id"
 ```
@@ -244,8 +245,15 @@ Now you can add the files you need. You'll need a pkg.yml 
to describe the driver
 # under the License.
 #
 pkg.name: libs/my_drivers/senseair
+pkg.description: Host side of the nimble Bluetooth Smart stack.
+pkg.author: "Apache Mynewt <d...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/";
+pkg.keywords:
+    - ble
+    - bluetooth
+
 pkg.deps:
-    - "@apache-mynewt-core/hw/hal"
+    - "@apache-mynewt-core/kernel/os"
 ```
 
 ```no-highlight
@@ -325,8 +333,8 @@ pkg.deps:
     - "@apache-mynewt-core/libs/os"
     - "@apache-mynewt-core/libs/shell"
     - "@apache-mynewt-core/sys/config"
-    - "@apache-mynewt-core/sys/log"
-    - "@apache-mynewt-core/sys/stats"
+    - "@apache-mynewt-core/sys/log/full"
+    - "@apache-mynewt-core/sys/stats/full"
     - "@apache-mynewt-core/libs/baselibc"
     - libs/my_drivers/senseair
 ```
@@ -772,7 +780,7 @@ senseair_init(int uartno)
 }
 ```
 
-And your modified your main() for senseair driver init.
+And your modified main() for senseair driver init.
 
 ```c
 int
@@ -802,8 +810,8 @@ Here's what your SenseAir board should look like once it's 
wired up:
 
 Now that you have that wired up, let's get the Arduino Primo wired up. A 
couple of things to note:
 
-* The Arduino Primo's 'console' UART is actually UART1. The secondary 
(bit-banged) UART is 
-UART0, so that's where we'll have to hook up the SenseAir.
+* The Arduino Primo's 'console' UART is actually UART1. 
+* The secondary (bit-banged) UART is UART0, so that's where we'll have to hook 
up the SenseAir.
 
 Here's what your Arduino Primo should now look like with everything wired in:
 

Reply via email to