forked from community/device-mgt-plugins
Merge pull request #52 from GPrathap/IoTS-1.0.0-M1
Io ts 1.0.0 m1
commit
af63452cf7
60
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneRealTimeService.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneRealTimeService.java
60
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneRealTimeService.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneRealTimeService.java
367
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneService.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneService.java
367
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneService.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/DroneService.java
0
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/exception/DroneAnalyzerException.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/exception/DroneAnalyzerException.java
0
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/exception/DroneAnalyzerException.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/exception/DroneAnalyzerException.java
73
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneAnalyzerXMPPConnector.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneAnalyzerXMPPConnector.java
73
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneAnalyzerXMPPConnector.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneAnalyzerXMPPConnector.java
4
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneXMPPConnector.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneXMPPConnector.java
4
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneXMPPConnector.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/transport/DroneXMPPConnector.java
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.droneanalyzer.service.trasformer;
|
||||
|
||||
|
||||
import org.apache.commons.collections4.queue.CircularFifoQueue;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.codehaus.jackson.JsonNode;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.constants.DroneConstants;
|
||||
import org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.constants.MessageConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class MessageTransformer {
|
||||
|
||||
private Log log = LogFactory.getLog(MessageTransformer.class);
|
||||
private CircularFifoQueue<String> sharedQueue;
|
||||
|
||||
private String outbound_message_format_for_simulator = "{\"quatanium_val\":[%f, %f, %f, %f]," +
|
||||
"\"basicParam\":{\"velocity\":[%f, %f, %f], \"global_location\":[%f, %f, %f]},\"battery_level\":%f, \"device_type\":\"IRIS_DRONE\"}";
|
||||
private String outbound_message_format_for_iris_drone = "{\"quatanium_val\":[%f, %f, %f]," +
|
||||
"\"basicParam\":{\"velocity\":[%f, %f, %f], \"global_location\":[%f, %f, %f]},\"battery_level\":%f," +
|
||||
"\"device_type\":\"SIMULATOR\"}";
|
||||
|
||||
public MessageTransformer(){
|
||||
sharedQueue = new CircularFifoQueue<String>(DroneConstants.MAXIMUM_BUFFERE_SIZE_OF_SHARED_QUEUE);
|
||||
}
|
||||
|
||||
private void messageTranslaterForSimulator(JsonNode inbound_message){
|
||||
JsonNode node = inbound_message;
|
||||
String outbound_message;
|
||||
|
||||
try {
|
||||
JsonNode velocity = node.get(MessageConfig.OUT_BASIC_PARAM_VAL).get(MessageConfig.OUT_BASIC_PARAM_VELOCITY);
|
||||
JsonNode global_location = node.get(MessageConfig.OUT_BASIC_PARAM_VAL).get(
|
||||
MessageConfig.OUT_BASIC_PARAM_GLOBAL_LOCATION);
|
||||
JsonNode quatanium_vals = node.get(MessageConfig.OUT_QUATANNIM_VAL);
|
||||
JsonNode battery_level = node.get(MessageConfig.OUT_BATTERY_LEVEL);
|
||||
outbound_message = String.format(outbound_message_format_for_simulator, sTd(quatanium_vals.get(0)),
|
||||
sTd(quatanium_vals.get(1)), sTd(quatanium_vals.get(2)), sTd(quatanium_vals.get(0)),
|
||||
sTd(velocity.get(0)), sTd(velocity.get(1)), sTd(velocity.get(2)), sTd(global_location.get(0)),
|
||||
sTd(global_location.get(1)), sTd(global_location.get(2)), sTd(battery_level));
|
||||
sharedQueue.add(outbound_message);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage()+",\n"+ e);
|
||||
}
|
||||
}
|
||||
|
||||
private void messageTranslaterForIRISDrone(JsonNode inbound_message){
|
||||
JsonNode node = inbound_message;
|
||||
String outbound_message;
|
||||
try {
|
||||
|
||||
JsonNode velocity = node.get(MessageConfig.OUT_BASIC_PARAM_VAL).get(MessageConfig.OUT_BASIC_PARAM_VELOCITY);
|
||||
System.out.println("-------1----------");
|
||||
JsonNode global_location = node.get(MessageConfig.OUT_BASIC_PARAM_VAL).get(
|
||||
MessageConfig.OUT_BASIC_PARAM_GLOBAL_LOCATION);
|
||||
System.out.println("-------2----------");
|
||||
JsonNode quatanium_vals = node.get(MessageConfig.OUT_QUATANNIM_VAL);
|
||||
JsonNode battery_level = node.get(MessageConfig.OUT_BATTERY_LEVEL);
|
||||
System.out.println("-------3----------");
|
||||
|
||||
outbound_message = String.format(outbound_message_format_for_iris_drone, sTd(quatanium_vals.get(0)),
|
||||
sTd(quatanium_vals.get(1)), sTd(quatanium_vals.get(2)), sTd(velocity.get(0)),
|
||||
sTd(velocity.get(1)), sTd(velocity.get(2)), sTd(global_location.get(0)),
|
||||
sTd(global_location.get(1)), sTd(global_location.get(2)), sTd(battery_level));
|
||||
|
||||
System.out.println("-----------------IRIS_DRONE---------------------"+ outbound_message);
|
||||
|
||||
sharedQueue.add(outbound_message);
|
||||
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage()+",\n"+ e);
|
||||
System.out.println( e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void messageTranslater(String inbound_message){
|
||||
JsonNode actualMessage = null;
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
try {
|
||||
actualMessage = objectMapper.readValue(inbound_message, JsonNode.class);
|
||||
JsonNode deviceType = actualMessage.get(MessageConfig.IN_DEVICE_TYPE);
|
||||
switch (deviceType.getTextValue()) {
|
||||
|
||||
case MessageConfig.IN_IRIS_DRONE:
|
||||
System.out.println("incomming message :" + inbound_message);
|
||||
messageTranslaterForIRISDrone(actualMessage);
|
||||
break;
|
||||
case MessageConfig.IN_SIMULATOR:
|
||||
messageTranslaterForSimulator(actualMessage);
|
||||
break;
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
log.error("Incoming message might be corrupted, "+ e);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private double sTd(JsonNode s)
|
||||
{
|
||||
return Double.parseDouble(s.toString());
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
try{
|
||||
if(sharedQueue.isEmpty() || sharedQueue == null){
|
||||
return "";
|
||||
}
|
||||
return sharedQueue.remove();
|
||||
}catch(Exception e) {
|
||||
log.error("There is no more messages to send or internal server error has been occurred, \n"+ e );
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmptyQueue(){
|
||||
return sharedQueue != null? sharedQueue.isEmpty():false;
|
||||
}
|
||||
|
||||
}
|
72
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/util/DroneAnalyzerServiceUtils.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/util/DroneAnalyzerServiceUtils.java
72
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/util/DroneAnalyzerServiceUtils.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/util/DroneAnalyzerServiceUtils.java
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.droneanalyzer.service.util.scep;
|
||||
|
||||
public class ContentType {
|
||||
public static final String X_PKI_MESSAGE = "application/x-pki-message";
|
||||
public static final String X_X509_CA_CERT = "application/x-x509-ca-cert";
|
||||
public static final String X_X509_CA_RA_CERT = "application/x-x509-ca-ra-cert";
|
||||
}
|
||||
|
30
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/test/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/impl/DroneAnalyzerDeviceDAOImplTest.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/util/scep/SCEPOperation.java
30
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/test/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/impl/DroneAnalyzerDeviceDAOImplTest.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.api/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/service/util/scep/SCEPOperation.java
@ -1,21 +1,19 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~ Copyright 2005-2013 WSO2, Inc. (http://wso2.com)
|
||||
~
|
||||
~ 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
|
||||
~ Licensed 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.
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<!--
|
@ -0,0 +1,116 @@
|
||||
package org.wso2.carbon.device.mgt.iot.droneanalyzer.service;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.Device;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created by geesara on 12/10/15.
|
||||
*/
|
||||
public class DroneServiceTest {
|
||||
|
||||
private static org.apache.commons.logging.Log log = LogFactory.getLog(DroneServiceTest.class);
|
||||
ApplicationContext context;
|
||||
WebClient client;
|
||||
|
||||
@Before
|
||||
public void init(){
|
||||
context = new ClassPathXmlApplicationContext("spring-cxf-client.xml");
|
||||
client = context.getBean("droneClient", WebClient.class);
|
||||
}
|
||||
//@Test
|
||||
public void registerDevice(){
|
||||
client.path("manager/device/register").accept(MediaType.APPLICATION_JSON_TYPE);
|
||||
client.query("deviceId", "device7");
|
||||
client.query("name", "dronetypeOne");
|
||||
client.query("owner", "DroneOwner");
|
||||
Response res = client.put(null);
|
||||
log.info("Response status :"+ res.getStatus());
|
||||
System.out.println("Response status :"+ res.getStatus());
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void removeDevice(){
|
||||
client.path("manager/device/remove/").accept(MediaType.APPLICATION_JSON_TYPE);
|
||||
client.path("device7");
|
||||
Response res = client.delete();
|
||||
log.info("Response status :"+ res.getStatus());
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void updateDevice(){
|
||||
client.path("manager/device/update/").accept(MediaType.APPLICATION_JSON_TYPE);
|
||||
client.path("device2");
|
||||
client.query("name", "ARDrone");
|
||||
Response res = client.post(null);
|
||||
log.info("Response status :"+ res.getStatus());
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void getDevice(){
|
||||
client.path("manager/device/").accept(MediaType.APPLICATION_JSON_TYPE);
|
||||
client.path("device2");
|
||||
Device res = client.get(Device.class);
|
||||
log.info("Device name :"+ res.getName());
|
||||
log.info("Device type :"+ res.getType());
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void getDroneDevices(){
|
||||
client.path("manager/devices/").accept(MediaType.APPLICATION_JSON_TYPE);
|
||||
client.path("DroneOwner");
|
||||
Collection<? extends Device> res = client.getCollection(Device.class);
|
||||
Iterator<? extends Device> iterator = res.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Device device = iterator.next();
|
||||
log.info("Device name :" + device.getName());
|
||||
log.info("Device type :"+ device.getType());
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void downloadSketch(){
|
||||
client.path("manager/devices/");
|
||||
client.path("type1");
|
||||
client.path("download").accept(MediaType.APPLICATION_OCTET_STREAM);
|
||||
Response res = client.get();
|
||||
log.info(res.getStatus());
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void droneController(){
|
||||
client.path("controller/send_command");
|
||||
client.query("owner", "DroneOwner");
|
||||
client.query("deviceId", "device2");
|
||||
client.query("action", "takeoff");
|
||||
client.query("speed", 5);
|
||||
client.query("duration", 56);
|
||||
client.accept(MediaType.APPLICATION_JSON);
|
||||
Response res = client.post(null);
|
||||
System.out.println(res.getStatus());
|
||||
}
|
||||
|
||||
public void generateSketchLink(){
|
||||
client.path("manager/devices/");
|
||||
client.path("type1");
|
||||
client.path("download").accept(MediaType.APPLICATION_OCTET_STREAM);
|
||||
Response res = client.get();
|
||||
log.info(res.getStatus());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package org.wso2.carbon.device.mgt.iot.droneanalyzer.service.transport;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppConfig;
|
||||
import org.wso2.carbon.utils.CarbonUtils;
|
||||
|
||||
/**
|
||||
* Created by geesara on 12/10/15.
|
||||
*/
|
||||
public class DroneAnalyzerXMPPConnectorTest {
|
||||
private static Log log = LogFactory.getLog(DroneAnalyzerXMPPConnectorTest.class);
|
||||
public DroneAnalyzerXMPPConnector droneAnalyzerXMPPConnector;
|
||||
|
||||
@BeforeClass
|
||||
public void setup(){
|
||||
//droneAnalyzerXMPPConnector = new DroneAnalyzerXMPPConnector();
|
||||
//droneAnalyzerXMPPConnector.initConnector();
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void login(){
|
||||
// droneAnalyzerXMPPConnector.connectAndLogin();
|
||||
// log.info("ip address "+XmppConfig.getInstance().getXmppServerIP());
|
||||
//log.info("path "+ CarbonUtils.getCarbonConfigDirPath());
|
||||
// log.info("path "+ CarbonUtils.getCarbonHome());
|
||||
//System.out.println(System.getProperty("carbon.home"));
|
||||
System.out.println(System.getenv("CARBON_HOME"));
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
|
||||
<bean id="jacksonJsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"></bean>
|
||||
|
||||
<util:list id="webClientProviders">
|
||||
<ref bean="jacksonJsonProvider"/>
|
||||
</util:list>
|
||||
|
||||
<bean id="droneClient" class="org.apache.cxf.jaxrs.client.WebClient"
|
||||
factory-method="create">
|
||||
<constructor-arg type="java.lang.String" value="http://localhost:9763/drone_analyzer/DroneAnalyzerServiceUnitManager/"/>
|
||||
<constructor-arg ref="webClientProviders" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.droneanalyzer.plugin;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||
import org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl.DroneAnalyzerManagerService;
|
||||
import org.wso2.carbon.device.mgt.iot.service.DeviceTypeService;
|
||||
|
||||
public class DroneAnalyzerManagementServiceComponent {
|
||||
private ServiceRegistration firealarmServiceRegRef;
|
||||
|
||||
private static final Log log = LogFactory.getLog(DroneAnalyzerManagementServiceComponent.class);
|
||||
|
||||
protected void activate(ComponentContext ctx) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Activating Drone Device Management Service Component");
|
||||
}
|
||||
try {
|
||||
BundleContext bundleContext = ctx.getBundleContext();
|
||||
firealarmServiceRegRef =
|
||||
bundleContext.registerService(DeviceManagementService.class.getName(),
|
||||
new DroneAnalyzerManagerService(), null);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Drone Device Management Service Component has been successfully activated");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error("Error occurred while activating Drone Device Management Service Component", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void deactivate(ComponentContext ctx) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("De-activating Virtual Firealarm Device Management Service Component");
|
||||
}
|
||||
try {
|
||||
if (firealarmServiceRegRef != null) {
|
||||
firealarmServiceRegRef.unregister();
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
"Virtual Firealarm Device Management Service Component has been successfully de-activated");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error("Error occurred while de-activating Virtual Firealarm Device Management bundle", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setDeviceTypeService(DeviceTypeService deviceTypeService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Data source service set to mobile service component");
|
||||
}
|
||||
}
|
||||
|
||||
protected void unsetDeviceTypeService(DeviceTypeService deviceTypeService) {
|
||||
//do nothing
|
||||
}
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.droneanalyzer.service.trasformer;
|
||||
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.codehaus.jackson.JsonNode;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.node.ArrayNode;
|
||||
import org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.constants.MessageConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
public class MessageTransformer {
|
||||
|
||||
private Log log = LogFactory.getLog(MessageTransformer.class);
|
||||
|
||||
private Queue<String> sharedQueue;
|
||||
private String current_message = "";
|
||||
ObjectMapper mapper;
|
||||
boolean isOld = true;
|
||||
private String inbound_message_format = "{\"quatanium_val\":[%d, %d, %d, %d],\"accelerometer\":[%d, %d, %d]," +
|
||||
"\"gyroscope\":[%d, %d, %d],\"magnetometer\":[%d, %d, %d],\"basicParam\":[%d, %d, %d]}";
|
||||
private String outbound_message_format = "{\"quatanium_val\":[%f, %f, %f, %f],\"accelerometer\":[%f, %f, %f]," +
|
||||
"\"gyroscope\":[%f, %f, %f],\"magnetometer\":[%f, %f, %f],\"basicParam\":[%f, %f, %f]}";
|
||||
|
||||
public MessageTransformer(){
|
||||
mapper = new ObjectMapper();
|
||||
sharedQueue = new LinkedList<String>();
|
||||
}
|
||||
|
||||
public void messageTranslater(String inbound_message){
|
||||
JsonNode actualObj = null;
|
||||
String outbound_message;
|
||||
try {
|
||||
actualObj = mapper.readTree(inbound_message);
|
||||
ArrayNode quatannim_vals = (ArrayNode) actualObj.path(MessageConfig.IN_QUATANNIM_VAL);
|
||||
ArrayNode accelerometer_vals = (ArrayNode) actualObj.path(MessageConfig.IN_ACCELETOMETER_VAL);
|
||||
ArrayNode gyroscope_vals = (ArrayNode) actualObj.path(MessageConfig.IN_GYROSCOPE_VAL);
|
||||
ArrayNode magnetometer_vals = (ArrayNode) actualObj.path(MessageConfig.IN_GYROSCOPE_VAL);
|
||||
ArrayNode basicParam_vals = (ArrayNode) actualObj.path(MessageConfig.IN_BASIC_PARAM_VAL);
|
||||
outbound_message = String.format(outbound_message_format, sTd(quatannim_vals.get(0)), sTd(quatannim_vals.get(1)),
|
||||
sTd(quatannim_vals.get(2)), sTd(quatannim_vals.get(3)), sTd(accelerometer_vals.get(0)),
|
||||
sTd(accelerometer_vals.get(1)), sTd(accelerometer_vals.get(2)), sTd(gyroscope_vals.get(0)),
|
||||
sTd(gyroscope_vals.get(1)), sTd(gyroscope_vals.get(2)), sTd(magnetometer_vals.get(0)),
|
||||
sTd(magnetometer_vals.get(1)), sTd(magnetometer_vals.get(2)), sTd(basicParam_vals.get(0)),
|
||||
sTd(basicParam_vals.get(1)), sTd(basicParam_vals.get(2)));
|
||||
|
||||
synchronized(current_message){
|
||||
isOld = false;
|
||||
current_message = outbound_message;
|
||||
}
|
||||
sharedQueue.add(outbound_message);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage()+",\n"+ e);
|
||||
}catch (Exception e) {
|
||||
log.error(e.getMessage()+",\n"+ e);
|
||||
}
|
||||
}
|
||||
|
||||
private double sTd(JsonNode s)
|
||||
{
|
||||
return Double.parseDouble(s.toString());
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
if(sharedQueue.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
return sharedQueue.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public String getCurrentMessage(){
|
||||
synchronized(current_message) {
|
||||
current_message = isOld == false ? current_message : null;
|
||||
isOld = true;
|
||||
}
|
||||
return current_message;
|
||||
}
|
||||
|
||||
public boolean isCurrentMessageEmpty()
|
||||
{
|
||||
return isOld;
|
||||
}
|
||||
|
||||
public boolean isEmptyQueue(){
|
||||
return sharedQueue.isEmpty();
|
||||
}
|
||||
|
||||
}
|
22
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/DroneConstants.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/DroneConstants.java
22
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/DroneConstants.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/DroneConstants.java
8
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/MessageConfig.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/MessageConfig.java
8
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/MessageConfig.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/constants/MessageConfig.java
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.droneanalyzer.plugin.controller;
|
||||
|
||||
public interface DroneController {
|
||||
boolean takeoff();
|
||||
boolean land();
|
||||
boolean up(double speed, double duration);
|
||||
boolean down(double speed, double duration);
|
||||
boolean left(double speed, double duration);
|
||||
boolean right(double speed, double duration);
|
||||
boolean front(double speed, double duration);
|
||||
boolean back(double speed, double duration);
|
||||
boolean clockwise(double speed, double duration);
|
||||
boolean conterClockwise(double speed, double duration);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.droneanalyzer.plugin.controller.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.controller.DroneController;
|
||||
|
||||
public class DroneControllerImpl implements DroneController{
|
||||
|
||||
@Override
|
||||
public boolean takeoff() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean land() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean up(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean down(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean left(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean right(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean front(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean back(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean clockwise(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean conterClockwise(double speed, double duration) {
|
||||
return false;
|
||||
}
|
||||
}
|
31
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManager.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManager.java
31
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManager.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManager.java
1
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManagerService.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManagerService.java
1
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManagerService.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/DroneAnalyzerManagerService.java
7
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/DroneAnalyzerDAO.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/DroneAnalyzerDAO.java
7
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/DroneAnalyzerDAO.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/DroneAnalyzerDAO.java
48
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/impl/DroneAnalyzerDeviceDAOImpl.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/impl/DroneAnalyzerDeviceDAOImpl.java
48
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/impl/DroneAnalyzerDeviceDAOImpl.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/dao/impl/DroneAnalyzerDeviceDAOImpl.java
3
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/util/DroneAnalyzerUtils.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/util/DroneAnalyzerUtils.java
3
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/util/DroneAnalyzerUtils.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/impl/util/DroneAnalyzerUtils.java
16
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/internal/DroneAnalyzerManagementServiceComponent.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/internal/DroneAnalyzerManagementServiceComponent.java
16
components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/internal/DroneAnalyzerManagementServiceComponent.java → components/device-mgt-iot-droneanalyzer/org.wso2.carbon.device.mgt.iot.droneanalyzer/src/main/java/org/wso2/carbon/device/mgt/iot/droneanalyzer/plugin/internal/DroneAnalyzerManagementServiceComponent.java
@ -0,0 +1,25 @@
|
||||
package org.wso2.carbon.device.mgt.iot.droneanalyzer.plugin.impl.dao.impl;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOException;
|
||||
|
||||
/**
|
||||
* Created by geesara on 12/9/15.
|
||||
*/
|
||||
public class DroneAnalyzerDeviceDAOImplTest {
|
||||
DroneAnalyzerDeviceDAOImpl dao;
|
||||
@Before
|
||||
public void init(){
|
||||
dao = new DroneAnalyzerDeviceDAOImpl();
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void testDBConnenction(){
|
||||
try {
|
||||
dao.deleteIotDevice("device1");
|
||||
} catch (IotDeviceManagementDAOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
#
|
||||
# Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
#
|
||||
# Licensed 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.
|
||||
#
|
||||
#
|
||||
|
||||
#[Device-Configurations]
|
||||
owner=${DEVICE_OWNER}
|
||||
deviceId=${DEVICE_ID}
|
||||
device-name=${DEVICE_NAME}
|
||||
controller-context=/drone_analyzer/controller
|
||||
https-ep=${HTTPS_EP}
|
||||
http-ep=${HTTP_EP}
|
||||
apim-ep=${APIM_EP}
|
||||
mqtt-ep=${MQTT_EP}
|
||||
xmpp-ep=${XMPP_EP}
|
||||
auth-method=token
|
||||
auth-token=${DEVICE_TOKEN}
|
||||
refresh-token=${DEVICE_REFRESH_TOKEN}
|
||||
push-interval=15
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
zipfilename=drone_analyzer.zip
|
@ -0,0 +1,48 @@
|
||||
<!--
|
||||
~ Copyright (c) 2015, 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.
|
||||
-->
|
||||
|
||||
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
|
||||
<providers>
|
||||
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
|
||||
</providers>
|
||||
|
||||
<datasources>
|
||||
<datasource>
|
||||
<name>VirtualFireAlarmDM_DB</name>
|
||||
<description>The datasource used for the Virtual-Firealarm database</description>
|
||||
<jndiConfig>
|
||||
<name>jdbc/VirtualFireAlarmDM_DB</name>
|
||||
</jndiConfig>
|
||||
<definition type="RDBMS">
|
||||
<configuration>
|
||||
<url>jdbc:h2:repository/database/VirtualFireAlarmDM_DB;DB_CLOSE_ON_EXIT=FALSE
|
||||
</url>
|
||||
<username>wso2carbon</username>
|
||||
<password>wso2carbon</password>
|
||||
<driverClassName>org.h2.Driver</driverClassName>
|
||||
<maxActive>50</maxActive>
|
||||
<maxWait>60000</maxWait>
|
||||
<testOnBorrow>true</testOnBorrow>
|
||||
<validationQuery>SELECT 1</validationQuery>
|
||||
<validationInterval>30000</validationInterval>
|
||||
</configuration>
|
||||
</definition>
|
||||
</datasource>
|
||||
</datasources>
|
||||
</datasources-configuration>
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `FIREALARM_DEVICE`
|
||||
-- Table `DRONE_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `VIRTUAL_FIREALARM_DEVICE` (
|
||||
`VIRTUAL_FIREALARM_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
CREATE TABLE IF NOT EXISTS `DRONE_DEVICE` (
|
||||
`DRONE_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`VIRTUAL_FIREALARM_DEVICE_ID`) );
|
||||
PRIMARY KEY (`DRONE_DEVICE_ID`) );
|
||||
|
||||
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
<div id="device_overview">
|
||||
<div class="media-left media-middle asset-image col-xs-2 col-sm-2 col-md-2 col-lg-2">
|
||||
{{unit "cdmf.unit.device.overview.droneanalyzer-display-image"}}
|
||||
</div>
|
||||
<div class="media-body asset-desc add-padding-left-5x">
|
||||
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Device Overview - Virtual Firealarm</div>
|
||||
{{#defineZone "device-detail-properties"}}
|
||||
<table class="table table-responsive table-striped" id="members">
|
||||
<tbody>
|
||||
<tr role="row" class="even"><td class="sorting_1" style="padding:10px 15px; width: 1%;;">Device</td><td style="padding:10px 15px;">{{device.viewModel.vendor}} {{device.properties.model}}</td></tr>
|
||||
<tr role="row" class="odd"><td class="sorting_1" style="padding:10px 15px;">Model</td><td style="padding:10px 15px;">{{device.viewModel.model}}</td></tr>
|
||||
<tr role="row" class="even"><td class="sorting_1" style="padding:10px 15px;">IMEI</td><td style="padding:10px 15px;">{{device.viewModel.imei}}</td></tr>
|
||||
{{#if device.viewModel.udid}}
|
||||
<tr role="row" class="even"><td class="sorting_1" style="padding:10px 15px;">UDID</td><td style="padding:10px 15px;">{{device.viewModel.udid}}</td></tr>
|
||||
{{/if}}
|
||||
{{#if device.viewModel.phoneNumber}}
|
||||
<tr role="row" class="even"><td class="sorting_1" style="padding:10px 15px;">Phone Number</td><td style="padding:10px 15px;">{{device.viewModel.phoneNumber}}</td></tr>
|
||||
{{/if}}
|
||||
<tr role="row" class="even">
|
||||
<td class="sorting_1" style="padding:10px 15px;">Status</td>
|
||||
<td style="padding:10px 15px;">
|
||||
{{#equal device.status "ACTIVE"}}<span><i class="fw fw-ok icon-success"></i> Active</span>{{/equal}}
|
||||
{{#equal device.status "INACTIVE"}}<span><i class="fw fw-warning icon-warning"></i> Inactive</span>{{/equal}}
|
||||
{{#equal device.status "BLOCKED"}}<span><i class="fw fw-remove icon-danger"></i> Blocked</span>{{/equal}}
|
||||
{{#equal device.status "REMOVED"}}<span><i class="fw fw-delete icon-danger"></i> Removed</span>{{/equal}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{{/defineZone}}
|
||||
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Operations</div>
|
||||
<div class="add-margin-top-4x">
|
||||
{{unit "cdmf.unit.device.iot-operation" deviceType=device.type}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,25 +0,0 @@
|
||||
function onRequest (context) {
|
||||
var log = new Log("detail.js");
|
||||
var deviceType = request.getParameter("type");
|
||||
var deviceId = request.getParameter("id");
|
||||
|
||||
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
|
||||
var deviceModule = require("/modules/device.js").deviceModule;
|
||||
var device = deviceModule.viewDevice(deviceType, deviceId);
|
||||
|
||||
if (device) {
|
||||
var viewModel = {};
|
||||
var deviceInfo = device.properties.DEVICE_INFO;
|
||||
if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) {
|
||||
deviceInfo = parse(stringify(deviceInfo));
|
||||
viewModel.system = device.properties.IMEI;
|
||||
viewModel.machine = "Virtual Firealarm";
|
||||
viewModel.vendor = device.properties.VENDOR;
|
||||
}
|
||||
device.viewModel = viewModel;
|
||||
}
|
||||
context.device = device;
|
||||
|
||||
return context;
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"version": "1.0.0"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/devicetype-conf/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.droneanalyzer_${feature.version}/configs/,target:${installFolder}/../../conf/devicetype-conf/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.droneanalyzer_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/drone_analyzer/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.droneanalyzer_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/drone_analyzer,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.droneanalyzer_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\
|
Loading…
Reference in new issue