diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql index 13f71ac3f..b6fa8cc04 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_call_executionplan/Android-Call-ExecutionPlan.siddhiql @@ -11,7 +11,7 @@ define stream CallStatsStream (meta_owner string, meta_deviceId string, meta_tim partition with (meta_deviceId of CallStream) begin - from CallStream[type == 'INCOMING' OR type == 'OUTGOING'] + from CallStream select meta_owner, meta_deviceId, meta_timestamp, number, type, (endTime - startTime) as duration, 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 CallStatsStream; 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_battery_level_chart_gadget/Android_Battery_Level_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_level_chart_gadget/Android_Battery_Level_Chart/js/provider-libs/ws-client.js index 4c78cf9d1..135f0881e 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_battery_level_chart_gadget/Android_Battery_Level_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_level_chart_gadget/Android_Battery_Level_Chart/js/provider-libs/ws-client.js @@ -130,13 +130,41 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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); }; 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 6d7f393c2..c62651037 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 @@ -130,13 +130,41 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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); }; diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_map_gadget/Android_Location_Map/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_location_map_gadget/Android_Location_Map/js/provider-libs/ws-client.js index 8757e44dc..c4b8a7dea 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_map_gadget/Android_Location_Map/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_location_map_gadget/Android_Location_Map/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; - var data = getWebsocketSubscriptionMessage(stream, streamVersion, [], []); + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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 */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_audio_gadget/Android_Realtime_Audio/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_realtime_audio_gadget/Android_Realtime_Audio/js/provider-libs/ws-client.js index 4c78cf9d1..c62651037 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_audio_gadget/Android_Realtime_Audio/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_realtime_audio_gadget/Android_Realtime_Audio/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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 */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_battery_gadget/Android_Realtime_Battery/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_realtime_battery_gadget/Android_Realtime_Battery/js/provider-libs/ws-client.js index 4c78cf9d1..c62651037 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_battery_gadget/Android_Realtime_Battery/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_realtime_battery_gadget/Android_Realtime_Battery/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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 */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_call_gadget/Android_Realtime_Call/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_realtime_call_gadget/Android_Realtime_Call/js/provider-libs/ws-client.js index 61bc55543..b24b3d350 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_call_gadget/Android_Realtime_Call/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_realtime_call_gadget/Android_Realtime_Call/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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 */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_data_gadget/Android_Realtime_Data/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_realtime_data_gadget/Android_Realtime_Data/js/provider-libs/ws-client.js index 4c78cf9d1..c62651037 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_data_gadget/Android_Realtime_Data/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_realtime_data_gadget/Android_Realtime_Data/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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 */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_screen_gadget/Android_Realtime_Screen/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_realtime_screen_gadget/Android_Realtime_Screen/js/provider-libs/ws-client.js index 4c78cf9d1..c62651037 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_screen_gadget/Android_Realtime_Screen/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_realtime_screen_gadget/Android_Realtime_Screen/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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 */ diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_sms_gadget/Android_Realtime_SMS/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_realtime_sms_gadget/Android_Realtime_SMS/js/provider-libs/ws-client.js index e62c073ba..c4b8a7dea 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_realtime_sms_gadget/Android_Realtime_SMS/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_realtime_sms_gadget/Android_Realtime_SMS/js/provider-libs/ws-client.js @@ -130,18 +130,45 @@ function getWebsocketSubscriptionMessage(streamName, streamVersion, streamProper } } +/** + * 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 filterPropNames = ["meta_deviceId"]; - var filterPropVals = ["htc"]; + var params = getAllQueryParamsFromURL(); + var deviceId; + var owner; + if (params != null) { + 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 */