mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 01:11:10 +03:00
SWIG_JAVA: C++ Interfaces to Java interfaces, Modified one Java Example
This commit translates C++ interfaces to Java interfaces, previously C++ Interfaces implemented java classes. * Added java swig interface files for all C++ interfaces to simplify swig javaupm_iADC.i javaupm_iCO2Sensor.i javaupm_iHumiditySensor.i javaupm_iLightController.i javaupm_iLightSensor.i javaupm_iModuleStatus.i javaupm_interfaces.i javaupm_iPressureSensor.i javaupm_iTemperatureSensor.i <example Usage> %include"../interfaces/javaupm_iADC.i" * Modified swig interface files for few sensors that implements interfaces ads1x15 bmp280 bmpx8x ds1808lc hlg150h lp8860 max44009 ms5611 si1132 si7005 t6713 * Removed few methods that were mentioned Protected and made them public, so that menthods can be overridden * Made IModuleStatus virtual to avoid ambiguity in multiple inheritance For example class A {}; class B : public A {}; class C : public A {}; class D : public B, public C {}; This can be solved as class A {}; class B : virtual public A {}; class C : virtual public A {}; class D : public B, public C {}; * Modified java interface files to support multiple swig versions * Modified javaupm interface file to support standard auto load library code * Fixed autoloadlibrary tests for interfaces * Created one interface example separately <BME280_InterfaceExample.java>, <example Usage> BME280_InterfaceExample.java since we cann't define swig versions inside java example file. So, instaed added swig versions in Cmake. <example Usage> if (SWIG_VERSION VERSION_GREATER 3.0.8) add_example_with_path(BME280_InterfaceExample bmp280 bmp280) endif() Signed-off-by: sisinty sasmita patra <sisinty.s.patra@intel.com>
This commit is contained in:

committed by
Sasmita Patra

parent
f8663c90f3
commit
1f18369fbe
@ -10,7 +10,7 @@ prefix = """
|
||||
try {
|
||||
System.loadLibrary(\""""
|
||||
|
||||
sufix = """\");
|
||||
suffix = """\");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. \\n" + e);
|
||||
System.exit(1);
|
||||
@ -27,10 +27,16 @@ class AutoLoadLibrary(u.TestCase):
|
||||
for fileName in files:
|
||||
if fnmatch.fnmatch(fileName, 'javaupm_*.i'):
|
||||
moduleName = fileName[:-2]
|
||||
snippet = prefix + moduleName + sufix
|
||||
snippet = prefix + moduleName + suffix
|
||||
|
||||
with open(os.path.join(subdir, fileName), "r") as f:
|
||||
if not snippet in f.read():
|
||||
#read in entire file
|
||||
data = f.read()
|
||||
#Make sure it is module
|
||||
if not '%module' in data:
|
||||
print "%%module not found in %s, skipping" % fileName
|
||||
continue
|
||||
if not snippet in data:
|
||||
broken_modules.append('%s: %s' % \
|
||||
(moduleName, os.path.join(subdir, fileName)))
|
||||
|
||||
@ -38,7 +44,7 @@ class AutoLoadLibrary(u.TestCase):
|
||||
"\nThe following modules do not contain the standard auto load library code:\n" + \
|
||||
"\n".join(broken_modules) + \
|
||||
"\nConsider adding the following snippet to the SWIG interface file:\n" + \
|
||||
prefix + "<module_name>" + sufix)
|
||||
prefix + "<module_name>" + suffix)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user