Share this page to your:

Apps

I'm assuming you will want to change the VM software, or add your own stuff to it, and it is designed to make that possible. Not necessarily easy, but this post will help. You do need to know enough C++ to get something compiled and we already covered how to set up the development environment.

The VM software is divided into apps: Clock, Compass, Dalek Detector, Gallery, Graphics, Heart, Notifications, Set Clock and Sleep. Each of those is a class that extends the App class. They self-register with the AppRegistry and that is what the menu (another class) uses to present all the options.

Gallery

Let's start with something easy. The Gallery app reads images off the SD card. You will find a copy of the files I put on my own SD card in the project (under SDBackup). You can replace those images with your own. You just need to make your images into 240x320 BMP files. Copy the resulting files to your SD card, push the card into the slot on the main board and you are ready to display images like this one:

kimi

Now let's take a look at that Gallery app's code. In the Gallery.h file you'll find that it extends the App class which means it needs to implement the following methods:

That is the basic structure of an app.

Icons

Each app needs an icon to display on the menu. Making one of these is a bit tricky and I covered the details this post. The shorter version is that I create a 28x28 pixel image in Gimp and export it as a .h file, then I process that with some logic (in the MakeIcons program referred to in that post) and finally paste the results into the app code.

You end up with a lot of hex values which we can use to define the image in an array which we eventually load into m_icon, a variable defined in the App class. App and Menu take care of displaying the icon on the menu. An important point to remember is that the icon is held in the app class, not in the menu. It makes the apps more self contained. In the same way we also add this at the end of the Gallery.cpp file:

App *gallery = new Gallery();

Instantiating the class causes it to register with the AppRegister which is what the Menu uses to display the options. The menu does its best to fit everything on the screen but there are, after all, only so many rows and columns. It is probably possible to have menu display a second page of options but that is not in this code. So if you want to add another app you'll need to remove one of the ones already there, or rework the menu.

Summary

This is about how the app software works. Each of the VM functions is implemented in an app and this post took us through the Gallery app and added some information about icons.