Registering a New Application
Registering a New Application

Registering a New Application

  1. For a developer to create and register a new application without the use of external scripts, perform the following procedure:
  2. With TouchGFX 4.14.0, open the Oxpecker Project (.touchgfx) in the Designer:
  3. Create a new screen.
  4. Add a new Interaction, with no trigger. Change the screen to itself without transition. The interaction name can be anything.
  5. (Optional) By itself, the empty screen should be enough to generate a new application through code. Add any additional UI feature to the screen as required. For example, as a minimum:
    • A Back button
    • A Status Bar at the top
    • A Background.
  6. Click
    Generate Code
    .
  7. After the process finishes, the newly generated source files need to be edited.
    1. Create a new file called
      /TouchGFX/gui/include/gui/common/ApplicationClasses/<screenname>App.hpp:
      /* Replace all instances of <Screen Name> with the name of the new screen */ #ifndef __<Screen name>_APP_HPP__ #define __<Screen name>_APP_HPP__ #include <gui/common/OxpeckerApplication.hpp> class <Screen name>App: public OxpeckerApplication { public: private: }; #endif
    2. Open the View's header located in
      /TouchGFX/gui/include/gui/<screenname>_screen/
      and add the following code blocks:
      ... #include <gui/common/ZebraApplication.hpp> #include <gui/common/AppClasses.hpp> #include <gui/common/ScreenNameApp.hpp> /* Replace apropriately with previously generated file */ ... class <Screen>View : public <Screen>ViewBase, public <Screen>App { public: ZEBRA_APPLICATION ...
    3. Open the Presenter header located in the same path as the previous file and add the following:
      ... #include <gui/common/KeypadHandler.hpp> class <screenname>Presenter : public touchgfx::Presenter, public ModelListener, public KeypadHandler { public: ... /** * Zebra Specific APIs common to all screens */ virtual void UpdateAllIcons(); virtual void UpdateIcon(IconID_t IconId, IconStateID_t IconState); virtual void setCurrentScreen(uint8_t CurrentScreen); virtual uint8_t getHomeKeyLaunch(void);
    4. Open the Presenter Source code located in
      /TouchGFX/gui/src/<screenname>_screen/<screenname>Presenter.cpp
      and add the following:
      <screenname>Presenter::<screenname>Presenter(<screenname>View& v) : KeypadHandler(model), view(v) { ... } ... void <screenname>Presenter::UpdateAllIcons() { /* Signals the model to start a full icon state update */ model->UpdateAllIcons(); } void <screenname>Presenter::UpdateIcon(IconID_t IconId, IconStateID_t IconState) { /* Signal the View to update a specific icon */ /* Note that the actual implementation is specific to the view - for most screens the icons are located in the Top Status Bar */ view.UpdateIcon(IconId, IconState); } void <screenname>Presenter::setCurrentScreen(uint8_t CurrentScreen) { model->setCurrentScreen(CurrentScreen); } uint8_t <screenname>Presenter::getHomeKeyLaunch(void) { return (model->getHomeKeyLaunch()); }
    5. Open the View Source code located in
      /TouchGFX/gui/src/<screenname>_screen/
      and add the following:
      ... #include <gui/common/platform_itf.h> #include <gui/common/ConfigParam.hpp> /* Optional, to allow configuration parameters for this application */ REGISTER_APPLICATION( <Screenname>View, "DemoApp", /* Name of the application, entirely user defined */ TRANSITION_CALLBACK(goto<screenname>ScreenNoTransition), /* is generated automatically because of step 3 */ PRIORITY /* defines the order in the home menu, can be any number between 1 and 255*/ ) …
    6. Open the Presenter source code, located in the same place as the View source; and add the following:
      ... <Screenname>Presenter::<Screenname>Presenter(<Screenname>View& v) : KeypadHandler(model), view(v) { …
With these steps, a minimal application with no functionality and only general keypad interactions will be available on the Home Menu when rebuilding the embedded project.