Remove _Nullable and _Nonnull

This commit is contained in:
Ken Van Hoeylandt 2026-02-01 02:01:18 +01:00
parent 7e3d178315
commit 4b02a98ba2
87 changed files with 215 additions and 219 deletions

View File

@ -4,7 +4,7 @@
#include <PwmBacklight.h>
#include <RgbDisplay.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 41 and interrupt pin is 40
auto configuration = std::make_unique<Gt911Touch::Configuration>(
I2C_NUM_0,

View File

@ -219,7 +219,7 @@ lvgl_port_display_rgb_cfg_t St7701Display::getLvglPortDisplayRgbConfig(esp_lcd_p
};
}
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable St7701Display::getTouchDevice() {
std::shared_ptr<tt::hal::touch::TouchDevice> St7701Display::getTouchDevice() {
if (touchDevice == nullptr) {
auto configuration = std::make_unique<Gt911Touch::Configuration>(
I2C_NUM_0,

View File

@ -7,7 +7,7 @@
class St7701Display final : public EspLcdDisplay {
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable touchDevice;
std::shared_ptr<tt::hal::touch::TouchDevice> touchDevice;
bool createIoHandle(esp_lcd_panel_io_handle_t& outHandle) override;
@ -27,7 +27,7 @@ public:
std::string getDescription() const override { return "ST7701S RGB display"; }
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override;
std::shared_ptr<tt::hal::touch::TouchDevice> getTouchDevice() override;
void setBacklightDuty(uint8_t backlightDuty) override;

View File

@ -4,7 +4,7 @@
#include <PwmBacklight.h>
#include <RgbDisplay.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 38 and interrupt pin is 18
// or INT = NC, schematic and other info floating around is kinda conflicting...
auto configuration = std::make_unique<Gt911Touch::Configuration>(

View File

@ -3,7 +3,7 @@
#include <Gt911Touch.h>
#include <RgbDisplay.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 38 and interrupt pin is 18
// or INT = NC, schematic and other info floating around is kinda conflicting...
auto configuration = std::make_unique<Gt911Touch::Configuration>(

View File

@ -4,7 +4,7 @@
#include <PwmBacklight.h>
#include <RgbDisplay.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 38 and interrupt pin is 18
// or INT = NC, schematic and other info floating around is kinda conflicting...
auto configuration = std::make_unique<Gt911Touch::Configuration>(

View File

@ -72,23 +72,23 @@ public:
uint32_t bufferSize; // Size in pixel count. 0 means default, which is 1/10 of the screen size
lcd_rgb_element_order_t rgbElementOrder;
std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction = nullptr;
std::function<void(uint8_t)> backlightDutyFunction = nullptr;
};
private:
esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_panel_handle_t _Nullable panelHandle = nullptr;
lv_display_t* _Nullable lvglDisplay = nullptr;
uint16_t* _Nullable buffer1 = nullptr;
uint16_t* _Nullable buffer2 = nullptr;
uint16_t* _Nullable tempBuf = nullptr;
SemaphoreHandle_t _Nullable teSyncSemaphore = nullptr;
esp_lcd_panel_io_handle_t ioHandle = nullptr;
esp_lcd_panel_handle_t panelHandle = nullptr;
lv_display_t* lvglDisplay = nullptr;
uint16_t* buffer1 = nullptr;
uint16_t* buffer2 = nullptr;
uint16_t* tempBuf = nullptr;
SemaphoreHandle_t teSyncSemaphore = nullptr;
bool teIsrInstalled = false;
bool isrServiceInstalledByUs = false;
std::unique_ptr<Configuration> configuration;
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable displayDriver;
std::shared_ptr<tt::hal::display::DisplayDriver> displayDriver;
bool createIoHandle();
@ -118,9 +118,9 @@ public:
bool stopLvgl() override;
lv_display_t* _Nullable getLvglDisplay() const override { return lvglDisplay; }
lv_display_t* getLvglDisplay() const override { return lvglDisplay; }
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override { return configuration->touch; }
std::shared_ptr<tt::hal::touch::TouchDevice> getTouchDevice() override { return configuration->touch; }
void setBacklightDuty(uint8_t backlightDuty) override {
if (configuration->backlightDutyFunction != nullptr) {
@ -132,7 +132,7 @@ public:
bool supportsDisplayDriver() const override { return true; }
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable getDisplayDriver() override;
std::shared_ptr<tt::hal::display::DisplayDriver> getDisplayDriver() override;
static void lvgl_port_flush_callback(lv_display_t *drv, const lv_area_t *area, uint8_t *color_map);

View File

@ -4,7 +4,7 @@
#include <PwmBacklight.h>
#include <RgbDisplay.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 38 and interrupt pin is 18
// or INT = NC, schematic and other info floating around is kinda conflicting...
auto configuration = std::make_unique<Gt911Touch::Configuration>(

View File

@ -5,7 +5,7 @@
class TdeckKeyboard final : public tt::hal::keyboard::KeyboardDevice {
lv_indev_t* _Nullable deviceHandle = nullptr;
lv_indev_t* deviceHandle = nullptr;
public:
@ -15,5 +15,5 @@ public:
bool startLvgl(lv_display_t* display) override;
bool stopLvgl() override;
bool isAttached() const override;
lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; }
lv_indev_t* getLvglIndev() override { return deviceHandle; }
};

View File

@ -5,7 +5,7 @@
class TpagerEncoder final : public tt::hal::encoder::EncoderDevice {
lv_indev_t* _Nullable encHandle = nullptr;
lv_indev_t* encHandle = nullptr;
pcnt_unit_handle_t encPcntUnit = nullptr;
bool initEncoder();
@ -26,5 +26,5 @@ public:
int getEncoderPulses() const;
lv_indev_t* _Nullable getLvglIndev() override { return encHandle; }
lv_indev_t* getLvglIndev() override { return encHandle; }
};

View File

@ -10,7 +10,7 @@
class TpagerKeyboard final : public tt::hal::keyboard::KeyboardDevice {
lv_indev_t* _Nullable kbHandle = nullptr;
lv_indev_t* kbHandle = nullptr;
gpio_num_t backlightPin = GPIO_NUM_NC;
ledc_timer_t backlightTimer;
ledc_channel_t backlightChannel;
@ -45,7 +45,7 @@ public:
bool stopLvgl() override;
bool isAttached() const override;
lv_indev_t* _Nullable getLvglIndev() override { return kbHandle; }
lv_indev_t* getLvglIndev() override { return kbHandle; }
bool setBacklightDuty(uint8_t duty);
void makeBacklightImpulse();

View File

@ -9,7 +9,7 @@
class CardputerKeyboard final : public tt::hal::keyboard::KeyboardDevice {
lv_indev_t* _Nullable kbHandle = nullptr;
lv_indev_t* kbHandle = nullptr;
QueueHandle_t queue = nullptr;
std::shared_ptr<Tca8418> keypad;
@ -42,5 +42,5 @@ public:
bool stopLvgl() override;
bool isAttached() const override;
lv_indev_t* _Nullable getLvglIndev() override { return kbHandle; }
lv_indev_t* getLvglIndev() override { return kbHandle; }
};

View File

@ -13,7 +13,7 @@
class CardputerEncoder final : public tt::hal::encoder::EncoderDevice {
KEYBOARD::Keyboard keyboard;
int lastKeyNum = 0;
lv_indev_t* _Nullable lvglDevice = nullptr;
lv_indev_t* lvglDevice = nullptr;
static void readCallback(lv_indev_t* indev, lv_indev_data_t* data);
@ -25,5 +25,5 @@ public:
bool startLvgl(lv_display_t* display) override;
bool stopLvgl() override;
lv_indev_t* _Nullable getLvglIndev() override { return lvglDevice; }
lv_indev_t* getLvglIndev() override { return lvglDevice; }
};

View File

@ -8,7 +8,7 @@
class CardputerKeyboard : public tt::hal::keyboard::KeyboardDevice {
KEYBOARD::Keyboard keyboard;
int lastKeyNum = 0;
lv_indev_t* _Nullable lvglDevice = nullptr;
lv_indev_t* lvglDevice = nullptr;
static void readCallback(lv_indev_t* indev, lv_indev_data_t* data);
@ -22,5 +22,5 @@ public:
bool isAttached() const override { return true; }
lv_indev_t* _Nullable getLvglIndev() override { return lvglDevice; }
lv_indev_t* getLvglIndev() override { return lvglDevice; }
};

View File

@ -21,7 +21,4 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION})
target_link_libraries(Simulator PRIVATE ${SDL2_LIBRARIES})
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
endif()

View File

@ -20,10 +20,10 @@ public:
bool supportsLvgl() const override { return true; }
bool startLvgl() override { return displayHandle != nullptr; }
bool stopLvgl() override { check(false, "Not supported"); }
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
lv_display_t* getLvglDisplay() const override { return displayHandle; }
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override { return std::make_shared<SdlTouch>(); }
std::shared_ptr<tt::hal::touch::TouchDevice> getTouchDevice() override { return std::make_shared<SdlTouch>(); }
bool supportsDisplayDriver() const override { return false; }
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable getDisplayDriver() override { return nullptr; }
std::shared_ptr<tt::hal::display::DisplayDriver> getDisplayDriver() override { return nullptr; }
};

View File

@ -6,7 +6,7 @@
class SdlKeyboard final : public tt::hal::keyboard::KeyboardDevice {
lv_indev_t* _Nullable handle = nullptr;
lv_indev_t* handle = nullptr;
public:
@ -22,5 +22,5 @@ public:
bool isAttached() const override { return true; }
lv_indev_t* _Nullable getLvglIndev() override { return handle; }
lv_indev_t* getLvglIndev() override { return handle; }
};

View File

@ -6,7 +6,7 @@
class SdlTouch final : public tt::hal::touch::TouchDevice {
lv_indev_t* _Nullable handle = nullptr;
lv_indev_t* handle = nullptr;
public:
@ -27,10 +27,10 @@ public:
bool stopLvgl() override { check(false, "Not supported"); }
lv_indev_t* _Nullable getLvglIndev() override { return handle; }
lv_indev_t* getLvglIndev() override { return handle; }
bool supportsTouchDriver() override { return false; }
std::shared_ptr<tt::hal::touch::TouchDriver> _Nullable getTouchDriver() override { return nullptr; };
std::shared_ptr<tt::hal::touch::TouchDriver> getTouchDriver() override { return nullptr; };
};

View File

@ -99,7 +99,7 @@ bool Hx8357Display::stopLvgl() {
return true;
}
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable Hx8357Display::getTouchDevice() {
std::shared_ptr<tt::hal::touch::TouchDevice> Hx8357Display::getTouchDevice() {
if (touchDevice == nullptr) {
touchDevice = std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(createTouch());
LOGGER.info("Created touch device");

View File

@ -21,10 +21,10 @@
class Hx8357Display : public tt::hal::display::DisplayDevice {
uint8_t* _Nullable buffer = nullptr;
lv_display_t* _Nullable lvglDisplay = nullptr;
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable touchDevice;
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable nativeDisplay;
uint8_t* buffer = nullptr;
lv_display_t* lvglDisplay = nullptr;
std::shared_ptr<tt::hal::touch::TouchDevice> touchDevice;
std::shared_ptr<tt::hal::display::DisplayDriver> nativeDisplay;
class Hx8357Driver : public tt::hal::display::DisplayDriver {
std::shared_ptr<tt::Lock> lock = tt::hal::spi::getLock(SPI2_HOST);
@ -51,14 +51,14 @@ public:
bool stopLvgl() override;
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override;
std::shared_ptr<tt::hal::touch::TouchDevice> getTouchDevice() override;
lv_display_t* _Nullable getLvglDisplay() const override { return lvglDisplay; }
lv_display_t* getLvglDisplay() const override { return lvglDisplay; }
// TODO: Set to true after fixing UnPhoneDisplayDriver
bool supportsDisplayDriver() const override { return false; }
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable getDisplayDriver() override {
std::shared_ptr<tt::hal::display::DisplayDriver> getDisplayDriver() override {
if (nativeDisplay == nullptr) {
nativeDisplay = std::make_shared<Hx8357Driver>();
}

View File

@ -4,7 +4,7 @@
#include <PwmBacklight.h>
#include <Gc9a01Display.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
auto configuration = std::make_unique<Cst816sTouch::Configuration>(
I2C_NUM_0,
240,

View File

@ -67,7 +67,7 @@ public:
uint32_t bufferSize; // Size in pixel count. 0 means default, which is 1/10 of the screen size
lcd_rgb_element_order_t rgbElementOrder;
std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction = nullptr;
std::function<void(uint8_t)> backlightDutyFunction = nullptr;
};
private:
@ -93,7 +93,7 @@ public:
std::string getDescription() const override { return "JD9853 display"; }
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable getTouchDevice() override { return configuration->touch; }
std::shared_ptr<tt::hal::touch::TouchDevice> getTouchDevice() override { return configuration->touch; }
void setBacklightDuty(uint8_t backlightDuty) override {
if (configuration->backlightDutyFunction != nullptr) {

View File

@ -3,7 +3,7 @@
#include <Gt911Touch.h>
#include <RgbDisplay.h>
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() {
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
// Note for future changes: Reset pin is 38 and interrupt pin is 18
// or INT = NC, schematic and other info floating around is kinda conflicting...
auto configuration = std::make_unique<Gt911Touch::Configuration>(

View File

@ -37,7 +37,7 @@ private:
bool triggerLongPress = false;
};
lv_indev_t* _Nullable deviceHandle = nullptr;
lv_indev_t* deviceHandle = nullptr;
std::shared_ptr<tt::Thread> driverThread;
bool interruptDriverThread = false;
tt::Mutex mutex;
@ -67,7 +67,8 @@ public:
bool startLvgl(lv_display_t* display) override;
bool stopLvgl() override;
lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; }
/** Could return nullptr if not started */
lv_indev_t* getLvglIndev() override { return deviceHandle; }
static std::shared_ptr<ButtonControl> createOneButtonControl(tt::hal::gpio::Pin pin) {
return std::make_shared<ButtonControl>(std::vector {

View File

@ -49,7 +49,7 @@ private:
std::unique_ptr<Configuration> configuration;
esp_lcd_panel_io_handle_t ioHandle = nullptr;
esp_lcd_touch_handle_t touchHandle = nullptr;
lv_indev_t* _Nullable deviceHandle = nullptr;
lv_indev_t* deviceHandle = nullptr;
void cleanup();

View File

@ -10,10 +10,10 @@
/** @deprecated use EspLcdDisplayV2 */
class EspLcdDisplay : public tt::hal::display::DisplayDevice {
esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_panel_handle_t _Nullable panelHandle = nullptr;
lv_display_t* _Nullable lvglDisplay = nullptr;
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable displayDriver;
esp_lcd_panel_io_handle_t ioHandle = nullptr;
esp_lcd_panel_handle_t panelHandle = nullptr;
lv_display_t* lvglDisplay = nullptr;
std::shared_ptr<tt::hal::display::DisplayDriver> displayDriver;
std::shared_ptr<tt::Lock> lock;
lcd_rgb_element_order_t rgbElementOrder;
@ -52,7 +52,7 @@ public:
bool stopLvgl() final;
lv_display_t* _Nullable getLvglDisplay() const final { return lvglDisplay; }
lv_display_t* getLvglDisplay() const final { return lvglDisplay; }
// endregion
@ -61,7 +61,7 @@ public:
bool supportsDisplayDriver() const override { return true; }
/** @return a NativeDisplay instance if this device supports it */
std::shared_ptr<tt::hal::display::DisplayDriver> _Nullable getDisplayDriver() final;
std::shared_ptr<tt::hal::display::DisplayDriver> getDisplayDriver() final;
// endregion
};

View File

@ -11,7 +11,7 @@ class EspLcdTouch : public tt::hal::touch::TouchDevice {
esp_lcd_touch_config_t config;
esp_lcd_panel_io_handle_t _Nullable ioHandle = nullptr;
esp_lcd_touch_handle_t _Nullable touchHandle = nullptr;
lv_indev_t* _Nullable lvglDevice = nullptr;
lv_indev_t* lvglDevice = nullptr;
std::shared_ptr<tt::hal::touch::TouchDriver> touchDriver;
protected:
@ -36,7 +36,7 @@ public:
bool stopLvgl() final;
lv_indev_t* _Nullable getLvglIndev() final { return lvglDevice; }
lv_indev_t* getLvglIndev() final { return lvglDevice; }
bool supportsTouchDriver() override { return true; }

View File

@ -34,7 +34,7 @@ public:
private:
std::unique_ptr<Configuration> configuration;
lv_indev_t* _Nullable deviceHandle = nullptr;
lv_indev_t* deviceHandle = nullptr;
FT6X36 driver = FT6X36(configuration->port, configuration->pinInterrupt);
std::shared_ptr<tt::Thread> driverThread;
bool interruptDriverThread = false;
@ -65,7 +65,7 @@ public:
bool startLvgl(lv_display_t* display) override;
bool stopLvgl() override;
lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; }
lv_indev_t* getLvglIndev() override { return deviceHandle; }
class Ft6TouchDriver : public tt::hal::touch::TouchDriver {
public:

View File

@ -25,7 +25,7 @@ public:
bool swapBytes;
uint32_t bufferSize; // Pixel count, not byte count. Set to 0 for default (1/10th of display size)
std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction;
std::function<void(uint8_t)> backlightDutyFunction; // Nullable
gpio_num_t resetPin;
lcd_rgb_element_order_t rgbElementOrder;
};

View File

@ -43,8 +43,6 @@ else ()
SDL2::SDL2-static SDL2-static
)
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
endif ()
add_custom_target(AlwaysRun

View File

@ -30,9 +30,6 @@ else ()
PUBLIC Include/
)
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
target_link_libraries(hal-device-module PUBLIC
TactilityFreeRtos
TactilityCore

View File

@ -79,17 +79,17 @@ void registerDevice(const std::shared_ptr<Device>& device);
/** Remove a device from the registry. */
void deregisterDevice(const std::shared_ptr<Device>& device);
/** Find a single device with a custom filter */
std::shared_ptr<Device> _Nullable findDevice(const std::function<bool(const std::shared_ptr<Device>&)>& filterFunction);
/** Find a single device with a custom filter. Could return nullptr if not found. */
std::shared_ptr<Device> findDevice(const std::function<bool(const std::shared_ptr<Device>&)>& filterFunction);
/** Find devices with a custom filter */
std::vector<std::shared_ptr<Device>> findDevices(const std::function<bool(const std::shared_ptr<Device>&)>& filterFunction);
/** Find a device in the registry by its name. */
std::shared_ptr<Device> _Nullable findDevice(std::string name);
/** Find a device in the registry by its name. Could return nullptr if not found. */
std::shared_ptr<Device> findDevice(std::string name);
/** Find a device in the registry by its identifier. */
std::shared_ptr<Device> _Nullable findDevice(Device::Id id);
/** Find a device in the registry by its identifier. Could return nullptr if not found.*/
std::shared_ptr<Device> findDevice(Device::Id id);
/** Find 0, 1 or more devices in the registry by type. */
std::vector<std::shared_ptr<Device>> findDevices(Device::Type type);

View File

@ -88,7 +88,7 @@ std::vector<std::shared_ptr<Device>> findDevices(const std::function<bool(const
return toVector(devices_view);
}
std::shared_ptr<Device> _Nullable findDevice(const std::function<bool(const std::shared_ptr<Device>&)>& filterFunction) {
std::shared_ptr<Device> findDevice(const std::function<bool(const std::shared_ptr<Device>&)>& filterFunction) {
auto scoped_mutex = mutex.asScopedLock();
scoped_mutex.lock();
@ -102,13 +102,13 @@ std::shared_ptr<Device> _Nullable findDevice(const std::function<bool(const std:
}
}
std::shared_ptr<Device> _Nullable findDevice(std::string name) {
std::shared_ptr<Device> findDevice(std::string name) {
return findDevice([&name](auto& device){
return device->getName() == name;
});
}
std::shared_ptr<Device> _Nullable findDevice(Device::Id id) {
std::shared_ptr<Device> findDevice(Device::Id id) {
return findDevice([id](auto& device){
return device->getId() == id;
});

View File

@ -62,9 +62,6 @@ else()
PUBLIC Include/
)
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
target_link_libraries(Tactility PUBLIC
cJSON
TactilityFreeRtos

View File

@ -27,9 +27,10 @@ void run(const Configuration& config, Module* platformModule, Module* deviceModu
/**
* While technically nullable, this instance is always set if tt_init() succeeds.
* Could return nullptr if init was not called.
* @return the Configuration instance that was passed on to tt_init() if init is successful
*/
const Configuration* _Nullable getConfiguration();
const Configuration* getConfiguration();
/** Provides access to the dispatcher that runs on the main task.
* @warning This dispatcher is used for WiFi and might block for some time during WiFi connection.
@ -40,7 +41,7 @@ Dispatcher& getMainDispatcher();
namespace hal {
/** While technically this configuration is nullable, it's never null after initHeadless() is called. */
const Configuration* _Nullable getConfiguration();
const Configuration* getConfiguration();
} // namespace hal

View File

@ -44,7 +44,8 @@ public:
virtual void onDestroy(AppContext& appContext) {}
virtual void onShow(AppContext& appContext, lv_obj_t* parent) {}
virtual void onHide(AppContext& appContext) {}
virtual void onResult(AppContext& appContext, LaunchId launchId, Result result, std::unique_ptr<Bundle> _Nullable resultData) {}
/** resultData could be null */
virtual void onResult(AppContext& appContext, LaunchId launchId, Result result, std::unique_ptr<Bundle> resultData) {}
Mutex& getMutex() { return mutex; }
@ -81,9 +82,9 @@ std::shared_ptr<App> create() { return std::shared_ptr<T>(new T); }
/**
* @brief Start an app
* @param[in] id application name or id
* @param[in] parameters optional parameters to pass onto the application
* @param[in] parameters optional parameters to pass onto the application. can be nullptr.
*/
LaunchId start(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters = nullptr);
LaunchId start(const std::string& id, std::shared_ptr<const Bundle> parameters = nullptr);
/** @brief Stop the currently showing app. Show the previous app if any app was still running. */
void stop();
@ -103,10 +104,10 @@ void stopAll(const std::string& id);
bool isRunning(const std::string& id);
/** @return the currently running app context (it is only ever null before the splash screen is shown) */
std::shared_ptr<AppContext> _Nullable getCurrentAppContext();
std::shared_ptr<AppContext> getCurrentAppContext();
/** @return the currently running app (it is only ever null before the splash screen is shown) */
std::shared_ptr<App> _Nullable getCurrentApp();
std::shared_ptr<App> getCurrentApp();
bool install(const std::string& path);

View File

@ -18,7 +18,7 @@ bool removeAppManifest(const std::string& id);
* @param[in] id the manifest id
* @return the application manifest if it was found
*/
_Nullable std::shared_ptr<AppManifest> findAppManifestById(const std::string& id);
std::shared_ptr<AppManifest> findAppManifestById(const std::string& id);
/** @return a list of all registered apps. This includes user and system apps. */
std::vector<std::shared_ptr<AppManifest>> getAppManifests();

View File

@ -8,20 +8,26 @@ namespace tt::app {
typedef void* (*CreateData)();
typedef void (*DestroyData)(void* data);
typedef void (*OnCreate)(void* appContext, void* _Nullable data);
typedef void (*OnDestroy)(void* appContext, void* _Nullable data);
typedef void (*OnShow)(void* appContext, void* _Nullable data, lv_obj_t* parent);
typedef void (*OnHide)(void* appContext, void* _Nullable data);
typedef void (*OnResult)(void* appContext, void* _Nullable data, LaunchId launchId, Result result, Bundle* resultData);
/** data is nullable */
typedef void (*OnCreate)(void* appContext, void* data);
/** data is nullable */
typedef void (*OnDestroy)(void* appContext, void* data);
/** data is nullable */
typedef void (*OnShow)(void* appContext, void* data, lv_obj_t* parent);
/** data is nullable */
typedef void (*OnHide)(void* appContext, void* data);
/** data is nullable, resultData is nullable. */
typedef void (*OnResult)(void* appContext, void* data, LaunchId launchId, Result result, Bundle* resultData);
/** All fields are nullable */
void setElfAppParameters(
CreateData _Nullable createData,
DestroyData _Nullable destroyData,
OnCreate _Nullable onCreate,
OnDestroy _Nullable onDestroy,
OnShow _Nullable onShow,
OnHide _Nullable onHide,
OnResult _Nullable onResult
CreateData createData,
DestroyData destroyData,
OnCreate onCreate,
OnDestroy onDestroy,
OnShow onShow,
OnHide onHide,
OnResult onResult
);
std::shared_ptr<App> createElfApp(const std::shared_ptr<AppManifest>& manifest);

View File

@ -15,6 +15,6 @@ namespace tt::file {
* @param[in] path the path to find a lock for
* @return a lock instance when a lock was found, otherwise nullptr
*/
std::shared_ptr<Lock> _Nullable findLock(const std::string& path);
std::shared_ptr<Lock> findLock(const std::string& path);
}

View File

@ -31,7 +31,7 @@ struct Configuration {
* Called before I2C/SPI/etc is initialized.
* Used for powering on the peripherals manually.
*/
const InitBoot _Nullable initBoot = nullptr;
const InitBoot initBoot = nullptr;
/** Init behaviour: default (esp_lvgl_port for ESP32, nothing for PC) or None (nothing on any platform). Only used in Tactility, not in TactilityHeadless. */
const LvglInit lvglInit = LvglInit::Default;

View File

@ -26,7 +26,8 @@ public:
virtual bool isPoweredOn() const { return true; }
virtual bool supportsPowerControl() const { return false; }
virtual std::shared_ptr<touch::TouchDevice> _Nullable getTouchDevice() = 0;
/** Could return nullptr if not started */
virtual std::shared_ptr<touch::TouchDevice> getTouchDevice() = 0;
/** Set a value in the range [0, 255] */
virtual void setBacklightDuty(uint8_t backlightDuty) { /* NO-OP */ }
@ -40,10 +41,12 @@ public:
virtual bool startLvgl() = 0;
virtual bool stopLvgl() = 0;
virtual lv_display_t* _Nullable getLvglDisplay() const = 0;
/** Could return nullptr if not started */
virtual lv_display_t* getLvglDisplay() const = 0;
virtual bool supportsDisplayDriver() const = 0;
virtual std::shared_ptr<DisplayDriver> _Nullable getDisplayDriver() = 0;
/** Could return nullptr if not supported */
virtual std::shared_ptr<DisplayDriver> getDisplayDriver() = 0;
};
} // namespace tt::hal::display

View File

@ -17,7 +17,8 @@ public:
virtual bool startLvgl(lv_display_t* display) = 0;
virtual bool stopLvgl() = 0;
virtual lv_indev_t* _Nullable getLvglIndev() = 0;
/** Could return nullptr if not started */
virtual lv_indev_t* getLvglIndev() = 0;
};
}

View File

@ -48,7 +48,7 @@ private:
const GpsConfiguration configuration;
RecursiveMutex mutex;
std::unique_ptr<Thread> _Nullable thread;
std::unique_ptr<Thread> thread;
bool threadInterrupted = false;
std::vector<GgaSubscription> ggaSubscriptions;
std::vector<RmcSubscription> rmcSubscriptions;

View File

@ -20,7 +20,8 @@ public:
/** @return true when the keyboard currently is physically attached */
virtual bool isAttached() const = 0;
virtual lv_indev_t* _Nullable getLvglIndev() = 0;
/** Could return nullptr if not started */
virtual lv_indev_t* getLvglIndev() = 0;
};
}

View File

@ -67,8 +67,8 @@ public:
bool isMounted(TickType_t timeout = kernel::MAX_TICKS) const { return getState(timeout) == State::Mounted; }
};
/** Return the SdCard device if the path is within the SdCard mounted path (path std::string::starts_with() check)*/
std::shared_ptr<SdCardDevice> _Nullable find(const std::string& path);
/** Return the SdCard device if the path is within the SdCard mounted path (path std::string::starts_with() check), otherwise return nullptr */
std::shared_ptr<SdCardDevice> find(const std::string& path);
/**
* Attempt to find an SD card that the specified belongs to,

View File

@ -82,7 +82,8 @@ public:
State getState(TickType_t timeout) const override;
sdmmc_card_t* _Nullable getCard() { return card; }
/** return card when mounted, otherwise return nullptr */
sdmmc_card_t* getCard() { return card; }
};
}

View File

@ -29,7 +29,7 @@ public:
gpio_num_t spiPinInt,
MountBehaviour mountBehaviourAtBoot,
/** When customLock is a nullptr, use the SPI default one */
std::shared_ptr<Lock> _Nullable customLock = nullptr,
std::shared_ptr<Lock> customLock = nullptr,
std::vector<gpio_num_t> csPinWorkAround = std::vector<gpio_num_t>(),
spi_host_device_t spiHost = SPI2_HOST,
int spiFrequencyKhz = SDMMC_FREQ_DEFAULT
@ -50,7 +50,7 @@ public:
gpio_num_t spiPinWp; // Write-protect
gpio_num_t spiPinInt; // Interrupt
MountBehaviour mountBehaviourAtBoot;
std::shared_ptr<Lock> _Nullable customLock;
std::shared_ptr<Lock> customLock; // can be nullptr
std::vector<gpio_num_t> csPinWorkAround;
spi_host_device_t spiHost;
bool formatOnMountFailed = false;
@ -91,7 +91,8 @@ public:
State getState(TickType_t timeout) const override;
sdmmc_card_t* _Nullable getCard() { return card; }
/** return card when mounted, otherwise return nullptr */
sdmmc_card_t* getCard() { return card; }
};
}

View File

@ -24,7 +24,7 @@ struct Configuration {
/** Whether configuration can be changed. */
bool isMutable;
/** Optional custom lock - otherwise creates one internally */
std::shared_ptr<Lock> _Nullable lock;
std::shared_ptr<Lock> lock;
};
enum class Status {

View File

@ -22,11 +22,13 @@ public:
virtual bool startLvgl(lv_display_t* display) = 0;
virtual bool stopLvgl() = 0;
virtual lv_indev_t* _Nullable getLvglIndev() = 0;
/** Could return nullptr if not started */
virtual lv_indev_t* getLvglIndev() = 0;
virtual bool supportsTouchDriver() = 0;
virtual std::shared_ptr<TouchDriver> _Nullable getTouchDriver() = 0;
/** Could return nullptr if not supported */
virtual std::shared_ptr<TouchDriver> getTouchDriver() = 0;
};
}

View File

@ -11,13 +11,13 @@ public:
*
* @param[in] x array of X coordinates
* @param[in] y array of Y coordinates
* @param[in] strength optional array of strengths
* @param[in] strength optional array of strengths (nullable)
* @param[in] pointCount the number of points currently touched on the screen
* @param[in] maxPointCount the maximum number of points that can be touched at once
*
* @return true when touched and coordinates are available
*/
virtual bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) = 0;
virtual bool getTouchedPoints(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount) = 0;
};
}

View File

@ -40,26 +40,26 @@ State getState(const std::string& id);
* @param[in] id the id as defined in the manifest
* @return the matching manifest or nullptr when it wasn't found
*/
std::shared_ptr<const ServiceManifest> _Nullable findManifestById(const std::string& id);
std::shared_ptr<const ServiceManifest> findManifestById(const std::string& id);
/** Find a ServiceContext by its manifest id.
* @param[in] id the id as defined in the manifest
* @return the service context or nullptr when it wasn't found
*/
std::shared_ptr<ServiceContext> _Nullable findServiceContextById(const std::string& id);
std::shared_ptr<ServiceContext> findServiceContextById(const std::string& id);
/** Find a Service by its manifest id.
* @param[in] id the id as defined in the manifest
* @return the service context or nullptr when it wasn't found
*/
std::shared_ptr<Service> _Nullable findServiceById(const std::string& id);
std::shared_ptr<Service> findServiceById(const std::string& id);
/** Find a Service by its manifest id.
* @param[in] id the id as defined in the manifest
* @return the service context or nullptr when it wasn't found
*/
template <typename T>
std::shared_ptr<T> _Nullable findServiceById(const std::string& id) {
std::shared_ptr<T> findServiceById(const std::string& id) {
return std::static_pointer_cast<T>(findServiceById(id));
}

View File

@ -34,7 +34,8 @@ class GpsService final : public Service {
bool startGpsDevice(GpsDeviceRecord& deviceRecord);
static bool stopGpsDevice(GpsDeviceRecord& deviceRecord);
GpsDeviceRecord* _Nullable findGpsRecord(const std::shared_ptr<hal::gps::GpsDevice>& record);
/** return nullptr when not found */
GpsDeviceRecord* findGpsRecord(const std::shared_ptr<hal::gps::GpsDevice>& record);
void onGgaSentence(hal::Device::Id deviceId, const minmea_sentence_gga& gga);
void onRmcSentence(hal::Device::Id deviceId, const minmea_sentence_rmc& rmc);

View File

@ -62,10 +62,10 @@ public:
/**
* @brief Start an app given an app id and an optional bundle with parameters
* @param id the app identifier
* @param parameters optional parameter bundle
* @param parameters optional parameter bundle (nullable)
* @return the launch id
*/
app::LaunchId start(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters);
app::LaunchId start(const std::string& id, std::shared_ptr<const Bundle> parameters);
/**
* @brief Stops the top-most app (the one that is currently active shown to the user
@ -85,8 +85,8 @@ public:
*/
void stopAll(const std::string& id);
/** @return the AppContext of the top-most application */
std::shared_ptr<app::AppContext> _Nullable getCurrentAppContext();
/** @return the AppContext of the top-most application, or nullptr if no app is running. */
std::shared_ptr<app::AppContext> getCurrentAppContext();
/** @return true if the app is running anywhere in the app stack (the app does not have to be the top-most one for this to return true) */
bool isRunning(const std::string& id) const;
@ -95,6 +95,7 @@ public:
std::shared_ptr<PubSub<Event>> getPubsub() const { return pubsubExternal; }
};
std::shared_ptr<LoaderService> _Nullable findLoaderService();
/** return the service or nullptr if it's not running */
std::shared_ptr<LoaderService> findLoaderService();
} // namespace

View File

@ -36,7 +36,7 @@ class AppInstance : public AppContext {
* When these are stored in the app struct, the struct takes ownership.
* Do not mutate after app creation.
*/
std::shared_ptr<const Bundle> _Nullable parameters;
std::shared_ptr<const Bundle> parameters;
std::shared_ptr<App> app;

View File

@ -39,7 +39,7 @@ class GuiService final : public Service {
// App-specific
std::shared_ptr<app::AppInstance> appToRender = nullptr;
lv_obj_t* _Nullable keyboard = nullptr;
lv_obj_t* keyboard = nullptr;
lv_group_t* keyboardGroup = nullptr;
bool isStarted = false;

View File

@ -48,7 +48,7 @@ public:
void stop();
};
std::shared_ptr<ScreenshotService> _Nullable optScreenshotService();
std::shared_ptr<ScreenshotService> optScreenshotService();
} // namespace

View File

@ -376,7 +376,8 @@ void run(const Configuration& config, Module* platformModule, Module* deviceModu
}
}
const Configuration* _Nullable getConfiguration() {
/** return the configuration or nullptr if it's not initialized */
const Configuration* getConfiguration() {
return config_instance;
}

View File

@ -5,7 +5,7 @@ namespace tt::app {
constexpr auto* TAG = "App";
LaunchId start(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters) {
LaunchId start(const std::string& id, std::shared_ptr<const Bundle> parameters) {
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
return service->start(id, std::move(parameters));
@ -35,13 +35,13 @@ bool isRunning(const std::string& id) {
return service->isRunning(id);
}
std::shared_ptr<AppContext> _Nullable getCurrentAppContext() {
std::shared_ptr<AppContext> getCurrentAppContext() {
const auto service = service::loader::findLoaderService();
assert(service != nullptr);
return service->getCurrentAppContext();
}
std::shared_ptr<App> _Nullable getCurrentApp() {
std::shared_ptr<App> getCurrentApp() {
const auto app_context = getCurrentAppContext();
return (app_context != nullptr) ? app_context->getApp() : nullptr;
}

View File

@ -39,7 +39,7 @@ bool removeAppManifest(const std::string& id) {
return app_manifest_map.erase(id) == 1;
}
_Nullable std::shared_ptr<AppManifest> findAppManifestById(const std::string& id) {
std::shared_ptr<AppManifest> findAppManifestById(const std::string& id) {
hash_mutex.lock();
auto result = app_manifest_map.find(id);
hash_mutex.unlock();

View File

@ -34,13 +34,13 @@ class ElfApp final : public App {
public:
struct Parameters {
CreateData _Nullable createData = nullptr;
DestroyData _Nullable destroyData = nullptr;
OnCreate _Nullable onCreate = nullptr;
OnDestroy _Nullable onDestroy = nullptr;
OnShow _Nullable onShow = nullptr;
OnHide _Nullable onHide = nullptr;
OnResult _Nullable onResult = nullptr;
CreateData createData = nullptr;
DestroyData destroyData = nullptr;
OnCreate onCreate = nullptr;
OnDestroy onDestroy = nullptr;
OnShow onShow = nullptr;
OnHide onHide = nullptr;
OnResult onResult = nullptr;
};
static void setParameters(const Parameters& parameters) {
@ -202,13 +202,13 @@ size_t ElfApp::staticParametersSetCount = 0;
std::shared_ptr<Lock> ElfApp::staticParametersLock = std::make_shared<Mutex>();
void setElfAppParameters(
CreateData _Nullable createData,
DestroyData _Nullable destroyData,
OnCreate _Nullable onCreate,
OnDestroy _Nullable onDestroy,
OnShow _Nullable onShow,
OnHide _Nullable onHide,
OnResult _Nullable onResult
CreateData createData,
DestroyData destroyData,
OnCreate onCreate,
OnDestroy onDestroy,
OnShow onShow,
OnHide onHide,
OnResult onResult
) {
ElfApp::setParameters({
.createData = createData,

View File

@ -30,7 +30,7 @@ class AppHubApp final : public App {
std::vector<AppHubEntry> entries;
Mutex mutex;
static std::shared_ptr<AppHubApp> _Nullable findAppInstance() {
static std::shared_ptr<AppHubApp> findAppInstance() {
auto app_context = getCurrentAppContext();
if (app_context->getManifest().appId != manifest.appId) {
return nullptr;

View File

@ -71,7 +71,7 @@ public:
};
/** Returns the app data if the app is active. Note that this could clash if the same app is started twice and a background thread is slow. */
std::shared_ptr<I2cScannerApp> _Nullable optApp() {
std::shared_ptr<I2cScannerApp> optApp() {
auto appContext = getCurrentAppContext();
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
return std::static_pointer_cast<I2cScannerApp>(appContext->getApp());

View File

@ -20,7 +20,7 @@ extern const AppManifest manifest;
class PowerApp;
/** Returns the app data if the app is active. Note that this could clash if the same app is started twice and a background thread is slow. */
std::shared_ptr<PowerApp> _Nullable optApp() {
std::shared_ptr<PowerApp> optApp() {
auto appContext = getCurrentAppContext();
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
return std::static_pointer_cast<PowerApp>(appContext->getApp());

View File

@ -49,7 +49,7 @@ public:
/** Returns the app data if the app is active. Note that this could clash if the same app is started twice and a background thread is slow. */
std::shared_ptr<ScreenshotApp> _Nullable optApp() {
std::shared_ptr<ScreenshotApp> optApp() {
auto appContext = getCurrentAppContext();
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
return std::static_pointer_cast<ScreenshotApp>(appContext->getApp());

View File

@ -274,7 +274,7 @@ extern const AppManifest manifest;
class SystemInfoApp;
static std::shared_ptr<SystemInfoApp> _Nullable optApp() {
static std::shared_ptr<SystemInfoApp> optApp() {
auto appContext = getCurrentAppContext();
if (appContext != nullptr && appContext->getManifest().appId == manifest.appId) {
return std::static_pointer_cast<SystemInfoApp>(appContext->getApp());

View File

@ -16,7 +16,7 @@ namespace tt::app::wifimanage {
static const auto LOGGER = Logger("WifiManageView");
std::shared_ptr<WifiManage> _Nullable optWifiManage();
std::shared_ptr<WifiManage> optWifiManage();
static uint8_t mapRssiToPercentage(int rssi) {
auto abs_rssi = std::abs(rssi);

View File

@ -5,7 +5,7 @@
namespace tt::file {
std::shared_ptr<Lock> _Nullable findLock(const std::string& path) {
std::shared_ptr<Lock> findLock(const std::string& path) {
return hal::sdcard::findSdCardLock(path);
}

View File

@ -3,7 +3,7 @@
namespace tt::hal::sdcard {
std::shared_ptr<SdCardDevice> _Nullable find(const std::string& path) {
std::shared_ptr<SdCardDevice> find(const std::string& path) {
auto sdcards = findDevices<SdCardDevice>(Device::Type::SdCard);
for (auto& sdcard : sdcards) {
if (sdcard->isMounted() && path.starts_with(sdcard->getMountPath())) {

View File

@ -20,7 +20,7 @@ struct BootModeData {
static Mode currentMode = Mode::Default;
static RTC_NOINIT_ATTR BootModeData bootModeData;
sdmmc_card_t* _Nullable getCard() {
sdmmc_card_t* getCard() {
auto sdcards = findDevices<sdcard::SpiSdCardDevice>(Device::Type::SdCard);
std::shared_ptr<sdcard::SpiSdCardDevice> usable_sdcard;

View File

@ -19,7 +19,7 @@
static const auto LOGGER = tt::Logger("USB");
namespace tt::hal::usb {
extern sdmmc_card_t* _Nullable getCard();
extern sdmmc_card_t* getCard();
}
enum {

View File

@ -44,7 +44,7 @@ void addService(const ServiceManifest& manifest, bool autoStart) {
addService(std::make_shared<const ServiceManifest>(manifest), autoStart);
}
std::shared_ptr<const ServiceManifest> _Nullable findManifestById(const std::string& id) {
std::shared_ptr<const ServiceManifest> findManifestById(const std::string& id) {
manifest_mutex.lock();
auto iterator = service_manifest_map.find(id);
auto manifest = iterator != service_manifest_map.end() ? iterator->second : nullptr;
@ -52,7 +52,7 @@ std::shared_ptr<const ServiceManifest> _Nullable findManifestById(const std::str
return manifest;
}
static std::shared_ptr<ServiceInstance> _Nullable findServiceInstanceById(const std::string& id) {
static std::shared_ptr<ServiceInstance> findServiceInstanceById(const std::string& id) {
manifest_mutex.lock();
auto iterator = service_instance_map.find(id);
auto service = iterator != service_instance_map.end() ? iterator->second : nullptr;
@ -92,11 +92,11 @@ bool startService(const std::string& id) {
return true;
}
std::shared_ptr<ServiceContext> _Nullable findServiceContextById(const std::string& id) {
std::shared_ptr<ServiceContext> findServiceContextById(const std::string& id) {
return findServiceInstanceById(id);
}
std::shared_ptr<Service> _Nullable findServiceById(const std::string& id) {
std::shared_ptr<Service> findServiceById(const std::string& id) {
auto instance = findServiceInstanceById(id);
return instance != nullptr ? instance->getService() : nullptr;
}

View File

@ -17,7 +17,7 @@ constexpr bool hasTimeElapsed(TickType_t now, TickType_t timeInThePast, TickType
return (now - timeInThePast) >= expireTimeInTicks;
}
GpsService::GpsDeviceRecord* _Nullable GpsService::findGpsRecord(const std::shared_ptr<GpsDevice>& device) {
GpsService::GpsDeviceRecord* GpsService::findGpsRecord(const std::shared_ptr<GpsDevice>& device) {
auto lock = mutex.asScopedLock();
lock.lock();

View File

@ -297,7 +297,7 @@ void LoaderService::stopAll(const std::string& id) {
});
}
std::shared_ptr<app::AppContext> _Nullable LoaderService::getCurrentAppContext() {
std::shared_ptr<app::AppContext> LoaderService::getCurrentAppContext() {
const auto lock = mutex.asScopedLock();
lock.lock();
if (appStack.empty()) {
@ -318,7 +318,7 @@ bool LoaderService::isRunning(const std::string& id) const {
return false;
}
std::shared_ptr<LoaderService> _Nullable findLoaderService() {
std::shared_ptr<LoaderService> findLoaderService() {
return service::findServiceById<LoaderService>(manifest.id);
}

View File

@ -16,7 +16,7 @@ static const auto LOGGER = Logger("ScreenshotService");
extern const ServiceManifest manifest;
std::shared_ptr<ScreenshotService> _Nullable optScreenshotService() {
std::shared_ptr<ScreenshotService> optScreenshotService() {
return service::findServiceById<ScreenshotService>(manifest.id);
}

View File

@ -90,7 +90,7 @@ static const char* getSdCardStatusIcon(hal::sdcard::SdCardDevice::State state) {
}
}
static _Nullable const char* getPowerStatusIcon() {
static const char* getPowerStatusIcon() {
// TODO: Support multiple power devices?
std::shared_ptr<hal::power::PowerDevice> power;
hal::findDevices<hal::power::PowerDevice>(hal::Device::Type::Power, [&power](const auto& device) {

View File

@ -62,9 +62,9 @@ public:
// for example: when scanning and you turn off the radio, the scan should probably stop or turning off
// the radio should disable the on/off button in the app as it is pending.
/** @brief The network interface when wifi is started */
esp_netif_t* _Nullable netif = nullptr;
esp_netif_t* netif = nullptr;
/** @brief Scanning results */
wifi_ap_record_t* _Nullable scan_list = nullptr;
wifi_ap_record_t* scan_list = nullptr;
/** @brief The current item count in scan_list (-1 when scan_list is NULL) */
uint16_t scan_list_count = 0;
/** @brief Maximum amount of records to scan (value > 0) */

View File

@ -19,9 +19,6 @@ else()
add_library(TactilityC OBJECT)
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
target_sources(TactilityC PRIVATE ${SOURCES})
include_directories(TactilityC PRIVATE Private/)
target_include_directories(TactilityC PUBLIC Include/)

View File

@ -22,46 +22,47 @@ typedef enum {
typedef unsigned int AppLaunchId;
/** Important: These function types must map to t::app types exactly */
/** Important: These function types must map to t::app types exactly. All void* data is nullable. */
typedef void* (*AppCreateData)();
typedef void (*AppDestroyData)(void* data);
typedef void (*AppOnCreate)(AppHandle app, void* _Nullable data);
typedef void (*AppOnDestroy)(AppHandle app, void* _Nullable data);
typedef void (*AppOnShow)(AppHandle app, void* _Nullable data, lv_obj_t* parent);
typedef void (*AppOnHide)(AppHandle app, void* _Nullable data);
typedef void (*AppOnResult)(AppHandle app, void* _Nullable data, AppLaunchId launchId, AppResult result, BundleHandle resultData);
typedef void (*AppOnCreate)(AppHandle app, void* data);
typedef void (*AppOnDestroy)(AppHandle app, void* data);
typedef void (*AppOnShow)(AppHandle app, void* data, lv_obj_t* parent);
typedef void (*AppOnHide)(AppHandle app, void* data);
typedef void (*AppOnResult)(AppHandle app, void* data, AppLaunchId launchId, AppResult result, BundleHandle resultData);
/** All callback types are nullable */
typedef struct {
/** The application can allocate data to re-use later (e.g. struct with state) */
AppCreateData _Nullable createData;
AppCreateData createData;
/** If createData is specified, this one must be specified too */
AppDestroyData _Nullable destroyData;
AppDestroyData destroyData;
/** Called when the app is launched (started) */
AppOnCreate _Nullable onCreate;
AppOnCreate onCreate;
/** Called when the app is exited (stopped) */
AppOnDestroy _Nullable onDestroy;
AppOnDestroy onDestroy;
/** Called when the app is about to be shown to the user (app becomes visible) */
AppOnShow _Nullable onShow;
AppOnShow onShow;
/** Called when the app is about to be invisible to the user (e.g. other app was launched by this app, and this app goes to the background) */
AppOnHide _Nullable onHide;
AppOnHide onHide;
/** Called when the app receives a result after launching another app */
AppOnResult _Nullable onResult;
AppOnResult onResult;
} AppRegistration;
/** This is used to register the manifest of an external app. */
void tt_app_register(const AppRegistration app);
/** @return the bundle that belongs to this application, or null if it wasn't started with parameters. */
BundleHandle _Nullable tt_app_get_parameters(AppHandle handle);
BundleHandle tt_app_get_parameters(AppHandle handle);
/**
* Set the result before closing an app.
* The result and bundle are passed along to the app that launched this app, when this app is closed.
* @param[in] handle the app handle to set the result for
* @param[in] result the result state to set
* @param[in] bundle the result bundle to set
* @param[in] bundle the result bundle to set (can be null)
*/
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle _Nullable bundle);
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle bundle);
/** @return true if a result was set for this app context */
bool tt_app_has_result(AppHandle handle);

View File

@ -32,11 +32,11 @@ void tt_app_register(
#endif
}
BundleHandle _Nullable tt_app_get_parameters(AppHandle handle) {
BundleHandle tt_app_get_parameters(AppHandle handle) {
return (BundleHandle)HANDLE_AS_APP_CONTEXT(handle)->getParameters().get();
}
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle _Nullable bundle) {
void tt_app_set_result(AppHandle handle, AppResult result, BundleHandle bundle) {
auto shared_bundle = std::unique_ptr<tt::Bundle>(static_cast<tt::Bundle*>(bundle));
HANDLE_AS_APP_CONTEXT(handle)->getApp()->setResult(static_cast<tt::app::Result>(result), std::move(shared_bundle));
}

View File

@ -35,7 +35,7 @@ void tt_hal_touch_driver_free(TouchDriverHandle handle) {
delete wrapper;
}
bool tt_hal_touch_driver_get_touched_points(TouchDriverHandle handle, uint16_t* x, uint16_t* y, uint16_t* _Nullable strength, uint8_t* pointCount, uint8_t maxPointCount) {
bool tt_hal_touch_driver_get_touched_points(TouchDriverHandle handle, uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* pointCount, uint8_t maxPointCount) {
DriverWrapper* wrapper = static_cast<DriverWrapper*>(handle);
return wrapper->driver->getTouchedPoints(x, y, strength, pointCount, maxPointCount);
}

View File

@ -23,9 +23,6 @@ else()
target_include_directories(TactilityCore PUBLIC Include/)
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
target_link_libraries(TactilityCore PUBLIC
TactilityFreeRtos
TactilityKernel

View File

@ -151,15 +151,15 @@ bool listDirectory(
*
* @param[in] path path the scan for files and directories
* @param[out] outList a pointer to vector of dirent
* @param[in] filter an optional filter to filter out specific items
* @param[in] sort an optional sorting function
* @param[in] filter an optional filter to filter out specific items (nullable)
* @param[in] sort an optional sorting function (nullable)
* @return the amount of items that were stored in "output" or -1 when an error occurred
*/
int scandir(
const std::string& path,
std::vector<dirent>& outList,
ScandirFilter _Nullable filter = nullptr,
ScandirSort _Nullable sort = nullptr
ScandirFilter filter = nullptr,
ScandirSort sort = nullptr
);
bool readLines(const std::string& filePath, bool stripNewLine, std::function<void(const char* line)> callback);

View File

@ -92,8 +92,8 @@ bool listDirectory(
int scandir(
const std::string& path,
std::vector<dirent>& outList,
ScandirFilter _Nullable filterMethod,
ScandirSort _Nullable sortMethod
ScandirFilter filterMethod,
ScandirSort sortMethod
) {
auto lock = getLock(path)->asScopedLock();
lock.lock();

View File

@ -155,7 +155,7 @@ public:
mutex.unlock();
}
void setStateCallback(StateCallback callback, _Nullable void* callbackContext = nullptr) {
void setStateCallback(StateCallback callback, void* callbackContext = nullptr) {
mutex.lock();
assert(state == State::Stopped);
stateCallback = callback;

View File

@ -7,9 +7,6 @@ set(CMAKE_CXX_COMPILER g++)
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
add_executable(TactilityTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
target_include_directories(TactilityTests PRIVATE
${DOCTESTINC}
)

View File

@ -7,9 +7,6 @@ set(CMAKE_CXX_COMPILER g++)
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
add_executable(TactilityCoreTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
target_include_directories(TactilityCoreTests PRIVATE
${DOCTESTINC}
)

View File

@ -7,9 +7,6 @@ set(CMAKE_CXX_COMPILER g++)
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
add_executable(TactilityFreeRtosTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
add_definitions(-D_Nullable=)
add_definitions(-D_Nonnull=)
target_include_directories(TactilityFreeRtosTests PRIVATE
${DOCTESTINC}
)