C

StateManager Class

class SafeRenderer::StateManager

The StateManager class maintains the state of the indicators. More...

Header: #include <StateManager>
Since: QtSafeRenderer 1.0

This class was introduced in QtSafeRenderer 1.0.

Public Types

enum StateException { ConnectionAlreadyExists, NotConnectedEvent, TooManyConnections, StateNotFound, MaxNumOfLayoutsExceed, …, InvalidLayoutObject }
enum Value { ValueOff, ValueOn }

Public Functions

StateManager(SafeRenderer::AbstractWindow &window, SafeRenderer::QSafeLayout &layout, const SafeRenderer::ARGB clearColorArg = ARGB())
void addLayout(SafeRenderer::QSafeLayout *const layout)
void connect(const SafeRenderer::quint32 eventArg, const SafeRenderer::qchar *const stateName)
void connect(const SafeRenderer::quint32 eventArg, const SafeRenderer::quint32 stateId)
void handleConnection(const SafeRenderer::QSafeEventSystem &eventArg)
void handleEvent(const SafeRenderer::QSafeEvent &eventArg)
bool setLayout(SafeRenderer::QSafeLayout *const layout)

Detailed Description

Member Type Documentation

enum StateManager::StateException

This enum describes the exception values in the StateManager class.

ConstantValueDescription
SafeRenderer::StateManager::ConnectionAlreadyExists0The event is already connected.
SafeRenderer::StateManager::NotConnectedEvent1The event is not connected.
SafeRenderer::StateManager::TooManyConnections2The number of connections exceeds the value defined in SafeRenderer::Constraints::MAX_NUM_OF_CONNECTIONS.
SafeRenderer::StateManager::StateNotFound3The connected item could not be found.
SafeRenderer::StateManager::MaxNumOfLayoutsExceed4The number of layouts exceeds maximum defined in SafeRenderer::Constraints::MAX_NUM_OF_LAYOUTS
SafeRenderer::StateManager::LayoutAlreadyExists5A layout with the same id have already been added.
SafeRenderer::StateManager::InvalidLayoutId6The layout id is 0.
SafeRenderer::StateManager::InvalidLayoutObject7The layout pointer is NULL or the layout is not in OK state.

enum StateManager::Value

This enum describes the ON and OFF states.

ConstantValueDescription
SafeRenderer::StateManager::ValueOff0The value is OFF.
SafeRenderer::StateManager::ValueOn1The value is ON.

Member Function Documentation

StateManager::StateManager(SafeRenderer::AbstractWindow &window, SafeRenderer::QSafeLayout &layout, const SafeRenderer::ARGB clearColorArg = ARGB())

Constructs a StateManager object with the given window framebuffer, the layout default layout, and the clearColorArg clear color value.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::QSafeBitmapFileReader::BitmapFileReaderException::IndexOutOfBoundsThe bitmap index exceeds the value defined in SafeRenderer::Constraints::MAX_AMOUNT_OF_BITMAPS.
SafeRenderer::QSafeLayout::LayoutException::UnknownBitmapIdThe bitmap could not found by the given bitmap ID.
SafeRenderer::QSafeLayout::LayoutException::UnknownItemThe item could not be found.
SafeRenderer::QSafeLayout::LayoutException::ItemOutOfBoundsThe item's position is out of the layout boundaries.
SafeRenderer::QSafeLayoutResourceReader::LayoutResourceReaderException::DataSizeMismatchThe resource file does not contain enough data or data is invalid.
SafeRenderer::QSafeRenderer::RendererException::UnsupportedSurfaceFormatThe bits per pixel value in the window is neither 16 or 32.
SafeRenderer::QStringSplitter::QStringSplitterException::TooLongFileNameThe resource file contains a too long filename.
SafeRenderer::StateManager::StateException::InvalidLayoutObjectThe layout is not in OK state

void StateManager::addLayout(SafeRenderer::QSafeLayout *const layout)

Adds new layout to the state manager. At this point layout is not taken into use. Each QSafeLayout instances has an unique id which is the hash value of the layout file. This value is used in QSafeEventChangeLayout event when requesting a layout change.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::StateManager::StateException::MaxNumOfLayoutsExceedMaximum amount of layouts exceeds.
SafeRenderer::StateManager::StateException::LayoutAlreadyExistsLayout with same id is already added.
SafeRenderer::LayoutException::UnknownItemLayout contains item which is not defined in the default layout.

void StateManager::connect(const SafeRenderer::quint32 eventArg, const SafeRenderer::qchar *const stateName)

Connects the external eventArg to the stateName layout item. stateName is the objectName of the safe item in QML.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::StateManager::StateException::ConnectionAlreadyExistsThe event is already connected.
SafeRenderer::StateManager::StateException::NotConnectedEventThe event is not connected.
SafeRenderer::StateManager::StateException::TooManyConnectionsThe number of connections exceeds the value defined in SafeRenderer::Constraints::MAX_NUM_OF_CONNECTIONS.
SafeRenderer::StateManager::StateException::StateNotFoundThe connected item could not be found.

An example of the QML definiton:

SafePicture {
    id: iconCoolant
    objectName: "iconCoolant"
    width: 30
    height: 30
    color: "#e41e25"
    source: "qrc:/iso-icons/iso_grs_7000_4_2426.dat"
}

You can connect the external event EventEngineTemperature to the iconCoolant item as follows:

stateManager.connect(SafeRenderer::EventEngineTemperature, "iconCoolant");

void StateManager::connect(const SafeRenderer::quint32 eventArg, const SafeRenderer::quint32 stateId)

Connects the external eventArg to the stateId layout item. stateId is the calculated hash of the safe item objectName in QML.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::StateManager::StateException::ConnectionAlreadyExistsThe event is already connected.
SafeRenderer::StateManager::StateException::NotConnectedEventThe event is not connected.
SafeRenderer::StateManager::StateException::TooManyConnectionsThe number of connections exceeds the value defined in SafeRenderer::Constraints::MAX_NUM_OF_CONNECTIONS.
SafeRenderer::StateManager::StateException::StateNotFoundThe connected item could not be found.

void StateManager::handleConnection(const SafeRenderer::QSafeEventSystem &eventArg)

Handles an eventArg that can change its associated state between ON and OFF.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::QSafeBitmapFileReader::BitmapFileReaderException::IndexOutOfBoundsThe bitmap index exceeds the value defined in SafeRenderer::Constraints::MAX_AMOUNT_OF_BITMAPS.
SafeRenderer::QSafeRenderer::RendererException::BitmapOufOfScreenThe bitmap does not fit inside screen area.
SafeRenderer::QSafeRenderer::RendererException::InvalidBitmapPointerThe bitmap pointer is a null pointer.
SafeRenderer::QSafeRenderer::RendererException::InvalidBitmapIdThe bitmap ID is 0.
SafeRenderer::StateManager::StateException::NotConnectedEventThe event is not connected.

void StateManager::handleEvent(const SafeRenderer::QSafeEvent &eventArg)

Handles the eventArg event. See the QSafeEvent class for more information about the events.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::QSafeBitmapFileReader::BitmapFileReaderException::IndexOutOfBoundsThe bitmap index exceeds the value defined in SafeRenderer::Constraints::MAX_AMOUNT_OF_BITMAPS.
SafeRenderer::QSafeLayout::LayoutException::UnknownBitmapIdThe bitmap could not be found by given the ID.
SafeRenderer::QSafeLayout::LayoutException::UnknownItemThe item could not be found.
SafeRenderer::QSafeLayout::LayoutException::ItemOutOfBoundsThe item's position is out of the layout boundaries.
SafeRenderer::QSafeRenderer::RendererException::BitmapOufOfScreenThe bitmap does not fit inside the screen area.
SafeRenderer::QSafeRenderer::RendererException::InvalidBitmapPointerThe bitmap pointer is a null pointer.
SafeRenderer::QSafeRenderer::RendererException::InvalidBitmapIdThe bitmap ID is 0.
SafeRenderer::StateManager::StateException::ConnectionAlreadyExistsThe event is already connected.
SafeRenderer::StateManager::StateException::NotConnectedEventThe event is not connected.
SafeRenderer::StateManager::StateException::TooManyConnectionsThe number of connections exceeds the value defined in SafeRenderer::Constraints::MAX_NUM_OF_CONNECTIONS.
SafeRenderer::StateManager::StateException::StateNotFoundThe connected item could not be found.

bool StateManager::setLayout(SafeRenderer::QSafeLayout *const layout)

Changes the current layout of StateManager to layout.

Returns true if the layout change succeeded, otherwise false.

In case of a failure, one of the following exceptions will be thrown:

ConstantDescription
SafeRenderer::QSafeBitmapFileReader::BitmapFileReaderException::IndexOutOfBoundsThe bitmap index exceeds the value defined in SafeRenderer::Constraints::MAX_AMOUNT_OF_BITMAPS.
SafeRenderer::QSafeRenderer::RendererException::BitmapOufOfScreenThe bitmap does not fit inside screen area.
SafeRenderer::QSafeRenderer::RendererException::InvalidBitmapPointerThe bitmap pointer is a null pointer.
SafeRenderer::QSafeRenderer::RendererException::InvalidBitmapIdThe bitmap ID is 0.

Available under certain Qt licenses.
Find out more.