summaryrefslogtreecommitdiff
path: root/src/Components/Ble
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-08-17 16:31:00 +0200
committerJF <jf@codingfield.com>2020-08-17 16:31:00 +0200
commit83f6d7d81b80809de0bc850a0b445bc035098dba (patch)
tree1e0187c2f622f17fafe15dad709089d5d04180cb /src/Components/Ble
parent18686ac2cbf6b97dd0250234ce128bd9ad350d6e (diff)
Fix most of the warnings. Remaining warnings come from nimble source code.
Diffstat (limited to 'src/Components/Ble')
-rw-r--r--src/Components/Ble/AlertNotificationClient.cpp2
-rw-r--r--src/Components/Ble/AlertNotificationService.cpp9
-rw-r--r--src/Components/Ble/CurrentTimeService.cpp5
-rw-r--r--src/Components/Ble/DeviceInformationService.h10
-rw-r--r--src/Components/Ble/DfuService.cpp4
-rw-r--r--src/Components/Ble/MusicService.cpp3
-rw-r--r--src/Components/Ble/NimbleController.cpp7
-rw-r--r--src/Components/Ble/NimbleController.h2
8 files changed, 19 insertions, 23 deletions
diff --git a/src/Components/Ble/AlertNotificationClient.cpp b/src/Components/Ble/AlertNotificationClient.cpp
index b65e019d..3e4b495f 100644
--- a/src/Components/Ble/AlertNotificationClient.cpp
+++ b/src/Components/Ble/AlertNotificationClient.cpp
@@ -116,7 +116,7 @@ void AlertNotificationClient::OnNotification(ble_gap_event *event) {
char *s = (char *) &data[3];
auto messageSize = min(maxMessageSize, (bufferSize-3));
- for (int i = 0; i < messageSize-1; i++) {
+ for (uint i = 0; i < messageSize-1; i++) {
if (s[i] == 0x00) {
s[i] = 0x0A;
}
diff --git a/src/Components/Ble/AlertNotificationService.cpp b/src/Components/Ble/AlertNotificationService.cpp
index 0faa17c8..ce2f7dd7 100644
--- a/src/Components/Ble/AlertNotificationService.cpp
+++ b/src/Components/Ble/AlertNotificationService.cpp
@@ -26,8 +26,8 @@ void AlertNotificationService::Init() {
ASSERT(res == 0);
}
-AlertNotificationService::AlertNotificationService ( Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager ) : m_systemTask{systemTask}, m_notificationManager{notificationManager},
- characteristicDefinition{
+AlertNotificationService::AlertNotificationService ( System::SystemTask& systemTask, NotificationManager& notificationManager )
+ : characteristicDefinition{
{
.uuid = (ble_uuid_t *) &ansCharUuid,
.access_cb = AlertNotificationCallback,
@@ -48,8 +48,7 @@ AlertNotificationService::AlertNotificationService ( Pinetime::System::SystemTas
{
0
},
- }
-{
+ }, m_systemTask{systemTask}, m_notificationManager{notificationManager} {
}
int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle,
@@ -67,7 +66,7 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle
char *s = (char *) &data[3];
auto messageSize = min(maxMessageSize, (bufferSize-3));
- for (int i = 0; i < messageSize-1; i++) {
+ for (uint i = 0; i < messageSize-1; i++) {
if (s[i] == 0x00) {
s[i] = 0x0A;
}
diff --git a/src/Components/Ble/CurrentTimeService.cpp b/src/Components/Ble/CurrentTimeService.cpp
index 80ad9c25..3a6264e2 100644
--- a/src/Components/Ble/CurrentTimeService.cpp
+++ b/src/Components/Ble/CurrentTimeService.cpp
@@ -57,7 +57,7 @@ int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handl
return 0;
}
-CurrentTimeService::CurrentTimeService(DateTime &dateTimeController) : m_dateTimeController{dateTimeController},
+CurrentTimeService::CurrentTimeService(DateTime &dateTimeController) :
characteristicDefinition{
{
.uuid = (ble_uuid_t *) &ctChrUuid,
@@ -80,8 +80,7 @@ CurrentTimeService::CurrentTimeService(DateTime &dateTimeController) : m_dateTim
{
0
},
- }
- {
+ }, m_dateTimeController{dateTimeController} {
}
diff --git a/src/Components/Ble/DeviceInformationService.h b/src/Components/Ble/DeviceInformationService.h
index d768da8e..7d7cea96 100644
--- a/src/Components/Ble/DeviceInformationService.h
+++ b/src/Components/Ble/DeviceInformationService.h
@@ -22,11 +22,11 @@ namespace Pinetime {
static constexpr uint16_t fwRevisionId {0x2a26};
static constexpr uint16_t hwRevisionId {0x2a27};
- static constexpr char* manufacturerName = "Codingfield";
- static constexpr char* modelNumber = "1";
- static constexpr char* serialNumber = "9.8.7.6.5.4";
- static constexpr char* fwRevision = "0.7.0";
- static constexpr char* hwRevision = "1.0.0";
+ static constexpr const char* manufacturerName = "Codingfield";
+ static constexpr const char* modelNumber = "1";
+ static constexpr const char* serialNumber = "9.8.7.6.5.4";
+ static constexpr const char* fwRevision = "0.7.0";
+ static constexpr const char* hwRevision = "1.0.0";
static constexpr ble_uuid16_t deviceInfoUuid {
.u { .type = BLE_UUID_TYPE_16 },
diff --git a/src/Components/Ble/DfuService.cpp b/src/Components/Ble/DfuService.cpp
index c6d8493f..fcbefdd0 100644
--- a/src/Components/Ble/DfuService.cpp
+++ b/src/Components/Ble/DfuService.cpp
@@ -394,14 +394,14 @@ void DfuService::DfuImage::WriteMagicNumber() {
}
void DfuService::DfuImage::Erase() {
- for (int erased = 0; erased < maxSize; erased += 0x1000) {
+ for (size_t erased = 0; erased < maxSize; erased += 0x1000) {
spiNorFlash.SectorErase(writeOffset + erased);
}
}
bool DfuService::DfuImage::Validate() {
uint32_t chunkSize = 200;
- int currentOffset = 0;
+ size_t currentOffset = 0;
uint16_t crc = 0;
bool first = true;
diff --git a/src/Components/Ble/MusicService.cpp b/src/Components/Ble/MusicService.cpp
index 5ec76697..b5fa5356 100644
--- a/src/Components/Ble/MusicService.cpp
+++ b/src/Components/Ble/MusicService.cpp
@@ -117,7 +117,6 @@ unsigned char Pinetime::Controllers::MusicService::status()
void Pinetime::Controllers::MusicService::event(char event)
{
auto *om = ble_hs_mbuf_from_flat(&event, 1);
- int ret;
uint16_t connectionHandle = m_system.nimble().connHandle();
@@ -125,6 +124,6 @@ void Pinetime::Controllers::MusicService::event(char event)
return;
}
- ret = ble_gattc_notify_custom(connectionHandle, m_eventHandle, om);
+ ble_gattc_notify_custom(connectionHandle, m_eventHandle, om);
}
diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp
index d7bbd8be..a865a824 100644
--- a/src/Components/Ble/NimbleController.cpp
+++ b/src/Components/Ble/NimbleController.cpp
@@ -139,14 +139,13 @@ void NimbleController::StartAdvertising() {
rsp_fields.name_len = strlen("Pinetime-JF");
rsp_fields.name_is_complete = 1;
- int res;
- res = ble_gap_adv_set_fields(&fields);
+ ble_gap_adv_set_fields(&fields);
// ASSERT(res == 0); // TODO this one sometimes fails with error 22 (notsync)
- res = ble_gap_adv_rsp_set_fields(&rsp_fields);
+ ble_gap_adv_rsp_set_fields(&rsp_fields);
// ASSERT(res == 0);
- res = ble_gap_adv_start(addrType, NULL, 180000,
+ ble_gap_adv_start(addrType, NULL, 180000,
&adv_params, GAPEventCallback, this);
// ASSERT(res == 0);// TODO I've disabled these ASSERT as they sometime asserts and reset the mcu.
// For now, the advertising is restarted as soon as it ends. There may be a race condition
diff --git a/src/Components/Ble/NimbleController.h b/src/Components/Ble/NimbleController.h
index dff93c87..49f4377b 100644
--- a/src/Components/Ble/NimbleController.h
+++ b/src/Components/Ble/NimbleController.h
@@ -43,7 +43,7 @@ namespace Pinetime {
uint16_t connHandle();
private:
- static constexpr char* deviceName = "Pinetime-JF";
+ static constexpr const char* deviceName = "Pinetime-JF";
Pinetime::System::SystemTask& systemTask;
Pinetime::Controllers::Ble& bleController;
DateTime& dateTimeController;