Compare commits

..

No commits in common. "rei/develop" and "main" have entirely different histories.

8 changed files with 4 additions and 215 deletions

5
.gitignore vendored
View File

@ -49,8 +49,3 @@ Testing/Temporary/
src/nRF5_SDK_15.3.0_59ac345 src/nRF5_SDK_15.3.0_59ac345
src/arm-none-eabi src/arm-none-eabi
node_modules
package.json
package-lock.json
spiNorFlash.raw

6
.gitmodules vendored
View File

@ -1,9 +1,9 @@
[submodule "InfiniTime"] [submodule "InfiniTime"]
path = InfiniTime path = InfiniTime
url = gitea@bics.ga:rei-forks/InfiniTime.git url = ../../InfiniTimeOrg/InfiniTime.git
[submodule "lv_drivers"] [submodule "lv_drivers"]
path = lv_drivers path = lv_drivers
url = https://github.com/lvgl/lv_drivers.git url = ../../lvgl/lv_drivers.git
[submodule "libpng"] [submodule "libpng"]
path = libpng path = libpng
url = https://github.com/glennrp/libpng.git url = ../../glennrp/libpng.git

View File

@ -80,8 +80,6 @@ target_sources(infinisim PUBLIC
sim/components/ble/MusicService.cpp sim/components/ble/MusicService.cpp
sim/components/ble/NavigationService.h sim/components/ble/NavigationService.h
sim/components/ble/NavigationService.cpp sim/components/ble/NavigationService.cpp
sim/components/ble/AgendaService.h
sim/components/ble/AgendaService.cpp
sim/components/ble/NimbleController.h sim/components/ble/NimbleController.h
sim/components/ble/NimbleController.cpp sim/components/ble/NimbleController.cpp
sim/components/ble/weather/WeatherService.h sim/components/ble/weather/WeatherService.h

@ -1 +1 @@
Subproject commit e54d78a04b42264770cf25dc2bb2952c7618b764 Subproject commit 443408312a0fd6e22bef6ffc878155479ba9eb53

View File

@ -1,138 +0,0 @@
/* Copyright (C) 2021 Adam Pigg
This file is part of InfiniTime.
InfiniTime is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
InfiniTime is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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 "components/ble/AgendaService.h"
#include "systemtask/SystemTask.h"
namespace {
/*
// 3fdaYYXX-e246-472e-b7e0-d2b0f3d9c17a
constexpr ble_uuid128_t CharUuid(uint8_t x, uint8_t y) {
return ble_uuid128_t {.u = {.type = BLE_UUID_TYPE_128},
.value = {0x7a, 0xc1, 0xd9, 0xf3, 0xb0, 0xd2, 0xe0, 0xb7, 0x2e, 0x47, 0x46, 0xe2, x, y, 0xda, 0x3f}};
}
// 00010000-78fc-48fe-8e23-433b3a1942d0
constexpr ble_uuid128_t BaseUuid() {
return CharUuid(0x00, 0x00);
}
constexpr ble_uuid128_t agendaUuid {BaseUuid()};
constexpr ble_uuid128_t agendaItemCharUuid {CharUuid(0x01, 0x00)};
int AgendaCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) {
auto agendaService = static_cast<Pinetime::Controllers::AgendaService*>(arg);
return agendaService->OnCommand(conn_handle, attr_handle, ctxt);
}
*/
} // namespace
Pinetime::Controllers::AgendaService::AgendaService(Pinetime::System::SystemTask& system) : m_system(system) {
/*
characteristicDefinition[0] = {.uuid = &agendaItemCharUuid.u,
.access_cb = AgendaCallback,
.arg = this,
.flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ};
characteristicDefinition[1] = {0};
serviceDefinition[0] = {.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &agendaUuid.u, .characteristics = characteristicDefinition};
serviceDefinition[1] = {0};
*/
m_agenda_times[0] = 1655327841;
m_agenda_pieces[0] = "Write AgendaService";
m_agenda_times[1] = 1655369999;
m_agenda_pieces[1] = "WTF C++ dates";
m_agenda_times[2] = 1655370699;
m_agenda_pieces[2] = "??? work ???";
m_agenda_times[3] = 1655380699;
m_agenda_pieces[3] = "??? stuff ???";
m_agenda_times[4] = 1655381699;
m_agenda_pieces[4] = "WTF C++ dates";
m_agenda_times[5] = 1655382699;
m_agenda_pieces[5] = "??? work ???";
m_agenda_times[6] = 1655493699;
m_agenda_pieces[6] = "??? stuff ???";
m_agenda_times[7] = 1655497999;
m_agenda_pieces[7] = "??? stuff ???";
}
void Pinetime::Controllers::AgendaService::Init() {
/*
int res = 0;
res = ble_gatts_count_cfg(serviceDefinition);
ASSERT(res == 0);
res = ble_gatts_add_svcs(serviceDefinition);
ASSERT(res == 0);
m_agenda_times[0] = 1655327841;
m_agenda_pieces[0] = "Write AgendaService";
*/
}
/*
int Pinetime::Controllers::AgendaService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) {
if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
size_t notifSize = OS_MBUF_PKTLEN(ctxt->om);
uint8_t data[notifSize + 1];
data[notifSize] = '\0';
os_mbuf_copydata(ctxt->om, 0, notifSize, data);
char* s = (char*) &data[0];
if (ble_uuid_cmp(ctxt->chr->uuid, &agendaItemCharUuid.u) == 0) {
if (notifSize >= 5) {
uint8_t itemIndex = (uint8_t) data[0];
uint32_t itemTime = ((uint32_t) data[1]) << 24 | ((uint32_t) data[2]) << 16 | ((uint32_t) data[3]) << 8 | ((uint32_t) data[4]);
char* sAgendaItem = (char*) &data[5];
if (itemIndex <= 15) { // don't allow a buffer overflow
m_agenda_times = itemTime;
// implicit std::string copy/conversion here:
m_agenda_pieces = sAgendaItem;
}
}
}
}
return 0;
}
*/
uint32_t Pinetime::Controllers::AgendaService::getAgendaTime(uint8_t index) {
if (index <= AGENDA_CAPACITY) {
return m_agenda_times[index];
} else {
return 0;
}
}
std::string Pinetime::Controllers::AgendaService::getAgendaPiece(uint8_t index) {
if (index <= AGENDA_CAPACITY) {
return m_agenda_pieces[index];
} else {
return 0;
}
}

View File

@ -1,59 +0,0 @@
/* Copyright (C) 2021 Adam Pigg
This file is part of InfiniTime.
InfiniTime is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
InfiniTime is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstdint>
#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>
// #undef max
// #undef min
namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class AgendaService {
public:
static const uint8_t AGENDA_CAPACITY = 30;
explicit AgendaService(Pinetime::System::SystemTask& system);
void Init();
// int OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
uint32_t getAgendaTime(uint8_t index);
std::string getAgendaPiece(uint8_t index);
private:
// struct ble_gatt_chr_def characteristicDefinition[2];
// struct ble_gatt_svc_def serviceDefinition[2];
uint32_t m_agenda_times[AGENDA_CAPACITY];
std::string m_agenda_pieces[AGENDA_CAPACITY];
Pinetime::System::SystemTask& m_system;
};
}
}

View File

@ -45,7 +45,6 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
// currentTimeService {dateTimeController}, // currentTimeService {dateTimeController},
musicService {systemTask}, musicService {systemTask},
weatherService {systemTask, dateTimeController}, weatherService {systemTask, dateTimeController},
agendaService {systemTask},
navService {systemTask} { navService {systemTask} {
// batteryInformationService {batteryController}, // batteryInformationService {batteryController},
// immediateAlertService {systemTask, notificationManager}, // immediateAlertService {systemTask, notificationManager},
@ -93,7 +92,6 @@ void NimbleController::Init() {
musicService.Init(); musicService.Init();
weatherService.Init(); weatherService.Init();
navService.Init(); navService.Init();
agendaService.Init();
// anService.Init(); // anService.Init();
// dfuService.Init(); // dfuService.Init();
// batteryInformationService.Init(); // batteryInformationService.Init();

View File

@ -18,7 +18,6 @@
//#include "components/ble/ImmediateAlertService.h" //#include "components/ble/ImmediateAlertService.h"
#include "components/ble/MusicService.h" #include "components/ble/MusicService.h"
#include "components/ble/NavigationService.h" #include "components/ble/NavigationService.h"
#include "components/ble/AgendaService.h"
//#include "components/ble/ServiceDiscovery.h" //#include "components/ble/ServiceDiscovery.h"
//#include "components/ble/MotionService.h" //#include "components/ble/MotionService.h"
#include "components/ble/weather/WeatherService.h" #include "components/ble/weather/WeatherService.h"
@ -76,9 +75,6 @@ namespace Pinetime {
Pinetime::Controllers::NavigationService& navigation() { Pinetime::Controllers::NavigationService& navigation() {
return navService; return navService;
}; };
Pinetime::Controllers::AgendaService& agenda() {
return agendaService;
};
Pinetime::Controllers::AlertNotificationService& alertService() { Pinetime::Controllers::AlertNotificationService& alertService() {
return anService; return anService;
}; };
@ -117,7 +113,6 @@ namespace Pinetime {
MusicService musicService; MusicService musicService;
WeatherService weatherService; WeatherService weatherService;
NavigationService navService; NavigationService navService;
AgendaService agendaService;
// BatteryInformationService batteryInformationService; // BatteryInformationService batteryInformationService;
// ImmediateAlertService immediateAlertService; // ImmediateAlertService immediateAlertService;
// HeartRateService heartRateService; // HeartRateService heartRateService;