Skip to content

Commit 97649ce

Browse files
committed
added client IAS
1 parent 5d96925 commit 97649ce

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

libraries/Bluefruit52Lib/src/clients/BLEClientIas.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,36 @@
33
//
44

55
#include "BLEClientIas.h"
6+
#include "bluefruit.h"
7+
8+
BLEClientIas::BLEClientIas() : BLEClientService(UUID16_SVC_IMMEDIATE_ALERT) {
9+
10+
}
11+
12+
bool BLEClientIas::begin(void) {
13+
// invoke superclass begin()
14+
BLEClientService::begin();
15+
return true;
16+
}
17+
18+
bool BLEClientIas::discover(uint16_t conn_handle) {
19+
VERIFY(BLEClientService::discover(conn_handle));
20+
21+
return true;
22+
}
23+
24+
uint16_t BLEClientIas::getAlertLevel() {
25+
26+
uint16_t level = 0;
27+
28+
BLEClientCharacteristic chr(uuid);
29+
chr.begin(this);
30+
31+
if (Bluefruit.Discovery.discoverCharacteristic(_conn_hdl, chr)) {
32+
level = chr.read16();
33+
}
34+
35+
Bluefruit.Discovery.setHandleRange(bck_range);
36+
37+
return level;
38+
}

libraries/Bluefruit52Lib/src/clients/BLEClientIas.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@
55
#ifndef ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
66
#define ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
77

8+
#include "bluefruit_common.h"
9+
#include "BLEClientCharacteristic.h"
10+
#include "BLEClientService.h"
811

9-
class BLEClientIas {
12+
class BLEClientIas : public BLEClientService {
13+
14+
public:
15+
BLEClientIas(void);
16+
17+
virtual bool begin(void);
18+
virtual bool discover(uint16_t conn_handle);
19+
20+
uint16_t getAlertLevel (void);
1021

1122
};
1223

0 commit comments

Comments
 (0)