android view related ui fixes : MACOS :: Git config auto genarated for sachithp@wso2's-MacBook-Pro.local

revert-dabc3590
kamidu 8 years ago
parent 6604c23257
commit c97dfb4080

@ -26,7 +26,7 @@
<property name="Arduino_dir" value="Arduino"/> <property name="Arduino_dir" value="Arduino"/>
<target name="clean"> <target name="clean">
<delete dir="${target-dir}" /> <delete dir="${target-dir}"/>
</target> </target>
<target name="zip" depends="clean"> <target name="zip" depends="clean">

@ -16,7 +16,8 @@
~ specific language governing permissions and limitations ~ specific language governing permissions and limitations
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent> <parent>
<artifactId>arduino-plugin</artifactId> <artifactId>arduino-plugin</artifactId>
@ -40,7 +41,7 @@
<phase>process-resources</phase> <phase>process-resources</phase>
<configuration> <configuration>
<target> <target>
<ant antfile="build.xml" target="zip" /> <ant antfile="build.xml" target="zip"/>
</target> </target>
</configuration> </configuration>
<goals> <goals>

@ -17,8 +17,8 @@
--> -->
<assembly <assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>src</id> <id>src</id>
<formats> <formats>

@ -18,6 +18,6 @@
--> -->
<artifact name="arduino_execution" version="1.0.0" type="event/execution-plan" serverRole="DataAnalyticsServer"> <artifact name="arduino_execution" version="1.0.0" type="event/execution-plan" serverRole="DataAnalyticsServer">
<file>arduino_execution.siddhiql</file> <file>arduino_execution.siddhiql</file>
</artifact> </artifact>

@ -16,7 +16,8 @@
~ specific language governing permissions and limitations ~ specific language governing permissions and limitations
~ under the License. ~ under the License.
--> -->
<eventReceiver name="arduino_receiver" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver"> <eventReceiver name="arduino_receiver" statistics="disable" trace="disable"
xmlns="http://wso2.org/carbon/eventreceiver">
<from eventAdapterType="oauth-http"> <from eventAdapterType="oauth-http">
<property name="contentValidator">iot-http</property> <property name="contentValidator">iot-http</property>
</from> </from>

@ -17,7 +17,7 @@
~ under the License. ~ under the License.
--> -->
<artifact name= "arduino_stream" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer"> <artifact name="arduino_stream" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<file>org.wso2.iot.arduino_1.0.0.json</file> <file>org.wso2.iot.arduino_1.0.0.json</file>
</artifact> </artifact>

@ -4,12 +4,19 @@
"nickName": "Arduino", "nickName": "Arduino",
"description": "Temperature data received from the Arduino", "description": "Temperature data received from the Arduino",
"metaData": [ "metaData": [
{"name":"owner","type":"STRING"}, {
{"name":"deviceId","type":"STRING"} "name": "owner",
"type": "STRING"
},
{
"name": "deviceId",
"type": "STRING"
}
], ],
"payloadData": [ "payloadData": [
{ {
"name": "temperature","type": "FLOAT" "name": "temperature",
"type": "FLOAT"
} }
] ]
} }

@ -17,7 +17,8 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>arduino-plugin</artifactId> <artifactId>arduino-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
@ -144,7 +145,7 @@
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId> <artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

@ -19,7 +19,6 @@
package org.wso2.carbon.device.mgt.iot.arduino.service.impl; package org.wso2.carbon.device.mgt.iot.arduino.service.impl;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;
import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.apimgt.annotations.api.Scopes;
import org.wso2.carbon.device.mgt.iot.arduino.service.impl.constants.ArduinoConstants; import org.wso2.carbon.device.mgt.iot.arduino.service.impl.constants.ArduinoConstants;
@ -110,7 +109,7 @@ public interface ArduinoService {
} }
) )
Response getArduinoTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, Response getArduinoTemperatureStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
@QueryParam("to") long to); @QueryParam("to") long to);
/** /**
* download device agent * download device agent

@ -148,7 +148,7 @@ public class ArduinoServiceImpl implements ArduinoService {
@QueryParam("to") long to) { @QueryParam("to") long to) {
try { try {
if (!APIUtil.getDeviceAccessAuthorizationService().isUserAuthorized(new DeviceIdentifier(deviceId, if (!APIUtil.getDeviceAccessAuthorizationService().isUserAuthorized(new DeviceIdentifier(deviceId,
ArduinoConstants.DEVICE_TYPE), DeviceGroupConstants.Permissions.DEFAULT_STATS_MONITOR_PERMISSIONS)) { ArduinoConstants.DEVICE_TYPE), DeviceGroupConstants.Permissions.DEFAULT_STATS_MONITOR_PERMISSIONS)) {
return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build();
} }
String fromDate = String.valueOf(from); String fromDate = String.valueOf(from);
@ -211,7 +211,7 @@ public class ArduinoServiceImpl implements ArduinoService {
private ZipArchive createDownloadFile(String owner, String deviceName) private ZipArchive createDownloadFile(String owner, String deviceName)
throws DeviceManagementException, JWTClientException, APIManagerException, throws DeviceManagementException, JWTClientException, APIManagerException,
UserStoreException { UserStoreException {
if (owner == null) { if (owner == null) {
throw new IllegalArgumentException("Error on createDownloadFile() Owner is null!"); throw new IllegalArgumentException("Error on createDownloadFile() Owner is null!");
} }
@ -224,7 +224,8 @@ public class ArduinoServiceImpl implements ArduinoService {
} }
String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm() String applicationUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm()
.getRealmConfiguration().getAdminUserName() + "@" + PrivilegedCarbonContext .getRealmConfiguration().getAdminUserName() + "@" + PrivilegedCarbonContext
.getThreadLocalCarbonContext().getTenantDomain();; .getThreadLocalCarbonContext().getTenantDomain();
;
if (apiApplicationKey == null) { if (apiApplicationKey == null) {
APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService(); APIManagementProviderService apiManagementProviderService = APIUtil.getAPIManagementProviderService();
String[] tags = {ArduinoConstants.DEVICE_TYPE}; String[] tags = {ArduinoConstants.DEVICE_TYPE};
@ -235,14 +236,14 @@ public class ArduinoServiceImpl implements ArduinoService {
JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient(); JWTClient jwtClient = APIUtil.getJWTClientManagerService().getJWTClient();
String scopes = " device_" + deviceId + " perm:arduino:enroll"; String scopes = " device_" + deviceId + " perm:arduino:enroll";
AccessTokenInfo accessTokenInfo = jwtClient.getAccessToken(apiApplicationKey.getConsumerKey(), AccessTokenInfo accessTokenInfo = jwtClient.getAccessToken(apiApplicationKey.getConsumerKey(),
apiApplicationKey.getConsumerSecret(), owner, scopes); apiApplicationKey.getConsumerSecret(), owner, scopes);
//create token //create token
String accessToken = accessTokenInfo.getAccessToken(); String accessToken = accessTokenInfo.getAccessToken();
String refreshToken = accessTokenInfo.getRefreshToken(); String refreshToken = accessTokenInfo.getRefreshToken();
//Register the device with CDMF //Register the device with CDMF
ZipUtil ziputil = new ZipUtil(); ZipUtil ziputil = new ZipUtil();
return ziputil.createZipFile(owner, APIUtil.getTenantDomainOftheUser(), return ziputil.createZipFile(owner, APIUtil.getTenantDomainOftheUser(),
ArduinoConstants.DEVICE_TYPE, deviceId, deviceName, accessToken, refreshToken); ArduinoConstants.DEVICE_TYPE, deviceId, deviceName, accessToken, refreshToken);
} }
private static String shortUUID() { private static String shortUUID() {

@ -26,16 +26,16 @@
it will result 403 error at the runtime. it will result 403 error at the runtime.
--> -->
<PermissionConfiguration> <PermissionConfiguration>
<APIVersion></APIVersion> <APIVersion></APIVersion>
<!-- Device related APIs --> <!-- Device related APIs -->
<Permission> <Permission>
<name>control bulb</name> <name>control bulb</name>
<path>/device-mgt/user/operations</path> <path>/device-mgt/user/operations</path>
<url>/device/*/bulb</url> <url>/device/*/bulb</url>
<method>POST</method> <method>POST</method>
<scope>arduino_user</scope> <scope>arduino_user</scope>
</Permission> </Permission>
<Permission> <Permission>
<name>get controls</name> <name>get controls</name>
<path>/device-mgt/user/operations</path> <path>/device-mgt/user/operations</path>

@ -16,9 +16,9 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
@ -30,7 +30,7 @@
</bean> </bean>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" /> <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
</jaxrs:providers> </jaxrs:providers>
</jaxrs:server> </jaxrs:server>

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<web-app version="2.5" <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true"> metadata-complete="true">
<display-name>Arduino</display-name> <display-name>Arduino</display-name>
<description>Arduino</description> <description>Arduino</description>
<servlet> <servlet>
<servlet-name>CXFServlet</servlet-name> <servlet-name>CXFServlet</servlet-name>
@ -28,7 +28,8 @@
</context-param> </context-param>
<listener> <listener>
<listener-class>org.wso2.carbon.device.mgt.iot.arduino.service.impl.listener.ArduinoPermissionUpdateListener</listener-class> <listener-class>org.wso2.carbon.device.mgt.iot.arduino.service.impl.listener.ArduinoPermissionUpdateListener
</listener-class>
</listener> </listener>
</web-app> </web-app>

@ -18,7 +18,8 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent> <parent>
<artifactId>arduino-plugin</artifactId> <artifactId>arduino-plugin</artifactId>

@ -17,8 +17,8 @@
--> -->
<assembly <assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>src</id> <id>src</id>
<formats> <formats>

@ -18,7 +18,7 @@
function onRequest(context) { function onRequest(context) {
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var devices = context.unit.params.devices; var devices = context.unit.params.devices;
var deviceType = context.uriParams.deviceType; var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter("deviceId"); var deviceId = request.getParameter("deviceId");
@ -26,7 +26,7 @@ function onRequest(context) {
if (devices) { if (devices) {
return { return {
"devices": stringify(devices), "devices": stringify(devices),
"backendApiUri": "/arduino/device/stats/" "backendApiUri": "/arduino/device/stats/"
}; };
} else if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { } else if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];

@ -48,25 +48,25 @@ function drawGraph_arduino(from, to) {
if (devices) { if (devices) {
for (var i = 0; i < devices.length; i++) { for (var i = 0; i < devices.length; i++) {
graphConfig['series'].push( graphConfig['series'].push(
{
'color': palette.color(),
'data': [{
x: parseInt(new Date().getTime() / 1000),
y: 0
}],
'name': devices[i].name
});
}
} else {
graphConfig['series'].push(
{ {
'color': palette.color(), 'color': palette.color(),
'data': [{ 'data': [{
x: parseInt(new Date().getTime() / 1000), x: parseInt(new Date().getTime() / 1000),
y: 0 y: 0
}], }],
'name': $("#arduino-details").data("devicename") 'name': devices[i].name
}); });
}
} else {
graphConfig['series'].push(
{
'color': palette.color(),
'data': [{
x: parseInt(new Date().getTime() / 1000),
y: 0
}],
'name': $("#arduino-details").data("devicename")
});
} }
var graph = new Rickshaw.Graph(graphConfig); var graph = new Rickshaw.Graph(graphConfig);
@ -103,9 +103,9 @@ function drawGraph_arduino(from, to) {
graph: graph, graph: graph,
formatter: function (series, x, y) { formatter: function (series, x, y) {
var date = '<span class="date">' + var date = '<span class="date">' +
moment((x + tzOffset) * 1000).format('Do MMM YYYY h:mm:ss a') + '</span>'; moment((x + tzOffset) * 1000).format('Do MMM YYYY h:mm:ss a') + '</span>';
var swatch = '<span class="detail_swatch" style="background-color: ' + var swatch = '<span class="detail_swatch" style="background-color: ' +
series.color + '"></span>'; series.color + '"></span>';
return swatch + series.name + ": " + parseInt(y) + '<br>' + date; return swatch + series.name + ": " + parseInt(y) + '<br>' + date;
} }
}); });
@ -145,7 +145,7 @@ function drawGraph_arduino(from, to) {
return; return;
} }
var backendApiUrl = $("#arduino-div-chart").data("backend-api-url") + devices[deviceIndex].deviceIdentifier var backendApiUrl = $("#arduino-div-chart").data("backend-api-url") + devices[deviceIndex].deviceIdentifier
+ "?from=" + from + "&to=" + to; + "?from=" + from + "&to=" + to;
var successCallback = function (data) { var successCallback = function (data) {
if (data) { if (data) {
drawLineGraph(JSON.parse(data)); drawLineGraph(JSON.parse(data));
@ -167,10 +167,10 @@ function drawGraph_arduino(from, to) {
var chartData = []; var chartData = [];
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
chartData.push( chartData.push(
{ {
x: parseInt(data[i].values.time) - tzOffset, x: parseInt(data[i].values.time) - tzOffset,
y: parseInt(data[i].values.temperature) y: parseInt(data[i].values.temperature)
} }
); );
} }

@ -33,14 +33,14 @@
</div> </div>
<div class="add-margin-top-4x"> <div class="add-margin-top-4x">
{{unit "cdmf.unit.device.operation-bar" device=device autoCompleteParams=autoCompleteParams {{unit "cdmf.unit.device.operation-bar" device=device autoCompleteParams=autoCompleteParams
encodedFeaturePayloads=encodedFeaturePayloads}} encodedFeaturePayloads=encodedFeaturePayloads}}
</div> </div>
{{/zone}} {{/zone}}
{{#zone "device-view-tabs"}} {{#zone "device-view-tabs"}}
<li class="active"><a class="list-group-item" href="#device_statistics" role="tab" <li class="active"><a class="list-group-item" href="#device_statistics" role="tab"
data-toggle="tab" aria-controls="device_statistics">Device data-toggle="tab" aria-controls="device_statistics">Device
Statistics</a> Statistics</a>
</li> </li>
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab" <li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
aria-controls="event_log">Operations Log</a></li> aria-controls="event_log">Operations Log</a></li>

@ -22,20 +22,20 @@ function onRequest(context) {
var deviceId = request.getParameter("id"); var deviceId = request.getParameter("id");
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var autoCompleteParams = [ var autoCompleteParams = [
{"name" : "deviceId", "value" : deviceId} {"name": "deviceId", "value": deviceId}
]; ];
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId); var device = deviceModule.viewDevice(deviceType, deviceId);
if (device && device.status != "error") { if (device && device.status != "error") {
var anchor = { "device" : { "id" : device.content.deviceIdentifier, "type" : device.content.type}}; var anchor = {"device": {"id": device.content.deviceIdentifier, "type": device.content.type}};
return { return {
"device": device.content, "device": device.content,
"autoCompleteParams" : autoCompleteParams, "autoCompleteParams": autoCompleteParams,
"encodedFeaturePayloads": "", "encodedFeaturePayloads": "",
"portalUrl" : devicemgtProps['portalURL'], "portalUrl": devicemgtProps['portalURL'],
"anchor" : JSON.stringify(anchor) "anchor": JSON.stringify(anchor)
}; };
} else { } else {
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");

@ -30,7 +30,7 @@
<div class="wr-input-control"> <div class="wr-input-control">
<label class="wr-input-label" for="email-config-host"> <label class="wr-input-label" for="email-config-host">
Http Server IP Http Server IP
<span class="helper" title="SMTP Server Host"> <span class="helper" title="SMTP Server Host">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
<br> <br>
@ -41,7 +41,7 @@
<label class="wr-input-label" for="email-config-host"> <label class="wr-input-label" for="email-config-host">
Http Server Port Http Server Port
<span class="helper" title="SMTP Server Host"> <span class="helper" title="SMTP Server Host">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
<br> <br>
@ -52,7 +52,7 @@
</div> </div>
<div class="wr-input-control wr-btn-grp"> <div class="wr-input-control wr-btn-grp">
<button id="save-general-btn" class="wr-btn" onclick="addConfiguration();"> <button id="save-general-btn" class="wr-btn" onclick="addConfiguration();">
Save Save
</button> </button>
</div> </div>
</div> </div>

@ -31,7 +31,7 @@ function onRequest(context) {
if (encodedClientKeys) { if (encodedClientKeys) {
var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"];
var resp = tokenUtil.decode(encodedClientKeys).split(":"); var resp = tokenUtil.decode(encodedClientKeys).split(":");
var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {}); var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username, "default", {});
if (tokenPair) { if (tokenPair) {
token = tokenPair.accessToken; token = tokenPair.accessToken;
} }

@ -25,9 +25,9 @@ $(window).load(function () {
var tNow = new Date().getTime() / 1000; var tNow = new Date().getTime() / 1000;
for (var i = 0; i < 30; i++) { for (var i = 0; i < 30; i++) {
chartData.push({ chartData.push({
x: tNow - (30 - i) * 15, x: tNow - (30 - i) * 15,
y: parseFloat(0) y: parseFloat(0)
}); });
} }
graph = new Rickshaw.Graph({ graph = new Rickshaw.Graph({
@ -90,9 +90,9 @@ function connect(target) {
ws.onmessage = function (event) { ws.onmessage = function (event) {
var dataPoint = JSON.parse(event.data); var dataPoint = JSON.parse(event.data);
chartData.push({ chartData.push({
x: parseInt(dataPoint[0]) / 1000, x: parseInt(dataPoint[0]) / 1000,
y: parseFloat(dataPoint[5]) y: parseFloat(dataPoint[5])
}); });
chartData.shift(); chartData.shift();
graph.update(); graph.update();
}; };

@ -4,7 +4,7 @@
"category": "iot", "category": "iot",
"downloadAgentUri": "arduino/device/download", "downloadAgentUri": "arduino/device/download",
"category": "iot", "category": "iot",
"scopes" : [ "scopes": [
"perm:arduino:enroll" "perm:arduino:enroll"
] ]
} }

@ -21,15 +21,19 @@
width: 50px; width: 50px;
color: #fff; color: #fff;
} }
.padding-top-double { .padding-top-double {
padding-top: 20px; padding-top: 20px;
} }
.padding-double { .padding-double {
padding: 20px; padding: 20px;
} }
.grey { .grey {
color: #333; color: #333;
} }
hr { hr {
display: block; display: block;
height: 1px; height: 1px;
@ -39,20 +43,25 @@ hr {
padding: 0; padding: 0;
opacity: 0.2; opacity: 0.2;
} }
.light-grey { .light-grey {
color: #7c7c7c; color: #7c7c7c;
} }
.uppercase { .uppercase {
text-transform: uppercase; text-transform: uppercase;
} }
.grey-bg { .grey-bg {
background-color: #f6f4f4; background-color: #f6f4f4;
} }
.doc-link{
.doc-link {
background: none; background: none;
color: #000; color: #000;
padding: 10px 0px; padding: 10px 0px;
} }
.doc-link a { .doc-link a {
color: #006eff; color: #006eff;
} }

@ -110,15 +110,15 @@ function attachEvents() {
doAction(data); doAction(data);
} }
); );
}else if(deviceName){ } else if (deviceName) {
$('.controls').append('<label for="deviceName" generated="true" class="error" ' + $('.controls').append('<label for="deviceName" generated="true" class="error" ' +
'style="display: inline-block;">Please enter at least 4 ' + 'style="display: inline-block;">Please enter at least 4 ' +
'characters.</label>'); 'characters.</label>');
$('.control-group').removeClass('success').addClass('error'); $('.control-group').removeClass('success').addClass('error');
} else { } else {
$('.controls').append('<label for="deviceName" generated="true" class="error" ' + $('.controls').append('<label for="deviceName" generated="true" class="error" ' +
'style="display: inline-block;">This field is required.' + 'style="display: inline-block;">This field is required.' +
'</label>'); '</label>');
$('.control-group').removeClass('success').addClass('error'); $('.control-group').removeClass('success').addClass('error');
} }
}); });
@ -146,7 +146,7 @@ function downloadAgent() {
setTimeout(function () { setTimeout(function () {
hidePopup(); hidePopup();
}, 1000); }, 1000);
}else { } else {
$("#invalid-username-error-msg span").text("Invalid device name"); $("#invalid-username-error-msg span").text("Invalid device name");
$("#invalid-username-error-msg").removeClass("hidden"); $("#invalid-username-error-msg").removeClass("hidden");
} }
@ -186,28 +186,28 @@ function doAction(data) {
} }
function artifactUpload() { function artifactUpload() {
var contentType = "application/json"; var contentType = "application/json";
var urix = backendEndBasePath + "/admin/devicetype/deploy/arduino"; var urix = backendEndBasePath + "/admin/devicetype/deploy/arduino";
var defaultStatusClasses = "fw fw-stack-1x"; var defaultStatusClasses = "fw fw-stack-1x";
var content = $("#arduino-statistic-response-template").find(".content"); var content = $("#arduino-statistic-response-template").find(".content");
var title = content.find("#title"); var title = content.find("#title");
var statusIcon = content.find("#status-icon"); var statusIcon = content.find("#status-icon");
var data = {} var data = {}
invokerUtil.post(urix, data, function (data) { invokerUtil.post(urix, data, function (data) {
title.html("Deploying statistic artifacts. Please wait..."); title.html("Deploying statistic artifacts. Please wait...");
statusIcon.attr("class", defaultStatusClasses + " fw-check"); statusIcon.attr("class", defaultStatusClasses + " fw-check");
$(modalPopupContent).html(content.html()); $(modalPopupContent).html(content.html());
showPopup(); showPopup();
setTimeout(function () { setTimeout(function () {
hidePopup(); hidePopup();
location.reload(true); location.reload(true);
}, 5000); }, 5000);
}, function (jqXHR) { }, function (jqXHR) {
title.html("Failed to deploy artifacts, Please contact administrator."); title.html("Failed to deploy artifacts, Please contact administrator.");
statusIcon.attr("class", defaultStatusClasses + " fw-error"); statusIcon.attr("class", defaultStatusClasses + " fw-error");
$(modalPopupContent).html(content.html()); $(modalPopupContent).html(content.html());
showPopup(); showPopup();
}, contentType); }, contentType);
} }

@ -32,31 +32,31 @@
<h3 class="uppercase">What it Does</h3> <h3 class="uppercase">What it Does</h3>
<hr> <hr>
<p class="grey margin-top">Connect Arduino UNO board to WSO2 IoT Server and visualize sensor <p class="grey margin-top">Connect Arduino UNO board to WSO2 IoT Server and visualize sensor
data.</p> data.</p>
<br> <br>
<h3 class="uppercase">What You Need</h3> <h3 class="uppercase">What You Need</h3>
<hr> <hr>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">ITEM 01</span> <span class="badge">ITEM 01</span>
Arduino UNO Board. Arduino UNO Board.
</li> </li>
<li> <li>
<span class="badge">ITEM 02</span> <span class="badge">ITEM 02</span>
Adafruit Wifi Shield for Arduino. Adafruit Wifi Shield for Arduino.
</li> </li>
<li> <li>
<span class="badge">ITEM 03</span> <span class="badge">ITEM 03</span>
LED bulb connected to Pin 13. LED bulb connected to Pin 13.
<i>(If not available, will use the one on the board.)</i> <i>(If not available, will use the one on the board.)</i>
</li> </li>
<li> <li>
<span class="badge">ITEM 04</span> <span class="badge">ITEM 04</span>
Resister( e.g 330 ohms ) Resister( e.g 330 ohms )
</li> </li>
<li> <li>
<span class="badge">STEP 05</span> <span class="badge">STEP 05</span>
Proceed to [Prepare] section. Proceed to [Prepare] section.
</ul> </ul>
<br> <br>
<a href="/api-store/apis/info?name={{@uriParams.deviceType}}&version=1.0.0&provider=admin" <a href="/api-store/apis/info?name={{@uriParams.deviceType}}&version=1.0.0&provider=admin"
@ -67,7 +67,8 @@
<i class="fw fw-download add-margin-1x"></i>Download Sketch <i class="fw fw-download add-margin-1x"></i>Download Sketch
</a> </a>
{{#if displayStatus}} {{#if displayStatus}}
<a href="javascript:artifactUpload()" class="btn-operations"><i class="fw fw-upload fw-inverse fw-lg add-margin-1x"></i> Deploy Analytics Artifacts</a> <a href="javascript:artifactUpload()" class="btn-operations"><i
class="fw fw-upload fw-inverse fw-lg add-margin-1x"></i> Deploy Analytics Artifacts</a>
{{/if}} {{/if}}
<p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS300/Arduino" <p class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS300/Arduino"
@ -201,11 +202,11 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">01</span> <span class="badge">01</span>
Wifi-Shield mounted onto the Arduino-UNO board Wifi-Shield mounted onto the Arduino-UNO board
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">02</span> <span class="badge">02</span>
Connect LED bulb to arduino as follows Connect LED bulb to arduino as follows
<br/><br/> <br/><br/>
<a href="{{@unit.publicUri}}/images/schematicsGuide.png" target="_blank"> <a href="{{@unit.publicUri}}/images/schematicsGuide.png" target="_blank">
<img src="{{@unit.publicUri}}/images/schematicsGuide.png" class="img-responsive"> <img src="{{@unit.publicUri}}/images/schematicsGuide.png" class="img-responsive">
@ -215,20 +216,20 @@
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">03</span> <span class="badge">03</span>
Download Arduino-Sketch from [Download Sketch] link above. Download Arduino-Sketch from [Download Sketch] link above.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">04</span> <span class="badge">04</span>
Unzip the downloaded Arduino Agent Unzip the downloaded Arduino Agent
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">05</span> <span class="badge">05</span>
Create a folder called "ArduinoBoardSketch" and move all source files Create a folder called "ArduinoBoardSketch" and move all source files
inside inside
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">06</span> <span class="badge">06</span>
Open ArduinoBoardSketch.h and provide appropriate values for Open ArduinoBoardSketch.h and provide appropriate values for
<i>[WLAN_SSID]</i>, <i>[WLAN_SSID]</i>,
<i>[WLAN_PASS]</i>, <i>[WLAN_PASS]</i>,
<i>[SERVICE_PORT]</i>, <i>[SERVICE_PORT]</i>,
@ -238,7 +239,7 @@
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">07</span> <span class="badge">07</span>
Burn the sketch onto your Arduino board and let the program run. Burn the sketch onto your Arduino board and let the program run.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
@ -246,14 +247,14 @@
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i> <i class="fw fw-right-arrow fw-stack-1x"></i>
</span> </span>
Arduino will publish it's internal temperature to WSO2-IoT-Server Arduino will publish it's internal temperature to WSO2-IoT-Server
<br/><br/> <br/><br/>
<span class="fw-stack margin-right"> <span class="fw-stack margin-right">
<i class="fw fw-circle-outline fw-stack-2x"></i> <i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i> <i class="fw fw-right-arrow fw-stack-1x"></i>
</span> </span>
LED on <i>PIN 13</i> can be controlled from Device Management page. LED on <i>PIN 13</i> can be controlled from Device Management page.
</li> </li>
</ul> </ul>
<br> <br>
@ -267,17 +268,17 @@
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">01</span> <span class="badge">01</span>
You can view all your connected devices at You can view all your connected devices at
<a href="{{@app.context}}/devices">[Device Management]</a> page. <a href="{{@app.context}}/devices">[Device Management]</a> page.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">02</span> <span class="badge">02</span>
Select one of connected devices and check for available control Select one of connected devices and check for available control
operations and monitor Real-Time data. operations and monitor Real-Time data.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="badge">03</span> <span class="badge">03</span>
You can also view analytics of the data published to IoT-Server by You can also view analytics of the data published to IoT-Server by
navigating to Device Analytics page. navigating to Device Analytics page.
</li> </li>
</ul> </ul>

@ -16,22 +16,22 @@
* under the License. * under the License.
*/ */
function onRequest(context){ function onRequest(context) {
var viewModel = {}; var viewModel = {};
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/admin/devicetype/deploy/arduino/status"; var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/admin/devicetype/deploy/arduino/status";
serviceInvokers.XMLHttp.get( serviceInvokers.XMLHttp.get(
url, function (responsePayload) { url, function (responsePayload) {
var responseContent = responsePayload.status; var responseContent = responsePayload.status;
new Log().error(responseContent); new Log().error(responseContent);
if ("204" == responsePayload.status) { if ("204" == responsePayload.status) {
viewModel["displayStatus"] = "Display"; viewModel["displayStatus"] = "Display";
} }
}, },
function (responsePayload) { function (responsePayload) {
//do nothing. //do nothing.
} }
); );
return viewModel; return viewModel;
} }

@ -17,7 +17,8 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>

@ -27,9 +27,16 @@
to save it to your computer.</p> to save it to your computer.</p>
<p class="doc-link">For further instructions and troubleshooting please visit the following <a href="https://docs.wso2.com/display/IoTS300/Android" <p class="doc-link">For further instructions and troubleshooting please visit the following <a href="https://docs.wso2.com/display/IoTS300/Android"
target="_blank">link</a>.</p>--> target="_blank">link</a>.</p>-->
<p class="doc-link text-center">Need help? Read <a {{#if isCloud}}
href="https://docs.wso2.com/display/DeviceCloud/Enrolling+an+Android+Device" target="_blank">WSO2 Device <p class="doc-link text-center">Need help? Read <a
Cloud documentation.</a></p> href="https://docs.wso2.com/display/IoTS300/Android" target="_blank">WSO2 Device
Cloud documentation.</a></p>
{{else}}
<p class="doc-link text-center">Need help? Read <a
href="https://docs.wso2.com/display/DeviceCloud/Enrolling+an+Android+Device" target="_blank">WSO2
IoT Server documentation.</a></p>
{{/if}}
</div> </div>
</div> </div>
@ -40,21 +47,16 @@
</div> </div>
</div> </div>
<div class="row grey-bg"> {{#if isCloud}}
{{#if isCloud}} <div class="row grey-bg">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 add-padding-top-2x add-padding-bottom-2x">
{{else}}
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x">
{{/if}}
<h5><strong>Step 1</strong></h5> <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 col-md-offset-1 col-lg-offset-1 add-padding-top-2x add-padding-bottom-2x">
<p>Let's start by installing the Android agent on your device. Open the downloaded file, and tap <b>INSTALL</b>.</p> <h5><strong>Step 1</strong></h5>
<img src="{{@unit.publicUri}}/images/install_agent.png" class="img-responsive"> <p>Let's start by installing the Android agent on your device. Open the downloaded file, and tap
</div> <b>INSTALL</b>.</p>
<img src="{{@unit.publicUri}}/images/install_agent.png" class="img-responsive">
{{#if isCloud}} </div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 add-padding-top-2x add-padding-bottom-2x"> <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 col-md-offset-2 col-lg-offset-2 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 2</strong></h5> <h5><strong>Step 2</strong></h5>
<p>Enter your: <p>Enter your:
<p> <p>
@ -65,7 +67,14 @@
</ul> </ul>
<img src="{{@unit.publicUri}}/images/login.png" class="img-responsive"> <img src="{{@unit.publicUri}}/images/login.png" class="img-responsive">
</div> </div>
{{else}} {{else}}
<div class="row grey-bg">
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 1</strong></h5>
<p>Let's start by installing the Android agent on your device. Open the downloaded file, and tap
<b>INSTALL</b>.</p>
<img src="{{@unit.publicUri}}/images/install_agent.png" class="img-responsive">
</div>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x"> <div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 add-padding-top-2x add-padding-bottom-2x">
<h5><strong>Step 2</strong></h5> <h5><strong>Step 2</strong></h5>
@ -88,7 +97,7 @@
</ul> </ul>
<img src="{{@unit.publicUri}}/images/install_agent.png" class="img-responsive"> <img src="{{@unit.publicUri}}/images/install_agent.png" class="img-responsive">
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -151,10 +160,10 @@
<br/> <br/>
{{#zone "topCss"}} {{#zone "topCss"}}
{{css "css/styles.css"}} {{css "css/styles.css"}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/type-view.js"}} {{js "js/type-view.js"}}
{{/zone}} {{/zone}}

Loading…
Cancel
Save