AP_SerialManager: add static create method

This commit is contained in:
Lucas De Marchi 2017-08-28 15:03:00 -07:00 committed by Francisco Ferreira
parent fbe0d9761c
commit 04866e9f76

View File

@ -71,9 +71,7 @@
class AP_SerialManager { class AP_SerialManager {
public: public:
enum SerialProtocol { enum SerialProtocol {
SerialProtocol_None = -1, SerialProtocol_None = -1,
SerialProtocol_Console = 0, // unused SerialProtocol_Console = 0, // unused
@ -92,8 +90,13 @@ public:
SerialProtocol_Beacon = 13 SerialProtocol_Beacon = 13
}; };
// Constructor static AP_SerialManager create() { return AP_SerialManager{}; }
AP_SerialManager();
constexpr AP_SerialManager(AP_SerialManager &&other) = default;
/* Do not allow copies */
AP_SerialManager(const AP_SerialManager &other) = delete;
AP_SerialManager &operator=(const AP_SerialManager&) = delete;
// init_console - initialise console at default baud rate // init_console - initialise console at default baud rate
void init_console(); void init_console();
@ -130,6 +133,7 @@ public:
static const struct AP_Param::GroupInfo var_info[]; static const struct AP_Param::GroupInfo var_info[];
private: private:
AP_SerialManager();
// array of uart info // array of uart info
struct { struct {