About flow of execution during app installation

Developer
Feb 28, 2014 at 4:25 AM
Hello,

I have some questions regarding the flow of execution of Lab of Things:

1) How is an app installed? During the installation, which module is responsible for dependency checking, e.g., whether the required devices are there?

I see that the app needs to be included as a project and it needs to be built before it is installed. So, how does HomeOS keep track of which apps are installed and which are not? The apps that are not installed, are those apps still running?

2) I do not have an in-depth understanding about plug-ins. That's why I have this question. Are the apps running as a service? Or, are they running as a webserver? How does the GUI in the browser interact with its corresponding app? Is the GUI talking to the platform and the platform is talking to the app through port, or the GUI is directly talking to the app?

Thank you.

-Munir.
Coordinator
Feb 28, 2014 at 5:16 AM

Hey, Munir –

1) If you are installing the app through the GUI (dashboard), only apps that are compatible with your home are shown as valid installation options. This check is done by the platform and you can trace it in GuiService.cs, which contains the functions that are called the GUI.

Installation of an app is in InstallAppWeb function in GuiService.cs. You will notice that it basically does two things:

(i) Start the module corresponding the app.

a. This function in turn will download the binaries if they don’t already exist on the hub. That would be the case where you are running HomeOS on a machine other than your build machine.

(ii) Insert an entry into Modules.xml configuration file in output/Configs/Config

It is step (ii) basically that gives HomeOS memory of which apps are installed. These apps will run again when the Platform is restarted. Apps that are not installed are not run even if their binaries are present in the output folder.

2) Apps run as modules in HomeOS and host UI services using WCF (windows communication framework), which you can think of as a lightweight webserver. They host two services:

a. A service that serves static UI content (HTML).

b. A service that implements the JS calls inside the HTML files.

The UI is essentially directly talking to the app, except that through the magic of WCF we make sure that the caller is authenticated for JS calls.

I hope this helps. Let me know if something is still not clear.

Cheers.

Developer
Feb 28, 2014 at 2:36 PM
Hi Ratul,

Thanks so much for the quick reply! The issues are clear now.

I have one more question about understanding the flow of execution. Can we run HomeOS from Visual Studio in the debug mode? I tried to do that, but Visual Studio says that
"A project with an Output Type of Class Library can not be started directly". If I create a new project within the solution, reference the platform, and write a main function like the one in Platform.cs, will that work?

I guess, a similar question is, why did we choose to run the platform from the .bat file instead of running directly from the Visual Studio?

Thank you once again.
-Munir.
Coordinator
Feb 28, 2014 at 3:06 PM

Munir –

You can run HomeOS from Visual Studio:

- Right click on the Platform project (not folder) -> Set as startup project

- Debug

This will start the main HomeOS binary in Debug mode. Without Step 1, it is probably trying to start another project.

We created the bat file mainly to set up the right firewall rules when running platform. If you see a firewall warning pop up when you do the above, please allow access to all three types of networks.

Cheers.

Developer
Mar 1, 2014 at 4:44 AM
Hi Ratul,

That helps a lot! I was able to run HomeOS from Visual Studio in the debug mode. Thanks so much for the quick reply!

-Munir.