SWIG: test callback & output grabbing

This commit is contained in:
Philippe Teuwen committed 2020-12-17 00:31:42 +01:00
1 parent c7e5648164
commit 39710c5fdf
26 files changed
+8332 -6950

No files matched your search

+15
View File
@@ -1,11 +1,26 @@
#ifndef LIBPM3_H
#define LIBPM3_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct pm3_device pm3;
pm3 *pm3_open(char *port);
// not catching output
int pm3_console(pm3 *dev, char *cmd);
// catching output as it comes
int pm3_console_async(pm3 *dev, char *cmd, int (*callback)(char* s));
// catching output at the end
//int pm3_console_sync(pm3 *dev, char *cmd, char* outbuf, int outbufsize);
const char *pm3_name_get(pm3 *dev);
void pm3_close(pm3 *dev);
pm3 *pm3_get_current_dev(void);
#ifdef __cplusplus
}
#endif
#endif // LIBPM3_H
+8
View File
@@ -0,0 +1,8 @@
#ifndef LIBPM3PP_H
#define LIBPM3PP_H
#include "pm3.h"
#include "pm3_helper.hpp"
int pm3_console_async_wrapper(pm3 *dev, char *cmd, ConsoleHandler *console_handler);
#endif // LIBPM3PP_H
+10
View File
@@ -0,0 +1,10 @@
#ifndef LIBPM3HELPERPP_H
#define LIBPM3HELPERPP_H
class ConsoleHandler {
public:
virtual int handle_output(char *string) = 0;
virtual ~ConsoleHandler() {}
};
#endif // LIBPM3HELPERPP_H