C API cleanup, add SMS support

This commit is contained in:
David Cermak
2021-04-15 09:46:28 +02:00
parent 4bf8ab07ca
commit d47cb69b20
13 changed files with 310 additions and 114 deletions

View File

@ -109,9 +109,9 @@ private:
*/
enum class Modem {
GenericModule, /*!< Default generic module with the most common commands */
SIM800, /*!< Derived from the GenericModule with specifics applied to SIM800 model */
SIM7600, /*!< Derived from the GenericModule, specifics applied to SIM7600 model */
BG96, /*!< Derived from the GenericModule, specifics applied to BG69 model */
SIM800, /*!< Derived from the GenericModule with specifics applied to SIM800 model */
};
/**
@ -201,6 +201,24 @@ public:
return nullptr;
}
template <typename ...Args>
DCE* build(const config *cfg, Args&&... args)
{
switch (m) {
case Modem::SIM800:
return build<SIM800>(cfg, std::forward<Args>(args)...);
case Modem::SIM7600:
return build<SIM7600>(cfg, std::forward<Args>(args)...);
case Modem::BG96:
return build<BG96>(cfg, std::forward<Args>(args)...);
case Modem::GenericModule:
return build<GenericModule>(cfg, std::forward<Args>(args)...);
default:
break;
}
return nullptr;
}
private:
Modem m;

View File

@ -96,6 +96,7 @@ public:
}
command_result command(const std::string &command, got_line_cb got_line, uint32_t time_ms) override;
command_result command(const std::string &command, got_line_cb got_line, uint32_t time_ms, const char separator) override;
private:

View File

@ -75,6 +75,7 @@ public:
* @param time_ms timeout in milliseconds
* @return OK, FAIL or TIMEOUT
*/
virtual command_result command(const std::string &command, got_line_cb got_line, uint32_t time_ms, const char separator) = 0;
virtual command_result command(const std::string &command, got_line_cb got_line, uint32_t time_ms) = 0;
};