luna-sysmgr-common
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HostArm Class Reference

#include <HostArm.h>

Inheritance diagram for HostArm:
[legend]
Collaboration diagram for HostArm:
[legend]

Public Member Functions

 HostArm ()
 
virtual ~HostArm ()
 
virtual void init (int w, int h)
 
virtual void show ()
 
virtual int getNumberOfSwitches () const
 
int readHidEvents (int fd, struct input_event *eventBuf, int bufSize)
 
virtual const char * hardwareName () const
 
virtual InputControlgetInputControlALS ()
 
virtual InputControlgetInputControlBluetoothInputDetect ()
 
virtual InputControlgetInputControlProximity ()
 
virtual InputControlgetInputControlTouchpanel ()
 
virtual InputControlgetInputControlKeys ()
 
virtual LedControlgetLedControlKeypadAndDisplay ()
 
virtual void OrientationSensorOn (bool enable)
 
virtual void setBluetoothKeyboardActive (bool active)
 
virtual bool bluetoothKeyboardActive () const
 
- Public Member Functions inherited from HostBase
virtual ~HostBase ()
 
const HostInfogetInfo () const
 
virtual void run ()
 
virtual void quit ()
 
virtual unsigned short translateKeyWithMeta (unsigned short key, bool withShift, bool withAlt)
 
void lockPainting ()
 
void unlockPainting ()
 
virtual void setMetaModifier (bool metaKeyDown)
 
virtual bool metaModifier ()
 
void turboModeSubscription (bool add)
 
virtual bool hasAltKey (Qt::KeyboardModifiers modifiers)
 
void setOrientation (OrientationEvent::Orientation o)
 
QPoint map (const QPoint &pt)
 
virtual OrientationEventpostProcessDeviceOrientation (OrientationEvent *currOrientation)
 
virtual bool homeButtonWakesUpScreen ()
 
- Public Member Functions inherited from TaskBase
 TaskBase ()
 
virtual ~TaskBase ()
 
void postEvent (sptr< Event > event, bool highPriority=false)
 
GMainLoop * mainLoop () const
 
SingletonTimermasterTimer () const
 
- Public Member Functions inherited from RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
void ref ()
 
void deref ()
 

Protected Slots

void readALSData ()
 
void readProxData ()
 

Protected Member Functions

virtual void wakeUpLcd ()
 
virtual int screenX (int rawX, Event::Type type)
 
virtual int screenY (int rawY, Event::Type type)
 
virtual void setCentralWidget (QWidget *view)
 
void setupInput (void)
 
void shutdownInput (void)
 
void startService (void)
 
void stopService (void)
 
void disableScreenBlanking ()
 
virtual void flip ()
 
virtual QImage takeScreenShot () const
 
virtual QImage takeAppDirectRenderingScreenShot () const
 
virtual void setAppDirectRenderingLayerEnabled (bool enable)
 
virtual void setRenderingLayerEnabled (bool enable)
 
virtual void NYXDataAvailable (NYXConnectorBase::Sensor aSensorType)
 
- Protected Member Functions inherited from HostBase
 HostBase ()
 
virtual void handleEvent (sptr< Event >)
 
virtual void turboMode (bool enable)
 

Static Protected Member Functions

static bool getMsgValueInt (LSMessage *msg, int &value)
 

Protected Attributes

QSocketNotifier * m_nyxLightNotifier
 
QSocketNotifier * m_nyxProxNotifier
 
int m_fb0Fd
 
int m_fb1Fd
 
void * m_fb0Buffer
 
int m_fb0NumBuffers
 
void * m_fb1Buffer
 
int m_fb1NumBuffers
 
LSHandle * m_service
 
InputControlm_nyxInputControlALS
 
InputControlm_nyxInputControlBluetoothInputDetect
 
InputControlm_nyxInputControlProx
 
InputControlm_nyxInputControlKeys
 
InputControlm_nyxInputControlTouchpanel
 
LedControlm_nyxLedControlKeypadAndDisplay
 
bool m_bluetoothKeyboardActive
 
NYXOrientationSensorConnectorm_OrientationSensor
 
- Protected Attributes inherited from HostBase
HostInfo m_info
 
Mutex m_paintMutex
 
bool m_metaKeyDown
 
OrientationEvent::Orientation m_orientation
 
QTransform m_trans
 
int m_numBuffers
 
unsigned m_turboModeSubscriptions
 
- Protected Attributes inherited from TaskBase
GMainContext * m_mainCtxt
 
GMainLoop * m_mainLoop
 
Mutex m_mutex
 
Mutex m_eventsMutex
 
std::list< sptr< Event > > m_eventsList
 
AsyncCaller< TaskBase > * m_asyncCaller
 
SingletonTimerm_masterTimer
 

Additional Inherited Members

- Signals inherited from HostBase
void signalBluetoothKeyboardActive (bool active)
 
- Static Public Member Functions inherited from HostBase
static HostBaseinstance ()
 
static bool hostIsQemu ()
 

Detailed Description

Base class for all ARM-based host device classes to derive from

Constructor & Destructor Documentation

HostArm::HostArm ( )

Constructs an ARM-based host device

Initializes common ARM hardware.

HostArm::~HostArm ( )
virtual

Shuts down ARM-specific hardware

Member Function Documentation

bool HostArm::bluetoothKeyboardActive ( ) const
virtual

Checks whether Bluetooth keyboard functionality is enabled

Todo:
Verify that the documentation for this method is correct.
Returns
true if Bluetooth keyboard functionality is enabled, otherwise false.

Reimplemented from HostBase.

void HostArm::disableScreenBlanking ( )
protected

Disable screen blanking and puts the screen into graphics mode

Enabled screen blanking to restore the screen from sleep, then immediately disables it.

After that, it puts the screen into grahics mode to get it ready to draw to (and hide the text terminal cursor).

When deciphering the implementation of this, see the manpage for console_ioctl, specifically TIOCLINUX subcodes 0 and 10.

void HostArm::flip ( )
protectedvirtual

Flips the back buffer to the display

Displays to the screen what is currently contained in the back buffer. Since there is a back buffer, drawing can be completed on the back buffer at the program's leisure before displaying it in one swift move with a flip.

Reimplemented from HostBase.

InputControl * HostArm::getInputControlALS ( )
virtual

Gets an InputControl pointer for the ambient light sensor

Allows the ambient light sensor to be turned on/off.

Returns
Ambient light sensor control.

Reimplemented from HostBase.

InputControl * HostArm::getInputControlBluetoothInputDetect ( )
virtual

Gets an InputControl pointer for Bluetooth input detection

Allows the Bluetooth input detection to be turned on/off.

Returns
Bluetooth input sensor control.

Reimplemented from HostBase.

InputControl * HostArm::getInputControlKeys ( )
virtual

Gets an InputControl pointer for the keyboard

Allows the keyboard to be turned on/off.

Todo:
Confirm documentation on this.
Returns
Control keys sensor control.

Reimplemented from HostBase.

InputControl * HostArm::getInputControlProximity ( )
virtual

Gets an InputControl pointer for the face proximity sensor

Allows the face proximity sensor to be turned on/off.

Returns
Face proximity sensor control.

Reimplemented from HostBase.

InputControl * HostArm::getInputControlTouchpanel ( )
virtual

Gets an InputControl pointer for the touch panel

Allows the touch panel to be turned on/off.

Returns
Touch panel sensor control.

Reimplemented from HostBase.

LedControl * HostArm::getLedControlKeypadAndDisplay ( )
virtual

Gets an LedControl pointer for the keyboard backlight

Allows the keyboard backlight to be turned on/off.

Todo:
Confirm documentation on this.
Returns
Keyboard backlight control.

Reimplemented from HostBase.

bool HostArm::getMsgValueInt ( LSMessage *  msg,
int &  value 
)
staticprotected

Given a return value from an IPC call with a "value" element, returns the integer value of it

When an IPC call passes back a JSON structure in a format such as:

{ value : "127" }

It returns the integer value of the "value" element.

Parameters
msgReturn value message to parse from IPC call.
valueWhere to store the integer version of the value.
Returns
true if parsing was successful, false if parsing failed.
int HostArm::getNumberOfSwitches ( ) const
virtual

Gets the number of hardware switches the current host device has

As an example, the Palm Pre has 3 switches:

  • Ringer on/off.
  • Slider opened/closed.
  • Headphones inserted/no headphones.
Returns
Number of hardware switches the device has.

Reimplemented from HostBase.

Reimplemented in HostArmQemu, HostArmBroadway, HostArmTopaz, HostArmOpal, and HostArmWindsorNot.

const char * HostArm::hardwareName ( ) const
virtual
void HostArm::init ( int  w,
int  h 
)
virtual

Initialize device-specific hardware

Initializes hardware, fetches display info, and generally prepares the host device for LunaSysMgr to run on it.

Must be overridden for each type of device Host class needed.

Parameters
wHint as to what the screen width probably is. Ignored by most devices since they can query the screen for its capabilities.
hHint as to what the screen height probably is. Ignored by most devices since they can query the screen for its capabilities.

Implements HostBase.

void HostArm::NYXDataAvailable ( NYXConnectorBase::Sensor  aSensorType)
protectedvirtual

Function gets called whenever there is some data available from NYX.

Parameters
[in]-aSensorType - Sensor which has got some data to report

Implements NYXConnectorObserver.

void HostArm::OrientationSensorOn ( bool  enable)
virtual

Function enables/disables the orientation sensor

Parameters
enabletrue to enable the orientation sensor, false to disable it.

Reimplemented from HostBase.

void HostArm::readALSData ( )
protectedslot

Read the value of the ambient light sensor

Reads the value of the ambient light sensor and posts an AlsEvent event to the active window's event queue with the value IF it is able to successfully retrieve the value.

Note
You MUST run HostArm::setupInput() (or HostArm::getInputControlALS() directly if you feel adventurous) before calling this method for it to actually do anything.
See Also
HostArm::getInputControlALS()
AlsEvent
Todo:
Document the value range for the ambient light sensor.
int HostArm::readHidEvents ( int  fd,
struct input_event *  eventBuf,
int  bufSize 
)

Reads input_event structures from a file descriptor and returns the number read

Mainly just a utility method for use within this class. Very purpose- specific.

See Also
input_event
Parameters
fdFile descriptor to read from.
eventBufBuffer to read input_events into.
bufSizeAmount of allocated memory (in bytes) that eventBuf points to.
Returns
Returns the number of events read on success (may be 0) or -1 on failure.
void HostArm::readProxData ( )
protectedslot

Read the value of the face proximity sensor

Reads the value of the face proximity sensor and posts an ProximityEvent event to the active window's event queue with the value IF it is able to successfully retrieve the value.

Note
You MUST run HostArm::setupInput() (or HostArm::getInputControlProximity() directly if you feel adventurous) before calling this method for it to actually do anything.
See Also
HostArm::getInputControlProximity()
ProximityEvent
Todo:
Document the value range for the face proximity sensor.
virtual int HostArm::screenX ( int  rawX,
Event::Type  type 
)
inlineprotectedvirtual

Remap a raw X value from the touchscreen to a pixel value

Todo:
Confirm this, since there's only one implementation of this at the moment.
Parameters
rawXRaw X value from the touchscreen.
typeType of event which gave us this coordinate value.
Returns
Screen X of the touch, in pixels.
virtual int HostArm::screenY ( int  rawY,
Event::Type  type 
)
inlineprotectedvirtual

Remap a raw Y value from the touchscreen to a pixel value

Todo:
Confirm this, since there's only one implementation of this at the moment.
Parameters
rawYRaw Y value from the touchscreen.
typeType of event which gave us this coordinate value.
Returns
Screen Y of the touch, in pixels.
void HostArm::setAppDirectRenderingLayerEnabled ( bool  enable)
protectedvirtual

Unknown purpose at this time

This is used in very few other places, so I don't know exactly what it's used for. On ARM devices, executes an FBIO command that I cannot currently find documentation for. Seems to have something to do with blanking.

Todo:
Document what this is used for and how it works once it's figured out.
Parameters
enableUnknown.

Reimplemented from HostBase.

void HostArm::setBluetoothKeyboardActive ( bool  active)
virtual

Enable/disable Bluetooth keyboards

Todo:
Verify that the documentation for this method is correct.
Parameters
activetrue to enable Bluetooth keyboards, false to disable

Reimplemented from HostBase.

void HostArm::setCentralWidget ( QWidget view)
protectedvirtual

Sets the Qt widget that the display should reside in

Mostly unused except under the QtDesktop and Qemu hosts, where it is used to attach a keyboard remapping filter.

Called by WindowServer::WindowServer().

Parameters
viewQt widget to display within.

Reimplemented from HostBase.

Reimplemented in HostArmQemu.

void HostArm::setRenderingLayerEnabled ( bool  enable)
protectedvirtual

Unknown purpose at this time

Almost the same as HostBase::setAppDirectRenderingLayerEnabled, but on a different fb device. Has something to do with blanking, but still don't really understand what this is used for.

Parameters
enableUnknown.

Reimplemented from HostBase.

void HostArm::setupInput ( void  )
protected

Starts talking to this device's sensors

Calls both HostArm::getInputControlALS() and HostArm::getInputControlProximity() to connect to HAL for the sensors. After each, it also subscribes to notifiers for them so when either of them changes value an event is posted to our event queue.

See Also
QSocketNotifier
void HostArm::show ( )
virtual

Grab access to the hardware (including the display and input devices) for use by LunaSysMgr

Run this when you're ready to start using the host to display things. It grabs exclusive access to the screen and input devices (on most devices) so it can actually start displaying graphics on the screen.

Must be overridden per-device since it's fairly device-specific what needs to be enabled to be able to run LunaSysMgr.

Reimplemented from HostBase.

void HostArm::shutdownInput ( void  )
protected

Disconnects from Nyx for each of the sensors

Sensors which are disconnected from include:

  • Ambient light sensor.
  • Face proximity sensor.
  • Touch panel.
  • Control keys (probably either hardware switches or the keyboard).

And closes down the Nyx notifiers for:

  • Face proximity sensor.
  • Ambient light sensor.
Todo:
Figure out whether "control keys" refers to hardware switches or the keyboard.
void HostArm::startService ( void  )
protected

Attaches the main GLib event loop for this host to the IPC system

Todo:
Confirm this once LSRegister is publicly documented.
void HostArm::stopService ( void  )
protected

Disconnects the main GLib event loop for this host from the IPC system

Todo:
Confirm this once LSUnregister is publicly documented.
QImage HostArm::takeAppDirectRenderingScreenShot ( ) const
protectedvirtual

Takes a screenshot, including anything rendered directly to the display by an app

Currently only implemented on ARM devices, and on them is the same as a regular screenshot.

Returns
An image showing the current state of the display, even if an app has drawn to it directly.

Reimplemented from HostBase.

QImage HostArm::takeScreenShot ( ) const
protectedvirtual

Takes a screenshot

Currently only implemented on ARM devices.

Returns
An image showing the current state of the display.

Reimplemented from HostBase.

void HostArm::wakeUpLcd ( )
protectedvirtual

Turns the LCD on

Not much more to say about this one. The function of it is pretty straightforward.

Member Data Documentation

bool HostArm::m_bluetoothKeyboardActive
protected

Whether or not a Bluetooth keyboard is active

Set by HostArm::setBluetoothKeyboardActive().

void* HostArm::m_fb0Buffer
protected

Memory-mapped pointer to /dev/fb0

Write pixel data to this to display it.

int HostArm::m_fb0Fd
protected

File descriptor for the first framebuffer device (/dev/fb0, the LCD)

Initialized by HostArm::init().

int HostArm::m_fb0NumBuffers
protected

Number of buffers successfully memory mapped for /dev/fb0

Looks like this is where you can tell how many back buffers have been enabled for the device (in addition to the main buffer). This should be the total number of buffers for the device, including back buffers.

Todo:
Confirm the documentation on this.
void* HostArm::m_fb1Buffer
protected

Memory-mapped pointer to /dev/fb1

Write pixel data to this to display it to /dev/fb1.

int HostArm::m_fb1Fd
protected

File descriptor for the secondary framebuffer device (/dev/fb1, for direct rendering)

Initialized by HostArm::init().

int HostArm::m_fb1NumBuffers
protected

Number of buffers successfully memory mapped for /dev/fb1

Looks like this is where you can tell how many back buffers have been enabled for the device (in addition to the main buffer). This should be the total number of buffers for the device, including back buffers.

Todo:
Confirm the documentation on this.
InputControl* HostArm::m_nyxInputControlALS
protected

Nyx input control for the ambient light sensor

Initialized in HostArm::getInputControlALS().

InputControl* HostArm::m_nyxInputControlBluetoothInputDetect
protected

Nyx input control for the whether or not a Bluetooth input device is connected

Initialized in HostArm::getInputControlBluetoothInputDetect().

Todo:
Confirm that this is what the Bluetooth input detect input control is for.
InputControl* HostArm::m_nyxInputControlKeys
protected

Nyx input control for the keyboard

Initialized in HostArm::getInputControlKeys().

Todo:
Confirm that this is in fact for the keyboard.
InputControl* HostArm::m_nyxInputControlProx
protected

Nyx input control for the face proximity sensor

Initialized in HostArm::getInputControlProximity().

InputControl* HostArm::m_nyxInputControlTouchpanel
protected

Nyx input control for the touch panel

Initialized in HostArm::getInputControlTouchpanel().

LedControl* HostArm::m_nyxLedControlKeypadAndDisplay
protected
QSocketNotifier* HostArm::m_nyxLightNotifier
protected

Watches for changes in the ambient light sensor value and posts events to the event queue when they occur

Initialized by HostArm::setupInput().

See Also
QSocketNotifier
HostArm::setupInput()
QSocketNotifier* HostArm::m_nyxProxNotifier
protected

Watches for changes in the face proximity sensor value and posts events to the event queue when they occur

Initialized by HostArm::setupInput().

See Also
QSocketNotifier
HostArm::setupInput()
NYXOrientationSensorConnector* HostArm::m_OrientationSensor
protected

Nyx sensor connector for the orientation sensor

Initialized, enabled, and disabled by HostArm::OrientationSensorOn().

LSHandle* HostArm::m_service
protected

IPC system connection

Appears to be initialized by HostArm::startService().


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