44 static Stack instance;
208 void onWrite(uint16_t connectionHandle,
const ble_gatts_evt_write_t& writeEvt);
BaseClass.
Definition: cs_BaseClass.h:15
Base class for a BLE service.
Definition: cs_Service.h:26
nRF51822 specific implementation of the BLEStack
Definition: cs_Stack.h:41
app_timer_id_t _connectionWatchdogTimerId
Definition: cs_Stack.h:70
bool checkCondition(condition_t condition, bool expectation)
Services_t _services
Definition: cs_Stack.h:59
void startScanning()
Start scanning for devices.
Stack()
Constructor of the BLE stack on the NRF5 series.
void stopConnectionWatchdog()
bool isDisconnecting()
In case a disconnect has been called, we cannot allow another write or we'll get an Fatal Error 8.
condition_t
Definition: cs_Stack.h:52
@ C_SERVICES_INITIALIZED
Definition: cs_Stack.h:52
@ C_STACK_INITIALIZED
Definition: cs_Stack.h:52
@ C_RADIO_INITIALIZED
Definition: cs_Stack.h:52
bool _connectionWatchdogRunning
Definition: cs_Stack.h:71
bool _disconnectingInProgress
Definition: cs_Stack.h:55
void updateConnParams()
Update connection parameters, can be called when already initialized.
~Stack()
The destructor shuts down the stack.
void onDisconnect(const ble_evt_t *p_ble_evt)
void onConnectionTimeout()
void createCharacteristics()
void onTxComplete(const ble_evt_t *p_ble_evt)
Transmission complete event.
uint8_t _scanBuffer[31]
Definition: cs_Stack.h:73
nrf_clock_lf_cfg_t _clockSource
Definition: cs_Stack.h:61
void onMemoryRelease(uint16_t connectionHandle)
void resetConnectionWatchdog()
Bluenet will automatically disconnect after nothing has been written for some time.
void updateMaxConnectionInterval(uint16_t connectionInterval_1_25_ms)
Set and update the preferred maximum connection interval in units of 1.25 ms.
uint16_t _connectionHandle
Definition: cs_Stack.h:66
app_timer_t _connectionWatchdogTimerData
Definition: cs_Stack.h:69
void onIncomingConnected(const ble_evt_t *p_ble_evt)
Connection request.
void stopScanning()
Stop scanning for devices.
void updateConnectionSupervisionTimeout(uint16_t conSupTimeout_10_ms)
Set and update the preferred connection supervision timeout in units of 10 ms.
bool _connectionIsOutgoing
Definition: cs_Stack.h:67
static Stack & getInstance()
Definition: cs_Stack.h:43
void setClockSource(nrf_clock_lf_cfg_t clockSource)
Set initial clock source, not applied unless done before radio init.
void init()
Initialization of the BLE stack.
void onWrite(uint16_t connectionHandle, const ble_gatts_evt_write_t &writeEvt)
void updateMinConnectionInterval(uint16_t connectionInterval_1_25_ms)
Set and update the preferred minimum connection interval in units of 1.25 ms.
bool isConnectedPeripheral()
void secReqTimeoutHandler(void *p_context)
fixed_tuple< Service *, MAX_SERVICE_COUNT > Services_t
Definition: cs_Stack.h:50
ble_data_t _scanBufferStruct
Definition: cs_Stack.h:74
bool isScanning()
Returns true if currently scanning.
void operator=(Stack const &)
void onGapTimeout(uint8_t src)
bool _scanning
Definition: cs_Stack.h:64
void addService(Service *svc)
Add a service to the stack.
void onConnect(const ble_evt_t *p_ble_evt)
void onIncomingDisconnected(const ble_evt_t *p_ble_evt)
static const uint8_t MAX_SERVICE_COUNT
Maximum number of services (currently set to 5)
Definition: cs_Stack.h:49
void onBleEvent(const ble_evt_t *p_ble_evt)
Function that handles BLE events.
void startConnectionWatchdog()
void initRadio()
Initialization of the radio.
void updateSlaveLatency(uint16_t slaveLatency)
Set and update the preferred slave latency count.
void onBleEventInterrupt(const ble_evt_t *p_ble_evt, bool isInterrupt)
Function that handles BLE events on interrupt level.
uint16_t getConnectionHandle()
Definition: cs_Stack.h:117
ble_gap_conn_params_t _connectionParams
Definition: cs_Stack.h:62
void initServices()
Register the added services to the softdevice.
void onMemoryRequest(uint16_t connectionHandle)
A fixed tuple is a vector with a templated type and a reserved capacity.
Definition: cs_Tuple.h:31