From 0c2465d03e1b8224c7177dc165cbeb91a9c19493 Mon Sep 17 00:00:00 2001 From: charitha Date: Tue, 20 Dec 2016 23:48:21 +0530 Subject: [PATCH 1/8] Add enrollment invitations API EP for android --- .../services/DeviceManagementService.java | 52 ++++++++++++++ .../impl/DeviceManagementServiceImpl.java | 29 +++++++- .../android-enrollment-invitation.vm | 72 +++++++++++++++++++ .../src/main/resources/p2.inf | 3 +- 4 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java index 5bf5fef24..04fcb4677 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java @@ -33,6 +33,7 @@ import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; +import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; @@ -198,6 +199,57 @@ public interface DeviceManagementService { value = "Properties to update the device operations and their status.") List resultOperations); + @POST + @Path("/invite") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Send enrollment invitation for android device", + tags = "Android Device Management", + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/invite/android", + description = "Send device enrollment invitation") } + ) + } + ) + @ApiResponses(value = { + @ApiResponse( + code = 201, + message = "Invited. \n Successfully sent invitations.", + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n The source can be retrieved from the URL specified in the location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new device.") + }) + Response sendEnrollmentInvitation(@ApiParam( + name = "EmailConfig", + value = "The properties required to send device enrollment invitation.") + @Valid EmailMetaInfo metaInfo); + @POST @ApiOperation( produces = MediaType.APPLICATION_JSON, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index 4ca9b9b44..815210af9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -29,6 +29,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; +import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; @@ -46,7 +47,15 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.ArrayList; @@ -164,6 +173,24 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return Response.status(Response.Status.CREATED).entity(pendingOperations).build(); } + @POST + @Path("/invite") + @Override + public Response sendEnrollmentInvitation(EmailMetaInfo metaInfo) { + try { + AndroidAPIUtils.getDeviceManagementService() + .sendEnrolmentInvitation("android-enrollment-invitation", metaInfo); + Message responseMessage = new Message(); + responseMessage.setResponseCode(Response.Status.OK.toString()); + responseMessage.setResponseMessage("Enrollment invitations sent."); + return Response.status(Response.Status.OK).entity(responseMessage).build(); + } catch (DeviceManagementException e) { + log.error(e.getMessage(), e); + throw new UnexpectedServerErrorException( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(e.getMessage()).build()); + } + } + private void updateOperations(String deviceId, List operations) throws OperationManagementException, PolicyComplianceException, ApplicationManagementException, NotificationManagementException, DeviceManagementException { diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm new file mode 100644 index 000000000..48d23fcb4 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm @@ -0,0 +1,72 @@ +#* + 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. +*# + + You have been invited to enroll your Android device in WSO2 IoT + + + + WSO2 IoT Server + + +
+
+
+
+ WSO2 +
+
+
+

+ Hi $first-name, +

+ +

+ You have been invited to enrol your android device in WSO2 IoT Server. + Click here to begin device enrolment from + your Android device.

+ +

+ Should you need assistance, please contact your administrator. +

+ +

+ Regards, +

+ +

+ WSO2 IoT Administrator +

+
+
+ + + + +
WSO2
+
+
+
+ + + ]]> + +
diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf index 3ef182348..ffd5fd2c6 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf @@ -11,6 +11,7 @@ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../data org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/devicetypes/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/devicetypes/,target:${installFolder}/../../deployment/server/devicetypes/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ instructions.unconfigure = \ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/mdm-android-agent.war);\ @@ -26,7 +27,7 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../dep org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.date-range-picker);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.leaflet);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod);\ -org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.qr-modal);\ +org.eclipse.equinox.p2.touchpoint.natives.remove(path:$${installFolder}/../../../repository/resources/email-templates/android-enrollment-invitation.vm);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/android);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/WSO2MobileAndroid_DB.h2.db);\ From 5465cea76dddc44adf1a9aee6ad7b4ba85f543f8 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Thu, 22 Dec 2016 14:03:49 +0530 Subject: [PATCH 2/8] Fixing QR modal unit not found issue --- .../cdmf.unit.device.type.android.device-view/device-view.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs index 3842be730..1b42bdfc6 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -1,6 +1,6 @@ {{unit "cdmf.unit.device.type.android.leaflet"}} {{unit "cdmf.unit.lib.qrcode"}} -{{unit "cdmf.unit.device.type.android.qr-modal"}} +{{unit "cdmf.unit.device.type.qr-modal"}} {{#if deviceFound}} {{#if isAuthorized}} From 4add08545a979aa6415cf750fe641bebc45ccc63 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 22 Dec 2016 16:32:06 +0530 Subject: [PATCH 3/8] Removed previously created accelerometer gadgets. --- .../Accelerometer_X/conf.json | 1 - .../Accelerometer_X/css/number-chart.css | 35 ------------------- .../Accelerometer_X/gadget.json | 9 ----- .../ACCELEROMETER_Y/conf.json | 1 - .../ACCELEROMETER_Y/css/number-chart.css | 35 ------------------- .../ACCELEROMETER_Y/gadget.json | 9 ----- .../ACCELEROMETER_Z/conf.json | 1 - .../ACCELEROMETER_Z/css/number-chart.css | 35 ------------------- .../ACCELEROMETER_Z/gadget.json | 9 ----- 9 files changed, 135 deletions(-) delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/conf.json delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/css/number-chart.css delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget.json delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/conf.json delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/css/number-chart.css delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget.json delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/conf.json delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/css/number-chart.css delete mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget.json diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/conf.json deleted file mode 100644 index 5617ac60d..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/conf.json +++ /dev/null @@ -1 +0,0 @@ -{"provider-conf" : {"streamName" : "org.wso2.iot.android.accelerometer:1.0.0", "provider-name" : "realtime"}, "chart-conf" : {"x" : "x", "title" : "ACCELEROMETER X", "maxLength" : "30", "gadget-name" : "Accelerometer X", "chart-name" : "number-chart"}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/css/number-chart.css b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/css/number-chart.css deleted file mode 100644 index 5dde0413a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/css/number-chart.css +++ /dev/null @@ -1,35 +0,0 @@ -#canvas { - height: 100%; - width: 100%; -} - -p { - margin: 0; - display: block; - text-align: center; - font-weight: bold; -} - -.titlecanvasContent { - color:steelblue; - font-size:18px; - font-weight: normal; - padding: 10px 0; -} - -.valcanvasContent { - color:#438CAD; - font-size:50px; - font-weight: normal; -} - - -.diffcanvasContent { - color:#438CAD; - font-size:14px; -} - -.diffPercentagecanvasContent { - color:#ff944d; - font-size:14px; -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget.json deleted file mode 100644 index 90a89cbff..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "Accelerometer_X", - "title": "Accelerometer X", - "type": "gadget", - "thumbnail": "gadget/Accelerometer_X/thumbnail.png", - "data": { - "url": "gadget/Accelerometer_X/gadget.xml" - } -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/conf.json deleted file mode 100644 index f20d0c48a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/conf.json +++ /dev/null @@ -1 +0,0 @@ -{"provider-conf" : {"streamName" : "org.wso2.iot.android.accelerometer:1.0.0", "provider-name" : "realtime"}, "chart-conf" : {"x" : "y", "title" : "ACCELEROMETER Y", "maxLength" : "30", "gadget-name" : "ACCELEROMETER Y", "chart-name" : "number-chart"}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/css/number-chart.css b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/css/number-chart.css deleted file mode 100644 index 5dde0413a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/css/number-chart.css +++ /dev/null @@ -1,35 +0,0 @@ -#canvas { - height: 100%; - width: 100%; -} - -p { - margin: 0; - display: block; - text-align: center; - font-weight: bold; -} - -.titlecanvasContent { - color:steelblue; - font-size:18px; - font-weight: normal; - padding: 10px 0; -} - -.valcanvasContent { - color:#438CAD; - font-size:50px; - font-weight: normal; -} - - -.diffcanvasContent { - color:#438CAD; - font-size:14px; -} - -.diffPercentagecanvasContent { - color:#ff944d; - font-size:14px; -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget.json deleted file mode 100644 index 16db7931b..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "ACCELEROMETER_Y", - "title": "ACCELEROMETER Y", - "type": "gadget", - "thumbnail": "gadget/ACCELEROMETER_Y/thumbnail.png", - "data": { - "url": "gadget/ACCELEROMETER_Y/gadget.xml" - } -} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/conf.json deleted file mode 100644 index 1940ff1dd..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/conf.json +++ /dev/null @@ -1 +0,0 @@ -{"provider-conf" : {"streamName" : "org.wso2.iot.android.accelerometer:1.0.0", "provider-name" : "realtime"}, "chart-conf" : {"x" : "z", "title" : "ACCELEROMETER Z", "maxLength" : "30", "gadget-name" : "ACCELEROMETER Z", "chart-name" : "number-chart"}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/css/number-chart.css b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/css/number-chart.css deleted file mode 100644 index 5dde0413a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/css/number-chart.css +++ /dev/null @@ -1,35 +0,0 @@ -#canvas { - height: 100%; - width: 100%; -} - -p { - margin: 0; - display: block; - text-align: center; - font-weight: bold; -} - -.titlecanvasContent { - color:steelblue; - font-size:18px; - font-weight: normal; - padding: 10px 0; -} - -.valcanvasContent { - color:#438CAD; - font-size:50px; - font-weight: normal; -} - - -.diffcanvasContent { - color:#438CAD; - font-size:14px; -} - -.diffPercentagecanvasContent { - color:#ff944d; - font-size:14px; -} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget.json deleted file mode 100644 index 4236c240a..000000000 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "id": "ACCELEROMETER_Z", - "title": "ACCELEROMETER Z", - "type": "gadget", - "thumbnail": "gadget/ACCELEROMETER_Z/thumbnail.png", - "data": { - "url": "gadget/ACCELEROMETER_Z/gadget.xml" - } -} From f0d7e4648a6b6767c78f745604fe3447e6679b1b Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 22 Dec 2016 16:33:27 +0530 Subject: [PATCH 4/8] Android sense execution plans changed to be used with multiline charts. --- ...droid-Accelerometer-ExecutionPlan.siddhiql | 8 +- ...g_wso2_iot_android_accelerometer_stats.xml | 14 +- ...iot.android.accelerometer.stats_1.0.0.json | 10 +- ....wso2.iot.android.accelerometer_1.0.0.json | 10 +- .../Android-Sense-ExecutionPlan.siddhiql | 49 ++++- .../js/provider-libs/ws-client.js | 2 +- .../Android-Gyroscope-ExecutionPlan.siddhiql | 10 +- .../org_wso2_iot_android_gyroscope_stats.xml | 14 +- ...so2.iot.android.gyroscope.stats_1.0.0.json | 10 +- .../org.wso2.iot.android.gyroscope_1.0.0.json | 10 +- .../Android-Magnetic-ExecutionPlan.siddhiql | 7 +- .../org_wso2_iot_android_magnetic_stats.xml | 14 +- ...wso2.iot.android.magnetic.stats_1.0.0.json | 10 +- .../org.wso2.iot.android.magnetic_1.0.0.json | 10 +- .../Android-Rotation-ExecutionPlan.siddhiql | 8 +- .../org_wso2_iot_android_rotation_stats.xml | 14 +- ...wso2.iot.android.rotation.stats_1.0.0.json | 10 +- .../org.wso2.iot.android.rotation_1.0.0.json | 10 +- .../android_sense_dashboard/android-iot.json | 204 ++++++++++-------- .../carbonapps/androidsense/artifacts.xml | 12 +- 20 files changed, 214 insertions(+), 222 deletions(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/Android-Accelerometer-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/Android-Accelerometer-ExecutionPlan.siddhiql index fa0e7517d..e89e73f86 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/Android-Accelerometer-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_executionplan/Android-Accelerometer-ExecutionPlan.siddhiql @@ -3,16 +3,16 @@ @Plan:description('Process accelerometer changes.') @Import('org.wso2.iot.android.accelerometer:1.0.0') -define stream AccelerometerStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream AccelerometerStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value +float); @Export('org.wso2.iot.android.accelerometer.stats:1.0.0') -define stream AccelerometerStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, x -float, y float, z float, year int, month int, day int, hour int, minute int); +define stream AccelerometerStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float, year int, month int, day int, hour int, minute int); partition with (meta_deviceId of AccelerometerStream) begin from AccelerometerStream - select meta_owner, meta_deviceId, meta_timestamp, x, y, z, time:extract + select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute insert into AccelerometerStatsStream; end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/org_wso2_iot_android_accelerometer_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/org_wso2_iot_android_accelerometer_stats.xml index abf3b755b..663853bfd 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/org_wso2_iot_android_accelerometer_stats.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_event_sink/org_wso2_iot_android_accelerometer_stats.xml @@ -26,23 +26,15 @@ LONG - x + axis false false false false - FLOAT - - - y - false - false - false - false - FLOAT + STRING - z + value false false false diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/org.wso2.iot.android.accelerometer.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/org.wso2.iot.android.accelerometer.stats_1.0.0.json index f735e0e3b..e1e1567f1 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/org.wso2.iot.android.accelerometer.stats_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_stats_streams/org.wso2.iot.android.accelerometer.stats_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" }, { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/org.wso2.iot.android.accelerometer_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/org.wso2.iot.android.accelerometer_1.0.0.json index 2c7bdbe54..69d9f8db0 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/org.wso2.iot.android.accelerometer_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_streams/org.wso2.iot.android.accelerometer_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" } ] diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql index 3b4d7b32f..cbb3a64e3 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql @@ -33,19 +33,19 @@ define stream SmsStream (meta_owner string, meta_deviceId string, meta_timestamp define stream geoLocationStream (id string, timeStamp long, latitude double, longitude double, type string, speed float, heading float); @Export('org.wso2.iot.android.accelerometer:1.0.0') -define stream AccelerometerStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream AccelerometerStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); @Export('org.wso2.iot.android.gyroscope:1.0.0') -define stream GyroscopeStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream GyroscopeStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); @Export('org.wso2.iot.android.magnetic:1.0.0') -define stream MagneticStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream MagneticStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); @Export('org.wso2.iot.android.gravity:1.0.0') define stream GravityStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); @Export('org.wso2.iot.android.rotation:1.0.0') -define stream RotationStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream RotationStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); @Export('org.wso2.iot.android.pressure:1.0.0') define stream PressureStream (meta_owner string, meta_deviceId string, meta_timestamp long, pressure float); @@ -57,14 +57,39 @@ define stream LightStream (meta_owner string, meta_deviceId string, meta_timesta define stream ProximityStream (meta_owner string, meta_deviceId string, meta_timestamp long, proximity float); from AndroidSense[meta_type == 'accelerometer'] -select meta_owner, meta_deviceId, meta_timestamp, accelerometer_x as x, accelerometer_y as y, accelerometer_z as z +select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, accelerometer_x as value +insert into AccelerometerStream; + +from AndroidSense[meta_type == 'accelerometer'] +select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, accelerometer_y as value +insert into AccelerometerStream; + +from AndroidSense[meta_type == 'accelerometer'] +select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, accelerometer_z as value insert into AccelerometerStream; from AndroidSense[meta_type == 'gyroscope'] -select meta_owner, meta_deviceId, meta_timestamp, gyroscope_x as x, gyroscope_y as y, gyroscope_z as z +select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, gyroscope_x as value insert into GyroscopeStream; + +from AndroidSense[meta_type == 'gyroscope'] +select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, gyroscope_y as value +insert into GyroscopeStream; + +from AndroidSense[meta_type == 'gyroscope'] +select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, gyroscope_z as value +insert into GyroscopeStream; + from AndroidSense[meta_type == 'magnetic'] -select meta_owner, meta_deviceId, meta_timestamp, magnetic_x as x, magnetic_y as y, magnetic_z as z +select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, magnetic_x as value +insert into MagneticStream; + +from AndroidSense[meta_type == 'magnetic'] +select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, magnetic_y as value +insert into MagneticStream; + +from AndroidSense[meta_type == 'magnetic'] +select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, magnetic_z as value insert into MagneticStream; from AndroidSense[meta_type == 'gravity'] @@ -72,7 +97,15 @@ select meta_owner, meta_deviceId, meta_timestamp, gravity_x as x, gravity_y as y insert into GravityStream; from AndroidSense[meta_type == 'rotation'] -select meta_owner, meta_deviceId, meta_timestamp, rotation_x as x, rotation_y as y, rotation_z as z +select meta_owner, meta_deviceId, meta_timestamp, 'X' as axis, rotation_x as value +insert into RotationStream; + +from AndroidSense[meta_type == 'rotation'] +select meta_owner, meta_deviceId, meta_timestamp, 'Y' as axis, rotation_y as value +insert into RotationStream; + +from AndroidSense[meta_type == 'rotation'] +select meta_owner, meta_deviceId, meta_timestamp, 'Z' as axis, rotation_z as value insert into RotationStream; from AndroidSense[meta_type == 'pressure'] diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/js/provider-libs/ws-client.js index ab7263155..96c835642 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/js/provider-libs/ws-client.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/Android-Gyroscope-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/Android-Gyroscope-ExecutionPlan.siddhiql index 85d502500..a90efaadf 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/Android-Gyroscope-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_executionplan/Android-Gyroscope-ExecutionPlan.siddhiql @@ -3,16 +3,16 @@ @Plan:description('Process gyroscope changes.') @Import('org.wso2.iot.android.gyroscope:1.0.0') -define stream GyroscopeStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream GyroscopeStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); @Export('org.wso2.iot.android.gyroscope.stats:1.0.0') -define stream GyroscopeStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, x -float, y float, z float, year int, month int, day int, hour int, minute int); +define stream GyroscopeStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value +float, year int, month int, day int, hour int, minute int); partition with (meta_deviceId of GyroscopeStream) begin from GyroscopeStream - select meta_owner, meta_deviceId, meta_timestamp, x, y, z, time:extract - (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute + select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract (meta_timestamp, 'year') as year, + time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute insert into GyroscopeStatsStream; end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/org_wso2_iot_android_gyroscope_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/org_wso2_iot_android_gyroscope_stats.xml index ba42b4ba7..c8f77320b 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/org_wso2_iot_android_gyroscope_stats.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_event_sink/org_wso2_iot_android_gyroscope_stats.xml @@ -26,23 +26,15 @@ LONG - x + axis false false false false - FLOAT - - - y - false - false - false - false - FLOAT + STRING - z + value false false false diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/org.wso2.iot.android.gyroscope.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/org.wso2.iot.android.gyroscope.stats_1.0.0.json index 6282a16a5..03292564f 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/org.wso2.iot.android.gyroscope.stats_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_stats_streams/org.wso2.iot.android.gyroscope.stats_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" }, { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/org.wso2.iot.android.gyroscope_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/org.wso2.iot.android.gyroscope_1.0.0.json index b7fcf81b7..05f1a3226 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/org.wso2.iot.android.gyroscope_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_streams/org.wso2.iot.android.gyroscope_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" } ] diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/Android-Magnetic-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/Android-Magnetic-ExecutionPlan.siddhiql index d7af0016f..52f7bb7ce 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/Android-Magnetic-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_executionplan/Android-Magnetic-ExecutionPlan.siddhiql @@ -3,16 +3,15 @@ @Plan:description('Process magnetic field changes.') @Import('org.wso2.iot.android.magnetic:1.0.0') -define stream MagneticStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream MagneticStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); @Export('org.wso2.iot.android.magnetic.stats:1.0.0') -define stream MagneticStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, x -float, y float, z float, year int, month int, day int, hour int, minute int); +define stream MagneticStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float, year int, month int, day int, hour int, minute int); partition with (meta_deviceId of MagneticStream) begin from MagneticStream - select meta_owner, meta_deviceId, meta_timestamp, x, y, z, time:extract + select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute insert into MagneticStatsStream; end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/org_wso2_iot_android_magnetic_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/org_wso2_iot_android_magnetic_stats.xml index 93328ca02..992d63505 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/org_wso2_iot_android_magnetic_stats.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_event_sink/org_wso2_iot_android_magnetic_stats.xml @@ -26,23 +26,15 @@ LONG - x + axis false false false false - FLOAT - - - y - false - false - false - false - FLOAT + STRING - z + value false false false diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/org.wso2.iot.android.magnetic.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/org.wso2.iot.android.magnetic.stats_1.0.0.json index 109ba5b1d..468369cf0 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/org.wso2.iot.android.magnetic.stats_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_stats_streams/org.wso2.iot.android.magnetic.stats_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" }, { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/org.wso2.iot.android.magnetic_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/org.wso2.iot.android.magnetic_1.0.0.json index a9ad5d8dc..a468cdf3e 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/org.wso2.iot.android.magnetic_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_streams/org.wso2.iot.android.magnetic_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" } ] diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/Android-Rotation-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/Android-Rotation-ExecutionPlan.siddhiql index df2e44c6d..19f66e977 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/Android-Rotation-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_executionplan/Android-Rotation-ExecutionPlan.siddhiql @@ -3,16 +3,16 @@ @Plan:description('Process rotation field changes.') @Import('org.wso2.iot.android.rotation:1.0.0') -define stream RotationStream (meta_owner string, meta_deviceId string, meta_timestamp long, x float, y float, z float); +define stream RotationStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value float); @Export('org.wso2.iot.android.rotation.stats:1.0.0') -define stream RotationStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, x -float, y float, z float, year int, month int, day int, hour int, minute int); +define stream RotationStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, axis string, value +float, year int, month int, day int, hour int, minute int); partition with (meta_deviceId of RotationStream) begin from RotationStream - select meta_owner, meta_deviceId, meta_timestamp, x, y, z, time:extract + select meta_owner, meta_deviceId, meta_timestamp, axis, value, time:extract (meta_timestamp, 'year') as year, time:extract(meta_timestamp, 'month') as month, time:extract(meta_timestamp, 'day') as day, time:extract(meta_timestamp, 'hour') as hour, time:extract(meta_timestamp, 'minute') as minute insert into RotationStatsStream; end; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/org_wso2_iot_android_rotation_stats.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/org_wso2_iot_android_rotation_stats.xml index 018b265f6..c235a8ac2 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/org_wso2_iot_android_rotation_stats.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_event_sink/org_wso2_iot_android_rotation_stats.xml @@ -26,23 +26,15 @@ LONG - x + axis false false false false - FLOAT - - - y - false - false - false - false - FLOAT + STRING - z + value false false false diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/org.wso2.iot.android.rotation.stats_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/org.wso2.iot.android.rotation.stats_1.0.0.json index 1bf43d4d6..418c8daf1 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/org.wso2.iot.android.rotation.stats_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_stats_streams/org.wso2.iot.android.rotation.stats_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" }, { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/org.wso2.iot.android.rotation_1.0.0.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/org.wso2.iot.android.rotation_1.0.0.json index 22e6988e2..c82c7f066 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/org.wso2.iot.android.rotation_1.0.0.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_streams/org.wso2.iot.android.rotation_1.0.0.json @@ -19,15 +19,11 @@ ], "payloadData": [ { - "name": "x", - "type": "FLOAT" - }, - { - "name": "y", - "type": "FLOAT" + "name": "axis", + "type": "STRING" }, { - "name": "z", + "name": "value", "type": "FLOAT" } ] diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json index 36570f484..41eaafb20 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_dashboard/android-iot.json @@ -10,17 +10,17 @@ "hideAllMenuItems": false, "id": "android-iot", "identityServerUrl": "", - "isEditorEnable": true, + "isEditorEnable": false, "isUserCustom": false, "isanon": false, - "landing": "home", + "landing": "sensors", "menu": [ { - "id": "home", + "id": "sensors", "isanon": false, "ishidden": false, "subordinates": [], - "title": "Home" + "title": "Sensors" }, { "id": "real-time", @@ -61,7 +61,7 @@ "id": "test", "isanon": false, "ishidden": false, - "title": "test", + "title": "Test", "subordinates": [] } ], @@ -70,22 +70,23 @@ "content": { "anon": {}, "default": { - "a": [ + "a": [], + "b": [ { - "id": "ACCELEROMETER_Y-0", + "id": "ANDROID_MAGNETIC_GADGET-0", "content": { - "id": "ACCELEROMETER_Y", - "title": "ACCELEROMETER Y", + "id": "ANDROID_MAGNETIC_GADGET", + "title": "ANDROID_MAGNETIC_GADGET", "type": "gadget", - "thumbnail": "fs://gadget/ACCELEROMETER_Y/thumbnail.png", + "thumbnail": "fs://gadget/ANDROID_MAGNETIC_GADGET/thumbnail.png", "data": { - "url": "fs://gadget/ACCELEROMETER_Y/gadget.xml" + "url": "fs://gadget/ANDROID_MAGNETIC_GADGET/gadget.xml" }, "styles": { "no_heading": false, "hide_gadget": false, "titlePosition": "center", - "title": "ACCELEROMETER Y" + "title": "MAGNETIC FIELD" }, "options": { "windowSize": { @@ -97,7 +98,7 @@ } }, "locale_titles": { - "en-US": "ACCELEROMETER Y" + "en-US": "MAGNETIC FIELD" }, "settings": { "priority": "5", @@ -106,58 +107,22 @@ } } ], - "b": [ - { - "id": "ACCELEROMETER_Z-0", - "content": { - "id": "ACCELEROMETER_Z", - "title": "ACCELEROMETER Z", - "type": "gadget", - "thumbnail": "fs://gadget/ACCELEROMETER_Z/thumbnail.png", - "data": { - "url": "fs://gadget/ACCELEROMETER_Z/gadget.xml" - }, - "styles": { - "no_heading": false, - "hide_gadget": false, - "titlePosition": "center", - "title": "ACCELEROMETER Z" - }, - "options": { - "windowSize": { - "type": "STRING", - "title": "Window Size", - "value": "10", - "options": [], - "required": false - } - }, - "locale_titles": { - "en-US": "ACCELEROMETER Z" - }, - "settings": { - "priority": "5", - "timeoutInterval": "60000" - } - } - } - ], "8e564cb7a1c6519179e2111cc05a79ca": [ { - "id": "Accelerometer_X-0", + "id": "ANDROID_ACCELEROMETER_GADGET-0", "content": { - "id": "Accelerometer_X", - "title": "Accelerometer X", + "id": "ANDROID_ACCELEROMETER_GADGET", + "title": "ANDROID_ACCELEROMETER_GADGET", "type": "gadget", - "thumbnail": "fs://gadget/Accelerometer_X/thumbnail.png", + "thumbnail": "fs://gadget/ANDROID_ACCELEROMETER_GADGET/thumbnail.png", "data": { - "url": "fs://gadget/Accelerometer_X/gadget.xml" + "url": "fs://gadget/ANDROID_ACCELEROMETER_GADGET/gadget.xml" }, "styles": { "no_heading": false, "hide_gadget": false, "titlePosition": "center", - "title": "Accelerometer X" + "title": "ACCELEROMETER" }, "options": { "windowSize": { @@ -169,7 +134,7 @@ } }, "locale_titles": { - "en-US": "Accelerometer X" + "en-US": "ACCELEROMETER" }, "settings": { "priority": "5", @@ -249,43 +214,107 @@ } } } + ], + "765379a7012b8819ea13524e5b312509": [ + { + "id": "ANDROID_ROTATION_GADGET-0", + "content": { + "id": "ANDROID_ROTATION_GADGET", + "title": "ANDROID_ROTATION_GADGET", + "type": "gadget", + "thumbnail": "fs://gadget/ANDROID_ROTATION_GADGET/thumbnail.png", + "data": { + "url": "fs://gadget/ANDROID_ROTATION_GADGET/gadget.xml" + }, + "styles": { + "no_heading": false, + "hide_gadget": false, + "titlePosition": "center", + "title": "ROTATIONAL VECTOR" + }, + "options": { + "windowSize": { + "type": "STRING", + "title": "Window Size", + "value": "10", + "options": [], + "required": false + } + }, + "locale_titles": { + "en-US": "ROTATIONAL VECTOR" + }, + "settings": { + "priority": "5", + "timeoutInterval": "60000" + } + } + } + ], + "47ceaee8a089ea8ef75c91e5b83a1a36": [ + { + "id": "ANDROID_GYROSCOPE_GADGET-0", + "content": { + "id": "ANDROID_GYROSCOPE_GADGET", + "title": "ANDROID_GYROSCOPE_GADGET", + "type": "gadget", + "thumbnail": "fs://gadget/ANDROID_GYROSCOPE_GADGET/thumbnail.png", + "data": { + "url": "fs://gadget/ANDROID_GYROSCOPE_GADGET/gadget.xml" + }, + "styles": { + "no_heading": false, + "hide_gadget": false, + "titlePosition": "center", + "title": "GYROSCOPE" + }, + "options": { + "windowSize": { + "type": "STRING", + "title": "Window Size", + "value": "10", + "options": [], + "required": false + } + }, + "locale_titles": { + "en-US": "GYROSCOPE" + }, + "settings": { + "priority": "5", + "timeoutInterval": "60000" + } + } + } ] } }, - "id": "home", + "id": "sensors", "isanon": false, "layout": { "content": { "loggedIn": { "blocks": [ - { - "id": "a", - "x": 4, - "y": 0, - "width": 4, - "height": 4, - "banner": false - }, { "id": "b", - "x": 8, + "x": 6, "y": 0, - "width": 4, - "height": 4, + "width": 6, + "height": 5, "banner": false }, { "id": "8e564cb7a1c6519179e2111cc05a79ca", "x": 0, "y": 0, - "width": 4, - "height": 4, + "width": 6, + "height": 5, "banner": false }, { "id": "fdfada688ff9e7b3271eece314618532", "x": 0, - "y": 4, + "y": 5, "width": 6, "height": 3, "banner": false @@ -293,7 +322,7 @@ { "id": "46193833e958e9f7e879263f372eb508", "x": 6, - "y": 4, + "y": 5, "width": 6, "height": 3, "banner": false @@ -301,25 +330,17 @@ { "id": "765379a7012b8819ea13524e5b312509", "x": 0, - "y": 7, - "width": 4, - "height": 4, + "y": 8, + "width": 6, + "height": 5, "banner": false }, { "id": "47ceaee8a089ea8ef75c91e5b83a1a36", - "x": 8, - "y": 7, - "width": 4, - "height": 4, - "banner": false - }, - { - "id": "4a9feeb19fc2ea76e252dcd62c954279", - "x": 4, - "y": 7, - "width": 4, - "height": 4, + "x": 6, + "y": 8, + "width": 6, + "height": 5, "banner": false } ] @@ -327,7 +348,7 @@ }, "fluidLayout": false }, - "title": "Home" + "title": "Sensors" }, { "content": { @@ -1281,7 +1302,7 @@ }, { "id": "test", - "title": "test", + "title": "Test", "layout": { "content": { "loggedIn": { @@ -1438,5 +1459,6 @@ }, "shareDashboard": false, "theme": "Default Theme", - "title": "Android IOT" -} \ No newline at end of file + "title": "Android IOT", + "defaultPriority": "5" +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml index 0d9518345..3619bedc6 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/artifacts.xml @@ -187,11 +187,7 @@ serverRole="DataAnalyticsServer"/> - - - + @@ -228,6 +226,8 @@ serverRole="DataAnalyticsServer"/> + @@ -239,6 +239,8 @@ serverRole="DataAnalyticsServer"/> + From c45a06b95a67912762e12b29ad8f5c889d355921 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 22 Dec 2016 16:34:45 +0530 Subject: [PATCH 5/8] New gadgets were added for Accelerometer, Gyroscope, Rotation and Magnetic field. --- .../ANDROID_ACCELEROMETER_GADGET/conf.json | 1 + .../gadget-controller.jag | 0 .../ANDROID_ACCELEROMETER_GADGET/gadget.json | 9 + .../ANDROID_ACCELEROMETER_GADGET}/gadget.xml | 6 +- .../js/core/gadget-core.js | 0 .../js/core/gadget-util.js | 35 +++ .../js/core/line-chart-api.js} | 39 ++- .../js/core/provider-client.js | 0 .../js/core/realtime-provider-api.js | 0 .../js/provider-libs/ws-client.js | 2 +- .../thumbnail.png | Bin .../android_accelerometer_gadget/artifact.xml | 23 ++ .../ANDROID_GYROSCOPE_GADGET/conf.json | 1 + .../gadget-controller.jag | 0 .../ANDROID_GYROSCOPE_GADGET/gadget.json | 9 + .../ANDROID_GYROSCOPE_GADGET}/gadget.xml | 6 +- .../js/core/gadget-core.js | 0 .../js/core/gadget-util.js | 2 +- .../js/core/line-chart-api.js} | 39 ++- .../js/core/provider-client.js | 0 .../js/core/realtime-provider-api.js | 0 .../js/provider-libs/ws-client.js | 2 +- .../ANDROID_GYROSCOPE_GADGET}/thumbnail.png | Bin .../artifact.xml | 4 +- .../ANDROID_MAGNETIC_GADGET/conf.json | 16 + .../gadget-controller.jag | 0 .../ANDROID_MAGNETIC_GADGET/gadget.json | 9 + .../ANDROID_MAGNETIC_GADGET}/gadget.xml | 6 +- .../js/core/gadget-core.js | 0 .../js/core/gadget-util.js | 2 +- .../js/core/line-chart-api.js} | 39 ++- .../js/core/provider-client.js | 0 .../js/core/realtime-provider-api.js | 0 .../js/provider-libs/ws-client.js | 2 +- .../ANDROID_MAGNETIC_GADGET}/thumbnail.png | Bin .../artifact.xml | 4 +- .../ANDROID_ROTATION_GADGET/conf.json | 16 + .../gadget-controller.jag | 42 +++ .../ANDROID_ROTATION_GADGET/gadget.json | 9 + .../ANDROID_ROTATION_GADGET/gadget.xml | 60 ++++ .../js/core/gadget-core.js | 64 ++++ .../js/core/gadget-util.js | 2 +- .../js/core/line-chart-api.js | 134 ++++++++ .../js/core/provider-client.js | 51 ++++ .../js/core/realtime-provider-api.js | 154 ++++++++++ .../js/provider-libs/ws-client.js | 287 ++++++++++++++++++ .../ANDROID_ROTATION_GADGET/thumbnail.png | Bin 0 -> 12971 bytes .../artifact.xml | 5 +- 48 files changed, 1031 insertions(+), 49 deletions(-) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET}/gadget-controller.jag (100%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget.json rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET}/gadget.xml (88%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET}/js/core/gadget-core.js (100%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/gadget-util.js rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/number-chart-api.js => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/line-chart-api.js} (76%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET}/js/core/provider-client.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET}/js/core/realtime-provider-api.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET}/js/provider-libs/ws-client.js (99%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET}/thumbnail.png (100%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/artifact.xml create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/gadget-controller.jag (100%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget.json rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/gadget.xml (88%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/js/core/gadget-core.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/js/core/gadget-util.js (98%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X/js/core/number-chart-api.js => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/line-chart-api.js} (76%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/js/core/provider-client.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/js/core/realtime-provider-api.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/js/provider-libs/ws-client.js (99%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET}/thumbnail.png (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget => android_gyroscope_gadget}/artifact.xml (82%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/gadget-controller.jag (100%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget.json rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/gadget.xml (88%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/js/core/gadget-core.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/js/core/gadget-util.js (98%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/number-chart-api.js => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/line-chart-api.js} (76%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/js/core/provider-client.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/js/core/realtime-provider-api.js (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/js/provider-libs/ws-client.js (99%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_z_gadget/ACCELEROMETER_Z => android_magnetic_gadget/ANDROID_MAGNETIC_GADGET}/thumbnail.png (100%) rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget => android_magnetic_gadget}/artifact.xml (82%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget-controller.jag create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.json create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.xml create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/gadget-core.js rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_x_gadget/Accelerometer_X => android_rotation_gadget/ANDROID_ROTATION_GADGET}/js/core/gadget-util.js (98%) create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/line-chart-api.js create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/provider-client.js create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/realtime-provider-api.js create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/provider-libs/ws-client.js create mode 100644 components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/thumbnail.png rename components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/{android_accelerometer_y_gadget => android_rotation_gadget}/artifact.xml (82%) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json new file mode 100644 index 000000000..3862cd4c4 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json @@ -0,0 +1 @@ +{"provider-conf" : {"streamName" : "org.wso2.iot.android.accelerometer:1.0.0", "provider-name" : "realtime"}, "chart-conf" : {"x" : "TIMESTAMP", "xType" : "time", "y" : "value", "yType" : "number", "color" : "axis", "maxLength" : "30", "gadget-name" : "ANDROID_ACCELETOMETER_GADGET", "chart-name" : "line-chart"}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget-controller.jag b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget-controller.jag similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget-controller.jag rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget-controller.jag diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget.json new file mode 100644 index 000000000..171958013 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget.json @@ -0,0 +1,9 @@ +{ + "id": "ANDROID_ACCELETOMETER_GADGET", + "title": "ANDROID_ACCELETOMETER_GADGET", + "type": "gadget", + "thumbnail": "gadget/ANDROID_ACCELETOMETER_GADGET/thumbnail.png", + "data": { + "url": "gadget/ANDROID_ACCELETOMETER_GADGET/gadget.xml" + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget.xml similarity index 88% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget.xml rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget.xml index 450b1bb05..2d138faeb 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/gadget.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/gadget.xml @@ -1,6 +1,6 @@ - + @@ -20,8 +20,6 @@ - - @@ -50,7 +48,7 @@ - + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/gadget-core.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/gadget-core.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/gadget-core.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/gadget-core.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/gadget-util.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/gadget-util.js new file mode 100644 index 000000000..c16d3af15 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/gadget-util.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var getGadgetLocation = function (callback) { + var gadgetLocation = "/portal/store/carbon.super/fs/gadget/ANDROID_ACCELEROMETER_GADGET"; + var PATH_SEPERATOR = "/"; + if (gadgetLocation.search("store") != -1) { + wso2.gadgets.identity.getTenantDomain(function (tenantDomain) { + var gadgetPath = gadgetLocation.split(PATH_SEPERATOR); + var modifiedPath = ''; + for (var i = 1; i < gadgetPath.length; i++) { + if (i === 3) { + modifiedPath = modifiedPath.concat(PATH_SEPERATOR, tenantDomain); + } else { + modifiedPath = modifiedPath.concat(PATH_SEPERATOR, gadgetPath[i]) + } + } + callback(modifiedPath); + }); + } else { + callback(gadgetLocation); + } +} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/number-chart-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/line-chart-api.js similarity index 76% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/number-chart-api.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/line-chart-api.js index ef2c5da98..18f363a32 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/number-chart-api.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/line-chart-api.js @@ -24,16 +24,30 @@ var getConfig, validate, isProviderRequired, draw, update; * @param schema */ getConfig = function(schema) { - var chartConf = require(CHART_LOCATION + '/number-chart/config.json').config; + var chartConf = require(CHART_LOCATION + '/line-chart/config.json').config; /* dynamic logic goes here */ - return chartConf; + var columns = []; + + columns.push("None"); + for(var i=0; i < schema.length; i++) { + columns.push(schema[i]["fieldName"]); + } + + for(var i=0; i < chartConf.length; i++) { + if (chartConf[i]["fieldName"] == "color") { + chartConf[i]["valueSet"] = columns; + break; + } + } + + return chartConf; }; /** - * validate the user inout for the chart configurationx + * validate the user inout for the chart configuration * @param chartConfig */ validate = function(chartConfig) { @@ -55,7 +69,9 @@ var getConfig, validate, isProviderRequired, draw, update; * @param data */ draw = function(placeholder, chartConfig, _schema, data) { + _schema = updateUserPrefXYTypes(_schema, chartConfig); var schema = toVizGrammarSchema(_schema); + var view = { id: "chart-0", schema: schema, @@ -93,19 +109,26 @@ var getConfig, validate, isProviderRequired, draw, update; */ update = function(data) { wso2gadgets.onDataReady(data,"append"); - } + }; buildChartConfig = function (_chartConfig) { var conf = {}; conf.x = _chartConfig.x; + conf.xType = _chartConfig.xType; + conf.yType = _chartConfig.yType; conf.maxLength = _chartConfig.maxLength; conf.charts = []; conf.charts[0] = { - type : "number", - title : _chartConfig.title + type : "line", + y: _chartConfig.y }; + + if (_chartConfig.color != "None") { + conf.charts[0].color = _chartConfig.color; + } + return conf; }; - -}()); + +}()); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/provider-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/provider-client.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/provider-client.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/provider-client.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/realtime-provider-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/realtime-provider-api.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/realtime-provider-api.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/core/realtime-provider-api.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/provider-libs/ws-client.js similarity index 99% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/provider-libs/ws-client.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/provider-libs/ws-client.js index fc49d8a35..760ecf951 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/js/provider-libs/ws-client.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/thumbnail.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/thumbnail.png similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/thumbnail.png rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/thumbnail.png diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/artifact.xml new file mode 100644 index 000000000..576b3ce0d --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/artifact.xml @@ -0,0 +1,23 @@ + + + + + ANDROID_ACCELEROMETER_GADGET + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json new file mode 100644 index 000000000..1433ef60f --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json @@ -0,0 +1 @@ +{"provider-conf" : {"streamName" : "org.wso2.iot.android.gyroscope:1.0.0", "provider-name" : "realtime"}, "chart-conf" : {"x" : "TIMESTAMP", "xType" : "time", "y" : "value", "yType" : "number", "color" : "axis", "maxLength" : "30", "gadget-name" : "ANDROID_GYROSCOPE_GADGET", "chart-name" : "line-chart"}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget-controller.jag b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget-controller.jag similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget-controller.jag rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget-controller.jag diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget.json new file mode 100644 index 000000000..dd6ccb149 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget.json @@ -0,0 +1,9 @@ +{ + "id": "ANDROID_GYROSCOPE_GADGET", + "title": "ANDROID_GYROSCOPE_GADGET", + "type": "gadget", + "thumbnail": "gadget/ANDROID_GYROSCOPE_GADGET/thumbnail.png", + "data": { + "url": "gadget/ANDROID_GYROSCOPE_GADGET/gadget.xml" + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget.xml similarity index 88% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget.xml rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget.xml index 8d098fb3e..f2dc17a74 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/gadget.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/gadget.xml @@ -1,6 +1,6 @@ - + @@ -20,8 +20,6 @@ - - @@ -50,7 +48,7 @@ - + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/gadget-core.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/gadget-core.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/gadget-core.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/gadget-core.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/gadget-util.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/gadget-util.js similarity index 98% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/gadget-util.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/gadget-util.js index ffdc7ddc1..77f1a1ffe 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/gadget-util.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/gadget-util.js @@ -14,7 +14,7 @@ * limitations under the License. */ var getGadgetLocation = function (callback) { - var gadgetLocation = "/portal/store/carbon.super/fs/gadget/ACCELEROMETER_Z"; + var gadgetLocation = "/portal/store/carbon.super/fs/gadget/ANDROID_GYROSCOPE_GADGET"; var PATH_SEPERATOR = "/"; if (gadgetLocation.search("store") != -1) { wso2.gadgets.identity.getTenantDomain(function (tenantDomain) { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/number-chart-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/line-chart-api.js similarity index 76% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/number-chart-api.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/line-chart-api.js index ef2c5da98..18f363a32 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/number-chart-api.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/line-chart-api.js @@ -24,16 +24,30 @@ var getConfig, validate, isProviderRequired, draw, update; * @param schema */ getConfig = function(schema) { - var chartConf = require(CHART_LOCATION + '/number-chart/config.json').config; + var chartConf = require(CHART_LOCATION + '/line-chart/config.json').config; /* dynamic logic goes here */ - return chartConf; + var columns = []; + + columns.push("None"); + for(var i=0; i < schema.length; i++) { + columns.push(schema[i]["fieldName"]); + } + + for(var i=0; i < chartConf.length; i++) { + if (chartConf[i]["fieldName"] == "color") { + chartConf[i]["valueSet"] = columns; + break; + } + } + + return chartConf; }; /** - * validate the user inout for the chart configurationx + * validate the user inout for the chart configuration * @param chartConfig */ validate = function(chartConfig) { @@ -55,7 +69,9 @@ var getConfig, validate, isProviderRequired, draw, update; * @param data */ draw = function(placeholder, chartConfig, _schema, data) { + _schema = updateUserPrefXYTypes(_schema, chartConfig); var schema = toVizGrammarSchema(_schema); + var view = { id: "chart-0", schema: schema, @@ -93,19 +109,26 @@ var getConfig, validate, isProviderRequired, draw, update; */ update = function(data) { wso2gadgets.onDataReady(data,"append"); - } + }; buildChartConfig = function (_chartConfig) { var conf = {}; conf.x = _chartConfig.x; + conf.xType = _chartConfig.xType; + conf.yType = _chartConfig.yType; conf.maxLength = _chartConfig.maxLength; conf.charts = []; conf.charts[0] = { - type : "number", - title : _chartConfig.title + type : "line", + y: _chartConfig.y }; + + if (_chartConfig.color != "None") { + conf.charts[0].color = _chartConfig.color; + } + return conf; }; - -}()); + +}()); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/provider-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/provider-client.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/provider-client.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/provider-client.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/realtime-provider-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/realtime-provider-api.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/realtime-provider-api.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/core/realtime-provider-api.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/provider-libs/ws-client.js similarity index 99% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/provider-libs/ws-client.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/provider-libs/ws-client.js index fc49d8a35..760ecf951 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/js/provider-libs/ws-client.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/thumbnail.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/thumbnail.png similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/thumbnail.png rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/thumbnail.png diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/artifact.xml similarity index 82% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/artifact.xml rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/artifact.xml index 91526382f..17c0b1a75 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/artifact.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/artifact.xml @@ -17,7 +17,7 @@ ~ under the License. --> - - ACCELEROMETER_Z + + ANDROID_GYROSCOPE_GADGET diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json new file mode 100644 index 000000000..8bb652b7c --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json @@ -0,0 +1,16 @@ +{ + "provider-conf": { + "streamName": "org.wso2.iot.android.magnetic:1.0.0", + "provider-name": "realtime" + }, + "chart-conf": { + "x": "TIMESTAMP", + "xType": "time", + "y": "value", + "yType": "number", + "color": "axis", + "maxLength": "30", + "gadget-name": "ANDROID_MAGNETIC_GADGET", + "chart-name": "line-chart" + } +} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget-controller.jag b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget-controller.jag similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget-controller.jag rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget-controller.jag diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget.json new file mode 100644 index 000000000..93efa3813 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget.json @@ -0,0 +1,9 @@ +{ + "id": "ANDROID_MAGNETIC_GADGET", + "title": "ANDROID_MAGNETIC_GADGET", + "type": "gadget", + "thumbnail": "gadget/ANDROID_MAGNETIC_GADGET/thumbnail.png", + "data": { + "url": "gadget/ANDROID_MAGNETIC_GADGET/gadget.xml" + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget.xml similarity index 88% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget.xml rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget.xml index 77802fd2d..e3a632324 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/gadget.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/gadget.xml @@ -1,6 +1,6 @@ - + @@ -20,8 +20,6 @@ - - @@ -50,7 +48,7 @@ - + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/gadget-core.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/gadget-core.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/gadget-core.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/gadget-core.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/gadget-util.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/gadget-util.js similarity index 98% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/gadget-util.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/gadget-util.js index 2ddc218d2..426dae39b 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/gadget-util.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/gadget-util.js @@ -14,7 +14,7 @@ * limitations under the License. */ var getGadgetLocation = function (callback) { - var gadgetLocation = "/portal/store/carbon.super/fs/gadget/ACCELEROMETER_Y"; + var gadgetLocation = "/portal/store/carbon.super/fs/gadget/ANDROID_MAGNETIC_GADGET"; var PATH_SEPERATOR = "/"; if (gadgetLocation.search("store") != -1) { wso2.gadgets.identity.getTenantDomain(function (tenantDomain) { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/number-chart-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/line-chart-api.js similarity index 76% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/number-chart-api.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/line-chart-api.js index ef2c5da98..18f363a32 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_y_gadget/ACCELEROMETER_Y/js/core/number-chart-api.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/line-chart-api.js @@ -24,16 +24,30 @@ var getConfig, validate, isProviderRequired, draw, update; * @param schema */ getConfig = function(schema) { - var chartConf = require(CHART_LOCATION + '/number-chart/config.json').config; + var chartConf = require(CHART_LOCATION + '/line-chart/config.json').config; /* dynamic logic goes here */ - return chartConf; + var columns = []; + + columns.push("None"); + for(var i=0; i < schema.length; i++) { + columns.push(schema[i]["fieldName"]); + } + + for(var i=0; i < chartConf.length; i++) { + if (chartConf[i]["fieldName"] == "color") { + chartConf[i]["valueSet"] = columns; + break; + } + } + + return chartConf; }; /** - * validate the user inout for the chart configurationx + * validate the user inout for the chart configuration * @param chartConfig */ validate = function(chartConfig) { @@ -55,7 +69,9 @@ var getConfig, validate, isProviderRequired, draw, update; * @param data */ draw = function(placeholder, chartConfig, _schema, data) { + _schema = updateUserPrefXYTypes(_schema, chartConfig); var schema = toVizGrammarSchema(_schema); + var view = { id: "chart-0", schema: schema, @@ -93,19 +109,26 @@ var getConfig, validate, isProviderRequired, draw, update; */ update = function(data) { wso2gadgets.onDataReady(data,"append"); - } + }; buildChartConfig = function (_chartConfig) { var conf = {}; conf.x = _chartConfig.x; + conf.xType = _chartConfig.xType; + conf.yType = _chartConfig.yType; conf.maxLength = _chartConfig.maxLength; conf.charts = []; conf.charts[0] = { - type : "number", - title : _chartConfig.title + type : "line", + y: _chartConfig.y }; + + if (_chartConfig.color != "None") { + conf.charts[0].color = _chartConfig.color; + } + return conf; }; - -}()); + +}()); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/provider-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/provider-client.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/provider-client.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/provider-client.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/realtime-provider-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/realtime-provider-api.js similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/js/core/realtime-provider-api.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/core/realtime-provider-api.js diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/provider-libs/ws-client.js similarity index 99% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/provider-libs/ws-client.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/provider-libs/ws-client.js index fc49d8a35..760ecf951 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/provider-libs/ws-client.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/js/provider-libs/ws-client.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/thumbnail.png b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/thumbnail.png similarity index 100% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_z_gadget/ACCELEROMETER_Z/thumbnail.png rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/thumbnail.png diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/artifact.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/artifact.xml similarity index 82% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/artifact.xml rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/artifact.xml index ca8d49f23..2d203339c 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/artifact.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/artifact.xml @@ -17,7 +17,7 @@ ~ under the License. --> - - Accelerometer_X + + ANDROID_MAGNETIC_GADGET diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json new file mode 100644 index 000000000..c4d09c437 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json @@ -0,0 +1,16 @@ +{ + "provider-conf": { + "streamName": "org.wso2.iot.android.rotation:1.0.0", + "provider-name": "realtime" + }, + "chart-conf": { + "x": "TIMESTAMP", + "xType": "time", + "y": "value", + "yType": "number", + "color": "axis", + "maxLength": "30", + "gadget-name": "ANDROID_ROTATION_GADGET", + "chart-name": "line-chart" + } +} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget-controller.jag b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget-controller.jag new file mode 100644 index 000000000..f84538a40 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget-controller.jag @@ -0,0 +1,42 @@ +<% +/** + * 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 () { + + response.contentType = 'application/json'; + var PROVIDER_CONF = 'provider-conf'; + var PROVIDER_NAME = 'provider-name'; + + var action = request.getParameter("action"); + var data = request.getContent(); + var providerConf = data[PROVIDER_CONF]; + var providerAPI = require('js/core/' + providerConf[PROVIDER_NAME] + '-provider-api.js'); + + if (action === 'getSchema') { + print(providerAPI.getSchema(providerConf)); + return; + } else if(action === 'getData'){ + print(providerAPI.getData(providerConf)); + return; + } + +}()); + + +%> diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.json new file mode 100644 index 000000000..1fbb053b4 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.json @@ -0,0 +1,9 @@ +{ + "id": "ANDROID_ROTATION_GADGET", + "title": "ANDROID_ROTATION_GADGET", + "type": "gadget", + "thumbnail": "gadget/ANDROID_ROTATION_GADGET/thumbnail.png", + "data": { + "url": "gadget/ANDROID_ROTATION_GADGET/gadget.xml" + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.xml new file mode 100644 index 000000000..3f050f24c --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/gadget.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ]]> +
+
diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/gadget-core.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/gadget-core.js new file mode 100644 index 000000000..8bfc5f742 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/gadget-core.js @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* Licensed 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 () { + var gadgetLocation; + var conf; + var schema; + var pref = new gadgets.Prefs(); + + var CHART_CONF = 'chart-conf'; + var PROVIDER_CONF = 'provider-conf'; + +var init = function () { + $.ajax({ + url: gadgetLocation + '/conf.json', + method: "GET", + contentType: "application/json", + async: false, + success: function (data) { + conf = JSON.parse(data); + $.ajax({ + url: gadgetLocation + '/gadget-controller.jag?action=getSchema', + method: "POST", + data: JSON.stringify(conf), + contentType: "application/json", + async: false, + success: function (data) { + schema = data; + } + }); + + } + }); +}; + + +var drawGadget = function (){ + + draw('#canvas', conf[CHART_CONF], schema, null); + registerCallBackforPush(conf[PROVIDER_CONF], schema, function(providerData) { + update(providerData); + }); + +}; + +getGadgetLocation(function (gadget_Location) { + gadgetLocation = gadget_Location; + init(); + drawGadget(); + +}); +}); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/gadget-util.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/gadget-util.js similarity index 98% rename from components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/gadget-util.js rename to components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/gadget-util.js index ccfb70698..8277d6ace 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_x_gadget/Accelerometer_X/js/core/gadget-util.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/gadget-util.js @@ -14,7 +14,7 @@ * limitations under the License. */ var getGadgetLocation = function (callback) { - var gadgetLocation = "/portal/store/carbon.super/fs/gadget/Accelerometer_X"; + var gadgetLocation = "/portal/store/carbon.super/fs/gadget/ANDROID_ROTATION_GADGET"; var PATH_SEPERATOR = "/"; if (gadgetLocation.search("store") != -1) { wso2.gadgets.identity.getTenantDomain(function (tenantDomain) { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/line-chart-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/line-chart-api.js new file mode 100644 index 000000000..18f363a32 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/line-chart-api.js @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var getConfig, validate, isProviderRequired, draw, update; + +(function() { + + var CHART_LOCATION = '/extensions/chart-templates/'; + + /** + * return the config to be populated in the chart configuration UI + * @param schema + */ + getConfig = function(schema) { + var chartConf = require(CHART_LOCATION + '/line-chart/config.json').config; + /* + dynamic logic goes here + */ + + var columns = []; + + columns.push("None"); + for(var i=0; i < schema.length; i++) { + columns.push(schema[i]["fieldName"]); + } + + for(var i=0; i < chartConf.length; i++) { + if (chartConf[i]["fieldName"] == "color") { + chartConf[i]["valueSet"] = columns; + break; + } + } + + return chartConf; + }; + + /** + * validate the user inout for the chart configuration + * @param chartConfig + */ + validate = function(chartConfig) { + return true; + }; + + /** + * TO be used when provider configuration steps need to be skipped + */ + isProviderRequired = function() { + + } + + + /** + * return the gadget content + * @param chartConfig + * @param schema + * @param data + */ + draw = function(placeholder, chartConfig, _schema, data) { + _schema = updateUserPrefXYTypes(_schema, chartConfig); + var schema = toVizGrammarSchema(_schema); + + var view = { + id: "chart-0", + schema: schema, + chartConfig: buildChartConfig(chartConfig), + data: function() { + if(data) { + var result = []; + console.log(data); + data.forEach(function(item) { + var row = []; + schema[0].metadata.names.forEach(function(name) { + row.push(item[name]); + }); + result.push(row); + }); + console.log(result); + wso2gadgets.onDataReady(result); + } + } + + }; + + try { + wso2gadgets.init(placeholder, view); + var view = wso2gadgets.load("chart-0"); + } catch (e) { + console.error(e); + } + + }; + + /** + * + * @param data + */ + update = function(data) { + wso2gadgets.onDataReady(data,"append"); + }; + + buildChartConfig = function (_chartConfig) { + var conf = {}; + conf.x = _chartConfig.x; + conf.xType = _chartConfig.xType; + conf.yType = _chartConfig.yType; + conf.maxLength = _chartConfig.maxLength; + conf.charts = []; + conf.charts[0] = { + type : "line", + y: _chartConfig.y + }; + + if (_chartConfig.color != "None") { + conf.charts[0].color = _chartConfig.color; + } + + return conf; + }; + + +}()); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/provider-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/provider-client.js new file mode 100644 index 000000000..6196677f6 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/provider-client.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// var registerCallBackforPush; + +(function() { + + var callback; + + /** + * TODO Need to read hostname,port, and tenantId from providerConfig + * @param providerConfig + * @param schema + */ + registerCallBackforPush = function(providerConfig, schema, _callback) { + var streamId = providerConfig['streamName']; + var hostname = window.parent.location.hostname; + var port = window.parent.location.port; + + subscribe(streamId.split(":")[0], streamId.split(":")[1], + '10', + onData, onError, + hostname, + port, + 'WEBSOCKET' + ); + callback = _callback; + }; + + function onData(streamId, data) { + callback(data); + }; + + function onError(error) { + console.error(error); + }; + +}()); + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/realtime-provider-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/realtime-provider-api.js new file mode 100644 index 000000000..7cf59af77 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/core/realtime-provider-api.js @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush; + +(function() { + + var PROVIDERS_LOCATION = '/extensions/providers/'; + var PROVIDER_NAME = 'realtime'; + + var log = new Log(); + var utils = require('/modules/utils.js'); + var carbon = require("carbon"); + var EventPublisherConstants = Packages.org.wso2.carbon.event.publisher.core.config.EventPublisherConstants; + var eventPublisherService = carbon.server.osgiService('org.wso2.carbon.event.publisher.core.EventPublisherService'); + var eventStreamService = carbon.server.osgiService('org.wso2.carbon.event.stream.core.EventStreamService'); + + var typeMap = { + "bool": "string", + "boolean": "string", + "string": "string", + "int": "number", + "integer": "number", + "long": "number", + "double": "number", + "float": "number", + "time": "time" + }; + + getConfig = function() { + var formConfig = require(PROVIDERS_LOCATION + '/' + PROVIDER_NAME + '/config.json'); + var datasources = []; + try { + var eventPublisherConfigurationList = eventPublisherService.getAllActiveEventPublisherConfigurations(); + for (var i = 0; i < eventPublisherConfigurationList.size(); i++) { + var eventPublisherConfiguration = eventPublisherService.getActiveEventPublisherConfiguration( + eventPublisherConfigurationList.get(i).getEventPublisherName());; + + var mappingTypeIsWso2 = eventPublisherConfiguration.getOutputMapping() + .getMappingType().equals(EventPublisherConstants.EF_WSO2EVENT_MAPPING_TYPE); + + var adapterType = null; + if (eventPublisherConfiguration.getToAdapterConfiguration() != null) { + adapterType = eventPublisherConfiguration.getToAdapterConfiguration().getType(); + } + if (mappingTypeIsWso2 && adapterType.trim() == "ui") { + var streamName = eventPublisherConfiguration.getFromStreamName(); + var streamVersion = eventPublisherConfiguration.getFromStreamVersion(); + var streamId = streamName + ":" + streamVersion; + datasources.push(streamId); + } + } + var datasourceCfg = { + "fieldLabel": "Event Stream", + "fieldName": "streamName", + "fieldType": "dropDown" + }; + datasourceCfg['valueSet'] = datasources; + } catch (e) { + log.error(e); + } + formConfig.config.push(datasourceCfg); + return formConfig; + }; + + /** + * validate the user input of provider configuration + * @param providerConfig + */ + validate = function(providerConfig) { + /* + validate the form and return + + */ + return true; + }; + + /** + * returns the data mode either push or pull + */ + getMode = function() { + return 'push'; + }; + + /** + * returns an array of column names & types + * @param providerConfig + */ + getSchema = function(providerConfig) { + var streamId = providerConfig["streamName"]; + var output = []; + + output.push({ + fieldName: "TIMESTAMP", + fieldType: "time" + }); + + if (eventStreamService != null) { + var eventStreamConfiguration = eventStreamService.getEventStreamConfiguration(streamId); + if (eventStreamConfiguration != null) { + var metaData = eventStreamConfiguration.getStreamDefinition().getMetaData(); + var correlationData = eventStreamConfiguration.getStreamDefinition().getCorrelationData(); + var payloadData = eventStreamConfiguration.getStreamDefinition().getPayloadData(); + if (metaData != null) { + for (var i = 0; i < metaData.size(); i++) { + var type = metaData.get(i).getType().toString().toLowerCase(); + output.push({ + fieldName: metaData.get(i).getName(), + fieldType: typeMap[type.toLowerCase()] + }); + } + } + if (correlationData != null) { + for (var i = 0; i < correlationData.size(); i++) { + var type = correlationData.get(i).getType().toString().toLowerCase(); + output.push({ + fieldName: correlationData.get(i).getName(), + fieldType: typeMap[type.toLowerCase()] + }); + } + } + if (payloadData != null) { + for (var i = 0; i < payloadData.size(); i++) { + var type = payloadData.get(i).getType().toString().toLowerCase(); + output.push({ + fieldName: payloadData.get(i).getName(), + fieldType: typeMap[type.toLowerCase()] + }); + } + } + } + } + return output; + }; + + getData = function(providerConfig,limit) { + var data = []; + return data; + }; + + +}()); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/provider-libs/ws-client.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/provider-libs/ws-client.js new file mode 100644 index 000000000..e498158c6 --- /dev/null +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/js/provider-libs/ws-client.js @@ -0,0 +1,287 @@ +/* + * 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. + */ + +var CONSTANTS = { + urlSeperator: '/', + queryParamStreamName : '?streamname=', + queryParamStreamVersion : '&version=', + queryParamLastUpdatedTime : '&lastUpdatedTime=', + urlSecureTransportWebsocket : 'wss://', + urlSecureTransportHttp : 'https://', + colon : ':', + defaultIntervalTime : 10 * 1000, + defaultHostName : 'localhost', + defaultSecurePortNumber : '9443', + defaultMode : 'AUTO', + processModeHTTP : 'HTTP', + processModeWebSocket : 'WEBSOCKET', + processModeAuto : 'AUTO', + numThousand : 1000, + websocketTimeAppender : 400, + websocketSubscriptionEndpoint : 'portal/uipublisher/websocketSubscriptionEndpoint.jag', + httpEventRetrievalEndpoint : 'portal/uipublisher/httpEventRetrievalEndpoint.jag' +}; + + +var websocket = null; +var webSocketUrl; +var httpUrl; +var cepHostName; +var cepPortNumber; +var isErrorOccured = false; +var lastUpdatedtime = -1; +var polingInterval; +var stream; +var streamVersion; +var firstPollingAttempt; +var processMode; +var onSuccessFunction; +var onErrorFunction; +var terminateWebsocketInstance = false; +var pollingContinue = true; + +function subscribe(streamName,version,intervalTime, + listeningFuncSuccessData,listeningFuncErrorData,cepHost,cepPort,mode){ + stopPollingProcesses(); + stream = streamName; + streamVersion = version; + onSuccessFunction = listeningFuncSuccessData; + onErrorFunction = listeningFuncErrorData; + + if(intervalTime == null || intervalTime == ""){ + polingInterval = CONSTANTS.defaultIntervalTime; + } else{ + polingInterval = intervalTime * CONSTANTS.numThousand; + } + + if(cepHost == null || cepHost == ""){ + cepHostName = CONSTANTS.defaultHostName; + } else{ + cepHostName = cepHost; + } + + if(cepPort == null || cepPort == ""){ + cepPortNumber = CONSTANTS.defaultSecurePortNumber; + } else{ + cepPortNumber = cepPort; + } + + if(mode == null || mode == ""){ + processMode = CONSTANTS.defaultMode; + } else{ + processMode = mode; + } + + webSocketUrl = CONSTANTS.urlSecureTransportWebsocket + cepHostName + CONSTANTS.colon + cepPortNumber + + CONSTANTS.urlSeperator + CONSTANTS.websocketSubscriptionEndpoint; + + if(processMode == CONSTANTS.processModeHTTP){ + firstPollingAttempt = true; + pollingContinue = true; + startPoll(); + } else{ + initializeWebSocket(webSocketUrl); + } +} + +/** + * Initializing Web Socket + */ +function initializeWebSocket(webSocketUrl){ + websocket = new WebSocket(webSocketUrl); + websocket.onopen = webSocketOnOpen; + websocket.onmessage = webSocketOnMessage; + websocket.onclose = webSocketOnClose; + websocket.onerror = webSocketOnError; +} + +function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProperties, streamValues) { + if (streamProperties.length === streamValues.length) { + var message = {}; + message.streamName = streamName; + message.streamVersion = streamVersion; + var i; + for (i = 0; i < streamProperties.length; i++) { + message.filterProps = []; + message.filterProps.push({ + 'name': streamProperties[i], + 'value': streamValues[i] + }); + } + return JSON.stringify(message); + } else { + console.log('stream properties and values are not in equal size'); + } +} + +/** + * Get the parameters as query parameters. + * This method parses those parameters and returns. + * */ +function getAllQueryParamsFromURL() { + var queryParamList = {}, qParam; + var urlQueryString = decodeURIComponent(window.top.location.search.substring(1)); + + if (urlQueryString) { + var queryStringPairs = urlQueryString.split('&'); + for (var i = 0; i < queryStringPairs.length; i++) { + qParam = queryStringPairs[i].split('='); + queryParamList[qParam[0]] = qParam[1]; + } + return queryParamList; + + } else { + return null; + } +} + +/** + * Web socket On Open + */ +var webSocketOnOpen = function () { + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params) { + owner = params["owner"]; + deviceId = params["deviceId"]; + } + var filterPropNames = ["meta_owner", "meta_deviceId"]; + var filterPropVals = [owner, deviceId]; + var data = getWebsocketSubscriptionMessage(stream, streamVersion, filterPropNames, filterPropVals); + websocket.send(data); +}; + +/** + * On server sends a message + */ +var webSocketOnMessage = function (evt) { + var event = evt.data; + var array = JSON.parse(event); + constructPayload(array); +}; + +/** + * On server close + */ +var webSocketOnClose =function (e) { + + if(isErrorOccured){ + if(processMode != CONSTANTS.processModeWebSocket){ + firstPollingAttempt = true; + pollingContinue = true; + startPoll(); + } + } else{ + if(!terminateWebsocketInstance){ + waitForSocketConnection(websocket); + } else{ + terminateWebsocketInstance = false; + } + + } +}; + +/** + * On server Error + */ +var webSocketOnError = function (err) { + var error = "Error: Cannot connect to Websocket URL:" + webSocketUrl + " .Hence closing the connection!"; + + onErrorFunction(error); + isErrorOccured = true; + +}; + +/** + * Gracefully increments the connection retry + */ +var waitTime = CONSTANTS.numThousand; +function waitForSocketConnection(socket, callback){ + setTimeout( + function () { + if (socket.readyState === 1) { + initializeWebSocket(webSocketUrl); + console.log("Connection is made"); + if(callback != null){ + callback(); + } + return; + } else { + websocket = new WebSocket(webSocketUrl); + waitTime += CONSTANTS.websocketTimeAppender; + waitForSocketConnection(websocket, callback); + } + }, waitTime); +} + +/** + * Polling to retrieve events from http request periodically + */ +function startPoll(){ + + (function poll(){ + setTimeout(function(){ + httpUrl = CONSTANTS.urlSecureTransportHttp + cepHostName + CONSTANTS.colon + cepPortNumber + + CONSTANTS.urlSeperator + CONSTANTS.httpEventRetrievalEndpoint + CONSTANTS.queryParamStreamName + stream + + CONSTANTS.queryParamStreamVersion + streamVersion + CONSTANTS.queryParamLastUpdatedTime + lastUpdatedtime;; + $.getJSON(httpUrl, function(responseText) { + if(firstPollingAttempt){ + /*var data = $("textarea#idConsole").val(); + $("textarea#idConsole").val(data + "Successfully connected to HTTP.");*/ + firstPollingAttempt = false; + } + var eventList = $.parseJSON(responseText.events); + if(eventList.length != 0){ + lastUpdatedtime = responseText.lastEventTime; + for(var i=0;i6ENwLKbHK%kA<`(x^{)D1Reg9MG9tc_-Egx1={;5qJRZK>84v$jP&HbszdA)mFe z8YxD{C?RABvsh~jSSwJEHOvG_yz`xUd1IKpn1pYU+_i2+w33gksr`K6)H?j6FcJ1@n>syQ{bCo10f_Rexqr_C!u4OGP zm}49-uVh3xP8*r1AnPo@qz8Pqo~i+bfXrQVE0ecEL6?G}Mf zVKTcPIO(@od!3PGsZy~Tpo+zW05-)vtW69?eJU(2rzN|7rukbA(vqD&)BY1>F?Wsa zvKrB-F3st}o~>zA=jN2xG(A`~>@(J8vS(fIY!)*WtHBY3-4M88A7^cfmG2dmo?%2d zLf>pVL<@HupU0cw&?yVScT2O9Aiq%7W#M&R&GvBBPQqKs&ZUhYN z2ec7G3R@1B(7%7!OCPM?Puq{2tas`|w-!z4^1kip>Omc-XUj}0U&V;>BzyKN6hY#g zAnXQ=XD<(v+Y==hY`oSHoj4begJ?+n(bRr<)F_u71A54_Hdg5o~MQic*J0{+;~n$n$Rnc(vlKnzP3Um$~;Ao z7$=BkW6U6TP%j{$HqBVDmFBG7Mdld^L0rl&l3(n$k7zw-!qCjJfmGd|1$QuelK#Y6Lc3N3* zl>Yd|My^Ih8p#QE9-{y{=QQTMvj;s|WinO9KP0ug=oA~-YU3!|e?Cd2XR7JwsWVY? zD^Kd(h7)B-evZuUGc}^bEkWWvP}q;PS6CYuXeY!e9{YR)e+@U_O6|}rgS}?(U|qN7 zO{haoBOa3oB|H&&kfz{RDJK(xl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?p-lj@b%)N<(~ ztAikGUux~G`ldoDf<)#fqAt@2jVz<y4{K(^%2PF=oR2|ECs8I3`Yrx>J~&D hXH@SWyZC - - ACCELEROMETER_Y + + ANDROID_ROTATION_GADGET - From 2fcaf12373a9bcaf01dec3eae62c4ffca7dced06 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 22 Dec 2016 16:42:48 +0530 Subject: [PATCH 6/8] Code reformatting. --- .../ANDROID_ACCELEROMETER_GADGET/conf.json | 17 ++++++++++++++++- .../Android_Battery_Percentage_Chart/conf.json | 2 +- .../ANDROID_GYROSCOPE_GADGET/conf.json | 17 ++++++++++++++++- .../ANDROID_MAGNETIC_GADGET/conf.json | 2 +- .../ANDROID_ROTATION_GADGET/conf.json | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json index 3862cd4c4..174f60c9d 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_accelerometer_gadget/ANDROID_ACCELEROMETER_GADGET/conf.json @@ -1 +1,16 @@ -{"provider-conf" : {"streamName" : "org.wso2.iot.android.accelerometer:1.0.0", "provider-name" : "realtime"}, "chart-conf" : {"x" : "TIMESTAMP", "xType" : "time", "y" : "value", "yType" : "number", "color" : "axis", "maxLength" : "30", "gadget-name" : "ANDROID_ACCELETOMETER_GADGET", "chart-name" : "line-chart"}} \ No newline at end of file +{ + "provider-conf": { + "streamName": "org.wso2.iot.android.accelerometer:1.0.0", + "provider-name": "realtime" + }, + "chart-conf": { + "x": "TIMESTAMP", + "xType": "time", + "y": "value", + "yType": "number", + "color": "axis", + "maxLength": "30", + "gadget-name": "ANDROID_ACCELETOMETER_GADGET", + "chart-name": "line-chart" + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/conf.json index f8111bc8e..292ad0734 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/conf.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_percentage_chart_gadget/Android_Battery_Percentage_Chart/conf.json @@ -10,4 +10,4 @@ "provider-name": "realtime", "streamName": "org.wso2.iot.android.battery:1.0.0" } -} \ No newline at end of file +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json index 1433ef60f..4da39ae5c 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_gyroscope_gadget/ANDROID_GYROSCOPE_GADGET/conf.json @@ -1 +1,16 @@ -{"provider-conf" : {"streamName" : "org.wso2.iot.android.gyroscope:1.0.0", "provider-name" : "realtime"}, "chart-conf" : {"x" : "TIMESTAMP", "xType" : "time", "y" : "value", "yType" : "number", "color" : "axis", "maxLength" : "30", "gadget-name" : "ANDROID_GYROSCOPE_GADGET", "chart-name" : "line-chart"}} \ No newline at end of file +{ + "provider-conf": { + "streamName": "org.wso2.iot.android.gyroscope:1.0.0", + "provider-name": "realtime" + }, + "chart-conf": { + "x": "TIMESTAMP", + "xType": "time", + "y": "value", + "yType": "number", + "color": "axis", + "maxLength": "30", + "gadget-name": "ANDROID_GYROSCOPE_GADGET", + "chart-name": "line-chart" + } +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json index 8bb652b7c..53199e326 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_magnetic_gadget/ANDROID_MAGNETIC_GADGET/conf.json @@ -13,4 +13,4 @@ "gadget-name": "ANDROID_MAGNETIC_GADGET", "chart-name": "line-chart" } -} \ No newline at end of file +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json index c4d09c437..aa1954d40 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_rotation_gadget/ANDROID_ROTATION_GADGET/conf.json @@ -13,4 +13,4 @@ "gadget-name": "ANDROID_ROTATION_GADGET", "chart-name": "line-chart" } -} \ No newline at end of file +} From 77b5d2422c5dcefdb5faa22433fa317d14db30ab Mon Sep 17 00:00:00 2001 From: madhawap Date: Thu, 22 Dec 2016 17:53:47 +0530 Subject: [PATCH 7/8] Task operation config related changes --- .../main/resources/devicetypes/android.xml | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml index 271dcd78b..f3a949c11 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/devicetypes/android.xml @@ -24,16 +24,32 @@ en_US 1.0.0 - This End User License Agreement ("Agreement") is a legal agreement between you ("You") and WSO2, Inc., regarding the enrollment of Your personal mobile device ("Device") in SoR's mobile device management program, and the loading to and removal from Your Device and Your use of certain applications and any associated software and user documentation, whether provided in "online" or electronic format, used in connection with the operation of or provision of services to WSO2, Inc., BY SELECTING "I ACCEPT" DURING INSTALLATION, YOU ARE ENROLLING YOUR DEVICE, AND THEREBY AUTHORIZING SOR OR ITS AGENTS TO INSTALL, UPDATE AND REMOVE THE APPS FROM YOUR DEVICE AS DESCRIBED IN THIS AGREEMENT. YOU ARE ALSO EXPLICITLY ACKNOWLEDGING AND AGREEING THAT (1) THIS IS A BINDING CONTRACT AND (2) YOU HAVE READ AND AGREE TO THE TERMS OF THIS AGREEMENT. + This End User License Agreement ("Agreement") is a legal agreement between you ("You") and WSO2, + Inc., regarding the enrollment of Your personal mobile device ("Device") in SoR's mobile device + management program, and the loading to and removal from Your Device and Your use of certain + applications and any associated software and user documentation, whether provided in "online" or + electronic format, used in connection with the operation of or provision of services to WSO2, + Inc., BY SELECTING "I ACCEPT" DURING INSTALLATION, YOU ARE ENROLLING YOUR DEVICE, AND THEREBY + AUTHORIZING SOR OR ITS AGENTS TO INSTALL, UPDATE AND REMOVE THE APPS FROM YOUR DEVICE AS DESCRIBED + IN THIS AGREEMENT. YOU ARE ALSO EXPLICITLY ACKNOWLEDGING AND AGREEING THAT (1) THIS IS A BINDING + CONTRACT AND (2) YOU HAVE READ AND AGREE TO THE TERMS OF THIS AGREEMENT. IF YOU DO NOT ACCEPT THESE TERMS, DO NOT ENROLL YOUR DEVICE AND DO NOT PROCEED ANY FURTHER. - You agree that: (1) You understand and agree to be bound by the terms and conditions contained in this Agreement, and (2) You are at least 21 years old and have the legal capacity to enter into this Agreement as defined by the laws of Your jurisdiction. SoR shall have the right, without prior notice, to terminate or suspend (i) this Agreement, (ii) the enrollment of Your Device, or (iii) the functioning of the Apps in the event of a violation of this Agreement or the cessation of Your relationship with SoR (including termination of Your employment if You are an employee or expiration or termination of Your applicable franchise or supply agreement if You are a franchisee of or supplier to the WSO2 WSO2, Inc., system). SoR expressly reserves all rights not expressly granted herein. + You agree that: (1) You understand and agree to be bound by the terms and conditions contained in + this Agreement, and (2) You are at least 21 years old and have the legal capacity to enter into + this Agreement as defined by the laws of Your jurisdiction. SoR shall have the right, without + prior notice, to terminate or suspend (i) this Agreement, (ii) the enrollment of Your Device, or + (iii) the functioning of the Apps in the event of a violation of this Agreement or the cessation + of Your relationship with SoR (including termination of Your employment if You are an employee or + expiration or termination of Your applicable franchise or supply agreement if You are a franchisee + of or supplier to the WSO2 WSO2, Inc., system). SoR expressly reserves all rights not expressly + granted herein. - false + true @@ -314,13 +330,13 @@ Unlock the device - + //Name needs to be decided true - 60000 + 60000 //Name needs to be decided DEVICE_INFO - 1 + 1 //Name needs to be decided APPLICATION_LIST From a4841d87ba5739c4fb75a9ee1a7f792ac7c8c5ab Mon Sep 17 00:00:00 2001 From: charitha Date: Thu, 22 Dec 2016 18:31:05 +0530 Subject: [PATCH 8/8] Add custom email template for android --- .../services/DeviceManagementService.java | 77 ++++--------------- .../impl/DeviceManagementServiceImpl.java | 19 ----- .../android/util/AndroidAPIUtils.java | 14 +++- .../android-enrollment-invitation.vm | 6 +- 4 files changed, 30 insertions(+), 86 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java index 04fcb4677..4bf71b564 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java @@ -18,22 +18,20 @@ */ package org.wso2.carbon.mdm.services.android.services; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Authorization; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Extension; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Info; import io.swagger.annotations.ResponseHeader; - +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Tag; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; @@ -41,7 +39,15 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; @@ -199,57 +205,6 @@ public interface DeviceManagementService { value = "Properties to update the device operations and their status.") List resultOperations); - @POST - @Path("/invite") - @ApiOperation( - produces = MediaType.APPLICATION_JSON, - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Send enrollment invitation for android device", - tags = "Android Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/enroll/invite/android", - description = "Send device enrollment invitation") } - ) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Invited. \n Successfully sent invitations.", - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding a new device.") - }) - Response sendEnrollmentInvitation(@ApiParam( - name = "EmailConfig", - value = "The properties required to send device enrollment invitation.") - @Valid EmailMetaInfo metaInfo); - @POST @ApiOperation( produces = MediaType.APPLICATION_JSON, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index 815210af9..409dcd758 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -29,7 +29,6 @@ import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; -import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidApplication; import org.wso2.carbon.mdm.services.android.bean.wrapper.AndroidDevice; @@ -173,24 +172,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return Response.status(Response.Status.CREATED).entity(pendingOperations).build(); } - @POST - @Path("/invite") - @Override - public Response sendEnrollmentInvitation(EmailMetaInfo metaInfo) { - try { - AndroidAPIUtils.getDeviceManagementService() - .sendEnrolmentInvitation("android-enrollment-invitation", metaInfo); - Message responseMessage = new Message(); - responseMessage.setResponseCode(Response.Status.OK.toString()); - responseMessage.setResponseMessage("Enrollment invitations sent."); - return Response.status(Response.Status.OK).entity(responseMessage).build(); - } catch (DeviceManagementException e) { - log.error(e.getMessage(), e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(e.getMessage()).build()); - } - } - private void updateOperations(String deviceId, List operations) throws OperationManagementException, PolicyComplianceException, ApplicationManagementException, NotificationManagementException, DeviceManagementException { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java index 9e8d1306b..9399eb996 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java @@ -18,19 +18,27 @@ package org.wso2.carbon.mdm.services.android.util; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.analytics.api.AnalyticsDataAPI; +import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse; import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry; -import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; import org.wso2.carbon.analytics.datasource.commons.Record; import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.analytics.data.publisher.service.EventsPublisherService; -import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm index 48d23fcb4..206f74cc8 100644 --- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/email/templates/android-enrollment-invitation.vm @@ -34,12 +34,12 @@

- Hi $first-name, + Hi,

- You have been invited to enrol your android device in WSO2 IoT Server. - Click here to begin device enrolment from + You have been invited by $first-name to enrol your android device in WSO2 IoT Server. + Click here to begin device enrolment from your Android device.