Minor cleanup
This commit is contained in:
1 parent
cc7dd5e410
commit
a954e58f53
1 file changed
+14
-13
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user