SkyCase IoT app development

This section explains the procedure for developing and deploying an application in the IoT app store. The build environment and basic concepts about the lifecycle of the application are explained with steps in writing it.

Development Environment

SkyCase supports apps written in Java. Developers can develop and build their applications using standard Java technologies and run them on SkyCase platform. Before starting the IoT app development, be sure that you have below development environment set up.
  • Java JDK (at least JDK 1.7)
  • Eclipse IDE
  • Latest SkyCase API library (skycase-api-*.jar) from downloads section

SkyCase API Library

A SkyCase application is built on top of the API library which provides basic functionality to interface with the SkyCase platform. This API library must be imported to the project and used. The API library contains the following primary classes

Application (skycase.app.Application)

Base class for the application which must be inherited to create an application instance. This class provides access to the basic interfaces like application state, port settings, user settings, requests etc.

AppPort (skycase.app.AppPort)

Class implementing the port configuration to map user's devices at runtime.

AppSetting (skycase.app.AppSetting)

Class that provides the setting to allow user configuration with respect to this application.

DataRequest (skycase.app.DataRequest)

This class allows read/write operations with devices mapped to this application.

AppEvent (skycase.app.AppEvent)

This class is used to generate runtime notification and/or email alerts to the user.

AppStatus (skycase.app.AppStatus)

This class is used to generate internal runtime status of the application to the user.

IPSO(skycase.app.IPSO)

This class provides the list of objects and resources defined by the IPSO for use in LWM2M communication.

Application Lifecycle

A SkyCase application once installed by the user and started is instantiated in the SkyCase platform. The platform interacts with the application by means of certain methods implemented by the application.
IoT Application Lifecyle
The life cycle of the application can be determined by the call to these functions.

OnStart

This method will be called when the application is loaded to memory for running. The user should initialize the user configurations apart from the internal configurations like application runtime state, app ports, app settings etc

OnExecute

This function is called continuously till the user stops it or for internal reasons specific to the platform operations. Typically called once every user configured time (getSleepTime), this function must implement the various logic specific to the application functionality. The application can invoke read and writes to the devices using the DataRequest objects.

OnStop

This method is called when the application is stopped by the user or by the platform for internal reasons. This is the last call guaranteed to be called before being unloaded from memory. So the application must store data in non-volatile configurations and restore later when started in the onStart call.

IoT Application Development

This section explains the steps in developing and deploying the application.

Writting App

The first part will describe the development procedure using the Eclipse IDE.
  • Create a Java project in eclipse with your preferred name.
  • Add the downloaded SkyCase API library as external jar in build path setting in project properties.
  • Create a package named skycase.main with a class called SkyCaseApp extending skycase.app.Application in SkyCaseApp.java file.
  • In the constructor, initialize the application state, app ports, and app settings as below
  • Add app port with the 'addAppPort()' API method . Each app port should be initialized with a unique key id which will be the only reference for further usage.
  • Add app setting with the 'addAppSetting()' API method . Each app setting should be initialized with a unique key id which will be the only reference for further usage.
  • Perform any necessary implementation in onStart method
  • Implement the application logic in the onExecute method
  • Remove any initializations in onStop method.
  • Any logic can be added as separate file that can be kept in a different package as well.
  • Build the same in Eclipse and export it a JAR file using the Exoprt option shown on right-clicking the project name.

Deploying App in Store

  • Upload the JAR file in the SkyCase platform using Developer Dashboard as follows.
  • Login using your user name pass word and select Develop Dashboard from the top-right drop down menu.
  • Select the Application option in the left menu and press the New Application button shown in the top right.
  • Give a name for your application in the dialog box shown.
  • In the Overview tab of the application, fill in information like the description, category, contact details, thumbnail image etc.
  • Under the versions tab, press the New Version button and fill the version number and Changes/Description information.
  • Then upload the JAR file created using the Upload drop down option available for the version.
  • The application can be promoted to Beta status and then to Stable status.
  • Finally the application can be published using the option available in the top right.
Once published the application will be available in the app store, from where the users can install it to their context. With this guide, it should be possible to develop application for the SkyCase IoT store. For more complex IoT app development examples and demos, kindly visit the tutorials section.