Moved SWIG code from C++ files (hpp and cxx) to SWIG interface files (.i). Added getter/setter methods for classes with protected or private vars.

This commit is contained in:
Serban Waltter
2018-01-17 14:20:32 +02:00
committed by Noel Eck
parent 2551596309
commit 63b2b33df7
39 changed files with 351 additions and 367 deletions

View File

@ -5,11 +5,21 @@
%include "../java_buffer.i"
%include "std_string.i"
%include "mcp2515_regs.h"
%include "mcp2515.hpp"
%{
#include "mcp2515.hpp"
#include "mcp2515_regs.h"
%}
%include "mcp2515_regs.h"
%include "mcp2515.hpp"
%ignore installISR(int pin, void *, void *);
%extend upm::MCP2515 {
void installISR(int pin, jobject runnable)
{
$self->installISR(pin, mraa_java_isr_callback, runnable);
}
}
JAVA_JNI_LOADLIBRARY(javaupm_mcp2515)

View File

@ -324,12 +324,7 @@ namespace upm {
return std::string((char *)m_message.pkt.data, m_message.len);
}
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(int pin, jobject runnable)
{
installISR(pin, mraa_java_isr_callback, runnable);
}
#else
/**
* Installs an interrupt service routine (ISR) to be called when
* an interrupt occurs.
@ -340,7 +335,7 @@ namespace upm {
* argument to the ISR.
*/
void installISR(int pin, void (*isr)(void *), void *arg);
#endif
/**
* Uninstalls the previously installed ISR
@ -518,9 +513,5 @@ namespace upm {
/* Disable implicit copy and assignment operators */
MCP2515(const MCP2515&) = delete;
MCP2515 &operator=(const MCP2515&) = delete;
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
void installISR(int pin, void (*isr)(void *), void *arg);
#endif
};
}