167#if NORDIC_SDK_VERSION > 15
168 ble_db_discovery_init_t _discoveryInit;
170 nrf_ble_gq_t* _queue;
176 uint16_t
_mtu = BLE_GATT_ATT_MTU_DEFAULT;
215 void onConnect(uint16_t connectionHandle,
const ble_gap_evt_connected_t& event);
219 void onMtu(uint16_t gattStatus,
const ble_gattc_evt_exchange_mtu_rsp_t& event);
220 void onRead(uint16_t gattStatus,
const ble_gattc_evt_read_rsp_t& event);
221 void onWrite(uint16_t gattStatus,
const ble_gattc_evt_write_rsp_t& event);
Class that enables you to connect to a device, and perform write or read operations.
Definition: cs_BleCentral.h:27
cs_ret_code_t writeNotificationConfig(uint16_t cccdHandle, bool enableNotifications)
Performs a write() with the value to enable or disable notifications.
void onMtu(uint16_t gattStatus, const ble_gattc_evt_exchange_mtu_rsp_t &event)
void onGattCentralEvent(uint16_t evtId, const ble_gattc_evt_t &event)
void onWrite(uint16_t gattStatus, const ble_gattc_evt_write_rsp_t &event)
void onDisconnect(const ble_gap_evt_disconnected_t &event)
void onBleEvent(const ble_evt_t *event)
Internal usage: to be called on BLE events.
cs_ret_code_t discoverServices(const UUID *uuids, uint8_t uuidCount)
Discover services.
TYPIFY(CONFIG_SCAN_INTERVAL_625US) _scanInterval
Scan setting to be used when connecting.
uint16_t _connectionHandle
Definition: cs_BleCentral.h:160
BleCentral(BleCentral const &)
bool isBusy()
Check whether an operation is in progress.
void onConnect(uint16_t connectionHandle, const ble_gap_evt_connected_t &event)
cs_ret_code_t connectWithClearance(const device_address_t &address, uint16_t timeoutMs=3000)
Same as connect(), but now we have clearance.
uint16_t _mtu
Current MTU.
Definition: cs_BleCentral.h:176
void onConnectClearance()
void onGapTimeout(const ble_gap_evt_timeout_t &event)
void onDiscoveryEvent(ble_db_discovery_evt_t &event)
Internal usage.
void onNotification(uint16_t gattStatus, const ble_gattc_evt_hvx_t &event)
void onGapEvent(uint16_t evtId, const ble_gap_evt_t &event)
Event handlers.
cs_ret_code_t connect(const device_address_t &address, uint16_t timeoutMs=3000)
Connect to a device.
cs_data_t requestWriteBuffer()
Request the write buffer.
void handleEvent(event_t &event)
Internal usage.
Operation _currentOperation
Operation in progress.
Definition: cs_BleCentral.h:181
void operator=(BleCentral const &)
device_address_t _address
Definition: cs_BleCentral.h:146
uint16_t _bufDataSize
How much data is actually in the buffer.
Definition: cs_BleCentral.h:158
void sendOperationResult(event_t &event)
TYPIFY(CONFIG_SCAN_WINDOW_625US) _scanWindow
void onRead(uint16_t gattStatus, const ble_gattc_evt_read_rsp_t &event)
cs_ret_code_t write(uint16_t handle, const uint8_t *data, uint16_t len)
Write data to a characteristic.
void finalizeOperation(Operation operation, cs_ret_code_t retCode)
Finalize an operation.
static BleCentral & getInstance()
Definition: cs_BleCentral.h:29
cs_ret_code_t nextWrite(uint16_t handle, uint16_t offset)
Writes the next chunk of a long write.
uint16_t _timeoutMs
Definition: cs_BleCentral.h:148
void finalizeOperation(Operation operation, uint8_t *data, uint8_t dataSize)
Operation
Definition: cs_BleCentral.h:132
cs_ret_code_t read(uint16_t handle)
Read data from a characteristic.
cs_data_t _buf
Buffer used for reading and writing.
Definition: cs_BleCentral.h:153
void init()
Initializes the class:
cs_ret_code_t disconnect()
Terminate current connection.
uint16_t _currentHandle
Keep up the handle of the current write or read operation.
Definition: cs_BleCentral.h:163
ble_db_discovery_t _discoveryModule
Definition: cs_BleCentral.h:165
bool isConnected()
Check whether this crownstone is connected as central.
Event listener.
Definition: cs_EventListener.h:17
Class that enables the use of 128 bit service UUIDs.
Definition: cs_UUID.h:35
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21
@ CONFIG_SCAN_INTERVAL_625US
@ CONFIG_SCAN_WINDOW_625US
Packets (structs) that are used internally in the firmware, and can be changed freely.
Definition: cs_PacketsInternal.h:27
Definition: cs_PacketsInternal.h:97