Added android sense battery execution plan.

revert-dabc3590
Menaka Jayawardena 8 years ago
parent 0e32b646d3
commit 2bd3c4a50c

@ -0,0 +1,19 @@
@Plan:name('Android-Battery-ExecutionPlan')
@Plan:description('Find the battery status of the android device.')
@Import('org.wso2.iot.android.battery:1.0.0')
define stream BatteryStream (meta_owner string, meta_deviceId string, meta_timestamp long, level int, state string, status string, temperature int);
@Export('org.wso2.iot.android.battery.stats:1.0.0')
define stream BatteryStatsStream (meta_owner string, meta_deviceId string, meta_timestamp long, level int, state
string, status string, temperature int, year int, month int, day int, hour int, minute int);
partition with (meta_deviceId of BatteryStream)
begin
from BatteryStream
select meta_owner, meta_deviceId, meta_timestamp, level, state, status, temperature, time:extract(preState.meta_timestamp, 'year') as year, time:extract(preState.meta_timestamp, 'month') as month, time:extract(preState.meta_timestamp, 'day') as day, time:extract(preState.meta_timestamp, 'hour') as hour, time:extract(preState.meta_timestamp, 'minute') as minute
insert into BatteryStatsStream;
end;

@ -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_android_call_executionplan" version="1.0.0" type="event/execution-plan" serverRole="DataAnalyticsServer">
<file>Android-Battery-ExecutionPlan.siddhiql</file>
</artifact>

@ -38,6 +38,8 @@
serverRole="DataAnalyticsServer"/> serverRole="DataAnalyticsServer"/>
<dependency artifact="android_android_audio_executionplan" version="1.0.0" include="true" <dependency artifact="android_android_audio_executionplan" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/> serverRole="DataAnalyticsServer"/>
<dependency artifact="android_android_battery_executionplan" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<dependency artifact="android_android_call_executionplan" version="1.0.0" include="true" <dependency artifact="android_android_call_executionplan" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/> serverRole="DataAnalyticsServer"/>
<dependency artifact="android_android_data_executionplan" version="1.0.0" include="true" <dependency artifact="android_android_data_executionplan" version="1.0.0" include="true"

@ -280,11 +280,7 @@ public class AndroidSenseServiceImpl implements AndroidSenseService {
if (added) { if (added) {
AndroidConfiguration androidConfiguration = new AndroidConfiguration(); AndroidConfiguration androidConfiguration = new AndroidConfiguration();
androidConfiguration.setTenantDomain(APIUtil.getAuthenticatedUserTenantDomain()); androidConfiguration.setTenantDomain(APIUtil.getAuthenticatedUserTenantDomain());
String mqttEndpoint = DEFAULT_MQTT_ENDPOINT; androidConfiguration.setMqttEndpoint(APIUtil.getMqttEndpoint());
if (mqttEndpoint.contains(AndroidSenseConstants.LOCALHOST)) {
mqttEndpoint = mqttEndpoint.replace(AndroidSenseConstants.LOCALHOST, APIUtil.getServerUrl());
}
androidConfiguration.setMqttEndpoint(mqttEndpoint);
return Response.ok(androidConfiguration.toString()).build(); return Response.ok(androidConfiguration.toString()).build();
} else { } else {
return Response.status(Response.Status.NOT_ACCEPTABLE.getStatusCode()).entity(false).build(); return Response.status(Response.Status.NOT_ACCEPTABLE.getStatusCode()).entity(false).build();

Loading…
Cancel
Save