Merge branch 'master' of https://github.com/wso2/carbon-device-mgt-plugins into devicetype-3.1.0

revert-dabc3590
ayyoob 8 years ago
commit 61a3455ec5

@ -20,5 +20,8 @@
<artifacts> <artifacts>
<artifact name="raspberrypi" version="1.0.0" type="carbon/application"> <artifact name="raspberrypi" version="1.0.0" type="carbon/application">
<dependency artifact="raspberrypi_execution" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/> <dependency artifact="raspberrypi_execution" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="raspberrypi_temperature_publisher" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="raspberrypi_temperature_store" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="raspberrypi_temperature_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
</artifact> </artifact>
</artifacts> </artifacts>

@ -6,10 +6,10 @@
/* define streams/tables and write queries here ... */ /* define streams/tables and write queries here ... */
@Import('org.wso2.iot.raspberrypi:1.0.0') @Import('iot.per.device.stream.raspberrypi:1.0.0')
define stream raspberrypi (meta_owner string, meta_deviceId string, meta_time long, temperature float); define stream raspberrypi (meta_owner string, meta_deviceId string, meta_time long, temperature float);
@Export('org.wso2.iot.devices.temperature:1.0.0') @Export('iot.per.device.stream.raspberrypi.temperature:1.0.0')
define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float); define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float);
from raspberrypi from raspberrypi

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, 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.
-->
<artifact name="raspberrypi_temperature_publisher" version="1.0.0" type="event/publisher" serverRole="DataAnalyticsServer">
<file>temperature_publisher.xml</file>
</artifact>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, 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.
-->
<eventPublisher name="publisher" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
<from streamName="iot.per.device.stream.raspberrypi.temperature" version="1.0.0"/>
<mapping customMapping="disable" type="wso2event"/>
<to eventAdapterType="secured-websocket"/>
</eventPublisher>

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, 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.
-->
<artifact name="raspberrypi_temperature_store" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
<file>iot_per_device_stream_raspberrypi_temperature.xml</file>
</artifact>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright (c) 2016, 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.
-->
<EventStoreConfiguration>
<Source>
<StreamId>iot.per.device.stream.raspberrypi.temperature:1.0.0</StreamId>
</Source>
<RecordStoreName>EVENT_STORE</RecordStoreName>
<TableSchema>
<ColumnDefinition>
<Name>meta_owner</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_deviceType</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_deviceId</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_time</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>LONG</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>temperature</Name>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>FLOAT</Type>
</ColumnDefinition>
</TableSchema>
</EventStoreConfiguration>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, 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.
-->
<artifact name="raspberrypi_temperature_stream" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<file>iot.per.device.stream.raspberrypi.temperature_1.0.0.json</file>
</artifact>

@ -0,0 +1,20 @@
{
"name": "iot.per.device.stream.raspberrypi.temperature",
"version": "1.0.0",
"nickName": "Temperature Data",
"description": "Temperature data received from the Device",
"metaData": [
{"name":"owner","type":"STRING"},
{"name":"deviceType","type":"STRING"},
{"name":"deviceId","type":"STRING"},
{"name":"time","type":"LONG"}
],
"payloadData": [
{
"name": "temperature","type": "FLOAT"
}
]
}

@ -112,8 +112,8 @@ public class RaspberryPiServiceImpl implements RaspberryPiService {
@QueryParam("from") long from, @QueryParam("to") long to) { @QueryParam("from") long from, @QueryParam("to") long to) {
String fromDate = String.valueOf(from); String fromDate = String.valueOf(from);
String toDate = String.valueOf(to); String toDate = String.valueOf(to);
String query = "deviceId:" + deviceId + " AND deviceType:" + String query = "meta_deviceId:" + deviceId + " AND meta_deviceType:" +
RaspberrypiConstants.DEVICE_TYPE + " AND time : [" + fromDate + " TO " + toDate + "]"; RaspberrypiConstants.DEVICE_TYPE + " AND meta_time : [" + fromDate + " TO " + toDate + "]";
String sensorTableName = RaspberrypiConstants.TEMPERATURE_EVENT_TABLE; String sensorTableName = RaspberrypiConstants.TEMPERATURE_EVENT_TABLE;
try { try {
if (!APIUtil.getDeviceAccessAuthorizationService().isUserAuthorized(new DeviceIdentifier(deviceId, if (!APIUtil.getDeviceAccessAuthorizationService().isUserAuthorized(new DeviceIdentifier(deviceId,

@ -26,7 +26,7 @@ public class RaspberrypiConstants {
public static final String BULB_CONTEXT = "BULB"; public static final String BULB_CONTEXT = "BULB";
//sensor events summerized table name //sensor events summerized table name
public static final String TEMPERATURE_EVENT_TABLE = "DEVICE_TEMPERATURE_SUMMARY"; public static final String TEMPERATURE_EVENT_TABLE = "IOT_PER_DEVICE_STREAM_RASPBERRYPI_TEMPERATURE";
//mqtt tranport related constants //mqtt tranport related constants
public static final String MQTT_ADAPTER_TOPIC_PROPERTY_NAME = "mqtt.adapter.topic"; public static final String MQTT_ADAPTER_TOPIC_PROPERTY_NAME = "mqtt.adapter.topic";

@ -42,7 +42,7 @@ function onRequest(context) {
if (tokenPair) { if (tokenPair) {
token = tokenPair.accessToken; token = tokenPair.accessToken;
} }
websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.temperature/1.0.0?" websocketEndpoint = websocketEndpoint + "/secured-websocket/iot.per.device.stream.raspberrypi.temperature/1.0.0?"
+ "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token;
} else { } else {
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + user.domain var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + user.domain
@ -50,7 +50,7 @@ function onRequest(context) {
if (tokenPair) { if (tokenPair) {
token = tokenPair.accessToken; token = tokenPair.accessToken;
} }
websocketEndpoint = websocketEndpoint + "/secured-websocket/t/" + user.domain + "/org.wso2.iot.devices.temperature/1.0.0?" websocketEndpoint = websocketEndpoint + "/secured-websocket/t/" + user.domain + "/iot.per.device.stream.raspberrypi.temperature/1.0.0?"
+ "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token;
} }

@ -120,17 +120,6 @@ public class AgentConstants {
public static final String XMPP_PROTOCOL = "XMPP"; public static final String XMPP_PROTOCOL = "XMPP";
public static final String CEP_FILE_NAME = "cep_query.txt"; public static final String CEP_FILE_NAME = "cep_query.txt";
public static final String CEP_QUERY = "define stream fireAlarmEventStream (deviceID string, temp int);\n" +
"from fireAlarmEventStream#window.time(30 sec)\n" +
"select deviceID, max(temp) as maxValue\n" +
"group by deviceID\n" +
"insert into analyzeStream for expired-events;\n" +
"from analyzeStream[maxValue > 50]\n" +
"select maxValue\n" +
"insert into bulbOnStream;\n" +
"from fireAlarmEventStream[temp < 50]\n" +
"select deviceID, temp\n" +
"insert into bulbOffStream;";
public static final String XMPP_SERVER_NAME_PROPERTY = "xmpp-server-name"; public static final String XMPP_SERVER_NAME_PROPERTY = "xmpp-server-name";

@ -70,7 +70,7 @@ public class SidhdhiQuery implements Runnable {
File f = new File(sidhdhiQueryPath); File f = new File(sidhdhiQueryPath);
if (!f.exists()) { if (!f.exists()) {
AgentUtilOperations.writeToFile(AgentConstants.CEP_QUERY, sidhdhiQueryPath); AgentUtilOperations.writeToFile("", sidhdhiQueryPath);
} }
StartExecutionPlan startExecutionPlan = new StartExecutionPlan().invoke(); StartExecutionPlan startExecutionPlan = new StartExecutionPlan().invoke();

@ -4,279 +4,91 @@
{{#if deviceFound}} {{#if deviceFound}}
{{#if isAuthorized}} {{#if isAuthorized}}
{{#zone "device-details-header"}} {{#zone "device-thumbnail"}}
<h1 class="page-sub-title device-id device-select" <i class="fw fw-android device-type fw-2x"></i>
data-deviceid="{{device.deviceIdentifier}}" data-type="{{device.type}}"
data-ownership="{{device.ownership}}"
data-owner="{{device.owner}}" data-status="{{device.status}}">
Device {{device.name}}
{{#if device.model}}
<span class="lbl-device">
( {{device.vendor}} {{device.model}} )
</span>
{{/if}}
</h1>
{{/zone}} {{/zone}}
{{#zone "overview-section"}} {{#zone "device-details-header"}}
<div class="media-body asset-desc add-padding-left-5x"> <h1 class="device-id"
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Device data-deviceid="{{device.deviceIdentifier}}"
Overview data-type="{{device.type}}"
</div> data-ownership="{{device.ownership}}"
<table class="table table-responsive table-striped" id="members"> data-owner="{{device.owner}}">
<tbody> {{device.owner}}'s {{device.name}}
{{#if device.deviceIdentifier}} <a id="device-info-tooltip" href="#" data-toggle="tooltip" title="Device Identifier: {{device.deviceIdentifier}}
<tr role="row" class="odd"> Firmware Build Date: {{device.osBuildDate}}
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Device ID</td> UDID: {{device.udid}}">
<td style="padding:10px 15px;">{{device.deviceIdentifier}}</td> <i class="fw fw-info"></i>
</tr> </a>
{{/if}} </h1>
{{#if device.name}} {{#if device.model}}
<tr role="row" class="even"> <h4>{{device.vendor}} {{device.model}}</h4>
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Name</td> {{/if}}
<td style="padding:10px 15px;">{{device.name}}</td> <h4>Ownership - <strong>{{device.ownership}}</strong></h4>
</tr> <h4>Device is
{{/if}} <strong>
{{#if device.vendor}} {{#equal device.status "ACTIVE"}}Active{{/equal}}
{{#if device.model}} {{#equal device.status "INACTIVE"}}Inactive{{/equal}}
<tr role="row" class="odd"> {{#equal device.status "BLOCKED"}}Blocked{{/equal}}
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Model</td> {{#equal device.status "REMOVED"}}Removed{{/equal}}
<td style="padding:10px 15px;">{{device.vendor}} {{#equal device.status "UNREACHABLE"}}Unreachable{{/equal}}
{{device.model}}</td> </strong>
</tr> </h4>
{{/if}}
{{/if}}
{{#if device.status}}
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Status</td>
<td style="padding:10px 15px;">
{{#equal device.status "ACTIVE"}}<span><i
class="fw fw-success icon-success"></i>Active</span>{{/equal}}
{{#equal device.status "INACTIVE"}}<span><i
class="fw fw-warning icon-warning"></i>Inactive</span>{{/equal}}
{{#equal device.status "BLOCKED"}}<span><i
class="fw fw-remove icon-danger"></i>Blocked</span>{{/equal}}
{{#equal device.status "REMOVED"}}<span><i
class="fw fw-delete icon-danger"></i>Removed</span>{{/equal}}
{{#equal device.status "UNREACHABLE"}}<span><i
class="fw fw-warning icon-warning"></i>Unreachable</span>{{/equal}}
</td>
</tr>
{{/if}}
{{#if device.owner}}
<tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Owner</td>
<td style="padding:10px 15px;">{{device.owner}}</td>
</tr>
{{/if}}
{{#if device.ownership}}
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Ownership</td>
<td style="padding:10px 15px;">{{device.ownership}}</td>
</tr>
{{/if}}
{{#if device.imei}}
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">IMEI</td>
<td style="padding:10px 15px;">{{device.imei}}</td>
</tr>
{{/if}}
{{#if device.udid}}
<tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">UDID</td>
<td style="padding:10px 15px;">{{device.udid}}</td>
</tr>
{{/if}}
{{#if device.osBuildDate}}
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Firmware Build
Date
</td>
<td style="padding:10px 15px;">{{device.osBuildDate}}</td>
</tr>
{{/if}}
{{#if device.phoneNumber}}
<tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Phone Number</td>
<td style="padding:10px 15px;">{{device.phoneNumber}}</td>
</tr>
{{/if}}
{{#if device.lastUpdatedTime}}
<tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 15%;">Last Update</td>
<td style="padding:10px 15px;">{{device.lastUpdatedTime}}</td>
</tr>
{{/if}}
</tbody>
</table>
</div>
{{/zone}} {{/zone}}
{{#zone "device-opetations"}} {{#zone "device-opetations"}}
{{#if device.isNotRemoved}} {{#if device.isNotRemoved}}
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px"> <div class="operation-container">
Operations <div class="operation-title">
</div> <h4>Device Operations</h4>
<div class="add-margin-top-4x"> </div>
{{unit "cdmf.unit.device.type.android.operation-bar" device=device {{unit "cdmf.unit.device.type.android.operation-bar" device=device
backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}} backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}}
</div> </div>
{{/if}} {{/if}}
{{/zone}} {{/zone}}
{{#zone "device-details-tab-injected"}} {{#zone "device-details"}}
<li role="presentation" class="list-group-item"> {{#if device.deviceInfoAvailable}}
<a href="#policy_compliance_tab" role="tab" data-toggle="tab" {{#if device.BatteryLevel}}
aria-controls="policy_compliance_tab"> <p><i class="icon fw fw-battery fw-2x"></i> <span>{{device.BatteryLevel.value}}%</span></p>
<i class="icon fw fw-policy"></i><span class="hidden-sm">Policy Compliance</span> {{/if}}
</a> {{#if device.ramUsage}}
</li> <p><i class="icon fw fw-hardware fw-2x fw-rotate-90"></i> <span>{{device.ramUsage.value}}%</span></p>
<li role="presentation" class="list-group-item location_tab"> {{/if}}
<a href="#device_location_tab" role="tab" data-toggle="tab" {{#if device.internalMemory}}
data-lat="{{device.location.latitude}}" <p><i class="icon fw fw-hdd fw-2x fw-rotate-90"></i> <span>{{device.internalMemory.usage}}</span>
data-long="{{device.location.longitude}}" <span class="memory-amt">GB/{{device.internalMemory.total}}GB</span></p>
aria-controls="device_location_tab" {{/if}}
class="initGeoLocationLink"> {{#if device.externalMemory}}
<i class="icon fw fw-map-location"></i> <p><i class="icon fw fw-usb-drive fw-2x"></i> <span>{{device.externalMemory.usage}}</span>
<span class="hidden-sm">Device Location</span> <span class="memory-amt">GB/{{device.externalMemory.total}}GB</span></p>
</a> {{/if}}
</li> {{else}}
<li role="presentation" class="list-group-item"> <p>Battery, RAM and Storage related information are not
<a href="#installed_applications_tab" role="tab" data-toggle="tab" available yet.</p>
aria-controls="installed_applications_tab"> {{/if}}
<i class="icon fw fw-application"></i><span class="hidden-sm">Installed Applications</span>
</a>
</li>
{{/zone}} {{/zone}}
{{#zone "device-details-tab-contents"}} {{#zone "device-details-tab-injected"}}
<div class="panel panel-default" role="tabpanel" id="device_details_tab"> <li><a data-toggle="tab" href="#location">Location</a></li>
<div class="panel-heading visible-xs collapsed" id="device_details"> <li><a data-toggle="tab" href="#app">Applications</a></li>
<h4 class="panel-title"> <li><a data-toggle="tab" href="#policy">Policy Compliance</a></li>
<a role="button" data-toggle="collapse" data-parent="#tabs"
href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<i class="fw fw-mobile fw-2x"></i>
Device Details
<i class="caret-updown fw fw-down"></i>
</a>
</h4>
</div>
<div class="panel-heading display-none-xs">Device Details</div>
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel"
aria-labelledby="device_details">
<div class="panel-body ">
<div class="device-detail-body">
<!-- device summary -->
{{#if device.deviceInfoAvailable}}
{{#if device.BatteryLevel}}
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="col-md-12">
<div class="wr-stats-board-tile">
<div class="tile-name">BATTERY</div>
<div>
<div class="tile-icon"><i
class="fw fw-battery"></i></div>
<div class="tile-stats">
{{device.BatteryLevel
.value}} %
</div>
</div>
</div>
</div>
</div>
{{/if}}
<!--{{#if device.cpuUsage}}-->
<!--<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">-->
<!--<div class="col-md-12">-->
<!--<div class="wr-stats-board-tile">-->
<!--<div class="tile-name">CPU Usage</div>-->
<!--<div>-->
<!--<div class="tile-icon"><i class="fw fw-dashboard"></i></div>-->
<!--<div class="tile-stats">-->
<!--{{device.cpuUsage.value}} %-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--{{/if}}-->
{{#if device.ramUsage}}
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="col-md-12">
<div class="wr-stats-board-tile">
<div class="tile-name">RAM Usage</div>
<div>
<div class="tile-icon"><i
class="fw fw-hardware"></i></div>
<div class="tile-stats">
{{device.ramUsage
.value}} %
</div>
</div>
</div>
</div>
</div>
{{/if}}
{{#if device.internalMemory}}
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="col-md-12">
<div class="wr-stats-board-tile">
<div class="tile-name">Local Storage</div>
<div>
<div class="tile-icon"><i
class="fw fw-hdd"></i>
</div>
<div class="tile-stats">
{{device.internalMemory
.usage}} %
<span class="tile-stats-free">
TOTAL OF {{device.internalMemory
.total}} GB
</span>
</div>
</div>
</div>
</div>
</div>
{{/if}}
{{#if device.externalMemory}}
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="col-md-12">
<div class="wr-stats-board-tile">
<div class="tile-name">External Storage</div>
<div>
<div class="tile-icon"><i
class="fw fw-usb-drive"></i></div>
<div class="tile-stats">
{{device.externalMemory
.usage}} %
<span class="tile-stats-free">
TOTAL OF {{device.externalMemory
.total}} GB
</span>
</div>
</div>
</div>
</div>
</div>
{{/if}}
{{else}}
<div class="message message-info">
<h4 class="remove-margin">
<i class="icon fw fw-info"></i>
Battery, RAM and Storage related information are not
available yet.
</h4>
</div>
{{/if}}
</div>
</div>
</div>
</div>
{{/zone}} {{/zone}}
{{#zone "device-view-tab-injected-conents"}} {{#zone "device-view-tab-injected-conents"}}
<div id="location" class="tab-pane fade">
<iframe width="100%" height="100%" frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJk_gsqyVZ4joR4UxR7brwMnA&key=AIzaSyChgf100i4rBz6neCNRyK1D05g9VLY8jvo" allowfullscreen></iframe>
</div>
<div id="app" class="tab-pane fade">
<div id="applications-list-container" data-public-uri="{{@unit.publicUri}}">
</div>
</div>
<div id="policy" class="tab-pane fade">
<div id="policy-list-container">
</div>
</div>
<div class="panel panel-default visible-xs-block" role="tabpanel" <div class="panel panel-default visible-xs-block" role="tabpanel"
id="policy_compliance_tab"> id="policy_compliance_tab">
<div class="panel-heading visible-xs collapsed" id="policy_compliance"> <div class="panel-heading visible-xs collapsed" id="policy_compliance">

@ -307,6 +307,8 @@ var InitiateViewOption = null;
viewModel["appContext"] = context; viewModel["appContext"] = context;
var content = template(viewModel); var content = template(viewModel);
$("#applications-list-container").html(content); $("#applications-list-container").html(content);
var iconSource = $("#applications-list-container").data("public-uri") + "/img/android_app_icon.png";
$("#applications-list-container img").attr("src",iconSource);
} else { } else {
$("#applications-list-container").html("<div class='message message-info'><h4><i class='icon fw fw-info'></i>No applications found.</h4>" + $("#applications-list-container").html("<div class='message message-info'><h4><i class='icon fw fw-info'></i>No applications found.</h4>" +
"<p>Please try refreshing the list in a while.</p></div>"); "<p>Please try refreshing the list in a while.</p></div>");

@ -1,31 +1,9 @@
<div class="wr-app-listing"> {{#each applications}}
<div class="wr-applist"> <div class="application">
{{#each applications}} <img src="">
<a style="text-align: center; width: 110px; height: 140px;"> <div class="app-info">
{{#equal platform "android"}}<i class="icon fw fw-android"></i>{{/equal}} <h4>{{name}}</h4>
{{#equal platform "ios"}}<i class="icon fw fw-apple"></i>{{/equal}} <p>v{{version}}</p>
{{#equal platform "windows"}}<i class="icon fw fw-windows"></i>{{/equal}} </div>
{{#equal isActive true}} </div>
<span style="word-wrap: break-word;"> {{/each}}
<i class="fw fw-success icon-success" style="font-size: 14px;"></i>
&nbsp;Active
</span>
<span style="word-wrap: break-word;"><b>{{name}}</b></span>
<span style="word-wrap: break-word;"><b>V:{{version}}</b></span>
{{#if memoryUsage}}
<span style="word-wrap: break-word;">
Memory Usage
</span>
<span style="word-wrap: break-word;">
( {{memoryUsage}} Bytes )
</span>
{{/if}}
{{/equal}}
{{#equal isActive false}}
<span style="word-wrap: break-word;">{{name}}</span>
<span style="word-wrap: break-word;"><b>V:{{version}}</b></span>
{{/equal}}
</a>
{{/each}}
</div>
</div>

@ -1,63 +1,26 @@
<div class="wr-list-group wr-sortable policy-list"> <div class="policy-item">
<span class="list-group-item" id="{{id}}"> {{#equal compliance "COMPLIANT"}}
<div class="row"> <i class="icon fw fw-success fw-3x policy-status"></i>
<div class="col-lg-3 clearfix"> {{/equal}}
<span class="wr-list-icon"> {{#equal compliance "NON-COMPLIANT"}}
{{#equal deviceType "android"}} <i class="icon fw fw-warning fw-3x policy-status"></i>
<i class=" fw fw-android"></i> {{/equal}}
{{/equal}} <p>
{{#equal deviceType "ios"}} <span class="policy-name">{{policy.policyName}}</span>
<i class=" fw fw-apple"></i> <span class="policy-platform">{{deviceType}}</span>
{{/equal}} </p>
{{#equal deviceType "windows"}} <p>
<i class=" fw fw-windows"></i> <span class="comp-type">Compliance Type : <strong>{{policy.compliance}}</strong></span>
{{/equal}} <span class="ownership-type">Ownership type : <strong>{{policy.ownershipType}}</strong></span>
</span> </p>
<span class="wr-list-desc"> <div class="actions">
<h3 class="wr-list-name">{{policy.policyName}}</h3> <div class="action-btn ripple">
<span class="wr-list-username">{{deviceType}}</span> <p><a href="{{appContext}}/policy/effective-policy?type={{deviceType}}&id={{deviceId}}">
</span> <i class="icon fw fw-view fw-2x"></i> <span>View Policy </span></a></p>
</div>
<div class="col-lg-6">
<div class="row no-gutter">
<div class="wr-desc-list-configs col-lg-4">
<div>
<b>Ownership Type : </b> {{policy.ownershipType}}
</div>
</div>
<div class="wr-desc-list-configs col-lg-4">
<div>
<b>Compliance Type :</b> {{policy.compliance}}
</div>
</div>
<div class="wr-desc-list-configs col-lg-4">
<div>
<b>Compliance :</b>
{{#equal compliance "COMPLIANT"}}
<span><i class="fw fw-success icon-success"></i> Compliant</span>
{{/equal}}
{{#equal compliance "NON-COMPLIANT"}}
<span><i class="fw fw-warning icon-danger"></i> Not Compliant</span>
{{/equal}}
</div>
</div>
</div>
</div>
<div class="col-lg-3">
<span class="list-group-item-actions">
<a href="{{appContext}}/policy/effective-policy?type={{deviceType}}&id={{deviceId}}" class="cu-btn-inner
policy-view-link" data-id="{{id}}">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i>
</span>
View
</a>
</span>
</div> </div>
</div> </div>
</span>
</div> </div>
<table class="table table-striped table-hover table-bordered display data-table" id="policy-compliance-table"> <table class="table table-striped table-hover table-bordered display data-table" id="policy-compliance-table">
<thead> <thead>
<tr class="sort-row"> <tr class="sort-row">
@ -77,4 +40,4 @@
{{/each}} {{/each}}
<br class="c-both" /> <br class="c-both" />
</tbody> </tbody>
</table> </table>

@ -21,5 +21,5 @@
<property name="topic">carbon.super/raspberrypi/+/temperature</property> <property name="topic">carbon.super/raspberrypi/+/temperature</property>
</from> </from>
<mapping customMapping="disable" type="json"/> <mapping customMapping="disable" type="json"/>
<to streamName="org.wso2.iot.raspberrypi" version="1.0.0"/> <to streamName="iot.per.device.stream.raspberrypi" version="1.0.0"/>
</eventReceiver> </eventReceiver>

@ -1,5 +1,5 @@
{ {
"name": "org.wso2.iot.raspberrypi", "name": "iot.per.device.stream.raspberrypi",
"version": "1.0.0", "version": "1.0.0",
"nickName": "raspberrypi", "nickName": "raspberrypi",
"description": "Temperature data received from the raspberrypi", "description": "Temperature data received from the raspberrypi",

@ -101,7 +101,7 @@ def main():
print ("MQTT_LISTENER: MQTT_TOPIC is " + TOPIC_TO_SUBSCRIBE) print ("MQTT_LISTENER: MQTT_TOPIC is " + TOPIC_TO_SUBSCRIBE)
global mqttClient global mqttClient
mqttClient = mqtt.Client() mqttClient = mqtt.Client(client_id="RaspberryPi Agent")
mqttClient.on_connect = on_connect mqttClient.on_connect = on_connect
mqttClient.on_message = on_message mqttClient.on_message = on_message
mqttClient.on_publish = on_publish mqttClient.on_publish = on_publish

@ -39,11 +39,16 @@ sudo apt-get update
sudo apt-get install python-pip sudo apt-get install python-pip
sudo pip install paho-mqtt sudo pip install paho-mqtt
#installing ada # installing ada
echo ===Installing ADA libraries
sudo apt-get install build-essential python-dev sudo apt-get install build-essential python-dev
unzip Adafruit_Python_DHT unzip Adafruit_Python_DHT
sudo python Adafruit_Python_DHT/setup.py install cd Adafruit_Python_DHT
sudo python setup.py install
cd ..
# moving files to start the agent as Daemon
echo ===Moving files to start agent as Daemon
sudo cp $currentDir/deviceConfig.properties $currentDir/src sudo cp $currentDir/deviceConfig.properties $currentDir/src
sudo cp -r $currentDir/src $destination sudo cp -r $currentDir/src $destination
sudo chmod 755 $destination/src/RaspberryAgent.py sudo chmod 755 $destination/src/RaspberryAgent.py
@ -51,4 +56,4 @@ sudo update-rc.d -f RaspberryService.sh remove
sudo cp $currentDir/RaspberryService.sh /etc/init.d sudo cp $currentDir/RaspberryService.sh /etc/init.d
sudo chmod 755 /etc/init.d/RaspberryService.sh sudo chmod 755 /etc/init.d/RaspberryService.sh
sudo update-rc.d RaspberryService.sh defaults sudo update-rc.d RaspberryService.sh defaults
sudo service RaspberryService.sh start sudo service RaspberryService.sh start

@ -1,11 +0,0 @@
define stream fireAlarmEventStream (deviceID string, temp int);
from fireAlarmEventStream#window.time(10 sec)
select deviceID, max(temp) as maxValue
group by deviceID
insert into analyzeStream for expired-events;
from analyzeStream[maxValue < 60]
select maxValue
insert into bulbOnStream;
from fireAlarmEventStream[temp > 60]
select deviceID, temp
insert into bulbOffStream;

@ -369,15 +369,15 @@
<Frequency> - The time interval (in seconds) in which the task should run for this device-type <Frequency> - The time interval (in seconds) in which the task should run for this device-type
<IdleTimeToMarkInactive> - The time duration (in seconds) in which the device can be moved to inactive status <IdleTimeToMarkInactive> - The time duration (in seconds) in which the device can be moved to inactive status
which means the device will be moved to inactive status if that device does not which means the device will be moved to inactive status if that device does not
contact the server within that time period. contact the server within that time period. Better to have a multiplier of Frequency.
<IdleTimeToMarkUnreachable> - The time duration (in seconds) in which the device can be moved to unreachable status <IdleTimeToMarkUnreachable> - The time duration (in seconds) in which the device can be moved to unreachable status
which means the device will be moved to unreachable status if that device does not which means the device will be moved to unreachable status if that device does not
contact the server within that time period. contact the server within that time period. Better to have a multiplier of Frequency.
--> -->
<DeviceStatusTaskConfig> <DeviceStatusTaskConfig>
<RequireStatusMonitoring>true</RequireStatusMonitoring> <RequireStatusMonitoring>true</RequireStatusMonitoring>
<Frequency>300</Frequency> <Frequency>300</Frequency>
<IdleTimeToMarkInactive>600</IdleTimeToMarkInactive> <IdleTimeToMarkInactive>900</IdleTimeToMarkInactive>
<IdleTimeToMarkUnreachable>300</IdleTimeToMarkUnreachable> <IdleTimeToMarkUnreachable>600</IdleTimeToMarkUnreachable>
</DeviceStatusTaskConfig> </DeviceStatusTaskConfig>
</DeviceTypeConfiguration> </DeviceTypeConfiguration>

@ -179,7 +179,7 @@
<DeviceStatusTaskConfig> <DeviceStatusTaskConfig>
<RequireStatusMonitoring>true</RequireStatusMonitoring> <RequireStatusMonitoring>true</RequireStatusMonitoring>
<Frequency>300</Frequency> <Frequency>300</Frequency>
<IdleTimeToMarkInactive>600</IdleTimeToMarkInactive> <IdleTimeToMarkInactive>900</IdleTimeToMarkInactive>
<IdleTimeToMarkUnreachable>300</IdleTimeToMarkUnreachable> <IdleTimeToMarkUnreachable>600</IdleTimeToMarkUnreachable>
</DeviceStatusTaskConfig> </DeviceStatusTaskConfig>
</DeviceTypeConfiguration> </DeviceTypeConfiguration>

@ -1146,14 +1146,14 @@
<javax.ws.rs.version>1.1.1</javax.ws.rs.version> <javax.ws.rs.version>1.1.1</javax.ws.rs.version>
<!-- Carbon Device Management --> <!-- Carbon Device Management -->
<carbon.devicemgt.version>3.0.7-SNAPSHOT</carbon.devicemgt.version> <carbon.devicemgt.version>3.0.8-SNAPSHOT</carbon.devicemgt.version>
<carbon.devicemgt.version.range>[3.0.0, 4.0.0)</carbon.devicemgt.version.range> <carbon.devicemgt.version.range>[3.0.0, 4.0.0)</carbon.devicemgt.version.range>
<!-- Carbon App Management --> <!-- Carbon App Management -->
<carbon.appmgt.version>1.2.25</carbon.appmgt.version> <carbon.appmgt.version>1.2.25</carbon.appmgt.version>
<!-- Carbon Device Management Plugins --> <!-- Carbon Device Management Plugins -->
<carbon.devicemgt.plugins.version>4.0.5-SNAPSHOT</carbon.devicemgt.plugins.version> <carbon.devicemgt.plugins.version>4.0.4</carbon.devicemgt.plugins.version>
<!-- Carbon Commons --> <!-- Carbon Commons -->
<carbon.commons.version>4.4.8</carbon.commons.version> <carbon.commons.version>4.4.8</carbon.commons.version>

Loading…
Cancel
Save