Skip to content

Commit

Permalink
Merge pull request #220 from ayyoob/merge-latest
Browse files Browse the repository at this point in the history
Merged IoT plugins
  • Loading branch information
prabathabey committed Mar 31, 2016
2 parents 45512be + 95aeb68 commit 205045a
Show file tree
Hide file tree
Showing 278 changed files with 9,697 additions and 7,255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.manager.api</artifactId>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - Android Sense Management API</name>
<description>WSO2 Carbon - Android Sense Management Service-API Implementation</description>
<name>WSO2 Carbon - Android Sense API</name>
<description>WSO2 Carbon - Android Sense Service-API Implementation</description>
<url>http://wso2.org</url>


<dependencies>
<!-- CDM -->
<dependency>
Expand Down Expand Up @@ -97,7 +96,7 @@

<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.analytics</artifactId>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher</artifactId>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -196,7 +195,7 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>android_sense_mgt</warName>
<warName>android_sense</warName>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
/*
* 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.
*/

package org.wso2.carbon.device.mgt.iot.androidsense.service.impl;

import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType;
import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature;
import org.wso2.carbon.device.mgt.iot.androidsense.service.impl.util.DeviceData;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@DeviceType(value = "android_sense")
@API(name = "android_sense", version = "1.0.0", context = "/android_sense", tags = {"android_sense"})
public interface AndroidSenseControllerService {

/**
* Service to push all the sensor data collected by the Android. Called by the Android device
*
* @param dataMsg The json string containing sensor readings
*/
@Path("device/sensors")
@POST
@Consumes(MediaType.APPLICATION_JSON)
Response addSensorData(DeviceData dataMsg);

/**
* End point which is called by Front-end js to get Light sensor readings from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/light")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "light", name = "Light", description = "Read Light data from the device", type = "monitor")
Response getLightData(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Battery data from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/battery")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "battery", name = "Battery", description = "Read Battery data from the device", type = "monitor")
Response getBattery(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get GPS data from the server.
*
* @param deviceId The registered device id call to this API.
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/gps")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "gps", name = "gps", description = "Read GPS data from the device", type = "monitor")
Response getGPS(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Magnetic data readings from the server.
*
* @param deviceId The registered device id
* call to this API.
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/magnetic")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "magnetic", name = "Magnetic", description = "Read Magnetic data from the device", type = "monitor")
Response readMagnetic(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Accelerometer data from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/accelerometer")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "accelerometer", name = "Accelerometer", description = "Read Accelerometer data from the device",
type = "monitor")
Response readAccelerometer(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Rotation data from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/rotation")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "rotation", name = "Rotation", description = "Read Rotational Vector data from the device",
type = "monitor")
Response readRotation(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Proximity data from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/proximity")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "proximity", name = "Proximity", description = "Read Proximity data from the device",
type = "monitor")
Response readProximity(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Gyroscope data from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/gyroscope")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "gyroscope", name = "Gyroscope", description = "Read Gyroscope data from the device",
type = "monitor")
Response readGyroscope(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Pressure data from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/pressure")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "pressure", name = "Pressure", description = "Read Pressure data from the device", type = "monitor")
Response readPressure(@PathParam("deviceId") String deviceId);

/**
* End point which is called by Front-end js to get Gravity data from the server.
*
* @param deviceId The registered device id
* @return This method returns a SensorRecord object.
*/
@Path("device/{deviceId}/sensors/gravity")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "gravity", name = "Gravity",
description = "Read Gravity data from the device", type = "monitor")
Response readGravity(@PathParam("deviceId") String deviceId);

@Path("device/{deviceId}/sensors/words")
@GET
@Consumes("application/json")
@Produces("application/json")
@Feature(code = "words", name = "Words", description = "Get the key words and occurrences",
type = "monitor")
Response getWords(@PathParam("deviceId") String deviceId, @QueryParam("sessionId") String sessionId);

/**
* End point to send the key words to the device
*
* @param deviceId The registered device Id.
* @param keywords The key words to be sent. (Comma separated values)
*/
@Path("device/{deviceId}/sensors/words")
@POST
@Feature(code = "keywords", name = "Add Keywords", description = "Send keywords to the device",
type = "operation")
Response sendKeyWords(@PathParam("deviceId") String deviceId, @FormParam("keywords") String keywords);

/**
* End point to send the key words to the device
*
* @param deviceId The registered device Id.
* @param threshold The key words to be sent. (Comma separated values)
*/
@Path("device/{deviceId}/sensors/words/threshold")
@POST
@Feature(code = "threshold", name = "Add a Threshold", description = "Set a threshold for word in the device",
type = "operation")
Response sendThreshold(@PathParam("deviceId") String deviceId, @FormParam("threshold") String threshold);

@Path("device/{deviceId}/sensors/words")
@DELETE
@Feature(code = "remove", name = "Remove Keywords", description = "Remove the keywords",
type = "operation")
Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words);

/**
* Retrieve Sensor data for the device type
*/
@Path("stats/device/{deviceId}/sensors/{sensorName}")
@GET
@Consumes("application/json")
@Produces("application/json")
Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor,
@QueryParam("from") long from, @QueryParam("to") long to);

}
Loading

0 comments on commit 205045a

Please sign in to comment.