A blue button is always a nice toy ...

Dependencies:   BLE_API X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Committer:
hux
Date:
Fri Jan 06 20:49:58 2017 +0000
Revision:
24:0f08f68579bd
Child:
27:32267cee7cb8
Version 1.0 - now satisfying behavior. No known bugs!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hux 24:0f08f68579bd 1 // print.h - print value of a characteristic
hux 24:0f08f68579bd 2 //
hux 24:0f08f68579bd 3 // Synopsis:
hux 24:0f08f68579bd 4 //
hux 24:0f08f68579bd 5 // See also: CHARACTERISTIC, GET, SET
hux 24:0f08f68579bd 6 //
hux 24:0f08f68579bd 7 #ifndef _PRINT_H_
hux 24:0f08f68579bd 8 #define _PRINT_H_
hux 24:0f08f68579bd 9
hux 24:0f08f68579bd 10 #include "ble/Gap.h"
hux 24:0f08f68579bd 11 #include "bricks/blob.h"
hux 24:0f08f68579bd 12
hux 24:0f08f68579bd 13 //==============================================================================
hux 24:0f08f68579bd 14 // Some Callbacks
hux 24:0f08f68579bd 15 //==============================================================================
hux 24:0f08f68579bd 16
hux 24:0f08f68579bd 17 inline void print(Blob &blue, GattCharacteristic &chr, const char *name)
hux 24:0f08f68579bd 18 {
hux 24:0f08f68579bd 19 Serial out(USBTX, USBRX); // serial port to PC terminal
hux 24:0f08f68579bd 20
hux 24:0f08f68579bd 21 Buffer data; uint8_t *p = data;
hux 24:0f08f68579bd 22 blue.get(chr,data);
hux 24:0f08f68579bd 23
hux 24:0f08f68579bd 24 out.printf("%s: %02x-%02x-%02x-%02x-%02x-",name,(int)(p[0]),(int)(p[1]),(int)(p[2]),(int)(p[3]),(int)(p[4]));
hux 24:0f08f68579bd 25 out.printf("%02x-%02x-%02x-%02x-%02x\r\n",(int)(p[5]),(int)(p[6]),(int)(p[7]),(int)(p[8]),(int)(p[9]));
hux 24:0f08f68579bd 26 }
hux 24:0f08f68579bd 27
hux 24:0f08f68579bd 28 #endif // _SET_H_