Implemented a few new callbacks

This commit is contained in:
Th3maz1ng 2023-04-22 13:23:20 +02:00
parent e698dfb274
commit ebf7f07789

View File

@ -223,7 +223,11 @@ static void setBLEEnabledCb(bool *enabled, SettingMode_e mode)
if(!ble_modem_on(true, true))
APP_LOG_ERROR("Failed to start BLE modem with service");
else
{
// We generate and set the pairing passkey
ble_service_set_pairing_passkey(random_gen_6_digit());
watch_face_set_bluetooth_indicator(&watchFace, BLUETOOTH_STATE_ON);
}
}
else
{
@ -265,6 +269,16 @@ static void getBLEDeviceNameCb(const char **dev_name)
*dev_name = BLE_DEVICE_NAME;
}
static void getBLEDeviceMACCb(const uint8_t **dev_mac)
{
*dev_mac = ble_service_get_device_mac_address();
}
static void getBLEDevicePairingKeyCb(const uint32_t *pairing_key)
{
*pairing_key = ble_service_get_active_pairing_passkey();
}
static void getBatteryVoltageCb(uint16_t *battery_voltage)
{
*battery_voltage = _battery_stats.battery_voltage;
@ -324,6 +338,8 @@ SettingsScreenAPIInterface_t settingsScreenAPIInterface =
.setWiFiEnabledSettingsCb = &(setWiFiEnabledCb),
.setLanguageSettingsCb = &(setLanguageCb),
.getBLEDeviceNameCb = &(getBLEDeviceNameCb),
.getBLEDeviceMACCb = &(getBLEDeviceMACCb),
.getBLEDevicePairingKeyCb = &(getBLEDevicePairingKeyCb),
.getBatteryVoltageCb = &(getBatteryVoltageCb),
.getMagnetometerRawDataCb = &(getMagnetometerRawDataCb),
.getBMP280DataCb = &(getBMP280DataCb),