Minor temporary patch to allow DFU packet callback
Fork of BLE_API by
UARTService Class Reference
BLE Service to enable UART over BLE. More...
#include <UARTService.h>
Public Member Functions | |
UARTService (BLEDevice &_ble) | |
uint16_t | getTXCharacteristicHandle () |
Note: TX and RX characteristics are to be interpreted from the viewpoint of the GATT client using this service. | |
uint16_t | getRXCharacteristicHandle () |
Note: TX and RX characteristics are to be interpreted from the viewpoint of the GATT client using this service. | |
size_t | write (const void *_buffer, size_t length) |
We attempt to collect bytes before pushing them to the UART RX characteristic--writing to the RX characteristic will then generate notifications for the client. | |
size_t | writeString (const char *str) |
Helper function to write out strings. | |
int | _putc (int c) |
Override for Stream::_putc() | |
int | _getc () |
Override for Stream::_getc() | |
Static Public Attributes | |
static const unsigned | GATT_MTU_SIZE_DEFAULT = 23 |
< Maximum length of data (in bytes) that can be transmitted by the UART service module to the peer. |
Detailed Description
BLE Service to enable UART over BLE.
Definition at line 41 of file UARTService.h.
Constructor & Destructor Documentation
UARTService | ( | BLEDevice & | _ble ) |
- Parameters:
-
ref] ble BLEDevice object for the underlying controller.
Definition at line 53 of file UARTService.h.
Member Function Documentation
int _getc | ( | ) |
Override for Stream::_getc()
- Returns:
- The character read.
Definition at line 155 of file UARTService.h.
int _putc | ( | int | c ) |
Override for Stream::_putc()
- Parameters:
-
c This function writes the character c, cast to an unsigned char, to stream.
- Returns:
- The character written as an unsigned char cast to an int or EOF on error.
Definition at line 146 of file UARTService.h.
uint16_t getRXCharacteristicHandle | ( | ) |
Note: TX and RX characteristics are to be interpreted from the viewpoint of the GATT client using this service.
Definition at line 80 of file UARTService.h.
uint16_t getTXCharacteristicHandle | ( | ) |
Note: TX and RX characteristics are to be interpreted from the viewpoint of the GATT client using this service.
Definition at line 73 of file UARTService.h.
size_t write | ( | const void * | _buffer, |
size_t | length | ||
) |
We attempt to collect bytes before pushing them to the UART RX characteristic--writing to the RX characteristic will then generate notifications for the client.
Updates made in quick succession to a notification-generating characteristic will result in data being buffered in the bluetooth stack as notifications are sent out. The stack will have its limits for this buffering; typically a small number under 10. Collecting data into the sendBuffer buffer helps mitigate the rate of updates. But we shouldn't buffer a large amount of data before updating the characteristic otherwise the client will need to turn around and make a long read request; this is because notifications include only the first 20 bytes of the updated data.
- Parameters:
-
buffer The received update length Amount of characters to be appended.
- Returns:
- Amount of characters appended to the rxCharacteristic.
Definition at line 101 of file UARTService.h.
size_t writeString | ( | const char * | str ) |
Helper function to write out strings.
- Parameters:
-
str The received string.
- Returns:
- Amount of characters appended to the rxCharacteristic.
Definition at line 135 of file UARTService.h.
Field Documentation
const unsigned GATT_MTU_SIZE_DEFAULT = 23 [static] |
< Maximum length of data (in bytes) that can be transmitted by the UART service module to the peer.
Definition at line 44 of file UARTService.h.
Generated on Wed Jul 13 2022 06:54:06 by 1.7.2