forked from community/device-mgt-plugins
parent
ff9efe1c76
commit
ef84791510
@ -0,0 +1,172 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>androidsense-plugin-feature</artifactId>
|
||||
<version>3.0.32-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature</artifactId>
|
||||
<version>3.0.32-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>WSO2 Carbon - IoT Server Android Sense Analytics Feature</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the Android Sense Device type specific analytics implementations for the IoT Server
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<includes>
|
||||
<include>build.properties</include>
|
||||
<include>p2.inf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.analytics
|
||||
</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/carbonapps
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unpack-analytics</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.analytics</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/carbonapps
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unpack-geo</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.iot.geo.dashboard</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/carbonapps
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.wso2.maven</groupId>
|
||||
<artifactId>carbon-p2-plugin</artifactId>
|
||||
<version>${carbon.p2.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>p2-feature-generation</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-feature-gen</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<id>org.wso2.carbon.device.mgt.iot.androidsense.analytics</id>
|
||||
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||
<adviceFile>
|
||||
<properties>
|
||||
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||
<propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<includedFeatures>
|
||||
<includedFeatureDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.analytics.feature:${carbon.devicemgt.plugins.version}
|
||||
</includedFeatureDef>
|
||||
</includedFeatures>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
custom = true
|
@ -0,0 +1,6 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../analytics/repository/deployment/server/carbonapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.analytics_${feature.version}/carbonapps/,target:${installFolder}/../../analytics/repository/deployment/server/carbonapps/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../analytics/repository/deployment/server/carbonapps/android_sense.car);\
|
@ -0,0 +1,226 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>androidsense-plugin-feature</artifactId>
|
||||
<version>3.0.32-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.backend.feature</artifactId>
|
||||
<version>3.0.32-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>WSO2 Carbon - IoT Server Android Sense Backend Feature</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the Android Sense Device type specific backend implementations for the IoT Server
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.api</artifactId>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database.wso2</groupId>
|
||||
<artifactId>h2-database-engine</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>default-profile</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy file="src/main/resources/default.p2.inf"
|
||||
tofile="src/main/resources/p2.inf"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cloud</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy file="src/main/resources/cloud.p2.inf"
|
||||
tofile="src/main/resources/p2.inf"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<includes>
|
||||
<include>build.properties</include>
|
||||
<include>p2.inf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-jaxrs-war</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.api</artifactId>
|
||||
<type>war</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${project.build.directory}/maven-shared-archive-resources/webapps/</outputDirectory>
|
||||
<destFileName>android_sense.war</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Creating Android Sense Plugin Management schema -->
|
||||
<id>create-android-sense-plugin-mgt-schema</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<echo message="########### Create Android Sense plugin Management H2 Schema ###########" />
|
||||
<property name="db.dir" value="target/maven-shared-archive-resources/database" />
|
||||
<property name="userid" value="wso2carbon" />
|
||||
<property name="password" value="wso2carbon" />
|
||||
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/AndroidSenseDM_DB;DB_CLOSE_ON_EXIT=FALSE" />
|
||||
|
||||
<mkdir dir="${basedir}/${db.dir}" />
|
||||
|
||||
<sql driver="org.h2.Driver" url="${dbURL}" userid="${userid}" password="${password}" autocommit="true" onerror="continue">
|
||||
<classpath refid="maven.dependency.classpath" />
|
||||
<classpath refid="maven.compile.classpath" />
|
||||
<classpath refid="maven.runtime.classpath" />
|
||||
|
||||
<fileset file="${basedir}/src/main/resources/dbscripts/h2.sql" />
|
||||
</sql>
|
||||
<echo message="##################### END ####################" />
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.wso2.maven</groupId>
|
||||
<artifactId>carbon-p2-plugin</artifactId>
|
||||
<version>${carbon.p2.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>p2-feature-generation</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-feature-gen</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<id>org.wso2.carbon.device.mgt.iot.androidsense.backend</id>
|
||||
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||
<adviceFile>
|
||||
<properties>
|
||||
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||
<propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<importFeatures>
|
||||
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
|
||||
<importFeatureDef>org.wso2.carbon.device.mgt.server:${carbon.devicemgt.version}</importFeatureDef>
|
||||
</importFeatures>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
custom = true
|
@ -0,0 +1,21 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/devicetypes/android_sense/);\
|
||||
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.androidsense.backend_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/android_sense,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/devicetypes/,target:${installFolder}/../../deployment/server/devicetypes/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/android_sense.war);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../resources/sketches/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/datasources/androidsense-datasources.xml);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/AndroidSenseDM_DB.h2.db);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/devicetypes/android_sense.xml);\
|
@ -0,0 +1,46 @@
|
||||
<!--
|
||||
~ 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>AndroidSenseDM_DB</name>
|
||||
<description>The datasource used for the Android Sense database</description>
|
||||
<jndiConfig>
|
||||
<name>jdbc/AndroidSenseDM_DB</name>
|
||||
</jndiConfig>
|
||||
<definition type="RDBMS">
|
||||
<configuration>
|
||||
<url>jdbc:h2:repository/database/AndroidSenseDM_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>
|
@ -0,0 +1,8 @@
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `ANDROID_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `ANDROID_SENSE_DEVICE` (
|
||||
`ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`ANDROID_DEVICE_ID`) );
|
@ -0,0 +1,8 @@
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `ANDROID_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS ANDROID_SENSE_DEVICE (
|
||||
ANDROID_DEVICE_ID VARCHAR(45) NOT NULL ,
|
||||
DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (ANDROID_DEVICE_ID) );
|
@ -0,0 +1,12 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `ANDROID_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `ANDROID_SENSE_DEVICE` (
|
||||
`ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`ANDROID_DEVICE_ID`) )
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `ANDROID_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE ANDROID_SENSE_DEVICE (
|
||||
ANDROID_DEVICE_ID VARCHAR(45) NOT NULL ,
|
||||
DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (ANDROID_DEVICE_ID) );
|
@ -0,0 +1,8 @@
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `ANDROID_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS ANDROID_SENSE_DEVICE (
|
||||
ANDROID_DEVICE_ID VARCHAR(45) NOT NULL ,
|
||||
DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (ANDROID_DEVICE_ID));
|
@ -0,0 +1,19 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../resources/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../resources/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../resources/devicetypes/android_sense/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/webapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/webapps/,target:${installFolder}/../../../repository/deployment/server/webapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/android_sense,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/datasources/,target:${installFolder}/../../../repository/conf/datasources/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.backend_${feature.version}/devicetypes/,target:${installFolder}/../../../repository/deployment/server/devicetypes/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/android_sense.war);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/resources/sketches/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/conf/datasources/androidsense-datasources.xml);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/database/AndroidSenseDM_DB.h2.db);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/devicetypes/android_sense.xml);\
|
@ -0,0 +1,71 @@
|
||||
<?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.
|
||||
-->
|
||||
<DeviceTypeConfiguration name="android_sense">
|
||||
<Features>
|
||||
<Feature code="keywords">
|
||||
<Name>Add Keywords</Name>
|
||||
<Description>Send keywords to the device</Description>
|
||||
<!--<Operation context="/android_sense/device/{deviceId}/words" method="POST">-->
|
||||
<!--<QueryParameters>-->
|
||||
<!--<Parameter>keywords</Parameter>-->
|
||||
<!--</QueryParameters>-->
|
||||
<!--</Operation>-->
|
||||
</Feature>
|
||||
<Feature code="threshold">
|
||||
<Name>Add Threshold</Name>
|
||||
<Description>Send Threshold to the device</Description>
|
||||
<!--<Operation context="/android_sense/device/{deviceId}/words/threshold" method="POST">-->
|
||||
<!--<QueryParameters>-->
|
||||
<!--<Parameter>threshold</Parameter>-->
|
||||
<!--</QueryParameters>-->
|
||||
<!--</Operation>-->
|
||||
</Feature>
|
||||
<Feature code="remove_words">
|
||||
<Name>Remove words</Name>
|
||||
<Description>Remove Threshold from the device</Description>
|
||||
<!--<Operation context="/android_sense/device/{deviceId}/words" method="DELETE">-->
|
||||
<!--<QueryParameters>-->
|
||||
<!--<Parameter>words</Parameter>-->
|
||||
<!--</QueryParameters>-->
|
||||
<!--</Operation>-->
|
||||
</Feature>
|
||||
</Features>
|
||||
|
||||
<ProvisioningConfig>
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<PushNotificationProvider type="MQTT">
|
||||
<FileBasedProperties>true</FileBasedProperties>
|
||||
<!--if file based properties is set to false then the configuration will be picked from platform configuration-->
|
||||
<ConfigProperties>
|
||||
<Property Name="mqttAdapterName">androidsense.mqtt.adapter</Property>
|
||||
<Property Name="qos">0</Property>
|
||||
<Property Name="clearSession">true</Property>
|
||||
</ConfigProperties>
|
||||
</PushNotificationProvider>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
<Version>1.0.0</Version>
|
||||
<Text>This is license text</Text>
|
||||
</License>
|
||||
|
||||
</DeviceTypeConfiguration>
|
@ -0,0 +1,24 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/devicetypes/android_sense/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/android_sense,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,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.androidsense.ui_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/devicetypes/,target:${installFolder}/../../deployment/server/devicetypes/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../resources/sketches/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../conf/datasources/androidsense-datasources.xml);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/AndroidSenseDM_DB.h2.db);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/devicetypes/android_sense.xml);\
|
@ -0,0 +1,22 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../resources/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../resources/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../resources/devicetypes/android_sense/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/android_sense,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/datasources/,target:${installFolder}/../../../repository/conf/datasources/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/jaggeryapps/,target:${installFolder}/../../../repository/deployment/server/jaggeryapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.androidsense.ui_${feature.version}/devicetypes/,target:${installFolder}/../../../repository/deployment/server/devicetypes/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/resources/sketches/android_sense);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/conf/datasources/androidsense-datasources.xml);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/database/AndroidSenseDM_DB.h2.db);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.analytics-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.platform.configuration);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/devicetypes/android_sense.xml);\
|
@ -0,0 +1,149 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>arduino-plugin-feature</artifactId>
|
||||
<version>3.0.32-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.analytics.feature</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>WSO2 Carbon - IoT Server Arduino Analytics Feature</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the Arduino Device type specific anaytics implementations for the IoT Server
|
||||
</description>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<includes>
|
||||
<include>build.properties</include>
|
||||
<include>p2.inf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.analytics
|
||||
</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/carbonapps
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unpack-analytics</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.analytics</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/carbonapps
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.wso2.maven</groupId>
|
||||
<artifactId>carbon-p2-plugin</artifactId>
|
||||
<version>${carbon.p2.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>p2-feature-generation</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-feature-gen</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<id>org.wso2.carbon.device.mgt.iot.arduino</id>
|
||||
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||
<adviceFile>
|
||||
<properties>
|
||||
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||
<propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<includedFeatures>
|
||||
<includedFeatureDef>
|
||||
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.analytics.feature:${carbon.devicemgt.plugins.version}
|
||||
</includedFeatureDef>
|
||||
</includedFeatures>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
custom = true
|
@ -0,0 +1,6 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/carbonapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps//arduino.car);\
|
@ -0,0 +1,136 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>arduino-plugin-feature</artifactId>
|
||||
<version>3.0.32-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.backend.feature</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>WSO2 Carbon - IoT Server Arduino Backend Feature</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the Arduino Device type backend specific implementations for the IoT Server
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.api</artifactId>
|
||||
<type>war</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database.wso2</groupId>
|
||||
<artifactId>h2-database-engine</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<includes>
|
||||
<include>build.properties</include>
|
||||
<include>p2.inf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-jaxrs-war</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.api
|
||||
</artifactId>
|
||||
<type>war</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>${project.build.directory}/maven-shared-archive-resources/webapps/
|
||||
</outputDirectory>
|
||||
<destFileName>arduino.war</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.wso2.maven</groupId>
|
||||
<artifactId>carbon-p2-plugin</artifactId>
|
||||
<version>${carbon.p2.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>p2-feature-generation</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-feature-gen</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<id>org.wso2.carbon.device.mgt.iot.arduino</id>
|
||||
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||
<adviceFile>
|
||||
<properties>
|
||||
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||
<propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<importFeatures>
|
||||
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||
</importFeatureDef>
|
||||
<importFeatureDef>org.wso2.carbon.device.mgt.server:${carbon.devicemgt.version}
|
||||
</importFeatureDef>
|
||||
</importFeatures>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
custom = true
|
@ -0,0 +1,43 @@
|
||||
<?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.
|
||||
-->
|
||||
<DeviceTypeConfiguration name="arduino">
|
||||
<Features>
|
||||
<Feature code="bulb">
|
||||
<Name>Control Bulb</Name>
|
||||
<Description>Control Bulb on Arduino Uno</Description>
|
||||
<Operation context="/arduino/device/{deviceId}/bulb" method="POST">
|
||||
<QueryParameters>
|
||||
<Parameter>state</Parameter>
|
||||
</QueryParameters>
|
||||
</Operation>
|
||||
</Feature>
|
||||
</Features>
|
||||
|
||||
<ProvisioningConfig>
|
||||
<SharedWithAllTenants>false</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
<Version>1.0.0</Version>
|
||||
<Text>This is license text</Text>
|
||||
</License>
|
||||
|
||||
</DeviceTypeConfiguration>
|
@ -0,0 +1,12 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/webapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/webapps/,target:${installFolder}/../../../repository/deployment/server/webapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/devicetypes/,target:${installFolder}/../../../repository/deployment/server/devicetypes/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/arduino.war);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/webapps/arduino);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/devicetypes/arduino.xml);\
|
@ -0,0 +1,135 @@
|
||||
<?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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>arduino-plugin-feature</artifactId>
|
||||
<version>3.0.32-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.ui.feature</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>WSO2 Carbon - IoT Server Arduino UI Feature</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the Arduino Device type UI specific implementations for the IoT Server
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database.wso2</groupId>
|
||||
<artifactId>h2-database-engine</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<includes>
|
||||
<include>build.properties</include>
|
||||
<include>p2.inf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.ui
|
||||
</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>
|
||||
${project.build.directory}/maven-shared-archive-resources/jaggeryapps/devicemgt
|
||||
</outputDirectory>
|
||||
<includes>**/*</includes>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.wso2.maven</groupId>
|
||||
<artifactId>carbon-p2-plugin</artifactId>
|
||||
<version>${carbon.p2.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>p2-feature-generation</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-feature-gen</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<id>org.wso2.carbon.device.mgt.iot.arduino</id>
|
||||
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||
<adviceFile>
|
||||
<properties>
|
||||
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||
<propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<importFeatures>
|
||||
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||
</importFeatureDef>
|
||||
<importFeatureDef>org.wso2.carbon.device.mgt.server:${carbon.devicemgt.version}
|
||||
</importFeatureDef>
|
||||
</importFeatures>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
#ifndef ArduinoWifiAgent_H
|
||||
#define ArduinoWifiAgent_H
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
// These are the interrupt and control pins
|
||||
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
|
||||
// These can be any two pins
|
||||
#define ADAFRUIT_CC3000_VBAT 5
|
||||
#define ADAFRUIT_CC3000_CS 10
|
||||
|
||||
#define WLAN_SSID "ssid" // Your wifi network SSID (cannot be longer than 32 characters!)
|
||||
#define WLAN_PASS "password" // Your wifi network password
|
||||
|
||||
#define WLAN_SECURITY WLAN_SEC_WPA2
|
||||
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
|
||||
#define IDLE_TIMEOUT_MS 3000
|
||||
|
||||
#define DEVICE_OWNER "${DEVICE_OWNER}"
|
||||
#define DEVICE_ID "${DEVICE_ID}"
|
||||
#define DEVICE_TOKEN "${DEVICE_TOKEN}"
|
||||
#define REFRESH_DEVICE_TOKEN "${DEVICE_REFRESH_TOKEN}"
|
||||
#define DEVICE_TYPE "arduino"
|
||||
#define TIME 0
|
||||
#define SUPER_TENANT "carbon.super"
|
||||
|
||||
#define DAS_SERVICE_EPOINT "/endpoints${TENANT_DOMAIN}/arduino_receiver?deviceId=${DEVICE_ID}"
|
||||
|
||||
#define IOT_SERVICE_EPOINT "/arduino/device/${DEVICE_ID}/controls"
|
||||
|
||||
#define POLL_INTERVAL 1000
|
||||
#define PUSH_INTERVAL 10000
|
||||
#define DEBUG true
|
||||
#define CON_DEBUG true
|
||||
|
||||
#define SERVICE_PORT ${SERVER_EP_PORT} //http port of iot server
|
||||
|
||||
byte server[4] = {${SERVER_EP_IP}}; //Ip address of iot server
|
||||
|
||||
//set static Ip
|
||||
/**
|
||||
byte deviceIP[4] = { 192, 168, 1,110 }; //Ststic ip address of arduino
|
||||
byte dns2[] = { 8, 8, 8, 8 }; //Ststic dns of arduino
|
||||
byte subnet[] = { 255, 255, 255, 0 }; //Ststic subnet of arduino
|
||||
byte gateway[] = { 192, 168, 1, 1 }; //Ststic gateway of arduino
|
||||
*/
|
||||
|
||||
String host, jsonPayLoad, replyMsg;
|
||||
String responseMsg, subStrn;
|
||||
double cpuTemperature = 0;
|
||||
static unsigned long pushTimestamp = 0;
|
||||
static unsigned long pollTimestamp = 0;
|
||||
char charBuf[10];
|
||||
String payLoad;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
|
||||
#include "ArduinoBoardSketch.h"
|
||||
#include <Adafruit_CC3000.h>
|
||||
#include <SPI.h>
|
||||
#include <avr/wdt.h>
|
||||
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
|
||||
SPI_CLOCK_DIVIDER); // you can change this clock speed
|
||||
|
||||
Adafruit_CC3000_Client client;
|
||||
|
||||
uint32_t sserver;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(F("Internal Temperature Sensor"));
|
||||
pinMode(6, OUTPUT);
|
||||
pinMode(13, OUTPUT);
|
||||
connectHttp();
|
||||
setupResource();
|
||||
wdt_enable(WDTO_8S);
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
wdt_reset();
|
||||
while( !cc3000.checkConnected() ){
|
||||
connectHttp();
|
||||
|
||||
}
|
||||
|
||||
|
||||
cpuTemperature=getBoardTemp();
|
||||
|
||||
|
||||
if(millis() - pushTimestamp > PUSH_INTERVAL){
|
||||
while (!client.connected()) {
|
||||
setupClient();
|
||||
}
|
||||
pushData();
|
||||
|
||||
pushTimestamp = millis();
|
||||
}
|
||||
|
||||
//Serial.println("PUSHED");
|
||||
|
||||
|
||||
wdt_reset();
|
||||
|
||||
if(millis() - pollTimestamp > POLL_INTERVAL){
|
||||
while (!client.connected()) {
|
||||
setupClient();
|
||||
}
|
||||
Serial.println("Read Controls");
|
||||
readControls();
|
||||
|
||||
pollTimestamp = millis();
|
||||
|
||||
}
|
||||
|
||||
// //Serial.println("LOOPING");
|
||||
wdt_reset();
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
#include "ArduinoBoardSketch.h"
|
||||
/**********************************************************************************************
|
||||
Use the below variables when required to set a static IP for the WifiSheild
|
||||
***********************************************************************************************/
|
||||
|
||||
uint32_t ip, ddns, ssubnet, ggateway;
|
||||
|
||||
String connecting = "connecting.... ";
|
||||
|
||||
void connectHttp() {
|
||||
/* Initialise the module */
|
||||
if(DEBUG) Serial.println(F("\nInitializing..."));
|
||||
if (!cc3000.begin())
|
||||
{
|
||||
if(DEBUG) Serial.println(F("Couldn't begin()! Check your wiring?"));
|
||||
while(1);
|
||||
}
|
||||
|
||||
/**********************************************************************************************
|
||||
Only required if using static IP for the WifiSheild
|
||||
***********************************************************************************************/
|
||||
|
||||
/**
|
||||
ip = cc3000.IP2U32(deviceIP[0], deviceIP[1], deviceIP[2], deviceIP[3]);
|
||||
ddns = cc3000.IP2U32(dns2[0], dns2[1], dns2[2], dns2[3]);
|
||||
ssubnet = cc3000.IP2U32(subnet[0], subnet[1], subnet[2], subnet[3]);
|
||||
ggateway = cc3000.IP2U32(gateway[0], gateway[1], gateway[2], gateway[3]);
|
||||
cc3000.setStaticIPAddress(ip, ssubnet, ggateway, ddns);
|
||||
*/
|
||||
// required for setting static IP
|
||||
|
||||
/***********************************************************************************************/
|
||||
|
||||
|
||||
sserver = cc3000.IP2U32(server[0], server[1], server[2], server[3]);
|
||||
|
||||
if(CON_DEBUG) {
|
||||
Serial.print(F("\nAttempting to connect to "));
|
||||
Serial.println(WLAN_SSID);
|
||||
}
|
||||
|
||||
cc3000.deleteProfiles();
|
||||
|
||||
if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
|
||||
if(CON_DEBUG) Serial.println(F("Failed!"));
|
||||
while(1);
|
||||
}
|
||||
|
||||
if(CON_DEBUG) Serial.println(F("Connected to Wifi network!"));
|
||||
|
||||
if(CON_DEBUG) Serial.println(F("Request DHCP"));
|
||||
while (!cc3000.checkDHCP())
|
||||
{
|
||||
delay(100);
|
||||
}
|
||||
|
||||
/* Display the IP address DNS, Gateway, etc. */
|
||||
while (! displayConnectionDetails()) {
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
if (cc3000.checkConnected()) {
|
||||
Serial.println("client Connected to AP");
|
||||
client = cc3000.connectTCP(sserver, SERVICE_PORT);
|
||||
if (client.connected()) {
|
||||
if(CON_DEBUG) Serial.println("client Connected to server");
|
||||
} else {
|
||||
if(CON_DEBUG) Serial.println(F("client Connection failed"));
|
||||
}
|
||||
} else {
|
||||
Serial.println(F("client Connection to AP failed"));
|
||||
}
|
||||
|
||||
if(CON_DEBUG) Serial.println(F("-------------------------------------"));
|
||||
}
|
||||
|
||||
|
||||
void setupResource(){
|
||||
String hostIP = getHostIP(server);
|
||||
String port = String(SERVICE_PORT);
|
||||
|
||||
host = "Host: " + hostIP + ":" + port;
|
||||
if(DEBUG) Serial.println(host);
|
||||
|
||||
jsonPayLoad = "{\"event\":{\"metaData\":";
|
||||
jsonPayLoad += "{\"owner\":\"";
|
||||
jsonPayLoad += String(DEVICE_OWNER);
|
||||
jsonPayLoad += "\",\"deviceId\":\"";
|
||||
jsonPayLoad += String(DEVICE_ID);
|
||||
jsonPayLoad += "\"}, \"payloadData\":{";
|
||||
|
||||
if(DEBUG) {
|
||||
Serial.print("JSON Payload: ");
|
||||
Serial.println(jsonPayLoad);
|
||||
Serial.println("-------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
String getHostIP(byte server[4]){
|
||||
String hostIP = String(server[0]);
|
||||
|
||||
for ( int index = 1; index < 4; index++) {
|
||||
hostIP += "." + String(server[index]);
|
||||
}
|
||||
|
||||
return hostIP;
|
||||
}
|
||||
|
||||
|
||||
bool displayConnectionDetails(void)
|
||||
{
|
||||
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
|
||||
|
||||
if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
|
||||
{
|
||||
if(DEBUG) Serial.println(F("Unable to retrieve the IP Address!\r\n"));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(CON_DEBUG) {
|
||||
Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
|
||||
Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
|
||||
Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
|
||||
Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
|
||||
Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
|
||||
Serial.println();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void setupClient(){
|
||||
client = cc3000.connectTCP(sserver, SERVICE_PORT); //SERVICE_PORT
|
||||
if (client.connected()) {
|
||||
if(CON_DEBUG) Serial.println("client Connected to server");
|
||||
} else {
|
||||
while( !cc3000.checkConnected() ){
|
||||
connectHttp();
|
||||
|
||||
}
|
||||
if(CON_DEBUG) Serial.println(F("client Connection failed"));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
#include "ArduinoBoardSketch.h"
|
||||
void readControls() {
|
||||
// String responseMsg;
|
||||
|
||||
Serial.println("Started..");
|
||||
|
||||
client.fastrprint(F("GET "));
|
||||
client.fastrprint(IOT_SERVICE_EPOINT);
|
||||
client.fastrprint(F(" HTTP/1.1"));
|
||||
client.fastrprint(F("\n"));
|
||||
client.fastrprint(host.c_str());client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("Authorization: Bearer ")); client.fastrprint(F(DEVICE_TOKEN)); client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("protocol: HTTP\n"));
|
||||
|
||||
client.println();
|
||||
|
||||
if(DEBUG) {
|
||||
Serial.print("GET ");
|
||||
Serial.print(IOT_SERVICE_EPOINT);
|
||||
Serial.print(" HTTP/1.1"); Serial.println();
|
||||
Serial.print(host); Serial.println();
|
||||
Serial.print("Content-Type: application/json"); Serial.println();
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
delay(1000);
|
||||
|
||||
while (client.available()) {
|
||||
char response = client.read();
|
||||
if(DEBUG) Serial.print(response);
|
||||
responseMsg += response;
|
||||
|
||||
}
|
||||
Serial.println();
|
||||
Serial.println("Ended..");
|
||||
int index = responseMsg.lastIndexOf(":");
|
||||
int newLine = responseMsg.lastIndexOf("\n");
|
||||
subStrn = responseMsg.substring(index + 1);
|
||||
responseMsg = responseMsg.substring(newLine + 1, index);
|
||||
|
||||
if(DEBUG) {
|
||||
Serial.print("Polling Response: ");
|
||||
Serial.print(responseMsg);
|
||||
Serial.println();
|
||||
Serial.println("-------------------------------");
|
||||
}
|
||||
|
||||
if (subStrn.equals("ON")) {
|
||||
Serial.println("ITS ON");
|
||||
digitalWrite(13, HIGH);
|
||||
digitalWrite(6, HIGH);
|
||||
} else if (subStrn.equals("OFF")){
|
||||
|
||||
Serial.println("ITS OFF");
|
||||
digitalWrite(13, LOW);
|
||||
digitalWrite(6, LOW);
|
||||
|
||||
}
|
||||
responseMsg = "";
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,133 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
#include "ArduinoBoardSketch.h"
|
||||
|
||||
/**********************************************************************************************
|
||||
This method will traverse the array of digital pins and batch the data from the those pins together.
|
||||
It makes a single call to the server and sends all pin values as a batch.
|
||||
Server dis-assembles it accordingly and makes multiple publish calls for each sensor type.
|
||||
***********************************************************************************************/
|
||||
|
||||
void pushData(){
|
||||
|
||||
payLoad = "\"temperature\":";
|
||||
payLoad += dtostrf(cpuTemperature, 3, 2, charBuf);
|
||||
payLoad += "}}}";
|
||||
|
||||
client.fastrprint(F("POST "));
|
||||
client.fastrprint(DAS_SERVICE_EPOINT);
|
||||
client.fastrprint(F(" HTTP/1.1")); client.fastrprint(F("\n"));
|
||||
client.fastrprint(host.c_str()); client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("Authorization: Bearer ")); client.fastrprint(F(DEVICE_TOKEN)); client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("Content-Type: application/json")); client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("Accept: application/json")); client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("Content-Length: "));
|
||||
|
||||
int payLength = jsonPayLoad.length() + payLoad.length();
|
||||
|
||||
client.fastrprint(String(payLength).c_str()); client.fastrprint(F("\n"));
|
||||
client.fastrprint(F("\n"));
|
||||
|
||||
if(DEBUG) {
|
||||
Serial.print("POST ");
|
||||
Serial.print(DAS_SERVICE_EPOINT);
|
||||
Serial.print(" HTTP/1.1"); Serial.println();
|
||||
Serial.print(host); Serial.println();
|
||||
Serial.print("Content-Type: application/json"); Serial.println();
|
||||
Serial.print("Content-Length: ");
|
||||
Serial.print(payLength); Serial.println();
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
||||
int chunkSize = 50;
|
||||
|
||||
for (int i = 0; i < jsonPayLoad.length(); i++) {
|
||||
if ( (i+1)*chunkSize > jsonPayLoad.length()) {
|
||||
client.print(jsonPayLoad.substring(i*chunkSize, jsonPayLoad.length()));
|
||||
if(DEBUG) Serial.print(jsonPayLoad.substring(i*chunkSize, jsonPayLoad.length()));
|
||||
i = jsonPayLoad.length();
|
||||
} else {
|
||||
client.print(jsonPayLoad.substring(i*chunkSize, (i+1)*chunkSize));
|
||||
if(DEBUG) Serial.print(jsonPayLoad.substring(i*chunkSize, (i+1)*chunkSize));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < payLoad.length(); i++) {
|
||||
if ( (i+1)*chunkSize > payLoad.length()) {
|
||||
client.print(payLoad.substring(i*chunkSize, payLoad.length()));
|
||||
if(DEBUG) Serial.print(payLoad.substring(i*chunkSize, payLoad.length()));
|
||||
i = payLoad.length();
|
||||
} else {
|
||||
client.print(payLoad.substring(i*chunkSize, (i+1)*chunkSize));
|
||||
if(DEBUG) Serial.print(payLoad.substring(i*chunkSize, (i+1)*chunkSize));
|
||||
}
|
||||
}
|
||||
|
||||
client.fastrprint(F("\n"));
|
||||
if(DEBUG) Serial.println();
|
||||
|
||||
delay(1000);
|
||||
|
||||
|
||||
while (client.available()) {
|
||||
char response = client.read();
|
||||
if(DEBUG) Serial.print(response);
|
||||
}
|
||||
|
||||
|
||||
if(DEBUG) {
|
||||
Serial.println();
|
||||
Serial.println("-------------------------------");
|
||||
}
|
||||
|
||||
payLoad = "";
|
||||
}
|
||||
|
||||
|
||||
double getBoardTemp(void)
|
||||
{
|
||||
unsigned int wADC;
|
||||
double t;
|
||||
|
||||
// The internal temperature has to be used
|
||||
// with the internal reference of 1.1V.
|
||||
// Channel 8 can not be selected with
|
||||
// the analogRead function yet.
|
||||
|
||||
// Set the internal reference and mux.
|
||||
ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3));
|
||||
ADCSRA |= _BV(ADEN); // enable the ADC
|
||||
|
||||
delay(20); // wait for voltages to become stable.
|
||||
|
||||
ADCSRA |= _BV(ADSC); // Start the ADC
|
||||
|
||||
// Detect end-of-conversion
|
||||
while (bit_is_set(ADCSRA,ADSC));
|
||||
|
||||
// Reading register "ADCW" takes care of how to read ADCL and ADCH.
|
||||
wADC = ADCW;
|
||||
|
||||
// The offset of 324.31 could be wrong. It is just an indication.
|
||||
t = (wADC - 324.31 ) / 1.22;
|
||||
|
||||
// The returned temperature is in degrees Celcius.
|
||||
return (t);
|
||||
}
|
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,20 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
templates=ArduinoBoardSketch.h
|
||||
zipfilename=ArduinoBoardSketch.zip
|
@ -0,0 +1 @@
|
||||
custom = true
|
@ -0,0 +1,43 @@
|
||||
<?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.
|
||||
-->
|
||||
<DeviceTypeConfiguration name="arduino">
|
||||
<Features>
|
||||
<Feature code="bulb">
|
||||
<Name>Control Bulb</Name>
|
||||
<Description>Control Bulb on Arduino Uno</Description>
|
||||
<Operation context="/arduino/device/{deviceId}/bulb" method="POST">
|
||||
<QueryParameters>
|
||||
<Parameter>state</Parameter>
|
||||
</QueryParameters>
|
||||
</Operation>
|
||||
</Feature>
|
||||
</Features>
|
||||
|
||||
<ProvisioningConfig>
|
||||
<SharedWithAllTenants>false</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
<Version>1.0.0</Version>
|
||||
<Text>This is license text</Text>
|
||||
</License>
|
||||
|
||||
</DeviceTypeConfiguration>
|
@ -0,0 +1,20 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/sketches/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/sketches/arduino/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/agent/,target:${installFolder}/../../../repository/resources/sketches/arduino/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/jaggeryapps/,target:${installFolder}/../../../repository/deployment/server/jaggeryapps/,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/deployment/server/devicetypes/);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/devicetypes/,target:${installFolder}/../../../repository/deployment/server/devicetypes/,overwrite:true);\
|
||||
|
||||
instructions.unconfigure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/resources/sketches/arduino);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.device-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.type-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.analytics-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.platform.configuration);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/resources/devicetypes/arduino.car);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../repository/deployment/server/devicetypes/arduino.xml);\
|
Loading…
Reference in new issue