diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml index eb937c2430..b54801592c 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml @@ -20,5 +20,8 @@ + + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql index a6808ef149..e20970b98a 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql @@ -6,10 +6,10 @@ /* define streams/tables and write queries here ... */ -@Import('org.wso2.iot.raspberrypi:1.0.0') +@Import('iot.per.device.stream.raspberrypi:1.0.0') define stream raspberrypi (meta_owner string, meta_deviceId string, meta_time long, temperature float); -@Export('org.wso2.iot.devices.temperature:1.0.0') +@Export('iot.per.device.stream.raspberrypi.temperature:1.0.0') define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float); from raspberrypi diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/artifact.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/artifact.xml new file mode 100644 index 0000000000..7002e5f4d2 --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/artifact.xml @@ -0,0 +1,22 @@ + + + + + temperature_publisher.xml + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/temperature_publisher.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/temperature_publisher.xml new file mode 100644 index 0000000000..5f8afc4f12 --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/temperature_publisher.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/artifact.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/artifact.xml new file mode 100644 index 0000000000..b3d58b879d --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/artifact.xml @@ -0,0 +1,22 @@ + + + + + iot_per_device_stream_raspberrypi_temperature.xml + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/iot_per_device_stream_raspberrypi_temperature.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/iot_per_device_stream_raspberrypi_temperature.xml new file mode 100644 index 0000000000..9d3d2621c4 --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/iot_per_device_stream_raspberrypi_temperature.xml @@ -0,0 +1,62 @@ + + + + + + iot.per.device.stream.raspberrypi.temperature:1.0.0 + + EVENT_STORE + + + meta_owner + true + true + false + STRING + + + meta_deviceType + true + true + false + STRING + + + meta_deviceId + true + true + false + STRING + + + meta_time + true + true + false + LONG + + + temperature + false + false + false + FLOAT + + + \ No newline at end of file diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/artifact.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/artifact.xml new file mode 100644 index 0000000000..4526dfd73b --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/artifact.xml @@ -0,0 +1,23 @@ + + + + + iot.per.device.stream.raspberrypi.temperature_1.0.0.json + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/iot.per.device.stream.raspberrypi.temperature_1.0.0.json b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/iot.per.device.stream.raspberrypi.temperature_1.0.0.json new file mode 100644 index 0000000000..212705222b --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/iot.per.device.stream.raspberrypi.temperature_1.0.0.json @@ -0,0 +1,20 @@ +{ + "name": "iot.per.device.stream.raspberrypi.temperature", + "version": "1.0.0", + "nickName": "Temperature Data", + "description": "Temperature data received from the Device", + "metaData": [ + {"name":"owner","type":"STRING"}, + {"name":"deviceType","type":"STRING"}, + {"name":"deviceId","type":"STRING"}, + {"name":"time","type":"LONG"} + ], + "payloadData": [ + { + "name": "temperature","type": "FLOAT" + } + ] +} + + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiServiceImpl.java b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiServiceImpl.java index fdd36862ae..93999db63f 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiServiceImpl.java +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/RaspberryPiServiceImpl.java @@ -112,8 +112,8 @@ public class RaspberryPiServiceImpl implements RaspberryPiService { @QueryParam("from") long from, @QueryParam("to") long to) { String fromDate = String.valueOf(from); String toDate = String.valueOf(to); - String query = "deviceId:" + deviceId + " AND deviceType:" + - RaspberrypiConstants.DEVICE_TYPE + " AND time : [" + fromDate + " TO " + toDate + "]"; + String query = "meta_deviceId:" + deviceId + " AND meta_deviceType:" + + RaspberrypiConstants.DEVICE_TYPE + " AND meta_time : [" + fromDate + " TO " + toDate + "]"; String sensorTableName = RaspberrypiConstants.TEMPERATURE_EVENT_TABLE; try { if (!APIUtil.getDeviceAccessAuthorizationService().isUserAuthorized(new DeviceIdentifier(deviceId, diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java index 5936cfb352..c19928ab74 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/service/impl/constants/RaspberrypiConstants.java @@ -26,7 +26,7 @@ public class RaspberrypiConstants { public static final String BULB_CONTEXT = "BULB"; //sensor events summerized table name - public static final String TEMPERATURE_EVENT_TABLE = "DEVICE_TEMPERATURE_SUMMARY"; + public static final String TEMPERATURE_EVENT_TABLE = "IOT_PER_DEVICE_STREAM_RASPBERRYPI_TEMPERATURE"; //mqtt tranport related constants public static final String MQTT_ADAPTER_TOPIC_PROPERTY_NAME = "mqtt.adapter.topic"; diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js index 674dd8a590..29416c5afe 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js @@ -42,7 +42,7 @@ function onRequest(context) { if (tokenPair) { token = tokenPair.accessToken; } - websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.temperature/1.0.0?" + websocketEndpoint = websocketEndpoint + "/secured-websocket/iot.per.device.stream.raspberrypi.temperature/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; } else { var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + user.domain @@ -50,7 +50,7 @@ function onRequest(context) { if (tokenPair) { token = tokenPair.accessToken; } - websocketEndpoint = websocketEndpoint + "/secured-websocket/t/" + user.domain + "/org.wso2.iot.devices.temperature/1.0.0?" + websocketEndpoint = websocketEndpoint + "/secured-websocket/t/" + user.domain + "/iot.per.device.stream.raspberrypi.temperature/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; } diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java index 0f83aa4d1f..1e732c752e 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentConstants.java @@ -120,17 +120,6 @@ public class AgentConstants { public static final String XMPP_PROTOCOL = "XMPP"; public static final String CEP_FILE_NAME = "cep_query.txt"; - public static final String CEP_QUERY = "define stream fireAlarmEventStream (deviceID string, temp int);\n" + - "from fireAlarmEventStream#window.time(30 sec)\n" + - "select deviceID, max(temp) as maxValue\n" + - "group by deviceID\n" + - "insert into analyzeStream for expired-events;\n" + - "from analyzeStream[maxValue > 50]\n" + - "select maxValue\n" + - "insert into bulbOnStream;\n" + - "from fireAlarmEventStream[temp < 50]\n" + - "select deviceID, temp\n" + - "insert into bulbOffStream;"; public static final String XMPP_SERVER_NAME_PROPERTY = "xmpp-server-name"; diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/sidhdhi/SidhdhiQuery.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/sidhdhi/SidhdhiQuery.java index 94e6bd525f..66829bbdfd 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/sidhdhi/SidhdhiQuery.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/sidhdhi/SidhdhiQuery.java @@ -70,7 +70,7 @@ public class SidhdhiQuery implements Runnable { File f = new File(sidhdhiQueryPath); if (!f.exists()) { - AgentUtilOperations.writeToFile(AgentConstants.CEP_QUERY, sidhdhiQueryPath); + AgentUtilOperations.writeToFile("", sidhdhiQueryPath); } StartExecutionPlan startExecutionPlan = new StartExecutionPlan().invoke(); 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 774fe4fc5c..50085f8de9 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 @@ -4,279 +4,91 @@ {{#if deviceFound}} {{#if isAuthorized}} - {{#zone "device-details-header"}} -

- Device {{device.name}} - {{#if device.model}} - - ( {{device.vendor}} {{device.model}} ) - - {{/if}} -

+ {{#zone "device-thumbnail"}} + {{/zone}} - {{#zone "overview-section"}} -
-
Device - Overview -
- - - {{#if device.deviceIdentifier}} - - - - - {{/if}} - {{#if device.name}} - - - - - {{/if}} - {{#if device.vendor}} - {{#if device.model}} - - - - - {{/if}} - {{/if}} - {{#if device.status}} - - - - - {{/if}} - {{#if device.owner}} - - - - - {{/if}} - {{#if device.ownership}} - - - - - {{/if}} - {{#if device.imei}} - - - - - {{/if}} - {{#if device.udid}} - - - - - {{/if}} - {{#if device.osBuildDate}} - - - - - {{/if}} - {{#if device.phoneNumber}} - - - - - {{/if}} - {{#if device.lastUpdatedTime}} - - - - - {{/if}} - -
Device ID{{device.deviceIdentifier}}
Name{{device.name}}
Model{{device.vendor}} - {{device.model}}
Status - {{#equal device.status "ACTIVE"}}Active{{/equal}} - {{#equal device.status "INACTIVE"}}Inactive{{/equal}} - {{#equal device.status "BLOCKED"}}Blocked{{/equal}} - {{#equal device.status "REMOVED"}}Removed{{/equal}} - {{#equal device.status "UNREACHABLE"}}Unreachable{{/equal}} -
Owner{{device.owner}}
Ownership{{device.ownership}}
IMEI{{device.imei}}
UDID{{device.udid}}
Firmware Build - Date - {{device.osBuildDate}}
Phone Number{{device.phoneNumber}}
Last Update{{device.lastUpdatedTime}}
-
+ {{#zone "device-details-header"}} +

+ {{device.owner}}'s {{device.name}} + + + +

+ {{#if device.model}} +

{{device.vendor}} {{device.model}}

+ {{/if}} +

Ownership - {{device.ownership}}

+

Device is + + {{#equal device.status "ACTIVE"}}Active{{/equal}} + {{#equal device.status "INACTIVE"}}Inactive{{/equal}} + {{#equal device.status "BLOCKED"}}Blocked{{/equal}} + {{#equal device.status "REMOVED"}}Removed{{/equal}} + {{#equal device.status "UNREACHABLE"}}Unreachable{{/equal}} + +

{{/zone}} - {{#zone "device-opetations"}} {{#if device.isNotRemoved}} -
- Operations -
-
+
+
+

Device Operations

+
{{unit "cdmf.unit.device.type.android.operation-bar" device=device backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}}
{{/if}} {{/zone}} - {{#zone "device-details-tab-injected"}} - - - + {{#zone "device-details"}} + {{#if device.deviceInfoAvailable}} + {{#if device.BatteryLevel}} +

{{device.BatteryLevel.value}}%

+ {{/if}} + {{#if device.ramUsage}} +

{{device.ramUsage.value}}%

+ {{/if}} + {{#if device.internalMemory}} +

{{device.internalMemory.usage}} + GB/{{device.internalMemory.total}}GB

+ {{/if}} + {{#if device.externalMemory}} +

{{device.externalMemory.usage}} + GB/{{device.externalMemory.total}}GB

+ {{/if}} + {{else}} +

Battery, RAM and Storage related information are not + available yet.

+ {{/if}} {{/zone}} - {{#zone "device-details-tab-contents"}} -
- - -
-
-
- - {{#if device.deviceInfoAvailable}} - {{#if device.BatteryLevel}} -
-
-
-
BATTERY
-
-
-
- {{device.BatteryLevel - .value}} % -
-
-
-
-
- {{/if}} - - - - - - - - - - - - - - - - {{#if device.ramUsage}} -
-
-
-
RAM Usage
-
-
-
- {{device.ramUsage - .value}} % -
-
-
-
-
- {{/if}} - {{#if device.internalMemory}} -
-
-
-
Local Storage
-
-
-
-
- {{device.internalMemory - .usage}} % - - TOTAL OF {{device.internalMemory - .total}} GB - -
-
-
-
-
- {{/if}} - {{#if device.externalMemory}} -
-
-
-
External Storage
-
-
-
- {{device.externalMemory - .usage}} % - - TOTAL OF {{device.externalMemory - .total}} GB - -
-
-
-
-
- {{/if}} - {{else}} -
-

- - Battery, RAM and Storage related information are not - available yet. -

-
- {{/if}} -
-
-
-
+ {{#zone "device-details-tab-injected"}} +
  • Location
  • +
  • Applications
  • +
  • Policy Compliance
  • {{/zone}} {{#zone "device-view-tab-injected-conents"}} +
    + +
    +
    +
    +
    +
    +
    +
    +
    +