ausocean / ausocean/client

ESP/Speaker: Replace `std::function` callbacks where callbacks are intentionally function pointers

Open
#160 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
0
Forks
0
Avg merge
1h 27m
Merged PRs (30d)
1

Description

## Problem

NetSender currently uses `std::function` for callback storage.

For callbacks that are intentionally restricted to ordinary C-style functions, `std::function` provides more flexibility than is required and has a larger object representation. It may also perform a heap allocation for sufficiently large callables.

In this component, the callbacks are currently used as non-capturing functions.

## Proposed change

For APIs that only require plain function callbacks, replace `std::function` with explicit function-pointer types.

For example:

```cpp
using pin_read_fn = int64_t (*)(void);
```
```cpp
esp_err_t (*parse_variable_callback)(const char *resp);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the NetSender implementation and its callback declarations in the ESP/Speaker component, then identify APIs that only accept non-capturing C-style callbacks. Replace those callback types with explicit function-pointer types where appropriate, while leaving APIs that require std::function flexibility unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.