add error codes to CTS; cosmetics

This commit is contained in:
uli 2022-05-29 16:35:35 +02:00
parent 688d5f04f5
commit 11fa523166
4 changed files with 34 additions and 36 deletions

View File

@ -44,8 +44,7 @@ int CurrentTimeService::OnCurrentTimeAccessed(uint16_t conn_handle, uint16_t att
if (res < 0) {
NRF_LOG_ERROR("Error reading BLE Data writing to CTS Current Time (too little data)")
// return OK/0 anyway, we did consume the request, we just ignored the invalid value´
return 0;
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
uint16_t year = ((uint16_t) result.year_MSO << 8) + result.year_LSO;
@ -82,8 +81,7 @@ int CurrentTimeService::OnLocalTimeAccessed(uint16_t conn_handle, uint16_t attr_
if (res < 0) {
NRF_LOG_ERROR("Error reading BLE Data writing to CTS Local Time (too little data)")
// return OK/0 anyway, we did consume the request, we just ignored the invalid value´
return 0;
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
NRF_LOG_INFO("Received data: %d %d", result.timezone, result.dst);

View File

@ -5,7 +5,6 @@
#include <string>
#include "components/settings/Settings.h"
namespace Pinetime {
namespace System {
class SystemTask;
@ -41,14 +40,14 @@ namespace Pinetime {
uint32_t systickCounter);
/*
* setter corresponding to the BLE Set Local Time characteristic.
*
* used to update difference between utc and local time (see UtcOffset())
*
* parameters are in quarters of an our. Following the BLE CTS specification,
* timezone is expected to be constant over DST which will be reported in
* dst field.
*/
* setter corresponding to the BLE Set Local Time characteristic.
*
* used to update difference between utc and local time (see UtcOffset())
*
* parameters are in quarters of an our. Following the BLE CTS specification,
* timezone is expected to be constant over DST which will be reported in
* dst field.
*/
void SetTimeZone(uint8_t timezone, uint8_t dst);
void UpdateTime(uint32_t systickCounter);

View File

@ -140,15 +140,14 @@ namespace Pinetime {
return settings.screenTimeOut;
};
void SetShakeThreshold(uint16_t thresh){
if(settings.shakeWakeThreshold != thresh){
settings.shakeWakeThreshold = thresh;
settingsChanged = true;
void SetShakeThreshold(uint16_t thresh) {
if (settings.shakeWakeThreshold != thresh) {
settings.shakeWakeThreshold = thresh;
settingsChanged = true;
}
}
int16_t GetShakeThreshold() const{
int16_t GetShakeThreshold() const {
return settings.shakeWakeThreshold;
}
@ -202,13 +201,13 @@ namespace Pinetime {
return settings.stepsGoal;
};
void SetBleRadioEnabled(bool enabled) {
bleRadioEnabled = enabled;
};
void SetBleRadioEnabled(bool enabled) {
bleRadioEnabled = enabled;
};
bool GetBleRadioEnabled() const {
return bleRadioEnabled;
};
bool GetBleRadioEnabled() const {
return bleRadioEnabled;
};
private:
Pinetime::Controllers::FS& fs;

View File

@ -70,15 +70,17 @@ void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
if (object == cbOption[i]) {
lv_checkbox_set_checked(cbOption[i], true);
if (i == 0) {
settingsController.SetClockType(Controllers::Settings::ClockType::H12);
};
if (i == 1) {
settingsController.SetClockType(Controllers::Settings::ClockType::H24);
};
if (i == 2) {
settingsController.SetClockType(Controllers::Settings::ClockType::UTC);
};
switch (i) {
case 0:
settingsController.SetClockType(Controllers::Settings::ClockType::H12);
break;
case 1:
settingsController.SetClockType(Controllers::Settings::ClockType::H24);
break;
case 2:
settingsController.SetClockType(Controllers::Settings::ClockType::UTC);
break;
}
} else {
lv_checkbox_set_checked(cbOption[i], false);