Persisting battery data stream and added analytics scripts.

revert-dabc3590
Menaka Jayawardena 8 years ago
parent 68270525ab
commit 779435a91d

@ -17,7 +17,8 @@
~ under the License.
-->
<artifact name= "android_android_call_executionplan" version="1.0.0" type="event/execution-plan" serverRole="DataAnalyticsServer">
<artifact name= "android_android_battery_executionplan" version="1.0.0" type="event/execution-plan"
serverRole="DataAnalyticsServer">
<file>Android-Battery-ExecutionPlan.siddhiql</file>
</artifact>

@ -158,10 +158,9 @@ var webSocketOnOpen = function () {
var params = getAllQueryParamsFromURL();
var deviceId;
var owner;
if (params != null) {
if (params) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Analytics>
<Editable>true</Editable>
<Name>AndriodCallScript</Name>
<Script> CREATE TEMPORARY TABLE AndroidBatteryData USING CarbonAnalytics OPTIONS(tableName
"ORG_WSO2_IOT_ANDROID_BATTERY_STATS", incrementalParams "ORG_WSO2_IOT_ANDROID_BATTERY_STATS, DAY");
CREATE TEMPORARY TABLE Android_Battery_Stat_Per_Day USING CarbonAnalytics
OPTIONS (tableName "Android_Battery_Stat_Per_Day",
schema "owner STRING, deviceId STRING, type STRING, level INT -i, year INT -i, month INT -i, day INT -i,
timestamp STRING", primaryKeys "year, month, day, deviceId, owner, type", mergeSchema "false");
INSERT INTO TABLE Android_Battery_Stat_Per_Day
SELECT meta_owner as owner, meta_deviceId as deviceId, type, avg(level) as level, year, month, day,
getDateStartingTime(year, month, day) as timestamp
FROM AndroidBatteryData
GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC;
INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_BATTERY_STATS;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics>

@ -17,7 +17,7 @@
~ under the License.
-->
<artifact name= "android_battery_level_chart_gadget" version="1.0.0" type="dashboards/gadget" serverRole="DataAnalyticsServer">
<file>Android_Battery_Level_Chart</file>
<artifact name= "android_battery_script" version="1.0.0" type="analytics/spark" serverRole="DataAnalyticsServer">
<file>AndroidBatteryScript.xml</file>
</artifact>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<artifact name= "android_battery_stats_event_sink" version="1.0.0" type="analytics/eventstore"
serverRole="DataAnalyticsServer">
<file>org_wso2_iot_android_battery_stats.xml</file>
</artifact>

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EventStoreConfiguration>
<TableSchema>
<ColumnDefinition>
<Name>meta_owner</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_deviceId</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_timestamp</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>LONG</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>level</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>INTEGER</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>state</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>status</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>LONG</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>temperature</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>INTEGER</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>year</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>INTEGER</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>month</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>INTEGER</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>day</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>INTEGER</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>hour</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>INTEGER</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>minute</Name>
<IsFacet>false</IsFacet>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>INTEGER</Type>
</ColumnDefinition>
</TableSchema>
<Source>
<StreamId>org.wso2.iot.android.battery.stats:1.0.0</StreamId>
</Source>
<MergeSchema>false</MergeSchema>
<RecordStoreName>PROCESSED_DATA_STORE</RecordStoreName>
</EventStoreConfiguration>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<artifact name= "android_battery_stats_streams" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<file>org.wso2.iot.android.battery.stats_1.0.0.json</file>
</artifact>

@ -0,0 +1,58 @@
{
"name": "org.wso2.iot.android.battery.stats",
"version": "1.0.0",
"nickName": "",
"description": "",
"metaData": [
{
"name": "owner",
"type": "STRING"
},
{
"name": "deviceId",
"type": "STRING"
},
{
"name": "timestamp",
"type": "LONG"
}
],
"payloadData": [
{
"name": "level",
"type": "INT"
},
{
"name": "state",
"type": "STRING"
},
{
"name": "status",
"type": "STRING"
},
{
"name": "temperature",
"type": "INT"
},
{
"name": "year",
"type": "INT"
},
{
"name": "month",
"type": "INT"
},
{
"name": "day",
"type": "INT"
},
{
"name": "hour",
"type": "INT"
},
{
"name": "minute",
"type": "INT"
}
]
}

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<artifact name= "android_battery_stats_ui_event_publisher" version="1.0.0" type="event/publisher"
serverRole="DataAnalyticsServer">
<file>org.wso2.iot.android.battery.stats.ui.publisher.xml</file>
</artifact>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<eventPublisher name="org.wso2.iot.android.battery.stats.ui.publisher"
processing="enable" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
<from streamName="org.wso2.iot.android.battery.stats" version="1.0.0"/>
<mapping customMapping="disable" type="wso2event"/>
<to eventAdapterType="ui"/>
</eventPublisher>

@ -158,10 +158,9 @@ var webSocketOnOpen = function () {
var params = getAllQueryParamsFromURL();
var deviceId;
var owner;
if (params != null) {
if (params) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];

@ -158,10 +158,9 @@ var webSocketOnOpen = function () {
var params = getAllQueryParamsFromURL();
var deviceId;
var owner;
if (params != null) {
if (params) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];

@ -158,10 +158,9 @@ var webSocketOnOpen = function () {
var params = getAllQueryParamsFromURL();
var deviceId;
var owner;
if (params != null) {
if (params) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];

@ -158,10 +158,9 @@ var webSocketOnOpen = function () {
var params = getAllQueryParamsFromURL();
var deviceId;
var owner;
if (params != null) {
if (params) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];

@ -158,10 +158,9 @@ var webSocketOnOpen = function () {
var params = getAllQueryParamsFromURL();
var deviceId;
var owner;
if (params != null) {
if (params) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];

@ -158,10 +158,9 @@ var webSocketOnOpen = function () {
var params = getAllQueryParamsFromURL();
var deviceId;
var owner;
if (params != null) {
if (params) {
owner = params["owner"];
deviceId = params["deviceId"];
}
var filterPropNames = ["meta_owner", "meta_deviceId"];
var filterPropVals = [owner, deviceId];

@ -586,9 +586,9 @@
{
"content": {
"data": {
"url": "fs://gadget/Android_Battery_Level_Chart/gadget.xml"
"url": "fs://gadget/Android_Battery_History_Chart/gadget.xml"
},
"id": "Android_Battery_Level_Chart",
"id": "Android_Battery_History_Chart",
"locale_titles": {
"en-US": "History"
},
@ -611,11 +611,11 @@
"title": "History",
"titlePosition": "center"
},
"thumbnail": "fs://gadget/Android_Battery_Level_Chart/thumbnail.png",
"title": "Android Battery Level Chart",
"thumbnail": "fs://gadget/Android_Battery_History_Chart/thumbnail.png",
"title": "Android Battery Hisory Chart",
"type": "gadget"
},
"id": "Android_Battery_Level_Chart-0"
"id": "Android_Battery_History_Chart-0"
}
],
"e": [

@ -56,11 +56,20 @@
<dependency artifact="android_audio_streams" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_level_chart_gadget" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_history_chart_gadget" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_percentage_chart_gadget" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_script" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_stats_event_sink" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_stats_streams" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_streams" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_ui_event_publisher" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_battery_stats_ui_event_publisher" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_call_script" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_call_stats_event_sink" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>

Loading…
Cancel
Save