Ken Van Hoeylandt cba73d1de2
app-module and TactilitySDK improvements (#665)
New features:
- SDK version 7.0.0 packages include version metadata and platform-specific application settings.
- Apps gain POSIX support for file polling, terminal attributes, and standard input/output, plus additional C and POSIX functions.
 - Shell commands can launch installed headless apps using their registered app settings.
- Apps can exit with a status code, and terminal clear commands support clearing from the cursor to the end, from the start through the cursor, or the entire display.

Fixes:
- SDK integration builds locate the build tool reliably and use settings for the selected platform.
- ESP32 file operations handle invalid paths and existing directories more consistently.
2026-09-27 22:30:23 +02:00

67 lines
2.2 KiB
C

// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <app/file.h>
#include <stddef.h>
#include <sys/types.h>
#include <tactility/error.h>
#ifdef __cplusplus
extern "C" {
#endif
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
/** Fixed size of an app instance's fd table. FD allocation uses the lowest unused index >= 3. */
#define APP_MAX_FDS 16
/**
* FD-table dispatch for read()/write()/close(). Falls through to the real syscall for a fd not
* bound by the calling task's own app instance.
*/
ssize_t app_io_read(int fd, void* buffer, size_t size);
ssize_t app_io_write(int fd, const void* buffer, size_t size);
int app_io_close(int fd);
/**
* FD-table dispatch for AppFileOps::await(): blocks until @a fd is ready or @a timeout elapses.
* @retval ERROR_NOT_FOUND @a fd isn't bound in the calling task's own app instance fd table
* @retval ERROR_TIMEOUT @a timeout elapsed
* @retval ERROR_NONE the condition is true
*/
error_t app_io_await(int fd, AppFileWait wait, TickType_t timeout);
/**
* FD-table dispatch for AppFileOps::poll(): reports readiness without blocking.
* @param[out] out_bits APP_FILE_READABLE and/or APP_FILE_WRITABLE
* @retval ERROR_NOT_FOUND @a fd isn't an app fd of the calling task's own app instance
* @retval ERROR_INVALID_STATE @a fd is an app fd that was already closed
* @retval ERROR_NONE on success
*/
error_t app_io_poll(int fd, uint32_t* out_bits);
/**
* FD-table dispatch for AppFileOps::ioctl().
* @retval ERROR_NOT_FOUND @a fd isn't bound in the calling task's own app instance fd table
* @retval ERROR_NOT_SUPPORTED the object bound at @a fd has no ioctl() implementation
*/
error_t app_io_ioctl(int fd, AppIoctlRequest request, void* arg);
/**
* Installs a custom AppFileOps at @a fd in the calling task's own app instance fd table.
* Unlike AppStreamBinding, writes are never teed to the real underlying fd.
* @warning Must be called from the app instance's own task.
* @retval ERROR_NOT_FOUND the calling task isn't a running app instance
* @retval ERROR_OUT_OF_RANGE @a fd is outside [0, APP_MAX_FDS)
* @retval ERROR_NONE on success
*/
error_t app_io_bind_self(int fd, const struct AppFileOps* ops, void* object);
#ifdef __cplusplus
}
#endif