Include cleanup: components

This commit is contained in:
okaestne 2020-11-15 15:05:51 +01:00
parent c3475b92fa
commit 1516573df4
No known key found for this signature in database
GPG key ID: 06A81B143EA9588F
35 changed files with 207 additions and 124 deletions

View file

@ -1,8 +1,7 @@
#include <drivers/include/nrfx_saadc.h>
#include "BatteryController.h"
#include <hal/nrf_gpio.h>
#include <libraries/log/nrf_log.h>
#include <algorithm>
#include "BatteryController.h"
using namespace Pinetime::Controllers;

View file

@ -1,7 +1,7 @@
#pragma once
#include <cstdint>
#include <drivers/include/nrfx_saadc.h>
namespace Pinetime {
namespace Controllers {
class Battery {

View file

@ -1,7 +1,7 @@
#include <systemtask/SystemTask.h>
#include "NotificationManager.h"
#include "AlertNotificationClient.h"
#include <algorithm>
#include "NotificationManager.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;
constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid;
@ -159,8 +159,8 @@ void AlertNotificationClient::OnNotification(ble_gap_event *event) {
const auto maxBufferSize{maxMessageSize + headerSize};
const auto dbgPacketLen = OS_MBUF_PKTLEN(event->notify_rx.om);
size_t bufferSize = min(dbgPacketLen + stringTerminatorSize, maxBufferSize);
auto messageSize = min(maxMessageSize, (bufferSize - headerSize));
size_t bufferSize = std::min(dbgPacketLen + stringTerminatorSize, maxBufferSize);
auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize));
NotificationManager::Notification notif;
os_mbuf_copydata(event->notify_rx.om, headerSize, messageSize - 1, notif.message.data());

View file

@ -1,13 +1,23 @@
#pragma once
#include <cstdint>
#include <array>
#include <functional>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
#include "BleClient.h"
namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class NotificationManager;
class AlertNotificationClient : public BleClient {
public:
explicit AlertNotificationClient(Pinetime::System::SystemTask &systemTask,

View file

@ -1,10 +1,9 @@
#include <hal/nrf_rtc.h>
#include "NotificationManager.h"
#include <systemtask/SystemTask.h>
#include "AlertNotificationService.h"
#include <hal/nrf_rtc.h>
#include <cstring>
#include <algorithm>
#include "NotificationManager.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;
@ -60,8 +59,8 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle
const auto maxBufferSize{maxMessageSize + headerSize};
const auto dbgPacketLen = OS_MBUF_PKTLEN(ctxt->om);
size_t bufferSize = min(dbgPacketLen + stringTerminatorSize, maxBufferSize);
auto messageSize = min(maxMessageSize, (bufferSize-headerSize));
size_t bufferSize = std::min(dbgPacketLen + stringTerminatorSize, maxBufferSize);
auto messageSize = std::min(maxMessageSize, (bufferSize-headerSize));
NotificationManager::Notification notif;
os_mbuf_copydata(ctxt->om, headerSize, messageSize-1, notif.message.data());

View file

@ -1,10 +1,20 @@
#pragma once
#include <cstdint>
#include <array>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class NotificationManager;
class AlertNotificationService {
public:
AlertNotificationService(Pinetime::System::SystemTask &systemTask,

View file

@ -1,5 +1,9 @@
#pragma once
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
namespace Pinetime {
namespace System {

View file

@ -1,5 +1,3 @@
#include <cstring>
#include <cstdlib>
#include "BleController.h"
using namespace Pinetime::Controllers;

View file

@ -1,8 +1,7 @@
#pragma once
#include <FreeRTOS.h>
#include <queue.h>
#include <array>
#include <cstdint>
namespace Pinetime {
namespace Controllers {

View file

@ -1,5 +1,6 @@
#include <hal/nrf_rtc.h>
#include "CurrentTimeClient.h"
#include <hal/nrf_rtc.h>
#include "components/datetime/DateTimeController.h"
using namespace Pinetime::Controllers;

View file

@ -1,13 +1,15 @@
#pragma once
#include <cstdint>
#include <array>
#include "components/datetime/DateTimeController.h"
#include "BleClient.h"
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
#include <cstdint>
#include "BleClient.h"
namespace Pinetime {
namespace Controllers {
class DateTime;
class CurrentTimeClient : public BleClient {
public:

View file

@ -3,7 +3,11 @@
#include <array>
#include "components/datetime/DateTimeController.h"
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
namespace Pinetime {
namespace Controllers {

View file

@ -1,9 +1,10 @@
#pragma once
#include <cstdint>
#include <array>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#include <Version.h>
#undef max
#undef min
#include "Version.h"
namespace Pinetime {
namespace Controllers {

View file

@ -1,8 +1,8 @@
#include <cstring>
#include "components/ble/BleController.h"
#include "systemtask/SystemTask.h"
#include "DfuService.h"
#include <cstring>
#include "components/ble/BleController.h"
#include "drivers/SpiNorFlash.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;

View file

@ -3,7 +3,11 @@
#include <cstdint>
#include <array>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
namespace Pinetime {
namespace System {

View file

@ -1,7 +1,7 @@
#include <systemtask/SystemTask.h>
#include <cstring>
#include "ImmediateAlertService.h"
#include "AlertNotificationService.h"
#include <cstring>
#include "NotificationManager.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;

View file

@ -1,5 +1,9 @@
#pragma once
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
namespace Pinetime {
namespace System {

View file

@ -15,8 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <systemtask/SystemTask.h>
#include "MusicService.h"
#include "systemtask/SystemTask.h"
int MSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) {
auto musicService = static_cast<Pinetime::Controllers::MusicService *>(arg);

View file

@ -18,10 +18,13 @@
#pragma once
#include <cstdint>
#include <array>
#include <string>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#include <host/ble_uuid.h>
#include <string>
#undef max
#undef min
//c7e50000-78fc-48fe-8e23-43b37a1942d0
#define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7}

View file

@ -1,15 +1,19 @@
#include "components/datetime/DateTimeController.h"
#include <systemtask/SystemTask.h>
#include "components/ble/NotificationManager.h"
#include <hal/nrf_rtc.h>
#include "NimbleController.h"
#include "MusicService.h"
#include <services/gatt/ble_svc_gatt.h>
#include <services/gap/ble_svc_gap.h>
#include <host/util/util.h>
#include <host/ble_hs_id.h>
#include <host/ble_hs.h>
#include <hal/nrf_rtc.h>
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#include <host/ble_hs.h>
#include <host/ble_hs_id.h>
#include <host/util/util.h>
#undef max
#undef min
#include <services/gap/ble_svc_gap.h>
#include <services/gatt/ble_svc_gatt.h>
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
#include "components/datetime/DateTimeController.h"
#include "systemtask/SystemTask.h"
using namespace Pinetime::Controllers;

View file

@ -2,24 +2,35 @@
#include <cstdint>
#include "AlertNotificationService.h"
#include "AlertNotificationClient.h"
#include "DeviceInformationService.h"
#include "CurrentTimeClient.h"
#include "DfuService.h"
#include "CurrentTimeService.h"
#include "MusicService.h"
#include "BatteryInformationService.h"
#include "ImmediateAlertService.h"
#include "ServiceDiscovery.h"
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#undef max
#undef min
#include "AlertNotificationClient.h"
#include "AlertNotificationService.h"
#include "BatteryInformationService.h"
#include "CurrentTimeClient.h"
#include "CurrentTimeService.h"
#include "DeviceInformationService.h"
#include "DfuService.h"
#include "ImmediateAlertService.h"
#include "MusicService.h"
#include "ServiceDiscovery.h"
namespace Pinetime {
namespace Drivers {
class SpiNorFlash;
}
namespace System {
class SystemTask;
}
namespace Controllers {
class Ble;
class DateTime;
class NotificationManager;
class NimbleController {

View file

@ -1,6 +1,6 @@
#include "NotificationManager.h"
#include <cstring>
#include <algorithm>
#include "NotificationManager.h"
using namespace Pinetime::Controllers;

View file

@ -2,6 +2,8 @@
#include <array>
#include <atomic>
#include <cstddef>
#include <cstdint>
namespace Pinetime {
namespace Controllers {
@ -27,7 +29,7 @@ namespace Pinetime {
bool ClearNewNotificationFlag();
bool AreNewNotificationsAvailable();
static constexpr uint8_t MaximumMessageSize() { return MessageSize; };
static constexpr size_t MaximumMessageSize() { return MessageSize; };
size_t NbNotifications() const;
private:

View file

@ -1,5 +1,7 @@
#include <libraries/log/nrf_log.h>
#include "ServiceDiscovery.h"
#include <libraries/log/nrf_log.h>
#include "BleClient.h"
using namespace Pinetime::Controllers;
ServiceDiscovery::ServiceDiscovery(std::array<BleClient*, 2>&& clients) : clients{clients} {

View file

@ -1,12 +1,12 @@
#pragma once
#include <array>
#include <functional>
#include <memory>
#include "BleClient.h"
#include <cstdint>
namespace Pinetime {
namespace Controllers {
class BleClient;
class ServiceDiscovery {
public:
ServiceDiscovery(std::array<BleClient*, 2>&& bleClients);

View file

@ -1,5 +1,5 @@
#include <hal/nrf_gpio.h>
#include "BrightnessController.h"
#include <hal/nrf_gpio.h>
using namespace Pinetime::Controllers;

View file

@ -1,8 +1,8 @@
#include <drivers/InternalFlash.h>
#include <hal/nrf_rtc.h>
#include "FirmwareValidator.h"
#include <hal/nrf_rtc.h>
#include "drivers/InternalFlash.h"
using namespace Pinetime::Controllers;
bool FirmwareValidator::IsValidated() const {

View file

@ -1,8 +1,5 @@
#include <libraries/svc/nrf_svci.h>
#include <FreeRTOS.h>
#include <task.h>
#include "Gfx.h"
#include "../../drivers/St7789.h"
#include "drivers/St7789.h"
using namespace Pinetime::Components;
Gfx::Gfx(Pinetime::Drivers::St7789 &lcd) : lcd{lcd} {

View file

@ -1,10 +1,10 @@
#pragma once
#include <cstdint>
#include <nrf_font.h>
#include <drivers/BufferProvider.h>
#include <FreeRTOS.h>
#include <nrf_font.h>
#include <task.h>
#include <cstddef>
#include <cstdint>
#include "drivers/BufferProvider.h"
namespace Pinetime {
namespace Drivers {

View file

@ -1,9 +1,8 @@
#include "NrfLogger.h"
#include <libraries/log/nrf_log.h>
#include <libraries/log/nrf_log_ctrl.h>
#include <libraries/log/nrf_log_default_backends.h>
#include <FreeRTOS.h>
#include <task.h>
#include <libraries/log/nrf_log.h>
#include "NrfLogger.h"
using namespace Pinetime::Logging;

View file

@ -1,6 +1,9 @@
#pragma once
#include "Logger.h"
#include <FreeRTOS.h>
#include <task.h>
namespace Pinetime {
namespace Logging{
class NrfLogger : public Logger {

View file

@ -1,32 +1,44 @@
// nrf
#include <hal/nrf_rtc.h>
#include <hal/nrf_wdt.h>
#include <legacy/nrf_drv_clock.h>
#include <libraries/gpiote/app_gpiote.h>
#include <libraries/timer/app_timer.h>
#include <softdevice/common/nrf_sdh.h>
// nimble
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <controller/ble_ll.h>
#include <host/ble_hs.h>
#include <host/util/util.h>
#include <nimble/nimble_port.h>
#include <nimble/nimble_port_freertos.h>
#include <nimble/npl_freertos.h>
#include <os/os_cputime.h>
#include <services/gap/ble_svc_gap.h>
#include <transport/ram/ble_hci_ram.h>
#undef max
#undef min
// FreeRTOS
#include <FreeRTOS.h>
#include <task.h>
#include <timers.h>
#include <legacy/nrf_drv_clock.h>
#include <hal/nrf_rtc.h>
#include <hal/nrf_wdt.h>
#include <os/os_cputime.h>
#include <libraries/timer/app_timer.h>
#include <libraries/gpiote/app_gpiote.h>
#include "displayapp/DisplayApp.h"
#include <softdevice/common/nrf_sdh.h>
#include "components/datetime/DateTimeController.h"
#include "components/battery/BatteryController.h"
#include "components/ble/BleController.h"
#include "components/ble/NotificationManager.h"
#include <drivers/St7789.h>
#include <drivers/SpiMaster.h>
#include <drivers/Spi.h>
#include "components/datetime/DateTimeController.h"
#include "displayapp/DisplayApp.h"
#include "displayapp/LittleVgl.h"
#include <systemtask/SystemTask.h>
#include <nimble/nimble_port_freertos.h>
#include <nimble/npl_freertos.h>
#include <nimble/nimble_port.h>
#include <host/ble_hs.h>
#include <controller/ble_ll.h>
#include <transport/ram/ble_hci_ram.h>
#include <host/util/util.h>
#include <services/gap/ble_svc_gap.h>
#include "drivers/Spi.h"
#include "drivers/SpiMaster.h"
#include "drivers/SpiNorFlash.h"
#include "drivers/St7789.h"
#include "drivers/TwiMaster.h"
#include "drivers/Cst816s.h"
#include "systemtask/SystemTask.h"
#if NRF_LOG_ENABLED
#include "logging/NrfLogger.h"

View file

@ -2,6 +2,7 @@
#include <FreeRTOS.h>
#include <timers.h>
#include <nrfx_gpiote.h>
void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action);
void DebounceTimerCallback(TimerHandle_t xTimer);

View file

@ -1,19 +1,27 @@
#include <libraries/log/nrf_log.h>
#include <libraries/gpiote/app_gpiote.h>
#include <drivers/Cst816s.h>
#include "displayapp/LittleVgl.h"
#include <hal/nrf_rtc.h>
#include "components/ble/NotificationManager.h"
#include "SystemTask.h"
#define min // workaround: nimble's min/max macros conflict with libstdc++
#define max
#include <host/ble_gap.h>
#include <host/ble_gatt.h>
#include <host/ble_hs_adv.h>
#include "SystemTask.h"
#include <nimble/hci_common.h>
#include <host/ble_gap.h>
#include <host/util/util.h>
#include <drivers/InternalFlash.h>
#include <nimble/hci_common.h>
#undef max
#undef min
#include <hal/nrf_rtc.h>
#include <libraries/gpiote/app_gpiote.h>
#include <libraries/log/nrf_log.h>
#include "BootloaderVersion.h"
#include "components/ble/BleController.h"
#include "displayapp/LittleVgl.h"
#include "drivers/Cst816s.h"
#include "drivers/St7789.h"
#include "drivers/InternalFlash.h"
#include "drivers/SpiMaster.h"
#include "drivers/SpiNorFlash.h"
#include "drivers/TwiMaster.h"
#include "main.h"
#include "components/ble/NimbleController.h"
#include "../BootloaderVersion.h"
using namespace Pinetime::System;

View file

@ -4,17 +4,23 @@
#include <FreeRTOS.h>
#include <task.h>
#include <drivers/SpiMaster.h>
#include <drivers/St7789.h>
#include "components/battery/BatteryController.h"
#include "displayapp/DisplayApp.h"
#include <drivers/Watchdog.h>
#include <drivers/SpiNorFlash.h>
#include <timers.h>
#include "SystemMonitor.h"
#include "components/battery/BatteryController.h"
#include "components/ble/NimbleController.h"
#include "timers.h"
#include "components/ble/NotificationManager.h"
#include "displayapp/DisplayApp.h"
#include "drivers/Watchdog.h"
namespace Pinetime {
namespace Drivers {
class Cst816S;
class SpiMaster;
class SpiNorFlash;
class St7789;
class TwiMaster;
}
namespace System {
class SystemTask {
public: