update examples to changed API
This commit is contained in:
1 parent
3fa85cc1b4
commit
4e3d92cc2a
10 files changed
+36
-22
No files matched your search
@@ -12,6 +12,8 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
/* This sketch invoke API to enter OTA dfu mode */
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
/*
|
||||
* This sketch will reset the board into Serial DFU mode
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
enterSerialDfu();
|
||||
|
||||
@@ -80,12 +80,12 @@ void loop()
|
||||
// Your code here
|
||||
}
|
||||
|
||||
void connect_callback(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
Serial.println("Connected");
|
||||
|
||||
Serial.print("Discovering DIS ... ");
|
||||
if ( bleClientDis.discover( Bluefruit.connHandle()) )
|
||||
if ( bleClientDis.discover(conn_handle) )
|
||||
{
|
||||
Serial.println("Discovered");
|
||||
|
||||
@@ -109,7 +109,7 @@ void connect_callback(void)
|
||||
}
|
||||
|
||||
Serial.print("Discovering ANCS ... ");
|
||||
if ( bleancs.discover( Bluefruit.connHandle() ) )
|
||||
if ( bleancs.discover(conn_handle) )
|
||||
{
|
||||
Serial.println("Discovered");
|
||||
|
||||
@@ -174,7 +174,7 @@ void ancs_notification_callback(AncsNotification_t* notif)
|
||||
}
|
||||
}
|
||||
|
||||
void disconnect_callback(uint8_t reason)
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
(void) reason;
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ void displayNotification(int index)
|
||||
* Connect Callback
|
||||
* Perform ANCS discovering, request Pairing
|
||||
*/
|
||||
void connect_callback(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
oled.clearDisplay();
|
||||
oled.setCursor(0, 0);
|
||||
@@ -237,7 +237,7 @@ void connect_callback(void)
|
||||
oled.print("Discovering ... ");
|
||||
oled.display();
|
||||
|
||||
if ( bleancs.discover( Bluefruit.connHandle() ) )
|
||||
if ( bleancs.discover( conn_handle ) )
|
||||
{
|
||||
oled.println("OK");
|
||||
|
||||
@@ -346,8 +346,9 @@ void ancs_notification_callback(AncsNotification_t* notif)
|
||||
}
|
||||
}
|
||||
|
||||
void disconnect_callback(uint8_t reason)
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
(void) conn_handle;
|
||||
(void) reason;
|
||||
|
||||
// reset notification array
|
||||
|
||||
@@ -100,17 +100,18 @@ void loop()
|
||||
waitForEvent();
|
||||
}
|
||||
|
||||
void connect_callback(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(central_name, sizeof(central_name));
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
}
|
||||
|
||||
void disconnect_callback(uint8_t reason)
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
(void) conn_handle;
|
||||
(void) reason;
|
||||
|
||||
Serial.println();
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
/* This sketch remove the folder that contains the bonding information
|
||||
* used by Bluefruit which is "/adafruit/bond"
|
||||
*/
|
||||
|
||||
#include <bluefruit.h>
|
||||
#include <Nffs.h>
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ uint8_t bps = 0;
|
||||
// Advanced function prototypes
|
||||
void setupAdv(void);
|
||||
void setupHRM(void);
|
||||
void connect_callback(void);
|
||||
void disconnect_callback(uint8_t reason);
|
||||
void connect_callback(uint16_t conn_handle);
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason);
|
||||
void cccd_callback(BLECharacteristic& chr, ble_gatts_evt_write_t* request);
|
||||
|
||||
void blink_timer_callback(TimerHandle_t xTimerID);
|
||||
@@ -154,17 +154,18 @@ void setupHRM(void)
|
||||
bslc.write(2); // Set the characteristic to 'Wrist' (2)
|
||||
}
|
||||
|
||||
void connect_callback(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(central_name, sizeof(central_name));
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
}
|
||||
|
||||
void disconnect_callback(uint8_t reason)
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
(void) conn_handle;
|
||||
(void) reason;
|
||||
|
||||
Serial.println("Disconnected");
|
||||
|
||||
@@ -113,10 +113,10 @@ void setupAdv(void)
|
||||
Bluefruit.ScanResponse.addName();
|
||||
}
|
||||
|
||||
void connect_callback(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(central_name, sizeof(central_name));
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
|
||||
@@ -92,10 +92,10 @@ void setupAdv(void)
|
||||
Bluefruit.ScanResponse.addName();
|
||||
}
|
||||
|
||||
void connect_callback(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
char central_name[32] = { 0 };
|
||||
Bluefruit.Gap.getPeerName(central_name, sizeof(central_name));
|
||||
Bluefruit.Gap.getPeerName(conn_handle, central_name, sizeof(central_name));
|
||||
|
||||
Serial.print("Connected to ");
|
||||
Serial.println(central_name);
|
||||
|
||||
@@ -73,13 +73,15 @@ void setupAdv(void)
|
||||
Bluefruit.ScanResponse.addName();
|
||||
}
|
||||
|
||||
void connect_callback(void)
|
||||
void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
(void) conn_handle;
|
||||
Serial.println("Connected");
|
||||
}
|
||||
|
||||
void disconnect_callback(uint8_t reason)
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
(void) conn_handle;
|
||||
(void) reason;
|
||||
|
||||
Serial.println();
|
||||
|
||||
Reference in new issue
Block a user