AP_HAL: added support for commandline arguments

useful for log replay, specifying log file
This commit is contained in:
Andrew Tridgell 2014-02-23 08:15:39 +11:00
parent 4e56196655
commit 735c6449a1
3 changed files with 20 additions and 0 deletions

View File

@ -53,6 +53,11 @@ public:
then return 0xFFFF. If unknown return 4096
*/
virtual uint16_t available_memory(void) { return 4096; }
/**
return commandline arguments, if available
*/
virtual void commandline_arguments(uint8_t &argc, char * const *&argv) { argc = 0; }
};
#endif // __AP_HAL_UTIL_H__

View File

@ -75,6 +75,7 @@ void HAL_Linux::init(int argc,char* const argv[]) const
uartA->begin(115200);
i2c->begin();
spi->init(NULL);
utilInstance.init(argc, argv);
}
const HAL_Linux AP_HAL_Linux;

View File

@ -7,7 +7,21 @@
class Linux::LinuxUtil : public AP_HAL::Util {
public:
void init(int argc, char * const *argv) {
saved_argc = argc;
saved_argv = argv;
}
bool run_debug_shell(AP_HAL::BetterStream *stream) { return false; }
/**
return commandline arguments, if available
*/
void commandline_arguments(uint8_t &argc, char * const *&argv);
private:
int saved_argc;
char* const *saved_argv;
};
#endif // __AP_HAL_LINUX_UTIL_H__