|
|
@ -18,14 +18,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl;
|
|
|
|
package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import io.swagger.annotations.SwaggerDefinition;
|
|
|
|
import io.swagger.annotations.*;
|
|
|
|
import io.swagger.annotations.Info;
|
|
|
|
|
|
|
|
import io.swagger.annotations.ExtensionProperty;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Extension;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Tag;
|
|
|
|
|
|
|
|
import org.wso2.carbon.apimgt.annotations.api.Scope;
|
|
|
|
import org.wso2.carbon.apimgt.annotations.api.Scope;
|
|
|
|
|
|
|
|
import org.wso2.carbon.apimgt.annotations.api.Scopes;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.ws.rs.*;
|
|
|
|
import javax.ws.rs.*;
|
|
|
|
|
|
|
|
import javax.ws.rs.core.MediaType;
|
|
|
|
import javax.ws.rs.core.Response;
|
|
|
|
import javax.ws.rs.core.Response;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -50,8 +48,20 @@ import javax.ws.rs.core.Response;
|
|
|
|
@Tag(name = "virtual_firealarm", description = "")
|
|
|
|
@Tag(name = "virtual_firealarm", description = "")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
@Scopes(
|
|
|
|
|
|
|
|
scopes = {
|
|
|
|
|
|
|
|
@Scope(
|
|
|
|
|
|
|
|
name = "Enroll device",
|
|
|
|
|
|
|
|
description = "",
|
|
|
|
|
|
|
|
key = "perm:firealarm:enroll",
|
|
|
|
|
|
|
|
permissions = {"/device-mgt/devices/enroll/firealarm"}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
public interface VirtualFireAlarmService {
|
|
|
|
public interface VirtualFireAlarmService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String SCOPE = "scope";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to
|
|
|
|
* This is an API called/used from within the Server(Front-End) or by a device Owner. It sends a control command to
|
|
|
|
* the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used
|
|
|
|
* the VirtualFirealarm device to switch `ON` or `OFF` its buzzer. The method also takes in the protocol to be used
|
|
|
@ -63,7 +73,19 @@ public interface VirtualFireAlarmService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@POST
|
|
|
|
@POST
|
|
|
|
@Path("device/{deviceId}/buzz")
|
|
|
|
@Path("device/{deviceId}/buzz")
|
|
|
|
@Scope(key = "device:firealarm:enroll", name = "", description = "")
|
|
|
|
@ApiOperation(
|
|
|
|
|
|
|
|
consumes = MediaType.APPLICATION_JSON,
|
|
|
|
|
|
|
|
httpMethod = "POST",
|
|
|
|
|
|
|
|
value = "Switch Buzzer",
|
|
|
|
|
|
|
|
notes = "",
|
|
|
|
|
|
|
|
response = Response.class,
|
|
|
|
|
|
|
|
tags = "virtual_firealarm",
|
|
|
|
|
|
|
|
extensions = {
|
|
|
|
|
|
|
|
@Extension(properties = {
|
|
|
|
|
|
|
|
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
Response switchBuzzer(@PathParam("deviceId") String deviceId,
|
|
|
|
Response switchBuzzer(@PathParam("deviceId") String deviceId,
|
|
|
|
@FormParam("state") String state);
|
|
|
|
@FormParam("state") String state);
|
|
|
|
|
|
|
|
|
|
|
@ -72,7 +94,19 @@ public interface VirtualFireAlarmService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Path("device/stats/{deviceId}")
|
|
|
|
@Path("device/stats/{deviceId}")
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Scope(key = "device:firealarm:enroll", name = "", description = "")
|
|
|
|
@ApiOperation(
|
|
|
|
|
|
|
|
consumes = MediaType.APPLICATION_JSON,
|
|
|
|
|
|
|
|
httpMethod = "GET",
|
|
|
|
|
|
|
|
value = "Retrieve Sensor data for the device type",
|
|
|
|
|
|
|
|
notes = "",
|
|
|
|
|
|
|
|
response = Response.class,
|
|
|
|
|
|
|
|
tags = "virtual_firealarm",
|
|
|
|
|
|
|
|
extensions = {
|
|
|
|
|
|
|
|
@Extension(properties = {
|
|
|
|
|
|
|
|
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
@Consumes("application/json")
|
|
|
|
@Consumes("application/json")
|
|
|
|
@Produces("application/json")
|
|
|
|
@Produces("application/json")
|
|
|
|
Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
|
|
|
|
Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from,
|
|
|
@ -81,7 +115,19 @@ public interface VirtualFireAlarmService {
|
|
|
|
@Path("device/download")
|
|
|
|
@Path("device/download")
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Produces("application/zip")
|
|
|
|
@Produces("application/zip")
|
|
|
|
@Scope(key = "device:firealarm:enroll", name = "", description = "")
|
|
|
|
@ApiOperation(
|
|
|
|
|
|
|
|
consumes = MediaType.APPLICATION_JSON,
|
|
|
|
|
|
|
|
httpMethod = "GET",
|
|
|
|
|
|
|
|
value = "Download agent",
|
|
|
|
|
|
|
|
notes = "",
|
|
|
|
|
|
|
|
response = Response.class,
|
|
|
|
|
|
|
|
tags = "virtual_firealarm",
|
|
|
|
|
|
|
|
extensions = {
|
|
|
|
|
|
|
|
@Extension(properties = {
|
|
|
|
|
|
|
|
@ExtensionProperty(name = SCOPE, value = "perm:firealarm:enroll")
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
|
|
|
|
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|