Add iot related stuffs

charithag 9 years ago
parent 9c43f0c965
commit 60e99704d2

@ -1,5 +1,5 @@
{
"version": "1.0.0",
"index": 29,
"extends": "cdmf.unit.ui.header.logo"
"extends": "mdm.unit.ui.header.logo"
}

@ -1,21 +1,13 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/virtual_firealarm/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/agent/,target:${installFolder}/../../resources/sketches/virtual_firealarm/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/virtual_firealarm_advanced/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/advanced_agent/,target:${installFolder}/../../resources/sketches/virtual_firealarm_advanced/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/publisher/samples/assets/deviceTypes/virtual_firealarm/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/ui/artifact/,target:${installFolder}/../../deployment/server/jaggeryapps/publisher/samples/assets/deviceTypes/virtual_firealarm/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/iotserver/pages/devices/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/ui/page/,target:${installFolder}/../../deployment/server/jaggeryapps/iotserver/pages/devices/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/iotserver/units/virtual_firealarm/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/ui/units/,target:${installFolder}/../../deployment/server/jaggeryapps/iotserver/units/virtual_firealarm/,overwrite:true);\
org.wso2.carbon.p2.touchpoint.addXMLElement(file:${installFolder}/../../conf/iot/iot-config.xml,xpath:/IoTDeviceTypeConfigManager,element:<IotDeviceTypeConfig type="${sample_type}"><DatasourceName>jdbc/${data_source}</DatasourceName><!--Uncomment this to work with apim @ 192.168.67.21 --><!--ApiApplicationName>firealarm</ApiApplicationName--></IotDeviceTypeConfig>); \
org.wso2.carbon.p2.touchpoint.addXMLElement(file:${installFolder}/../../conf/datasources/master-datasources.xml,xpath:/datasources-configuration/datasources,element:<datasource><name>${data_source}</name><description>The datasource used for the Virtual-Firealarm database</description><jndiConfig><name>jdbc/${data_source}</name></jndiConfig><definition type="RDBMS"><configuration><url>jdbc:h2:repository/database/${data_source};DB_CLOSE_ON_EXIT=FALSE</url><username>wso2carbon</username><password>wso2carbon</password><driverClassName>org.h2.Driver</driverClassName><maxActive>50</maxActive><maxWait>60000</maxWait><testOnBorrow>true</testOnBorrow><validationQuery>SELECT 1</validationQuery><validationInterval>30000</validationInterval></configuration></definition></datasource>); \
org.wso2.carbon.p2.touchpoint.addXMLElement(file:${installFolder}/../../conf/datasources/master-datasources.xml,xpath:/datasources-configuration/datasources,element:<datasource><name>${data_source}</name><description>The datasource used for the Virtual-Firealarm database</description><jndiConfig><name>jdbc/${data_source}</name></jndiConfig><definition type="RDBMS"><configuration><url>jdbc${#58}h2${#58}repository/database/${data_source}${#59}DB_CLOSE_ON_EXIT=FALSE</url><username>wso2carbon</username><password>wso2carbon</password><driverClassName>org.h2.Driver</driverClassName><maxActive>50</maxActive><maxWait>60000</maxWait><testOnBorrow>true</testOnBorrow><validationQuery>SELECT 1</validationQuery><validationInterval>30000</validationInterval></configuration></definition></datasource>); \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.virtualfirealarm_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/virtual_firealarm,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.devicemgt.ui_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\

@ -1,25 +0,0 @@
{
"name": "virtual_firealarm",
"tags": "WSO2, IoT, Raspberry, Fire Alarm, Virtual",
"rate": 3,
"attributes": {
"overview_status": "PUBLISHED",
"overview_provider":"admin",
"overview_version":"1.0.0",
"overview_name":"virtual_firealarm",
"overview_url":"http://www.google.lk",
"setupGuide_guideImage":"virtual_firealarm/guide.png",
"overview_actionLabel":"Create a virtual device",
"sketches_Sketches":["virtual_firealarm","virtual_firealarm_advanced"],
"ingredients_ingredients":[
"Virtual Agent that simulates an actual firealarm. Simple agent demonstrate the basic functionality and Advanced agent consists with advance features like policy management, edge computing etc."
],
"overview_description":"Download our Virtual Agent and try-it out for close to real simulation of the FireAlarm Device-Type",
"setupGuide_description":"Extract the downloaded agent and run start-device.sh to start agent",
"quickStartupSteps_stepDescription":["Download the Virtual Agent","Run the 'start-device.sh' script","Provide the push-interval and network-interface"],
"quickStartupSteps_stepLabel":["1","2","3"],
"images_thumbnail":"virtual_firealarm/virtual_firealarm_thumbnail.png",
"images_banner":"virtual_firealarm/virtual_firealarm_banner.png",
"overview_thumbnail": "images_thumbnail"
}
}

@ -1,8 +0,0 @@
{{layout "fluid"}}
{{#zone "title"}}
WSO2 IoT Server | Virtual FireAlarm
{{/zone}}
{{#zone "body"}}
{{unit "appbar" link="dashboard" enableBack="true" title="Virtual FireAlarm"}}
{{unit "virtual_firealarm"}}
{{/zone}}

@ -1,112 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var modalPopup = ".wr-modalpopup";
var modalPopupContainer = modalPopup + " .modalpopup-container";
var modalPopupContent = modalPopup + " .modalpopup-content";
var body = "body";
/*
* set popup maximum height function.
*/
function setPopupMaxHeight() {
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));
$(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2)));
}
/*
* show popup function.
*/
function showPopup() {
$(modalPopup).show();
setPopupMaxHeight();
}
/*
* hide popup function.
*/
function hidePopup() {
$(modalPopupContent).html('');
$(modalPopup).hide();
}
/*
* DOM ready functions.
*/
$(document).ready(function () {
attachEvents();
});
function attachEvents() {
/**
* Following click function would execute
* when a user clicks on "Download" link
* on Device Management page in WSO2 DC Console.
*/
$("a.download-link").click(function () {
var sketchType = $(this).data("sketchtype");
var deviceType = $(this).data("devicetype");
var downloadDeviceAPI = "/iotserver/api/device/sketch/generate_link";
var payload = {"sketchType":sketchType, "deviceType":deviceType};
console.log(payload);
$(modalPopupContent).html($('#download-device-modal-content').html());
showPopup();
$("a#download-device-download-link").click(function () {
invokerUtil.post(
downloadDeviceAPI,
payload,
function (data, textStatus, jqxhr) {
if(jqxhr.status == 200) {
if(data == "403"){
$(modalPopupContent).html($('#device-403-content').html());
$("#device-403-link").click(function () {
window.location = "/iotserver/login";
});
showPopup();
}else {
$(modalPopupContent).html($('#download-device-modal-content-links').html());
$("#download-device-url").val(data);
$("#download-device-url").focus(function () {
$(this).select();
});
showPopup();
}
}else{
$(modalPopupContent).html($('#device-403-content').html());
$("#device-403-link").click(function () {
window.location.reload();
});
showPopup();
}
},
function () {
$(modalPopupContent).html($('#device-unexpected-error-content').html());
$("a#device-unexpected-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#download-device-cancel-link").click(function () {
hidePopup();
});
});
}

@ -1,4 +0,0 @@
{
"title" : "Virtual Firealarm",
"description":"Connect and Test a Virtual Firealarm over the WSO2 IoT Server"
}

@ -1,213 +0,0 @@
{{#zone "main"}}
<div class="container container-bg white-bg">
<div class=" margin-top-double">
<div class="row row padding-top-double padding-bottom-double margin-bottom-double">
<div class="col-lg-12 margin-top-double">
<h1 class="grey ">Fire Alarm</h1>
<hr>
<p class="margin-bottom-double light-grey ">Connect your Fire Alarm device
to the WSO2 IoT server. </p>
</div>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
<img src="{{self.publicURL}}/images/firealarm.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-6 col-md-8 col-lg-8 padding-top">
<h2 class="uppercase">Ingredients</h2>
<hr>
<p class="grey margin-top">Hardware Requirements </p>
<br>
<span class="fw-stack fw-lg margin-right">
<i class="fw fw-ring fw-stack-2x"> </i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>Raspberry Pi (Internet Enabled)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
<span class="fw-stack fw-lg margin-right">
<i class="fw fw-ring fw-stack-2x"> </i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>DHT11 Temperature Sensor<br/><br/>
<span class="fw-stack fw-lg margin-right">
<i class="fw fw-ring fw-stack-2x"> </i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>LED
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class="fw-stack fw-lg margin-right">
<i class="fw fw-ring fw-stack-2x"> </i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>Buzzer(3v)<br><br>
<a href="#" class="download-link btn-operations" data-devicetype="virtual_firealarm" data-sketchtype="virtual_firealarm"><i class="fw fw-download"></i> Download</a>
<!--form method="POST" class="form-login-box float-left"
action="{{sketchPath}}">
<input type="hidden" name="deviceType" value="firealarm" />
<input type="hidden" name="sketchType" value="firealarm" />
<button class="wr-btn margin-right" type="submit">Create
Sketch
for Ethernet</button>
</form-->
<br/>
</div>
<div class ="col-xs-12 col-sm-6 col-md-3 col-lg-12 padding-double grey-bg ">
<h2 class="uppercase">Prepare</h2><hr>
<p class="grey margin-top"><b>Get your device ready</b></p>
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
<span class="circle">01 </span> <span class="padding-left"><b>Set up your RaspberryPi device as shown in the schematic below and get the FireAlarm setup.</b></span>
</div>
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom">
<span class="circle">02 </span> <span class="padding-left"><b>Connect a monitor to your RaspberryPi via the HDMI cable to get a UI view of the device.</b></span>
</div>
<div class="margin-doubles padding-top-double margin-bottom-double light-grey margin-left-double margin-bottom">
<span class="circle">03 </span> <span class="padding-left"><b>Get the RaspberryPi to connect to the internet (via Ethernet or Wifi) and note its IP_ADDRESS</b></span>
</div>
</div>
<div class ="col-xs-12 col-sm-6 col-md-3 col-lg-12 padding-double grey-bg ">
<h2 class="uppercase">Schematic Diagram</h2><hr>
<p class="grey margin-top">Click on the image to zoom</p>
<center>
<a href="{{self.publicURL}}/images/schematicsGuide.png" target="_blank">
<img src="{{self.publicURL}}/images/schematicsGuide.png" class="img-responsive" style="max-width: 500px; max-height: 500px" />
</a>
</center>
</div>
</div>
<div class="row row padding-top-double padding-bottom-double margin-bottom-double ">
<div class="col-lg-12 margin-top-double">
<h2 class="uppercase ">Connect (Quickstart)</h2>
<hr>
<p class="margin-bottom-double light-grey ">Internet of Things Foundation Quickstart connection </p>
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
<span class="circle">01 </span> <span class="padding-left"><b>Click on the <i>"Create DEB"</i> button above to get the download link for the FireAlarm setup files</b></span><br>
</div>
<br>
<div>
<span class="padding-left"><i>(The following commands can be issued by directly typing into the terminal of the device or by an <b>"ssh"</b> login from a remote PC)</i></span>
</div>
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
<span class="circle">02 </span> <span class="padding-left"><b>Download the FireAlarm setup files using the following command: "curl -k &#60;url_link_received_from_the_above_step&#62; > Agent.zip"</b></span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <i> This will download a zip file named &#34;Agent.zip&#34;</i>
</div>
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
<span class="circle">03 </span> <span class="padding-left"><b>Run the following commands to successfuly install the package and get the service running:</b></span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>&nbsp;&nbsp;cd &#60PATH_WHERE_THE_DOWNLOADED_&#34;Agent.zip&#34;_FILE_IS&#62 </b> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>unzip Agent.zip -d Agent</b> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>cd Agent</b> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>sudo chmod 755 startservice.sh</b> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <b>sudo ./startservice.sh</b> <br>
</div>
<div class="margin-doubles padding-top-double light-grey margin-left-double margin-bottom ">
<span class="circle">04 </span> <span class="padding-left">Follow the installation instructions and complete installation. Upon completion the Agent would have started automatically</span><br>
</div>
</div>
</div>
</div>
<div id="download-device-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Please download the file from following link.</h3>
<br/>
<div class="buttons">
<form method="POST" action="{{sketchPath}}">
<input type="hidden" name="deviceType" value="firealarm" />
<input type="hidden" name="sketchType" value="firealarm" />
<button class="btn-operations" type="submit" style="font-size: 13px;border:none; padding: 10px 10px; display: inline-block; margin-right: 2px; text-decoration: none;">Download Now</button>
&nbsp;&nbsp;
<a href="#" id="download-device-download-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Copy Link&nbsp;&nbsp;&nbsp;&nbsp;
</a>
&nbsp;&nbsp;
</form>
</div>
</div>
</div>
</div>
</div>
<div id="download-device-modal-content-links" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Please download the file from following link(Press CTRL+C).</h3>
<br/>
<div>
<input id="download-device-url" style="color:#3f3f3f;padding:5px" type="text" value="" placeholder="Type here" size="60">
</div>
</div>
</div>
</div>
</div>
<div id="device-400-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Exception at backend. Try Later.</h3>
<div class="buttons">
<a href="#" id="device-400-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-403-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Action not permitted.</h3>
<div class="buttons">
<a href="#" id="device-403-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-409-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Device Sketch does not exist.</h3>
<div class="buttons">
<a href="#" id="device-409-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-unexpected-error-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Unexpected error.</h3>
<div class="buttons">
<a href="#" id="device-unexpected-error-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
{{/zone}}
{{#zone "topCss"}}
<link href="{{self.publicURL}}/css/fontwso2.css" rel="stylesheet">
<link href="{{self.publicURL}}/css/fontwso2-extend.css" rel="stylesheet">
{{/zone}}
{{#zone "bottomJs"}}
<script src="{{self.publicURL}}/js/firealarm.js"></script>
{{/zone}}

@ -1,4 +0,0 @@
function onRequest(context){
context.sketchPath = "../api/device/sketch/download";
return context;
}
Loading…
Cancel
Save