This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// code to add to slides, not a complete implementation | |
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { | |
if (newState == BluetoothGatt.STATE_CONNECTED) { | |
this.gatt = gatt; | |
gatt.discoverServices(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BluetoothManager manager = | |
(BluetoothManager) activity.getSystemService(Context.BLUETOOTH_SERVICE); | |
BluetoothAdapter adapter = manager.getAdapter(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void unlockCharacteristicWritten(BLECentral& central, | |
BLECharacteristic& characteristic) { | |
// central wrote new value to the unlock characteristic | |
Serial.println(F("Unlock characteristic written")); | |
openLock(characteristic.value(), characteristic.valueLength()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************************* | |
This is an example for our nRF51822 based Bluefruit LE modules | |
Pick one up today in the adafruit shop! | |
Adafruit invests time and resources providing this open source code, | |
please support Adafruit and open-source hardware by purchasing | |
products from Adafruit! | |
MIT license, check LICENSE for more information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <BLEPeripheral.h> | |
#define LED_PIN 3 | |
// define pins (varies per shield/board) | |
#define BLE_REQ 10 | |
#define BLE_RDY 2 | |
#define BLE_RST 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TemperatureCharacteristic = function() { | |
TemperatureCharacteristic.super_.call(this, { | |
uuid: 'bbb1', | |
properties: ['read', 'notify'], | |
}); | |
}; | |
util.inherits(TemperatureCharacteristic, Characteristic); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cordova project to test BLE notifications | |
// Run the test service on OS X or Linux with Node.js | |
// http://bit.ly/bleno-test-service | |
// characteristic ffffffff-ffff-ffff-ffff-fffffffffff5 will | |
// increment a counter every 5 seconds notifying this app | |
// create a new cordova project | |
// $ cordova create notify com.example.notify Notify | |
// replace notify/www/js/index.js with this file | |
// $ cd notify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_peripheralManager = [[CBPeripheralManager alloc] | |
initWithDelegate:self | |
queue:nil]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_peripheralManager = [[CBPeripheralManager alloc] | |
initWithDelegate:self | |
queue:nil]; | |
NSUUID *uuid = [[NSUUID alloc] | |
initWithUUIDString:@"12345678-AAAA-BBBB-CCCC-123456789ABC"]; | |
_region = [[CLBeaconRegion alloc] | |
initWithProximityUUID:uuid | |
major:1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_central = [[CBCentralManager alloc] | |
initWithDelegate:self | |
queue:nil | |
options:nil]; | |