Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
aurore::Platform Class Referenceabstract

#include <aurore/core/platform.hpp>

Public Member Functions

virtual ~Platform ()=default
 
virtual void createWindow (std::string title, uint32_t width, uint32_t height, float windowXPos=NAN, float windowYPos=NAN)=0
 
virtual void restoreWindow ()
 
virtual void setWindowSize (uint32_t windowWidth, uint32_t windowHeight)
 
virtual void setWindowSizeLimits (uint32_t windowMinWidth, uint32_t windowMinHeight, uint32_t windowMaxWidth, uint32_t windowMaxHeight)
 
virtual void setWindowPosition (int windowXPos, int windowYPos)
 
virtual void setWindowState (uint32_t windowWidth, uint32_t windowHeight, int windowXPos, int windowYPos)
 
virtual std::string getName ()=0
 
virtual bool hasWirelessConnection ()
 
virtual int getWirelessLevel ()=0
 
virtual bool hasEthernetConnection ()
 
virtual std::string getIpAddress ()=0
 
virtual std::string getDnsServer ()=0
 
virtual bool canShowBatteryLevel ()
 
virtual bool canShowWirelessLevel ()
 
virtual int getBatteryLevel ()=0
 
virtual bool isBatteryCharging ()=0
 
virtual void disableScreenDimming (bool disable, const std::string &reason="disable dimming", const std::string &app="aurore")=0
 
virtual bool isScreenDimmingDisabled ()=0
 
virtual void setBacklightBrightness (float brightness)=0
 
virtual float getBacklightBrightness ()=0
 
virtual bool canSetBacklightBrightness ()=0
 
virtual void setWindowAlwaysOnTop (bool enable)
 
virtual bool mainLoopIteration ()=0
 
virtual bool runLoop (const std::function< bool()> &runLoopImpl)
 
virtual ThemeVariant getThemeVariant ()=0
 
virtual void setThemeVariant (ThemeVariant theme)=0
 
virtual std::string getLocale ()=0
 
virtual AudioPlayer * getAudioPlayer ()=0
 
virtual VideoContext * getVideoContext ()=0
 
virtual InputManager * getInputManager ()=0
 
virtual ImeManager * getImeManager ()=0
 
virtual FontLoader * getFontLoader ()=0
 
virtual bool isApplicationMode ()=0
 
virtual void exitToHomeMode (bool value)=0
 
virtual void forceEnableGamePlayRecording ()=0
 
virtual void openBrowser (std::string url)=0
 
virtual void pasteToClipboard (const std::string &text)
 
virtual std::string pasteFromClipboard ()
 

Static Public Member Functions

static bool isBrowserUrl (const std::string &url)
 
static Platform * createPlatform ()
 
static void setFactory (std::function< Platform *()> factory)
 

Static Public Attributes

static std::vector< std::string > BROWSER_URL_SCHEMES = { "http", "https" }
 
static std::string APP_LOCALE_DEFAULT = "auto"
 

Constructor & Destructor Documentation

◆ ~Platform()

virtual aurore::Platform::~Platform ( )
virtualdefault

Member Function Documentation

◆ canSetBacklightBrightness()

virtual bool aurore::Platform::canSetBacklightBrightness ( )
pure virtual

Returns true if the platform can set/get the backlight brightness

◆ canShowBatteryLevel()

virtual bool aurore::Platform::canShowBatteryLevel ( )
inlinevirtual

Returns if battery level supports.

◆ canShowWirelessLevel()

virtual bool aurore::Platform::canShowWirelessLevel ( )
inlinevirtual

Returns if Wireless level supports.

◆ createPlatform()

static Platform * aurore::Platform::createPlatform ( )
static

Selects and returns the best platform.

◆ createWindow()

virtual void aurore::Platform::createWindow ( std::string  title,
uint32_t  width,
uint32_t  height,
float  windowXPos = NAN,
float  windowYPos = NAN 
)
pure virtual

Called on startup, right after instanciation, to create and open a window with the given title and size.

◆ disableScreenDimming()

virtual void aurore::Platform::disableScreenDimming ( bool  disable,
const std::string &  reason = "disable dimming",
const std::string &  app = "aurore" 
)
pure virtual

Disable screen dimming/saver...

Parameters
disableInhibit or not
reasonIf disable is true, pass Inhibited reason to the system.
appIf disable is true, pass app name to the system.

◆ exitToHomeMode()

virtual void aurore::Platform::exitToHomeMode ( bool  value)
pure virtual

When the program exits, exit directly to the home menu

◆ forceEnableGamePlayRecording()

virtual void aurore::Platform::forceEnableGamePlayRecording ( )
pure virtual

When the program exits, exit directly to the home menu

◆ getAudioPlayer()

virtual AudioPlayer * aurore::Platform::getAudioPlayer ( )
pure virtual

Returns the AudioPlayer for the platform. Cannot return nullptr.

◆ getBacklightBrightness()

virtual float aurore::Platform::getBacklightBrightness ( )
pure virtual

Get the backlight brightness

Returns
0.0 to 1.0

◆ getBatteryLevel()

virtual int aurore::Platform::getBatteryLevel ( )
pure virtual

Returns the battery level from 0 to 100.

◆ getDnsServer()

virtual std::string aurore::Platform::getDnsServer ( )
pure virtual

Returns dns server address.

◆ getFontLoader()

virtual FontLoader * aurore::Platform::getFontLoader ( )
pure virtual

Returns the FontLoader for the platform. Cannot return nullptr.

◆ getImeManager()

virtual ImeManager * aurore::Platform::getImeManager ( )
pure virtual

Returns the ImeManager for the platform. Cannot return nullptr.

◆ getInputManager()

virtual InputManager * aurore::Platform::getInputManager ( )
pure virtual

Returns the InputManager for the platform. Cannot return nullptr.

◆ getIpAddress()

virtual std::string aurore::Platform::getIpAddress ( )
pure virtual

Returns ip address.

◆ getLocale()

virtual std::string aurore::Platform::getLocale ( )
pure virtual

Can be called at anytime to get the current locale

For now, the locale is assumed to stay the same during the whole time the app is running (no locale hot swap)

As such, the result should be cached by the platform code. The method should return one of the locale constants defined in the i18n header file.

◆ getName()

virtual std::string aurore::Platform::getName ( )
pure virtual

Returns the human-readable name of the platform.

◆ getThemeVariant()

virtual ThemeVariant aurore::Platform::getThemeVariant ( )
pure virtual

Can be called at anytime to get the current system theme variant.

For now, the variant is assumed to stay the same during the whole time the app is running (no variant hot swap).

As such, the result should be cached by the platform code.

◆ getVideoContext()

virtual VideoContext * aurore::Platform::getVideoContext ( )
pure virtual

Returns the VideoContext for the platform. Cannot return nullptr.

◆ getWirelessLevel()

virtual int aurore::Platform::getWirelessLevel ( )
pure virtual

Returns wireless quality level from 0 to 3.

◆ hasEthernetConnection()

virtual bool aurore::Platform::hasEthernetConnection ( )
inlinevirtual

Returns true if device has ethernet connection.

◆ hasWirelessConnection()

virtual bool aurore::Platform::hasWirelessConnection ( )
inlinevirtual

Returns true if device has wireless connection.

◆ isApplicationMode()

virtual bool aurore::Platform::isApplicationMode ( )
pure virtual

Returns if non applet.

◆ isBatteryCharging()

virtual bool aurore::Platform::isBatteryCharging ( )
pure virtual

Returns the battery level from 0 to 100.

◆ isBrowserUrl()

static bool aurore::Platform::isBrowserUrl ( const std::string &  url)
static

true if openBrowser() may open this url: it starts with one of BROWSER_URL_SCHEMES followed by "://" and has no control character

◆ isScreenDimmingDisabled()

virtual bool aurore::Platform::isScreenDimmingDisabled ( )
pure virtual

Returns true if screen dimming is disabled

◆ mainLoopIteration()

virtual bool aurore::Platform::mainLoopIteration ( )
pure virtual

Called at every iteration of the main loop. Must return false if the app should continue running (for example, return false if the X button was pressed on the window).

◆ openBrowser()

virtual void aurore::Platform::openBrowser ( std::string  url)
pure virtual

Open a link in browser

Parameters
urlthe link which will be opened; one that isBrowserUrl() refuses is not opened

◆ pasteFromClipboard()

virtual std::string aurore::Platform::pasteFromClipboard ( )
inlinevirtual

Copy text from clipboard

◆ pasteToClipboard()

virtual void aurore::Platform::pasteToClipboard ( const std::string &  text)
inlinevirtual

Paste text to clipboard

◆ restoreWindow()

virtual void aurore::Platform::restoreWindow ( )
inlinevirtual

This function also restores windows from maximization.

◆ runLoop()

virtual bool aurore::Platform::runLoop ( const std::function< bool()> &  runLoopImpl)
inlinevirtual

◆ setBacklightBrightness()

virtual void aurore::Platform::setBacklightBrightness ( float  brightness)
pure virtual

Set the backlight brightness

Parameters
brightness0.0 to 1.0

◆ setFactory()

static void aurore::Platform::setFactory ( std::function< Platform *()>  factory)
inlinestatic

Has createPlatform() return what factory makes instead of the build's own platform (the test harness' headless one). To call before Application::init(); an empty function goes back to the default.

◆ setThemeVariant()

virtual void aurore::Platform::setThemeVariant ( ThemeVariant  theme)
pure virtual

Overwrite current theme settings

◆ setWindowAlwaysOnTop()

virtual void aurore::Platform::setWindowAlwaysOnTop ( bool  enable)
inlinevirtual

Set the windows always on top

◆ setWindowPosition()

virtual void aurore::Platform::setWindowPosition ( int  windowXPos,
int  windowYPos 
)
inlinevirtual

Set window position

◆ setWindowSize()

virtual void aurore::Platform::setWindowSize ( uint32_t  windowWidth,
uint32_t  windowHeight 
)
inlinevirtual

Set window size

◆ setWindowSizeLimits()

virtual void aurore::Platform::setWindowSizeLimits ( uint32_t  windowMinWidth,
uint32_t  windowMinHeight,
uint32_t  windowMaxWidth,
uint32_t  windowMaxHeight 
)
inlinevirtual

Set window size limits

◆ setWindowState()

virtual void aurore::Platform::setWindowState ( uint32_t  windowWidth,
uint32_t  windowHeight,
int  windowXPos,
int  windowYPos 
)
inlinevirtual

1.restoreWindow 2.Set window size 3.Set window position

Member Data Documentation

◆ APP_LOCALE_DEFAULT

std::string aurore::Platform::APP_LOCALE_DEFAULT = "auto"
inlinestatic

App locale, empty for default

◆ BROWSER_URL_SCHEMES

std::vector<std::string> aurore::Platform::BROWSER_URL_SCHEMES = { "http", "https" }
inlinestatic

The schemes openBrowser() accepts, in lower case


The documentation for this class was generated from the following file: