virtuasl firealarm type view changes

NuwanSameera 9 years ago
commit e0b71a336f

@ -211,7 +211,8 @@ public class AndroidSenseService {
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "readbattery", name = "Battery", description = "Read Battery data from the device", type = "monitor")
@Feature(code = "readbattery", name = "Battery", description = "Read Battery data from the device",
type = "monitor")
public SensorRecord readBattery(
@HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId,
@Context HttpServletResponse response) {
@ -251,7 +252,8 @@ public class AndroidSenseService {
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "readmagnetic", name = "Magnetic", description = "Read Magnetic data from the device", type = "monitor")
@Feature(code = "readmagnetic", name = "Magnetic", description = "Read Magnetic data from the device",
type = "monitor")
public SensorRecord readMagnetic(
@HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId,
@Context HttpServletResponse response) {
@ -271,7 +273,8 @@ public class AndroidSenseService {
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "readaccelerometer", name = "Accelerometer", description = "Read Accelerometer data from the device", type = "monitor")
@Feature(code = "readaccelerometer", name = "Accelerometer", description = "Read Accelerometer data from the " +
"device", type = "monitor")
public SensorRecord readAccelerometer(
@HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId,
@Context HttpServletResponse response) {
@ -291,7 +294,8 @@ public class AndroidSenseService {
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "readrotation", name = "Rotation", description = "Read Rotational Vector data from the device", type = "monitor")
@Feature(code = "readrotation", name = "Rotation", description = "Read Rotational Vector data from the device",
type = "monitor")
public SensorRecord readRotation(
@HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId,
@Context HttpServletResponse response) {
@ -311,7 +315,8 @@ public class AndroidSenseService {
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "readproximity", name = "Proximity", description = "Read Proximity data from the device", type = "monitor")
@Feature(code = "readproximity", name = "Proximity", description = "Read Proximity data from the device",
type = "monitor")
public SensorRecord readProximity(
@HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId,
@Context HttpServletResponse response) {
@ -331,7 +336,8 @@ public class AndroidSenseService {
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "readgyroscope", name = "Gyroscope", description = "Read Gyroscope data from the device", type = "monitor")
@Feature(code = "readgyroscope", name = "Gyroscope", description = "Read Gyroscope data from the device",
type = "monitor")
public SensorRecord readGyroscope(
@HeaderParam("owner") String owner, @HeaderParam("deviceId") String deviceId,
@Context HttpServletResponse response) {

@ -71,7 +71,8 @@ public class AndroidSenseService {
public boolean register(@FormParam("username") String username,
@FormParam("password") String password,
@FormParam("deviceId") String deviceId,
@FormParam("owner") String owner) {
@FormParam("owner") String owner,
@FormParam("deviceName") String deviceName) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
@ -114,8 +115,7 @@ public class AndroidSenseService {
enrolmentInfo.setDateOfLastUpdate(new Date().getTime());
enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE);
enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD);
String name = owner + " android " + deviceId;
device.setName(name);
device.setName(deviceName);
device.setType(AndroidSenseConstants.DEVICE_TYPE);
enrolmentInfo.setOwner(owner);
device.setEnrolmentInfo(enrolmentInfo);

@ -63,11 +63,9 @@ import java.util.UUID;
@API(name = "virtual_firealarm", version = "1.0.0", context = "/virtual_firealarm")
public class VirtualFireAlarmService {
private static Log log = LogFactory.getLog(VirtualFireAlarmService.class);
//TODO; replace this tenant domain
private static final String SUPER_TENANT = "carbon.super";
private static Log log = LogFactory.getLog(VirtualFireAlarmService.class);
@Context //injected response proxy supporting multiple thread
private HttpServletResponse response;
@ -76,6 +74,15 @@ public class VirtualFireAlarmService {
Also contains utility methods required for the execution of these APIs
--------------------------------------------------------------------------------------- */
/**
* @return
*/
private static String shortUUID() {
UUID uuid = UUID.randomUUID();
long l = ByteBuffer.wrap(uuid.toString().getBytes(StandardCharsets.UTF_8)).getLong();
return Long.toString(l, Character.MAX_RADIX);
}
/**
* @param deviceId
* @param name
@ -133,7 +140,8 @@ public class VirtualFireAlarmService {
*/
@Path("manager/device/remove/{device_id}")
@DELETE
public void removeDevice(@PathParam("device_id") String deviceId, @Context HttpServletResponse response) {
public void removeDevice(@PathParam("device_id") String deviceId,
@Context HttpServletResponse response) {
DeviceManagement deviceManagement = new DeviceManagement(SUPER_TENANT);
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
@ -246,8 +254,8 @@ public class VirtualFireAlarmService {
for (Device device : userDevices) {
if (device.getType().equals(VirtualFireAlarmConstants.DEVICE_TYPE) &&
device.getEnrolmentInfo().getStatus().equals(
EnrolmentInfo.Status.ACTIVE)) {
device.getEnrolmentInfo().getStatus().equals(
EnrolmentInfo.Status.ACTIVE)) {
userDevicesforFirealarm.add(device);
}
@ -365,8 +373,8 @@ public class VirtualFireAlarmService {
if (!status) {
String msg =
"XMPP Account was not created for device - " + deviceId + " of owner - " + owner +
".XMPP might have been disabled in org.wso2.carbon.device.mgt.iot" +
".common.config.server.configs";
".XMPP might have been disabled in org.wso2.carbon.device.mgt.iot" +
".common.config.server.configs";
log.warn(msg);
throw new DeviceManagementException(msg);
}
@ -388,13 +396,4 @@ public class VirtualFireAlarmService {
return zipFile;
}
/**
* @return
*/
private static String shortUUID() {
UUID uuid = UUID.randomUUID();
long l = ByteBuffer.wrap(uuid.toString().getBytes(StandardCharsets.UTF_8)).getLong();
return Long.toString(l, Character.MAX_RADIX);
}
}

@ -7,6 +7,10 @@
<img src="{{@unit.publicUri}}/images/android-sense-icon.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h4 class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS100/Android+Sense" target="_blank">[ here ]</a> for latest instructions and trouble shooting</h4>
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h3 class="uppercase">What it Does</h3>
@ -16,7 +20,7 @@
<h3 class="uppercase">What You Need</h3>
<hr>
<p class="grey margin-top">You've got to just have an Android Device to get started.</p>
<p class="grey margin-top">You should have an Android Device to get started.</p>
<ul class="list-unstyled">
<li class="padding-top-double"><span class="circle">STEP 01</span>&nbsp;&nbsp;&nbsp;Go ahead and click [Enroll
Device].
@ -156,7 +160,7 @@
<li class="padding-top-double"><span class="circle">04</span>&nbsp;&nbsp;&nbsp;Fill the login form with the
credentials.
<i>(Use server URL as [&nbsp;https://&lt;WSO2_IoT_SERVER_HOST&gt;:&lt;SERVER_PORT&gt;&nbsp;] and click on
the <strong>Enroll Device</strong> button.)</i></li>
the <strong>Register Device</strong> button.)</i></li>
<li class="padding-top-double"><span class="circle">05</span>&nbsp;&nbsp;&nbsp;Once the device is enrolled,
click on the <strong>[+]</strong> button to select
the sensors.
@ -284,6 +288,16 @@
.grey-bg {
background-color: #f6f4f4;
}
.doc-link {
background: #11375B;
padding: 20px;
color: white;
}
.doc-link a {
color: white;
}
</style>
{{#zone "bottomJs"}}

@ -2,7 +2,7 @@ function onRequest(context){
var viewModel = {};
var process = require("process");
var serverIP = process.getProperty("carbon.local.ip");
var serverPort = process.getProperty("carbon.https.port");
viewModel.enrollmentURL = "https://"+serverIP+":"+serverPort+"/android_sense/manager/device/android_sense/download/";
var serverPort = process.getProperty("carbon.http.port");
viewModel.enrollmentURL = "http://"+serverIP+":"+serverPort+"/android_sense_mgt/manager/device/android_sense/download/";
return viewModel;
}

@ -7,6 +7,10 @@
<img src="{{@unit.publicUri}}/images/ardunio-icon.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h4 class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS100/Arduino" target="_blank">[ here ]</a> for latest instructions and trouble shooting</h4>
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h3 class="uppercase">What it Does</h3>
@ -273,6 +277,16 @@
.grey-bg {
background-color: #f6f4f4;
}
.doc-link {
background: #11375B;
padding: 20px;
color: white;
}
.doc-link a {
color: white;
}
</style>
{{/zone}}

@ -7,6 +7,10 @@
<img src="{{@unit.publicUri}}/images/display-icon.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h4 class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS100/Digital+Display" target="_blank">[ here ]</a> for latest instructions and trouble shooting</h4>
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h3 class="uppercase">What it Does</h3>
@ -270,6 +274,16 @@
.grey-bg {
background-color: #f6f4f4;
}
.doc-link {
background: #11375B;
padding: 20px;
color: white;
}
.doc-link a {
color: white;
}
</style>
{{#zone "bottomJs"}}

@ -7,6 +7,10 @@
<img src="{{@unit.publicUri}}/images/drone-icon.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h4 class="doc-link">Click <a href="https://docs.wso2.com/pages/viewpage.action?pageId=48289181" target="_blank">[ here ]</a> for latest instructions and trouble shooting</h4>
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h3 class="uppercase">What it Does</h3>
@ -308,6 +312,16 @@
.grey-bg {
background-color: #f6f4f4;
}
.doc-link {
background: #11375B;
padding: 20px;
color: white;
}
.doc-link a {
color: white;
}
</style>
{{/zone}}

@ -7,6 +7,10 @@
<img src="{{@unit.publicUri}}/images/respberry-icon.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h4 class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS100/Raspberry+Pi" target="_blank">[ here ]</a> for latest instructions and trouble shooting</h4>
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h3 class="uppercase">What it Does</h3>
@ -301,6 +305,15 @@
.grey-bg {
background-color: #f6f4f4;
}
.doc-link {
background: #11375B;
padding: 20px;
color: white;
}
.doc-link a {
color: white;
}
</style>
{{/zone}}

@ -1,7 +1,7 @@
{
"deviceType": {
"label": "Virtual Firealarm",
"category": "iot",
"category": "virtual",
"downloadAgentUri": "manager/device/virtual_firealarm/download",
"downloadAgentLinkGenUri": "manager/device/virtual_firealarm/generate_link"
},

@ -1,11 +1,14 @@
<div class="col-lg-12 margin-top-double">
<h1 class="grey ">Virtual Firealrm</h1>
<h1 class="grey ">Virtual Firealarm</h1>
<hr>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 padding-top">
<img src="{{@unit.publicUri}}/images/firealarm-icon.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h4 class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS100/Virtual+Firealarm" target="_blank">[ here ]</a> for latest instructions and trouble shooting</h4>
</div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
@ -29,7 +32,9 @@
</li>
<li class="padding-top-double"><span class="circle">STEP 04</span>&nbsp;&nbsp;&nbsp;Proceed to the [Prepare]
section.
<li>
<li></span> The device supports MQTT and XMPP Communications. It is configured to use MQTT by default.</li>
<li><br></li>
</ul>
<br>
@ -260,10 +265,21 @@
.grey-bg {
background-color: #f6f4f4;
}
.doc-link {
background: #11375B;
padding: 20px;
color: white;
}
.doc-link a {
color: white;
}
</style>
{{/zone}}
{{#zone "bottomJs"}}
{{js "/js/download.js"}}
{{js "/js/jquery.validate.js"}}
{{/zone}}
{{/zone}}

@ -1,3 +1,132 @@
{{#zone "device-detail-properties"}}
<div class="media">
<div class="media-left col-xs-12 col-sm-2 col-md-2 col-lg-2">
<ul class="list-group" role="tablist">
<li class="active"><a class="list-group-item"
href="#device_details"
role="tab" data-toggle="tab"
aria-controls="device_details">Device
Details</a>
</li>
<li><a class="list-group-item" href="#policy_compliance"
role="tab"
data-toggle="tab" aria-controls="policy_compliance">Policy
Compliance</a>
</li>
<li><a class="list-group-item" href="#device_location"
role="tab"
data-toggle="tab" aria-controls="device_location">Device
Location</a>
</li>
<li><a class="list-group-item" href="#installed_applications" role="tab"
data-toggle="tab" aria-controls="installed_applications">Installed
Applications</a>
</li>
<li><a class="list-group-item" href="#event_log" role="tab"
data-toggle="tab" aria-controls="event_log">Operations
Log</a></li>
</ul>
</div>
<div class="media-body add-padding-left-5x remove-padding-xs tab-content">
<div class="panel-group tab-content">
<div class="panel panel-default tab-pane active"
id="device_details" role="tabpanel"
aria-labelledby="device_details">
{{unit "cdmf.unit.device.details" device=device}}
</div>
<div class="panel panel-default tab-pane" id="policy_compliance"
role="tabpanel" aria-labelledby="policy_compliance">
<div class="panel-heading">Policy Compliance <span><a
href="#" id="refresh-policy"><i
class="fw fw-refresh"></i></a></span></div>
<div class="panel-body">
<div id="policy-spinner"
class="wr-advance-operations-init hidden">
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i class="fw fw-settings fw-spin fw-2x"></i>
&nbsp;&nbsp;&nbsp;
Loading Policy Compliance . . .
<br>
<br>
</div>
<div id="policy-list-container">
<div class="panel-body">
Not available yet
</div>
<br class="c-both"/>
</div>
</div>
</div>
<div class="panel panel-default tab-pane" id="device_location"
role="tabpanel" aria-labelledby="device_location">
<div class="panel-heading">Device Location</div>
<div class="panel-body">
<div id="device-location"
data-lat="{{device.viewModel.location.latitude}}"
data-long="{{device.viewModel.location.longitude}}"
style="height:450px" class="panel-body">
</div>
<div id="map-error" class="panel-body">
Not available yet
</div>
<br class="c-both"/>
</div>
</div>
<div class="panel panel-default tab-pane" id="installed_applications"
role="tabpanel" aria-labelledby="installed_applications">
<div class="panel-heading">Installed Applications <span><a href="#"
id="refresh-apps"><i
class="fw fw-refresh"></i></a></span></div>
<div class="panel-body">
<div id="apps-spinner" class="wr-advance-operations-init hidden">
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i class="fw fw-settings fw-spin fw-2x"></i>
&nbsp;&nbsp;&nbsp;
Loading App List . . .
<br>
<br>
</div>
<div id="applications-list-container">
<div class="panel-body">
Not available yet
</div>
<br class="c-both"/>
</div>
</div>
</div>
<div class="panel panel-default tab-pane" id="event_log"
role="tabpanel" aria-labelledby="event_log">
<div class="panel-heading">Operations Log <span><a href="#"
id="refresh-operations"><i
class="fw fw-refresh"></i></a></span></div>
<div class="panel-body">
<div id="operations-spinner"
class="wr-advance-operations-init hidden">
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i class="fw fw-settings fw-spin fw-2x"></i>
&nbsp;&nbsp;&nbsp;
Loading Operations Log . . .
<br>
<br>
</div>
<div id="operations-log-container">
<div class="panel-body">
Not available yet
</div>
<br class="c-both"/>
</div>
</div>
</div>
</div>
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}
{{js "js/device-detail.js"}}
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>

@ -0,0 +1,66 @@
/*
* 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.
*/
function onRequest(context) {
var log = new Log("detail.js");
var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter("id");
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/device.js").deviceModule;
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device) {
var viewModel = {};
var deviceInfo = device.properties.DEVICE_INFO;
if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) {
deviceInfo = parse(stringify(deviceInfo));
viewModel.imei = device.properties.IMEI;
viewModel.model = device.properties.DEVICE_MODEL;
viewModel.vendor = device.properties.VENDOR;
viewModel.internal_memory = {};
viewModel.external_memory = {};
viewModel.location = {
latitude: device.properties.LATITUDE,
longitude: device.properties.LONGITUDE
};
var info = {};
var infoList = parse(deviceInfo);
if (infoList != null && infoList != undefined) {
for (var j = 0; j < infoList.length; j++) {
info[infoList[j].name] = infoList[j].value;
}
}
deviceInfo = info;
viewModel.BatteryLevel = deviceInfo.BATTERY_LEVEL;
viewModel.internal_memory.FreeCapacity = Math.round(deviceInfo.INTERNAL_AVAILABLE_MEMORY * 100) / 100;
viewModel.internal_memory.DeviceCapacityPercentage = Math.round(deviceInfo.INTERNAL_AVAILABLE_MEMORY
/ deviceInfo.INTERNAL_TOTAL_MEMORY * 10000) / 100;
viewModel.external_memory.FreeCapacity = Math.round(deviceInfo.EXTERNAL_AVAILABLE_MEMORY * 100) / 100;
viewModel.external_memory.DeviceCapacityPercentage = Math.round(deviceInfo.EXTERNAL_AVAILABLE_MEMORY
/ deviceInfo.EXTERNAL_TOTAL_MEMORY * 10000) / 100;
device.viewModel = viewModel;
}
}
log.info(device);
var utility = require("/app/modules/utility.js").utility;
var configs = utility.getDeviceTypeConfig(deviceType);
return {"device": device, "label": configs["deviceType"]["label"]};
}
}

@ -33,9 +33,8 @@
<br>
</div>
</div>
<div id="qr-code-modal" data-enrollment-url="{{enrollmentURL}}" class="hidden">
<div id="qr-code-modal"
data-enrollment-url="{{hostName}}{{@unit.publicUri}}/asset/android-agent.apk" class="hidden">
<div class="content">
<div class="row">

@ -1,6 +1,24 @@
/*
* 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.
*/
function onRequest(context){
var viewModel = {};
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
viewModel.enrollmentURL = devicemgtProps.enrollmentURL;
viewModel.hostName = devicemgtProps["httpsURL"];
return viewModel;
}
Loading…
Cancel
Save