This section aims to help developers who wish to extend this project in the future. Our project consists of different layers, the website, the web service API and the Gadgeteer library. It takes a great deal of effort to recreate the development environment
for all these layers to extend their functionalities in nature. Code management is one of the hardest tasks in software engineering and having understood this, we have listed all the software requirements and steps involved to setup the development environment
for all these layers.

1.1. Web Service
The web service project is an azure cloud service project which can be easily packaged and deployed in azure. Since it is a cloud service project, it has certificates and keys associated with corresponding azure accounts. Therefore this project cannot be used
within another account. In this section we will discuss about software requirements, steps to setup the environment and the required configuration changes to run the application.

1.1.2. Steps to setup the Project:
1. Install the visual studio 2012 and update 3 to setup the development environment.
2. Sign up for windows azure account.
3. Install the Windows Azure SDK for .NET version 2.0
4. Create an Azure Storage Account for storing diagnostics information and installing SQL Server.
5. Create a service bus namespace in windows azure using steps followed in this link, http://msdn.microsoft.com/en-us/library/windowsazure/hh690931.aspx
6. After creating the service bus, follow this link http://msdn.microsoft.com/en-us/library/windowsazure/ee706774.aspx to obtain Access Key from azure management portal.
7. Download the pusher server library for .NET from the following GitHub link , https://github.com/pusher/pusher-dotnet-server
8. Sign up for Pusher in http://pusher.com/pricing and get a free API account.
9. In order to set up the database for user and device management you need to generate the database from the data model in DataAccessLayer project. This can be achieved by following this tutorial: http://msdn.microsoft.com/en-us/library/vstudio/dd456815(v=vs.100).aspx.
10. Then, you need to set up MongoDB database in order to store sensor derived data. First you need to set up a virtual machine on Azure in order to host the database. This can be done by following this article: http://www.f5debug.net/post/2012/07/30/Windows-Azure-Virtual-Machines-Meet-Azure-Edition.aspx
11. After creating the virtual machine successfully, you need to set up MongoDB database on that machine. Please follow this: http://www.f5debug.net/post/2012/08/06/Installing-and-ConfiguringMongoDB-on-Windows-Azure-Virtual-Machine-Part-1-Meet-Azure-Edition.aspx

1.1.3. Configuration Changes in the source code:
1. The azure service bus Access Key should be included in the configuration file. It is only a small, but the same change has to be made in different application to make everything to work together. The following is the list of files where the change has to
be made.
• IoTWebService /WCFServiceWebRole1/Web.config
• IotLiveMonitoringAgent /FailingSensorMonitoringAgent/App.config
• IoTWorkerRoles /PusherWorkerRole/App.config
• IoTWorkerRoles /DBStoreWorkerRole/App.Config
• IoTWebService /IoTWebService/ ServiceConfiguration.Local.cscfg
• IoTWebService /IoTWebService/ ServiceConfiguration.Cloud.cscfg
• IoTWorkerRoles / IoTWorkerRoles/ ServiceConfiguration.Local.cscfg
• IoTWorkerRoles / IoTWorkerRoles/ ServiceConfiguration.Cloud.cscfg
For Example, the following code snippet shows the Windows Azure Service Bus connection String.
<ConfigurationSettings>
<Setting name="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://iotwebservice.servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=XKQe0FZvcAOFp4lZwqNHV/JCpI9Tb4SyaXBvn/wzBm8=" />
</ConfigurationSettings>

Change this connection to the following format.
<ConfigurationSettings>
<Setting name="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://"YourServiceBusNamespace"/;SharedSecretIssuer=owner;SharedSecretValue="YourAccess_Key""/>
</ConfigurationSettings>
2. Most of the projects are cloud service projects and these project have diagnostics connection string which is used for logging diagnostics information in a given azure cloud storage account. This setting has to be changed to include a valid storage account
credentials. The following is the list of files where the changes has to be made.
• IoTWebService /WCFServiceWebRole1/Web.config
• IotLiveMonitoringAgent /FailingSensorMonitoringAgent/App.config
• IoTWorkerRoles /PusherWorkerRole/App.config
• IoTWorkerRoles /DBStoreWorkerRole/App.Config
• IoTWebService /IoTWebService/ ServiceConfiguration.Local.cscfg
• IoTWebService /IoTWebService/ ServiceConfiguration.Cloud.cscfg
• IoTWorkerRoles / IoTWorkerRoles/ ServiceConfiguration.Local.cscfg
• IoTWorkerRoles / IoTWorkerRoles/ ServiceConfiguration.Cloud.cscfg
For example, the following code snippet shows the configuration setting for specifying diagnostics connection string.
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=youraccountname;AccountKey=y9QEQuIPmHM++9Gwo92i8rdlWZlfPgET+4N51ME63pYfTn7O4ba7YllkXYBYnlduxfPX5c4nAkoGTM8PyXrmEg=="
/>
</ConfigurationSettings>

3. A third party Cloud Service called Pusher is used for push notifications. This pusher exposes API which takes account specific app id, app key and secret key. This has to be replaced with new credentials obtained by signing up with them. Then, these details
have to be changed in the source code to use it. Further, the following files needs to be changed.
• /PusherWorkerRole/WorkerRole.cs
The following code snippet shows the existing
var pusher = new Pusher("49656","3a96bb88c88f38d16083","319cf390152ad39a1132");

This has to be replaced with the newly obtained credentials from Pusher.
var pusher = new Pusher("YourAppId","YourAppKey","YourAppSecretKey");

4. After generating the database, you need to update the connection string for App.config file which is inside DataAccessLayer project. In addition, you also need to update the connection string for web.config file inside WCFServiceWebRole1 project. Code snippet
below shows the xml tag that needs to be updated.

NOTE: Azure SQL server is not accessible through Eduroam because of firewall restriction
5. The last step is to update the DSN address of you virtual machine and your database name inside Mongo.cs file in DataAccessLayer project. Code snippet below shows the variables that need to be updated.

1.2. Gadgeteer Library
This section descibes the instuctions to import the Gadgeteer library in a new Gadgeteer project.

1.2.3. Configuration Changes in the source code:
To run the two example applications, developers need to configure the WiFi information to their own accounts and passwords.

1.3. Web Site
This section describes the steps to import the website in a new Visual Studio project.

1.3.1. Requirements
• Windows Azure Account
• Pusher Sandbox Account
• Visual Studio 2012
Note that regarding to the Pusher is described in the API technical guide. You should follow the instructions and use your pusher JavaScript.

1.3.2. Installation Steps
1. Download the website our Codeplex page: https://gadgeteeriot.codeplex.com/
2. Open Visual Studio 2012 and click open Website and then select the GadgeteerAPI. Then right click to the solution and click add existing project and browse to UI Testing. Afterwards, the solution contains two projects the GadgeteerAPI website and the UI
Testing project.
3. Pusher Configuration
a. The charts.aspx file contains the JavaScript file that pusher provides, there is no need to change it except if pusher updated its API.
b. Browse to /scripts/livedata.js in line 114 there is an example of usage of the Pusher. You may change this piece of code to correspond to your credentials.