ESP-NOW bridge for P4 (#573)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "tt_app.h"
|
||||
#include "tt_bundle.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Show a file selection dialog that allows the user to select an existing file.
|
||||
* @return the launch ID of the dialog, which can be compared in onResult to identify the source
|
||||
*/
|
||||
AppLaunchId tt_app_fileselection_start_for_existing_file();
|
||||
|
||||
/**
|
||||
* Show a file selection dialog that allows the user to select a new or existing file.
|
||||
* @return the launch ID of the dialog, which can be compared in onResult to identify the source
|
||||
*/
|
||||
AppLaunchId tt_app_fileselection_start_for_existing_or_new_file();
|
||||
|
||||
/**
|
||||
* @param[in] handle the result bundle passed to onResult
|
||||
* @param[out] buffer the buffer to store the selected path in
|
||||
* @param[in] bufferSize the size of the buffer (must include room for the null terminator)
|
||||
* @return true if a path was selected and written to buffer, false otherwise
|
||||
*/
|
||||
bool tt_app_fileselection_get_result_path(BundleHandle handle, char* buffer, uint32_t bufferSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "tt_app_fileselection.h"
|
||||
#include <Tactility/app/App.h>
|
||||
#include <Tactility/app/fileselection/FileSelection.h>
|
||||
#include <Tactility/Bundle.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
|
||||
AppLaunchId tt_app_fileselection_start_for_existing_file() {
|
||||
return tt::app::fileselection::startForExistingFile();
|
||||
}
|
||||
|
||||
AppLaunchId tt_app_fileselection_start_for_existing_or_new_file() {
|
||||
return tt::app::fileselection::startForExistingOrNewFile();
|
||||
}
|
||||
|
||||
bool tt_app_fileselection_get_result_path(BundleHandle handle, char* buffer, uint32_t bufferSize) {
|
||||
auto path = tt::app::fileselection::getResultPath(*(tt::Bundle*)handle);
|
||||
if (path.empty() || bufferSize == 0) {
|
||||
return false;
|
||||
}
|
||||
strncpy(buffer, path.c_str(), bufferSize - 1);
|
||||
buffer[bufferSize - 1] = '\0';
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "tt_app.h"
|
||||
#include "tt_app_alertdialog.h"
|
||||
#include "tt_app_fileselection.h"
|
||||
#include "tt_app_selectiondialog.h"
|
||||
#include "tt_bundle.h"
|
||||
#include "tt_gps.h"
|
||||
@@ -41,6 +42,7 @@
|
||||
#include <esp_netif.h>
|
||||
#include <esp_heap_caps.h>
|
||||
#include <esp_timer.h>
|
||||
#include <esp_system.h>
|
||||
#include <fcntl.h>
|
||||
#include <lwip/sockets.h>
|
||||
#include <lwip/netdb.h>
|
||||
@@ -274,6 +276,9 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_app_get_parameters),
|
||||
ESP_ELFSYM_EXPORT(tt_app_set_result),
|
||||
ESP_ELFSYM_EXPORT(tt_app_has_result),
|
||||
ESP_ELFSYM_EXPORT(tt_app_fileselection_start_for_existing_file),
|
||||
ESP_ELFSYM_EXPORT(tt_app_fileselection_start_for_existing_or_new_file),
|
||||
ESP_ELFSYM_EXPORT(tt_app_fileselection_get_result_path),
|
||||
ESP_ELFSYM_EXPORT(tt_app_selectiondialog_start),
|
||||
ESP_ELFSYM_EXPORT(tt_app_selectiondialog_get_result_index),
|
||||
ESP_ELFSYM_EXPORT(tt_app_alertdialog_start),
|
||||
@@ -460,6 +465,8 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(ppa_do_scale_rotate_mirror),
|
||||
// esp_cache.h
|
||||
ESP_ELFSYM_EXPORT(esp_cache_msync),
|
||||
// esp_system.h
|
||||
ESP_ELFSYM_EXPORT(esp_restart),
|
||||
#endif
|
||||
// delimiter
|
||||
ESP_ELFSYM_END
|
||||
|
||||
Reference in New Issue
Block a user