mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-19 21:42:25 +02:00
Update examples
This commit is contained in:
@ -58,7 +58,7 @@ public:
|
||||
explicit CMux(std::unique_ptr<Terminal> t, std::unique_ptr<uint8_t[]> b, size_t buff_size):
|
||||
term(std::move(t)), buffer_size(buff_size), buffer(std::move(b)) {}
|
||||
~CMux() = default;
|
||||
void init();
|
||||
[[nodiscard]] bool init();
|
||||
void set_read_cb(int inst, std::function<bool(uint8_t *data, size_t len)> f);
|
||||
|
||||
int write(int i, uint8_t *data, size_t len);
|
||||
@ -79,6 +79,8 @@ private:
|
||||
static uint8_t fcs_crc(const uint8_t frame[6]);
|
||||
Lock lock;
|
||||
int instance;
|
||||
int sabm_ack;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -152,7 +152,7 @@ public:
|
||||
|
||||
|
||||
template <typename Module, typename ...Args>
|
||||
std::shared_ptr<Module> build_shared_module(const config *cfg, Args&&... args)
|
||||
static std::shared_ptr<Module> build_shared_module(const config *cfg, Args&&... args)
|
||||
{
|
||||
return build_module_T<Module>(cfg, std::forward<Args>(args)...);
|
||||
}
|
||||
@ -222,14 +222,15 @@ public:
|
||||
private:
|
||||
Modem m;
|
||||
|
||||
protected:
|
||||
template <typename Module, typename Ptr = std::shared_ptr<Module>, typename ...Args>
|
||||
Module build_module_T(const config *cfg, Args&&... args)
|
||||
static Ptr build_module_T(const config *cfg, Args&&... args)
|
||||
{
|
||||
Builder<Module> b(std::forward<Args>(args)...);
|
||||
return b.template create_module<Module>(cfg);
|
||||
return b.template create_module<Ptr>(cfg);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
template <typename Module, typename Dce = DCE_T<Module>, typename DcePtr = Dce*, typename ...Args>
|
||||
static DcePtr build_generic_DCE(const config *cfg, Args&&... args)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
|
||||
void start() { term->start(); }
|
||||
|
||||
void set_mode(modem_mode m) {
|
||||
[[nodiscard]] bool set_mode(modem_mode m) {
|
||||
term->start();
|
||||
mode = m;
|
||||
if (m == modem_mode::DATA_MODE) {
|
||||
@ -91,8 +91,9 @@ public:
|
||||
command_term = other_term.get();
|
||||
}
|
||||
} else if (m == modem_mode::CMUX_MODE) {
|
||||
setup_cmux();
|
||||
return setup_cmux();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
command_result command(const std::string &command, got_line_cb got_line, uint32_t time_ms) override;
|
||||
@ -102,7 +103,7 @@ public:
|
||||
private:
|
||||
Lock lock;
|
||||
|
||||
void setup_cmux();
|
||||
[[nodiscard]] bool setup_cmux();
|
||||
|
||||
static const size_t GOT_LINE = signal_group::bit0;
|
||||
size_t buffer_size;
|
||||
|
Reference in New Issue
Block a user