SWIG: test callback & output grabbing
This commit is contained in:
@@ -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
client/include/pm3.hpp
Normal file
8
client/include/pm3.hpp
Normal 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
client/include/pm3_helper.hpp
Normal file
10
client/include/pm3_helper.hpp
Normal 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
|
||||
Reference in New Issue
Block a user