added client IAS
This commit is contained in:
1 parent
5d96925d9a
commit
97649cee90
2 files changed
+45
-1
No files matched your search
@@ -3,3 +3,36 @@
|
||||
//
|
||||
|
||||
#include "BLEClientIas.h"
|
||||
#include "bluefruit.h"
|
||||
|
||||
BLEClientIas::BLEClientIas() : BLEClientService(UUID16_SVC_IMMEDIATE_ALERT) {
|
||||
|
||||
}
|
||||
|
||||
bool BLEClientIas::begin(void) {
|
||||
// invoke superclass begin()
|
||||
BLEClientService::begin();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BLEClientIas::discover(uint16_t conn_handle) {
|
||||
VERIFY(BLEClientService::discover(conn_handle));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t BLEClientIas::getAlertLevel() {
|
||||
|
||||
uint16_t level = 0;
|
||||
|
||||
BLEClientCharacteristic chr(uuid);
|
||||
chr.begin(this);
|
||||
|
||||
if (Bluefruit.Discovery.discoverCharacteristic(_conn_hdl, chr)) {
|
||||
level = chr.read16();
|
||||
}
|
||||
|
||||
Bluefruit.Discovery.setHandleRange(bck_range);
|
||||
|
||||
return level;
|
||||
}
|
||||
@@ -5,8 +5,19 @@
|
||||
#ifndef ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
|
||||
#define ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
|
||||
|
||||
#include "bluefruit_common.h"
|
||||
#include "BLEClientCharacteristic.h"
|
||||
#include "BLEClientService.h"
|
||||
|
||||
class BLEClientIas {
|
||||
class BLEClientIas : public BLEClientService {
|
||||
|
||||
public:
|
||||
BLEClientIas(void);
|
||||
|
||||
virtual bool begin(void);
|
||||
virtual bool discover(uint16_t conn_handle);
|
||||
|
||||
uint16_t getAlertLevel (void);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user