summaryrefslogtreecommitdiff
path: root/src/components/ble
diff options
context:
space:
mode:
authorFinlay Davidson <finlay.davidson@coderclass.nl>2023-01-07 21:23:15 +0100
committerJF <JF002@users.noreply.github.com>2023-01-09 21:41:21 +0100
commit96165a8541b33baace920e26f062b2e282d644c6 (patch)
tree41a5c6ec1f9a9981fcf970b7b48095b54c142d64 /src/components/ble
parent09db67e003ab593956b4d4474fd08e7548985030 (diff)
Format header files
In my PR updating clang-format, I forgot to also format the headers.
Diffstat (limited to 'src/components/ble')
-rw-r--r--src/components/ble/AlertNotificationService.h1
-rw-r--r--src/components/ble/BatteryInformationService.h2
-rw-r--r--src/components/ble/BleController.h8
-rw-r--r--src/components/ble/CurrentTimeClient.h3
-rw-r--r--src/components/ble/DfuService.h4
-rw-r--r--src/components/ble/FSService.h6
-rw-r--r--src/components/ble/HeartRateService.h2
-rw-r--r--src/components/ble/ImmediateAlertService.h2
-rw-r--r--src/components/ble/MotionService.h2
-rw-r--r--src/components/ble/MusicService.h1
-rw-r--r--src/components/ble/NavigationService.h1
-rw-r--r--src/components/ble/NimbleController.h3
-rw-r--r--src/components/ble/NotificationManager.h2
-rw-r--r--src/components/ble/weather/WeatherService.h1
14 files changed, 38 insertions, 0 deletions
diff --git a/src/components/ble/AlertNotificationService.h b/src/components/ble/AlertNotificationService.h
index 5c7d428c..7f5273ac 100644
--- a/src/components/ble/AlertNotificationService.h
+++ b/src/components/ble/AlertNotificationService.h
@@ -16,6 +16,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class NotificationManager;
diff --git a/src/components/ble/BatteryInformationService.h b/src/components/ble/BatteryInformationService.h
index c6fc52e4..cc4d2604 100644
--- a/src/components/ble/BatteryInformationService.h
+++ b/src/components/ble/BatteryInformationService.h
@@ -9,8 +9,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class Battery;
+
class BatteryInformationService {
public:
BatteryInformationService(Controllers::Battery& batteryController);
diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h
index 675ede2d..de0a1bc2 100644
--- a/src/components/ble/BleController.h
+++ b/src/components/ble/BleController.h
@@ -24,6 +24,7 @@ namespace Pinetime {
void StopFirmwareUpdate();
void FirmwareUpdateTotalBytes(uint32_t totalBytes);
void FirmwareUpdateCurrentBytes(uint32_t currentBytes);
+
void State(FirmwareUpdateStates state) {
firmwareUpdateState = state;
}
@@ -31,12 +32,15 @@ namespace Pinetime {
bool IsFirmwareUpdating() const {
return isFirmwareUpdating;
}
+
uint32_t FirmwareUpdateTotalBytes() const {
return firmwareUpdateTotalBytes;
}
+
uint32_t FirmwareUpdateCurrentBytes() const {
return firmwareUpdateCurrentBytes;
}
+
FirmwareUpdateStates State() const {
return firmwareUpdateState;
}
@@ -44,15 +48,19 @@ namespace Pinetime {
void Address(BleAddress&& addr) {
address = addr;
}
+
const BleAddress& Address() const {
return address;
}
+
void AddressType(AddressTypes t) {
addressType = t;
}
+
void SetPairingKey(uint32_t k) {
pairingKey = k;
}
+
uint32_t GetPairingKey() const {
return pairingKey;
}
diff --git a/src/components/ble/CurrentTimeClient.h b/src/components/ble/CurrentTimeClient.h
index c718d2d9..0a3a8735 100644
--- a/src/components/ble/CurrentTimeClient.h
+++ b/src/components/ble/CurrentTimeClient.h
@@ -19,12 +19,15 @@ namespace Pinetime {
bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service);
int OnCharacteristicDiscoveryEvent(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_chr* characteristic);
int OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_attr* attribute);
+
static constexpr const ble_uuid16_t* Uuid() {
return &CurrentTimeClient::ctsServiceUuid;
}
+
static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() {
return &CurrentTimeClient::currentTimeCharacteristicUuid;
}
+
void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) override;
private:
diff --git a/src/components/ble/DfuService.h b/src/components/ble/DfuService.h
index 4708a4a6..b56911b9 100644
--- a/src/components/ble/DfuService.h
+++ b/src/components/ble/DfuService.h
@@ -13,9 +13,11 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Drivers {
class SpiNorFlash;
}
+
namespace Controllers {
class Ble;
@@ -46,10 +48,12 @@ namespace Pinetime {
void OnNotificationTimer();
void Reset();
};
+
class DfuImage {
public:
DfuImage(Pinetime::Drivers::SpiNorFlash& spiNorFlash) : spiNorFlash {spiNorFlash} {
}
+
void Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc);
void Erase();
void Append(uint8_t* data, size_t size);
diff --git a/src/components/ble/FSService.h b/src/components/ble/FSService.h
index 828925a8..b2299623 100644
--- a/src/components/ble/FSService.h
+++ b/src/components/ble/FSService.h
@@ -11,8 +11,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class Ble;
+
class FSService {
public:
FSService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::FS& fs);
@@ -71,6 +73,7 @@ namespace Pinetime {
FSState state;
char filepath[maxpathlen]; // TODO ..ugh fixed filepath len
int fileSize;
+
using ReadHeader = struct __attribute__((packed)) {
commands command;
uint8_t padding;
@@ -89,6 +92,7 @@ namespace Pinetime {
uint32_t chunklen;
uint8_t chunk[];
};
+
using ReadPacing = struct __attribute__((packed)) {
commands command;
uint8_t status;
@@ -124,6 +128,7 @@ namespace Pinetime {
uint32_t dataSize;
uint8_t data[];
};
+
using ListDirHeader = struct __attribute__((packed)) {
commands command;
uint8_t padding;
@@ -171,6 +176,7 @@ namespace Pinetime {
commands command;
uint8_t status;
};
+
using MoveHeader = struct __attribute__((packed)) {
commands command;
uint8_t padding;
diff --git a/src/components/ble/HeartRateService.h b/src/components/ble/HeartRateService.h
index 4e4a5a42..a60c12f6 100644
--- a/src/components/ble/HeartRateService.h
+++ b/src/components/ble/HeartRateService.h
@@ -10,8 +10,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class HeartRateController;
+
class HeartRateService {
public:
HeartRateService(Pinetime::System::SystemTask& system, Controllers::HeartRateController& heartRateController);
diff --git a/src/components/ble/ImmediateAlertService.h b/src/components/ble/ImmediateAlertService.h
index 1f778acd..c54b63ec 100644
--- a/src/components/ble/ImmediateAlertService.h
+++ b/src/components/ble/ImmediateAlertService.h
@@ -9,8 +9,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class NotificationManager;
+
class ImmediateAlertService {
public:
enum class Levels : uint8_t { NoAlert = 0, MildAlert = 1, HighAlert = 2 };
diff --git a/src/components/ble/MotionService.h b/src/components/ble/MotionService.h
index 1b4ac0a3..c9483766 100644
--- a/src/components/ble/MotionService.h
+++ b/src/components/ble/MotionService.h
@@ -10,8 +10,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class MotionController;
+
class MotionService {
public:
MotionService(Pinetime::System::SystemTask& system, Controllers::MotionController& motionController);
diff --git a/src/components/ble/MusicService.h b/src/components/ble/MusicService.h
index 047d0d26..9f1042cc 100644
--- a/src/components/ble/MusicService.h
+++ b/src/components/ble/MusicService.h
@@ -30,6 +30,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class MusicService {
public:
diff --git a/src/components/ble/NavigationService.h b/src/components/ble/NavigationService.h
index c0c77f35..78e7b888 100644
--- a/src/components/ble/NavigationService.h
+++ b/src/components/ble/NavigationService.h
@@ -30,6 +30,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class NavigationService {
diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h
index 000231fe..8f1dfed7 100644
--- a/src/components/ble/NimbleController.h
+++ b/src/components/ble/NimbleController.h
@@ -58,12 +58,15 @@ namespace Pinetime {
Pinetime::Controllers::MusicService& music() {
return musicService;
};
+
Pinetime::Controllers::NavigationService& navigation() {
return navService;
};
+
Pinetime::Controllers::AlertNotificationService& alertService() {
return anService;
};
+
Pinetime::Controllers::WeatherService& weather() {
return weatherService;
};
diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h
index 4c199dbf..09b5a561 100644
--- a/src/components/ble/NotificationManager.h
+++ b/src/components/ble/NotificationManager.h
@@ -51,9 +51,11 @@ namespace Pinetime {
static constexpr size_t MaximumMessageSize() {
return MessageSize;
};
+
bool IsEmpty() const {
return size == 0;
}
+
size_t NbNotifications() const;
private:
diff --git a/src/components/ble/weather/WeatherService.h b/src/components/ble/weather/WeatherService.h
index e37417da..786cad89 100644
--- a/src/components/ble/weather/WeatherService.h
+++ b/src/components/ble/weather/WeatherService.h
@@ -39,6 +39,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
+
namespace Controllers {
class WeatherService {