File tree Expand file tree Collapse file tree 6 files changed +134
-0
lines changed
libraries/Bluefruit52Lib/src Expand file tree Collapse file tree 6 files changed +134
-0
lines changed Original file line number Diff line number Diff line change 13
13
/tools /.idea /
14
14
/tools /midi_tests /node_modules
15
15
16
+ .idea /
16
17
.DS_Store
17
18
* .swp
18
19
/Output
Original file line number Diff line number Diff line change 62
62
#include " services/BLEDfu.h"
63
63
#include " services/BLEUart.h"
64
64
#include " services/BLEBas.h"
65
+ #include " services/BLEIas.h"
65
66
#include " services/BLEBeacon.h"
66
67
#include " services/BLEHidGeneric.h"
67
68
#include " services/BLEHidAdafruit.h"
75
76
#include " clients/BLEClientCts.h"
76
77
#include " clients/BLEClientHidAdafruit.h"
77
78
#include " clients/BLEClientBas.h"
79
+ #include " clients/BLEClientIas.h"
78
80
79
81
#include " utility/AdaCallback.h"
80
82
#include " utility/bonding.h"
Original file line number Diff line number Diff line change
1
+ //
2
+ // Created by Charlie Bershatsky on 4/19/23.
3
+ //
4
+
5
+ #include " BLEClientIas.h"
6
+ #include " bluefruit.h"
7
+
8
+ BLEClientIas::BLEClientIas () :
9
+ BLEClientService(UUID16_SVC_IMMEDIATE_ALERT), _alert(UUID16_SVC_IMMEDIATE_ALERT) {
10
+
11
+ }
12
+
13
+ bool BLEClientIas::begin (void ) {
14
+ // invoke superclass begin()
15
+ BLEClientService::begin ();
16
+
17
+ _alert.begin (this );
18
+
19
+ return true ;
20
+ }
21
+
22
+ bool BLEClientIas::discover (uint16_t conn_handle) {
23
+ VERIFY (BLEClientService::discover (conn_handle));
24
+ _conn_hdl = conn_handle;
25
+ return true ;
26
+ }
27
+
28
+ uint16_t BLEClientIas::getAlertLevel () {
29
+
30
+ uint8_t level = 0 ;
31
+ ble_gattc_handle_range_t bck_range = Bluefruit.Discovery .getHandleRange ();
32
+
33
+ _alert.begin (this );
34
+
35
+ if (Bluefruit.Discovery .discoverCharacteristic (_conn_hdl, _alert)) {
36
+ level = _alert.read8 ();
37
+ }
38
+
39
+ Bluefruit.Discovery .setHandleRange (bck_range);
40
+
41
+ return level;
42
+ }
Original file line number Diff line number Diff line change
1
+ //
2
+ // Created by Charlie Bershatsky on 4/19/23.
3
+ //
4
+
5
+ #ifndef ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
6
+ #define ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
7
+
8
+ #include " bluefruit_common.h"
9
+ #include " BLEClientCharacteristic.h"
10
+ #include " BLEClientService.h"
11
+
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 );
21
+
22
+ private:
23
+ BLEClientCharacteristic _alert;
24
+
25
+ };
26
+
27
+
28
+ #endif // ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
Original file line number Diff line number Diff line change
1
+ //
2
+ // Created by Charlie Bershatsky on 4/19/23.
3
+ //
4
+
5
+ #include " BLEIas.h"
6
+ #include " bluefruit.h"
7
+ #include " utility/utilities.h"
8
+ #include " BLEService.h"
9
+
10
+ BLEIas::BLEIas (void ) :
11
+ BLEService(UUID16_SVC_IMMEDIATE_ALERT), _alert(UUID16_SVC_IMMEDIATE_ALERT) {
12
+
13
+ }
14
+
15
+ void BLEIas::write (uint8_t alert_level) {
16
+ _alert.write8 (alert_level);
17
+ }
18
+
19
+ err_t BLEIas::begin (void ) {
20
+
21
+ // Invoke the superclass begin()
22
+ VERIFY_STATUS (BLEService::begin ());
23
+
24
+ _alert.setProperties (CHR_PROPS_READ);
25
+ _alert.setPermission (SECMODE_OPEN, SECMODE_NO_ACCESS);
26
+ _alert.setFixedLen (1 );
27
+
28
+ VERIFY_STATUS ( _alert.begin () );
29
+
30
+ return ERROR_NONE;
31
+
32
+ }
Original file line number Diff line number Diff line change
1
+ //
2
+ // Created by Charlie Bershatsky on 4/19/23.
3
+ //
4
+
5
+ #ifndef ADAFRUIT_NRF52_ARDUINO_BLEIAS_H
6
+ #define ADAFRUIT_NRF52_ARDUINO_BLEIAS_H
7
+
8
+ #include " bluefruit_common.h"
9
+
10
+ #include " BLEService.h"
11
+ #include " BLECharacteristic.h"
12
+
13
+
14
+ class BLEIas : public BLEService {
15
+
16
+ protected:
17
+ BLECharacteristic _alert;
18
+
19
+ public:
20
+ BLEIas (void );
21
+
22
+ void write (uint8_t level);
23
+
24
+ virtual err_t begin (void );
25
+
26
+ };
27
+
28
+
29
+ #endif // ADAFRUIT_NRF52_ARDUINO_BLEIAS_H
You can’t perform that action at this time.
0 commit comments