mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00

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>
95 lines
2.4 KiB
C++
95 lines
2.4 KiB
C++
/*
|
|
* Author: Henry Bruce <henry.bruce@intel.com>
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
* a copy of this software and associated documentation files (the
|
|
* "Software"), to deal in the Software without restriction, including
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
* the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "iModuleStatus.hpp"
|
|
|
|
namespace upm
|
|
{
|
|
/**
|
|
* @brief ILightController Interface for Light Controllers
|
|
*/
|
|
|
|
/**
|
|
*
|
|
* @brief Interface for Light Controllers
|
|
|
|
* This interface is used to represent light controllers
|
|
|
|
* @snippet light-controllers.cxx Interesting
|
|
*/
|
|
|
|
class ILightController : virtual public IModuleStatus
|
|
{
|
|
public:
|
|
/**
|
|
* Turn on power
|
|
*
|
|
* @throws std::runtime_error
|
|
*/
|
|
virtual void setPowerOn() = 0;
|
|
|
|
/**
|
|
* Turn off power
|
|
*
|
|
* @throws std::runtime_error
|
|
*/
|
|
virtual void setPowerOff() = 0;
|
|
|
|
/**
|
|
* Get power state
|
|
*
|
|
* @return true if powered, false otherwise
|
|
*
|
|
* @throws std::runtime_error
|
|
*/
|
|
virtual bool isPowered() = 0;
|
|
|
|
/**
|
|
* Set brightness
|
|
*
|
|
* @param brightness as percentage
|
|
*
|
|
* @throws std::runtime_error
|
|
*/
|
|
virtual void setBrightness(int percent) = 0;
|
|
|
|
/**
|
|
* Get brightness
|
|
*
|
|
* @return brightness as percentage
|
|
*
|
|
* @throws std::runtime_error
|
|
*/
|
|
virtual int getBrightness() = 0;
|
|
|
|
virtual ~ILightController() {}
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|