Komut
subscribe()
Açıklama
Bir BLE özellikleri bildirimine veya endikasyonlarına abone olun.
Sözdizimi
bleCharacteristic.subscribe ()
Parametreler
Yok
İadeler
doğru , başarılı, başarısız yanlış
Misal
…
// ...
// retrieve the simple key characteristic
BLECharacteristic simpleKeyCharacteristic = peripheral.characteristic("ffe1");
// subscribe to the simple key characteristic
Serial.println("Subscribing to simple key characteristic ...");
if (!simpleKeyCharacteristic) {
Serial.println("no simple key characteristic found!");
peripheral.disconnect();
return;
} else if (!simpleKeyCharacteristic.canSubscribe()) {
Serial.println("simple key characteristic is not subscribable!");
peripheral.disconnect();
return;
} else if (!simpleKeyCharacteristic.subscribe()) {
Serial.println("subscription failed!");
peripheral.disconnect();
return;
}
// ...
…
// ...
// retrieve the simple key characteristic
BLECharacteristic simpleKeyCharacteristic = peripheral.characteristic("ffe1");
// subscribe to the simple key characteristic
Serial.println("Subscribing to simple key characteristic ...");
if (!simpleKeyCharacteristic) {
Serial.println("no simple key characteristic found!");
peripheral.disconnect();
return;
} else if (!simpleKeyCharacteristic.canSubscribe()) {
Serial.println("simple key characteristic is not subscribable!");
peripheral.disconnect();
return;
} else if (!simpleKeyCharacteristic.subscribe()) {
Serial.println("subscription failed!");
peripheral.disconnect();
return;
}
// ...
…
See Also
- BLECharacteristic()
- uuid()
- properties()
- valueSize()
- value()
- valueLength()
- readValue()
- writeValue()
- setEventHandler()
- descriptorCount()
- hasDescriptor()
- descriptor()
- canRead()
- read()
- canWrite()
- canSubscribe()
- canUnsubscribe()
- unsubscribe()
- valueUpdated()