From a954e58f5347866b320d7d73e831b3fce3620f1f Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Tue, 18 Apr 2017 22:24:26 +0200 Subject: [PATCH] Minor cleanup --- .../examples/Peripheral/ancs/ancs.ino | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/ancs/ancs.ino b/libraries/Bluefruit52Lib/examples/Peripheral/ancs/ancs.ino index 70b6e6c2..7c1c29c5 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/ancs/ancs.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/ancs/ancs.ino @@ -77,19 +77,19 @@ void loop() // If service is not yet discovered if ( !bleancs.discovered() ) return; - // Your handling code here + // Your code here } void connect_callback(void) { Serial.println("Connected"); - Serial.print("Dicovering DIS ... "); + Serial.print("Discovering DIS ... "); if ( bleClientDis.discover( Bluefruit.connHandle()) ) { - Serial.println("Found it"); + Serial.println("Discovered"); - // read and print out Manufacturer + // Read and print Manufacturer string memset(buffer, 0, sizeof(buffer)); if ( bleClientDis.getManufacturer(buffer, sizeof(buffer)) ) { @@ -97,7 +97,7 @@ void connect_callback(void) Serial.println(buffer); } - // read and print out Model Number + // Read and print Model Number string memset(buffer, 0, sizeof(buffer)); if ( bleClientDis.getModel(buffer, sizeof(buffer)) ) { @@ -111,14 +111,14 @@ void connect_callback(void) Serial.print("Discovering ANCS ... "); if ( bleancs.discover( Bluefruit.connHandle() ) ) { - Serial.println("Found it"); + Serial.println("Discovered"); // ANCS requires pairing to work, it makes sense to request security here as well - Serial.print("Attempt to PAIR with iOS, please press PAIR on your phone ... "); + Serial.print("Attempting to PAIR with the iOS device, please press PAIR on your phone ... "); if ( Bluefruit.requestPairing() ) { - Serial.println("Done"); - Serial.println("Enable Notification"); + Serial.println("Done"); + Serial.println("Enabling notifications"); Serial.println(); bleancs.enableNotification(); @@ -139,8 +139,9 @@ void ancs_notification_callback(AncsNotification_t* notif) Serial.print(" | "); // Get notification Title - // iDevice often include Unicode "Bidirection Text Control" in the Title. - // Mostly are U+202D as beginning and U+202C as ending. You may want to remove them + // iDevice often includes Unicode "Bidirection Text Control" in the Title. + // Most strings have U+202D at the beginning and U+202C at the end. You may + // want to remove them. // U+202D is E2-80-AD, U+202C is E2-80-AC in UTF-8 memset(buffer, 0, sizeof(buffer)); bleancs.getAttribute(notif->uid, ANCS_ATTR_TITLE, buffer, sizeof(buffer)); @@ -151,7 +152,7 @@ void ancs_notification_callback(AncsNotification_t* notif) bleancs.getAttribute(notif->uid, ANCS_ATTR_MESSAGE, buffer, sizeof(buffer)); Serial.printf("%-15s | ", buffer); - // Get App ID and store to app_id + // Get App ID and store in the app_id variable char app_id[64] = { 0 }; memset(buffer, 0, sizeof(buffer)); bleancs.getAttribute(notif->uid, ANCS_ATTR_APP_IDENTIFIER, buffer, sizeof(buffer)); @@ -165,7 +166,7 @@ void ancs_notification_callback(AncsNotification_t* notif) Serial.println(); - // Automatically accept incoming call using perform Action + // Automatically accept incoming calls using 'performAction' if ( notif->categoryID == ANCS_CAT_INCOMING_CALL && notif->eventID == ANCS_EVT_NOTIFICATION_ADDED) { Serial.println("Incoming call accepted");