few changes for RTS/CTS control
Dependencies: MTS-Serial libmDot mbed-rtos mbed
Fork of mDot_AT_firmware by
Diff: CommandTerminal/CommandTerminal.h
- Revision:
- 9:ff62b20f7000
- Parent:
- 4:666017851052
--- a/CommandTerminal/CommandTerminal.h Mon Apr 04 13:17:44 2016 +0000 +++ b/CommandTerminal/CommandTerminal.h Mon Apr 04 09:00:31 2016 -0500 @@ -33,9 +33,12 @@ */ #include "mbed.h" +#include "ATSerial.h" #include "MTSSerial.h" +#include "MTSSerialFlowControl.h" #include "Commands.h" #include "mDot.h" +#include "mDotEvent.h" /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __command_terminal_H__ @@ -43,6 +46,28 @@ class CommandTerminal { + class RadioEvent : public mDotEvent { + + mts::ATSerial& _serial; + public: + RadioEvent(mts::ATSerial& serial) : _serial(serial) {} + + virtual ~RadioEvent() {} + + /*! + * MAC layer event callback prototype. + * + * \param [IN] flags Bit field indicating the MAC events occurred + * \param [IN] info Details about MAC events occurred + */ + virtual void MacEvent(LoRaMacEventFlags *flags, LoRaMacEventInfo *info); + + virtual uint8_t MeasureBattery(void) { + return 255; + } +}; + + public: enum WaitType { @@ -53,7 +78,8 @@ WAIT_NA }; - CommandTerminal(mts::MTSSerial& serial, mDot* dot); + CommandTerminal(mts::ATSerial& serial, mDot* dot); + virtual ~CommandTerminal(); // Command prompt text... static const char banner[]; @@ -67,6 +93,8 @@ static const char help[]; static const char cmd_error[]; static const char newline[]; + static const char connect[]; + static const char no_carrier[]; static const char done[]; static const char error[]; @@ -85,20 +113,20 @@ __WFI(); } - mts::MTSSerial& _serial; - static mts::MTSSerial* _serialp; + mts::ATSerial& _serial; + static mts::ATSerial* _serialp; mDot* _dot; + CommandTerminal::RadioEvent* _events; mDot::Mode _mode; std::vector<Command*> _commands; Thread _idle_thread; bool _sleep_standby; DigitalOut _xbee_on_sleep; - bool _serial_up; void addCommand(Command* cmd); - void serial_loop(); + void serialLoop(); bool autoJoinCheck(); void printHelp(); @@ -110,7 +138,7 @@ void writef(const char* format, ... ); void sleep(bool standby); - void wakeup(bool standby); + void wakeup(void); };