Convert existing device types to samples

application-manager-new
charithag 9 years ago
parent 7e11475bb5
commit 5384c8ef0a

@ -17,7 +17,8 @@
~ 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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.dc</groupId>
@ -104,22 +105,22 @@
</goals>
<configuration>
<tasks>
<echo message="########### Create Device Management H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/WSO2DM_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/h2.sql" />
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/repository/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/WSO2DM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/h2.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</tasks>
</configuration>
</execution>
@ -132,21 +133,21 @@
</goals>
<configuration>
<tasks>
<echo message="########### Create IDP Management H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/identity/application-mgt/h2.sql" />
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/repository/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/identity/application-mgt/h2.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</configuration>
</execution>
@ -159,25 +160,25 @@
</goals>
<configuration>
<tasks>
<echo message="########### Create API Management H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/WSO2AM_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/apimgt/h2.sql" />
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/repository/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/WSO2AM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/apimgt/h2.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</configuration>
</execution>
<execution>
<execution>
<!-- Creating IOT Management schema -->
<id>create-firealarm-schema</id>
<phase>package</phase>
@ -186,22 +187,23 @@
</goals>
<configuration>
<tasks>
<echo message="########### Device Cloud H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/FireAlarmDM_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_raspberry.sql" /-->
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_firealarm.sql" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/samples/firealarm/database"/>
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/samples/firealarm/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/FireAlarmDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_firealarm.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</tasks>
</configuration>
</execution>
@ -214,21 +216,22 @@
</goals>
<configuration>
<tasks>
<echo message="########### Device Cloud H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/SensebotDM_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_raspberry.sql" /-->
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_sensebot.sql" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/samples/sensebot/database"/>
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/samples/sensebot/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/SensebotDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_sensebot.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</configuration>
</execution>
@ -242,21 +245,22 @@
</goals>
<configuration>
<tasks>
<echo message="########### Device Cloud H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/ArduinoDM_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_raspberry.sql" /-->
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_arduino.sql" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/samples/arduino/database"/>
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/samples/arduino/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/ArduinoDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_arduino.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</configuration>
</execution>
@ -270,20 +274,21 @@
</goals>
<configuration>
<tasks>
<echo message="########### Device Cloud H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/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" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_android_sense.sql" />
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/repository/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"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_android_sense.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</configuration>
</execution>
@ -297,21 +302,21 @@
</goals>
<configuration>
<tasks>
<echo message="########### Device Cloud H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/RaspberrypiDM_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_raspberry.sql" /-->
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_raspberrypi.sql" />
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/repository/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/RaspberrypiDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_raspberrypi.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</configuration>
</execution>
@ -325,53 +330,51 @@
</goals>
<configuration>
<tasks>
<echo message="########### Device Cloud H2 Schema ###########" />
<property name="db.dir" value="target/wso2carbon-core-${carbon.kernel.version}/repository/database" />
<property name="userid" value="wso2carbon" />
<property name="password" value="wso2carbon" />
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/DigitalDisplayDM_DB;DB_CLOSE_ON_EXIT=FALSE" />
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_raspberry.sql" /-->
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_digital_display.sql" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/samples/digital_display/database"/>
<property name="db.dir"
value="target/wso2carbon-core-${carbon.kernel.version}/samples/digital_display/database"/>
<property name="userid" value="wso2carbon"/>
<property name="password" value="wso2carbon"/>
<property name="dbURL"
value="jdbc:h2:file:${basedir}/${db.dir}/DigitalDisplayDM_DB;DB_CLOSE_ON_EXIT=FALSE"/>
<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}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/plugins/h2_digital_display.sql"/>
</sql>
<echo message="##################### END ####################" />
</tasks>
</configuration>
</execution>
<execution>
<id>3-extract-docs-from-components</id>
<id>3-extract-apps-from-components</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<property name="tempdir" value="target/docs-temp" />
<property name="jardir" value="target/jars" />
<property name="tempdir" value="target/apps-temp"/>
<property name="jardir" value="target/jars"/>
<!--<property name="shindig.version" value="2.5.0-beta5" />-->
<mkdir dir="${tempdir}" />
<mkdir dir="${tempdir}/wso2dc-${project.version}/repository/components" />
<mkdir dir="${tempdir}/wso2dc-${project.version}/repository/deployment/server" />
<mkdir dir="${tempdir}/wso2dc-${project.version}/repository/deployment/server/webapps" />
<mkdir dir="${tempdir}"/>
<mkdir dir="${tempdir}/wso2dc-${project.version}/repository/components"/>
<mkdir dir="${tempdir}/wso2dc-${project.version}/repository/deployment/server"/>
<mkdir dir="${tempdir}/wso2dc-${project.version}/repository/deployment/server/webapps"/>
<unzip dest="${tempdir}">
<fileset dir="target">
<include name="wso2dc-${project.version}.zip" />
<include name="wso2dc-${project.version}.zip"/>
</fileset>
</unzip>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components" overwrite="true">
<fileset dir="${tempdir}/wso2dc-${project.version}/repository/components" />
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components"
overwrite="true">
<fileset dir="${tempdir}/wso2dc-${project.version}/repository/components"/>
</copy>
<!--testing -->
<!--<unzip src="target/shindig/WEB-INF/lib/shindig-common-${shindig.version}.jar" dest="${jardir}/shindig-common-${shindig.version}">
@ -391,8 +394,8 @@
og4j.logger.net.sf.ehcache=ERROR
</concat>
<delete file="target/wso2dc-${project.version}.zip" />
<delete dir="${tempdir}" />
<delete file="target/wso2dc-${project.version}.zip"/>
<delete dir="${tempdir}"/>
</tasks>
</configuration>
</execution>
@ -401,40 +404,51 @@
<phase>package</phase>
<configuration>
<tasks>
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/webapps" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/webapps"/>
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/sketches" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/samples"/>
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/scripts" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/sketches"/>
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/statistics" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/scripts"/>
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/patches" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/statistics"/>
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/lib" />
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/patches"/>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps" overwrite="true">
<mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/lib"/>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps"
overwrite="true">
<fileset dir="src/repository/jaggeryapps"></fileset>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/sketches" overwrite="true">
<fileset dir="src/sketches" />
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/samples"
overwrite="true">
<fileset dir="src/samples"/>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/sketches"
overwrite="true">
<fileset dir="src/sketches"/>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/scripts" overwrite="true">
<fileset dir="src/scripts" />
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/resources/scripts"
overwrite="true">
<fileset dir="src/scripts"/>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/statistics" overwrite="true">
<fileset dir="src/statistics" />
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/statistics"
overwrite="true">
<fileset dir="src/statistics"/>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/patches">
<fileset dir="src/patches" />
<fileset dir="src/patches"/>
</copy>
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/lib">
<fileset dir="src/lib" />
<fileset dir="src/lib"/>
</copy>
<!--<copy todir="target/wso2carbon-core-${carbon.kernel.version}/modules" overwrite="true">
@ -459,20 +473,20 @@
<phase>install</phase>
<configuration>
<tasks>
<delete dir="target/jars" />
<delete dir="target/*.xml" />
<delete dir="target/archive-tmp" />
<delete dir="target/dependency-maven-plugin-markers" />
<delete dir="target/maven-archiver" />
<delete dir="target/wso2carbon-core-${carbon.kernel.version}" />
<delete dir="target/wso2carbon-core-${carbon.kernel.version}" />
<delete file="target/wso2dc-${project.version}.jar" />
<delete dir="target/sources" />
<delete dir="target/site" />
<delete dir="target/antrun" />
<delete dir="src/site" />
<delete dir="target/jars"/>
<delete dir="target/*.xml"/>
<delete dir="target/archive-tmp"/>
<delete dir="target/dependency-maven-plugin-markers"/>
<delete dir="target/maven-archiver"/>
<delete dir="target/wso2carbon-core-${carbon.kernel.version}"/>
<delete dir="target/wso2carbon-core-${carbon.kernel.version}"/>
<delete file="target/wso2dc-${project.version}.jar"/>
<delete dir="target/sources"/>
<delete dir="target/site"/>
<delete dir="target/antrun"/>
<delete dir="src/site"/>
<!--<delete dir="target/shindig" />-->
<delete dir="target/jaxwebapps" />
<delete dir="target/jaxwebapps"/>
</tasks>
</configuration>
<goals>

@ -1,232 +0,0 @@
.date-picker
{
width:170px;
height:25px;
padding:0;
border:0;
line-height:25px;
padding-left:10px;
font-size:12px;
font-family:Arial;
font-weight:bold;
cursor:pointer;
color:#303030;
position:relative;
z-index:2;
}
.date-picker-wrapper
{
position:absolute;
z-index:1;
border:1px solid #bfbfbf;
background-color:#efefef;
width:428px;
padding: 5px 12px;
font-size:12px;
line-height:20px;
color:#aaa;
font-family:Arial;
box-shadow:3px 3px 10px rgba(0,0,0,0.5);
}
.date-picker-wrapper.single-date {
width:auto;
}
.date-picker-wrapper.no-shortcuts { padding-bottom:12px;}
.date-picker-wrapper .footer
{
font-size:11px;
padding-top: 3px;
}
.date-picker-wrapper b
{
color:#666;
font-weight:700;
}
.date-picker-wrapper a
{
color: rgb(107, 180, 214);
text-decoration:underline;
}
.date-picker-wrapper .month-name
{
text-transform: uppercase;
}
.date-picker-wrapper .month-wrapper
{
border:1px solid #bfbfbf;
border-radius:3px;
background-color:#fff;
padding:5px;
cursor:default;
position:relative;
_overflow:hidden;
}
.date-picker-wrapper .month-wrapper table
{
width:190px;
float:left;
}
.date-picker-wrapper .month-wrapper table.month2
{
width:190px;
float:right;
}
.date-picker-wrapper .month-wrapper table th,
.date-picker-wrapper .month-wrapper table td
{
vertical-align:middle;
text-align:center;
line-height:14px;
margin : 0px;
padding : 0px;
}
.date-picker-wrapper .month-wrapper table .day
{
height:19px;
line-height:19px;
font-size:12px;
margin-bottom:1px;
color:#999;
cursor:default;
}
.date-picker-wrapper .month-wrapper table div.day.lastMonth,
.date-picker-wrapper .month-wrapper table div.day.nextMonth
{
color:#999;
cursor:default;
}
.date-picker-wrapper .month-wrapper table .day.checked
{
background-color: rgba(156, 219, 247, 0.5);
}
.date-picker-wrapper .month-wrapper table .week-name
{
height:20px;
line-height:20px;
font-weight:100;
text-transform: uppercase;
}
.date-picker-wrapper .month-wrapper table .day.has-tooltip { cursor:help !important;}
.date-picker-wrapper .month-wrapper table .day.toMonth.valid
{
color:#333;
cursor:pointer;
}
.date-picker-wrapper .month-wrapper table .day.real-today { background-color: rgb(255, 230, 132); }
.date-picker-wrapper .month-wrapper table .day.real-today.checked { background-color: rgb(112, 204, 213); }
.date-picker-wrapper table .caption
{
height:40px;
}
.date-picker-wrapper table .caption .next,
.date-picker-wrapper table .caption .prev
{
padding:0 5px;
cursor:pointer;
}
.date-picker-wrapper table .caption .next:hover,
.date-picker-wrapper table .caption .prev:hover
{
background-color:#ccc;
color:white;
}
.date-picker-wrapper .gap
{
position:absolute;
display:none;
top:0px;
left:204px;
z-index: 1;
width:15px;
height: 100%;
background-color:red;
font-size:0;
line-height:0;
}
.date-picker-wrapper .gap .gap-lines { height: 100%; overflow:hidden; }
.date-picker-wrapper .gap .gap-line { height:15px;width:15px; position:relative; }
.date-picker-wrapper .gap .gap-line .gap-1 { z-index:1; height:0; border-left:8px solid white; border-top:8px solid #eee;border-bottom:8px solid #eee; }
.date-picker-wrapper .gap .gap-line .gap-2 { position:absolute; right:0; top:0px; z-index:2; height:0; border-left:8px solid transparent; border-top:8px solid white; }
.date-picker-wrapper .gap .gap-line .gap-3 { position:absolute; right:0; top:8px; z-index:2; height:0; border-left:8px solid transparent; border-bottom:8px solid white; }
.date-picker-wrapper .gap .gap-top-mask { width: 6px; height:1px; position:absolute; top: -1px; left: 1px; background-color: #eee; z-index:3; }
.date-picker-wrapper .gap .gap-bottom-mask { width: 6px; height:1px; position:absolute; bottom: -1px; left: 7px; background-color: #eee; z-index:3; }
.date-picker-wrapper .selected-days
{
display:none;
}
.date-picker-wrapper .drp_top-bar
{
line-height:40px;
height:40px;
position:relative;
}
.date-picker-wrapper .drp_top-bar .error-top { display:none; }
.date-picker-wrapper .drp_top-bar .normal-top { display:none; }
.date-picker-wrapper .drp_top-bar .default-top { display:block; }
.date-picker-wrapper .drp_top-bar.error .default-top { display:none; }
.date-picker-wrapper .drp_top-bar.error .error-top { display:block; color:red; }
.date-picker-wrapper .drp_top-bar.normal .default-top { display:none; }
.date-picker-wrapper .drp_top-bar.normal .normal-top { display:block; }
.date-picker-wrapper .drp_top-bar .apply-btn
{
position:absolute;
right: 0px;
top: 6px;
padding:3px 5px;
margin:0;
font-size:12px;
border-radius:4px;
cursor:pointer;
color: #d9eef7;
border: solid 1px #0076a3;
background: #0095cd;
background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
background: -moz-linear-gradient(top, #00adee, #0078a5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');
color:white;
}
.date-picker-wrapper .drp_top-bar .apply-btn.disabled
{
cursor: pointer;
color: #606060;
border: solid 1px #b7b7b7;
background: #fff;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));
background: -moz-linear-gradient(top, #fff, #ededed);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');
}
/*time styling*/
.time {
position: relative;
}
.time input[type=range] {
vertical-align: middle;
}
.time1, .time2 {
width: 180px;
padding: 0 5px;
text-align: center;
}
.time1 {
float: left;
}
.time2 {
float: right;
}
.hour, .minute {
text-align: right;
}
.hide {
display: none;
}

@ -1,645 +0,0 @@
/********************
* SVG CSS
*/
svg {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
/* Trying to get SVG to act like a greedy block in all browsers */
display: block;
width:100%;
height:100%;
}
/********************
Default CSS for an svg element nvd3 used
*/
svg.nvd3-svg {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-ms-user-select: none;
-moz-user-select: none;
user-select: none;
display: block;
}
/********************
Box shadow and border radius styling
*/
.nvtooltip.with-3d-shadow, .with-3d-shadow .nvtooltip {
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
/********************
* TOOLTIP CSS
*/
.nvtooltip {
position: absolute;
background-color: rgba(255,255,255,1.0);
padding: 1px;
border: 1px solid rgba(0,0,0,.2);
z-index: 10000;
font-family: Arial;
font-size: 13px;
text-align: left;
pointer-events: none;
white-space: nowrap;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/*Give tooltips that old fade in transition by
putting a "with-transitions" class on the container div.
*/
.nvtooltip.with-transitions, .with-transitions .nvtooltip {
transition: opacity 50ms linear;
-moz-transition: opacity 50ms linear;
-webkit-transition: opacity 50ms linear;
transition-delay: 200ms;
-moz-transition-delay: 200ms;
-webkit-transition-delay: 200ms;
}
.nvtooltip.x-nvtooltip,
.nvtooltip.y-nvtooltip {
padding: 8px;
}
.nvtooltip h3 {
margin: 0;
padding: 4px 14px;
line-height: 18px;
font-weight: normal;
background-color: rgba(247,247,247,0.75);
text-align: center;
border-bottom: 1px solid #ebebeb;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 1px 5px 0 0;
}
.nvtooltip p {
margin: 0;
padding: 5px 14px;
text-align: center;
}
.nvtooltip span {
display: inline-block;
margin: 2px 0;
}
.nvtooltip table {
margin: 6px;
border-spacing:0;
}
.nvtooltip table td {
padding: 2px 9px 2px 0;
vertical-align: middle;
}
.nvtooltip table td.key {
font-weight:normal;
}
.nvtooltip table td.value {
text-align: right;
font-weight: bold;
}
.nvtooltip table tr.highlight td {
padding: 1px 9px 1px 0;
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-style: solid;
border-top-width: 1px;
}
.nvtooltip table td.legend-color-guide div {
width: 8px;
height: 8px;
vertical-align: middle;
}
.nvtooltip .footer {
padding: 3px;
text-align: center;
}
.nvtooltip-pending-removal {
position: absolute;
pointer-events: none;
}
.nvd3 text {
font: normal 12px Arial;
}
.nvd3 .title {
font: bold 14px Arial;
}
.nvd3 .nv-background {
fill: white;
fill-opacity: 0;
}
.nvd3.nv-noData {
font-size: 18px;
font-weight: bold;
}
/**********
* Brush
*/
.nv-brush .extent {
fill-opacity: .125;
shape-rendering: crispEdges;
}
/**********
* Legend
*/
.nvd3 .nv-legend .nv-series {
cursor: pointer;
}
.nvd3 .nv-legend .nv-disabled circle {
fill-opacity: 0;
}
/**********
* Axes
*/
.axis {
opacity: 1;
}
.axis.nv-disabled {
opacity: 0;
}
.nvd3 .nv-axis {
pointer-events:none;
}
.nvd3 .nv-axis path {
fill: none;
stroke: #000;
stroke-opacity: .75;
shape-rendering: crispEdges;
}
.nvd3 .nv-axis path.domain {
stroke-opacity: .75;
}
.nvd3 .nv-axis.nv-x path.domain {
stroke-opacity: 0;
}
.nvd3 .nv-axis line {
fill: none;
stroke: #e5e5e5;
shape-rendering: crispEdges;
}
.nvd3 .nv-axis .zero line,
/*this selector may not be necessary*/ .nvd3 .nv-axis line.zero {
stroke-opacity: .75;
}
.nvd3 .nv-axis .nv-axisMaxMin text {
font-weight: bold;
}
.nvd3 .x .nv-axis .nv-axisMaxMin text,
.nvd3 .x2 .nv-axis .nv-axisMaxMin text,
.nvd3 .x3 .nv-axis .nv-axisMaxMin text {
text-anchor: middle
}
/**********
* Brush
*/
.nv-brush .resize path {
fill: #eee;
stroke: #666;
}
/**********
* Bars
*/
.nvd3 .nv-bars .negative rect {
zfill: brown;
}
.nvd3 .nv-bars rect {
zfill: steelblue;
fill-opacity: .75;
transition: fill-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear;
}
.nvd3 .nv-bars rect.hover {
fill-opacity: 1;
}
.nvd3 .nv-bars .hover rect {
fill: lightblue;
}
.nvd3 .nv-bars text {
fill: rgba(0,0,0,0);
}
.nvd3 .nv-bars .hover text {
fill: rgba(0,0,0,1);
}
/**********
* Bars
*/
.nvd3 .nv-multibar .nv-groups rect,
.nvd3 .nv-multibarHorizontal .nv-groups rect,
.nvd3 .nv-discretebar .nv-groups rect {
stroke-opacity: 0;
transition: fill-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear;
}
.nvd3 .nv-multibar .nv-groups rect:hover,
.nvd3 .nv-multibarHorizontal .nv-groups rect:hover,
.nvd3 .nv-discretebar .nv-groups rect:hover {
fill-opacity: 1;
}
.nvd3 .nv-discretebar .nv-groups text,
.nvd3 .nv-multibarHorizontal .nv-groups text {
font-weight: bold;
fill: rgba(0,0,0,1);
stroke: rgba(0,0,0,0);
}
/***********
* Pie Chart
*/
.nvd3.nv-pie path {
stroke-opacity: 0;
transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear, stroke-width 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-pie .nv-pie-title {
font-size: 24px;
fill: rgba(19, 196, 249, 0.59);
}
.nvd3.nv-pie .nv-slice text {
stroke: #000;
stroke-width: 0;
}
.nvd3.nv-pie path {
stroke: #fff;
stroke-width: 1px;
stroke-opacity: 1;
}
.nvd3.nv-pie .hover path {
fill-opacity: .7;
}
.nvd3.nv-pie .nv-label {
pointer-events: none;
}
.nvd3.nv-pie .nv-label rect {
fill-opacity: 0;
stroke-opacity: 0;
}
/**********
* Lines
*/
.nvd3 .nv-groups path.nv-line {
fill: none;
stroke-width: 1.5px;
}
.nvd3 .nv-groups path.nv-line.nv-thin-line {
stroke-width: 1px;
}
.nvd3 .nv-groups path.nv-area {
stroke: none;
}
.nvd3 .nv-line.hover path {
stroke-width: 6px;
}
.nvd3.nv-line .nvd3.nv-scatter .nv-groups .nv-point {
fill-opacity: 0;
stroke-opacity: 0;
}
.nvd3.nv-scatter.nv-single-point .nv-groups .nv-point {
fill-opacity: .5 !important;
stroke-opacity: .5 !important;
}
.with-transitions .nvd3 .nv-groups .nv-point {
transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-moz-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: stroke-width 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-scatter .nv-groups .nv-point.hover,
.nvd3 .nv-groups .nv-point.hover {
stroke-width: 7px;
fill-opacity: .95 !important;
stroke-opacity: .95 !important;
}
.nvd3 .nv-point-paths path {
stroke: #aaa;
stroke-opacity: 0;
fill: #eee;
fill-opacity: 0;
}
.nvd3 .nv-indexLine {
cursor: ew-resize;
}
/**********
* Distribution
*/
.nvd3 .nv-distribution {
pointer-events: none;
}
/**********
* Scatter
*/
.nvd3 .nv-groups .nv-point.hover {
stroke-width: 20px;
stroke-opacity: .5;
}
.nvd3 .nv-scatter .nv-point.hover {
fill-opacity: 1;
}
/**********
* Stacked Area
*/
.nvd3.nv-stackedarea path.nv-area {
fill-opacity: .7;
stroke-opacity: 0;
transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
-moz-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
-webkit-transition: fill-opacity 250ms linear, stroke-opacity 250ms linear;
}
.nvd3.nv-stackedarea path.nv-area.hover {
fill-opacity: .9;
}
.nvd3.nv-stackedarea .nv-groups .nv-point {
stroke-opacity: 0;
fill-opacity: 0;
}
/**********
* Line Plus Bar
*/
.nvd3.nv-linePlusBar .nv-bar rect {
fill-opacity: .75;
}
.nvd3.nv-linePlusBar .nv-bar rect:hover {
fill-opacity: 1;
}
/**********
* Bullet
*/
.nvd3.nv-bullet { font: 10px sans-serif; }
.nvd3.nv-bullet .nv-measure { fill-opacity: .8; }
.nvd3.nv-bullet .nv-measure:hover { fill-opacity: 1; }
.nvd3.nv-bullet .nv-marker { stroke: #000; stroke-width: 2px; }
.nvd3.nv-bullet .nv-markerTriangle { stroke: #000; fill: #fff; stroke-width: 1.5px; }
.nvd3.nv-bullet .nv-tick line { stroke: #666; stroke-width: .5px; }
.nvd3.nv-bullet .nv-range.nv-s0 { fill: #eee; }
.nvd3.nv-bullet .nv-range.nv-s1 { fill: #ddd; }
.nvd3.nv-bullet .nv-range.nv-s2 { fill: #ccc; }
.nvd3.nv-bullet .nv-title { font-size: 14px; font-weight: bold; }
.nvd3.nv-bullet .nv-subtitle { fill: #999; }
.nvd3.nv-bullet .nv-range {
fill: #bababa;
fill-opacity: .4;
}
.nvd3.nv-bullet .nv-range:hover {
fill-opacity: .7;
}
/**********
* Sparkline
*/
.nvd3.nv-sparkline path {
fill: none;
}
.nvd3.nv-sparklineplus g.nv-hoverValue {
pointer-events: none;
}
.nvd3.nv-sparklineplus .nv-hoverValue line {
stroke: #333;
stroke-width: 1.5px;
}
.nvd3.nv-sparklineplus,
.nvd3.nv-sparklineplus g {
pointer-events: all;
}
.nvd3 .nv-hoverArea {
fill-opacity: 0;
stroke-opacity: 0;
}
.nvd3.nv-sparklineplus .nv-xValue,
.nvd3.nv-sparklineplus .nv-yValue {
stroke-width: 0;
font-size: .9em;
font-weight: normal;
}
.nvd3.nv-sparklineplus .nv-yValue {
stroke: #f66;
}
.nvd3.nv-sparklineplus .nv-maxValue {
stroke: #2ca02c;
fill: #2ca02c;
}
.nvd3.nv-sparklineplus .nv-minValue {
stroke: #d62728;
fill: #d62728;
}
.nvd3.nv-sparklineplus .nv-currentValue {
font-weight: bold;
font-size: 1.1em;
}
/**********
* historical stock
*/
.nvd3.nv-ohlcBar .nv-ticks .nv-tick {
stroke-width: 1px;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.hover {
stroke-width: 2px;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.positive {
stroke: #2ca02c;
}
.nvd3.nv-ohlcBar .nv-ticks .nv-tick.negative {
stroke: #d62728;
}
.nvd3.nv-historicalStockChart .nv-axis .nv-axislabel {
font-weight: bold;
}
.nvd3.nv-historicalStockChart .nv-dragTarget {
fill-opacity: 0;
stroke: none;
cursor: move;
}
.nvd3 .nv-brush .extent {
fill-opacity: 0 !important;
}
.nvd3 .nv-brushBackground rect {
stroke: #000;
stroke-width: .4;
fill: #fff;
fill-opacity: .7;
}
/**********
* Parallel Coordinates
*/
.nvd3 .background path {
fill: none;
stroke: #EEE;
stroke-opacity: .4;
shape-rendering: crispEdges;
}
.nvd3 .foreground path {
fill: none;
stroke-opacity: .7;
}
.nvd3 .brush .extent {
fill-opacity: .3;
stroke: #fff;
shape-rendering: crispEdges;
}
.nvd3 .axis line, .axis path {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.nvd3 .axis text {
text-shadow: 0 1px 0 #fff;
}
/****
Interactive Layer
*/
.nvd3 .nv-interactiveGuideLine {
pointer-events:none;
}
.nvd3 line.nv-guideline {
stroke: #ccc;
}

@ -1,10 +0,0 @@
function changeImage() {
var image = document.getElementById('myImage');
if (image.src.match("bulb-on")) {
image.src = "/iot/public/mydevice/images/bulb-off.png";
} else {
image.src = "/iot/public/mydevice/images/bulb-on.png";
}
}

@ -1,117 +0,0 @@
var fromDate;
var toDate;
var configObject = {
format: 'DD.MM.YYYY HH:mm',
separator: ' to ',
language: 'auto',
startOfWeek: 'sunday',// or sunday
getValue: function () {
return this.value;
},
setValue: function (s) {
this.value = s;
},
startDate: false,
endDate: false,
minDays: 0,
maxDays: 0,
showShortcuts: true,
time: {
enabled: true
},
shortcuts: {
//'prev-days': [1,3,5,7],
'next-days': [3, 5, 7],
//'prev' : ['week','month','year'],
'next': ['week', 'month', 'year']
},
customShortcuts: [],
inline: false,
container: 'body',
alwaysOpen: false,
singleDate: false,
batchMode: false,
stickyMonths: false
};
$('#date-range1').dateRangePicker(configObject)
.bind('datepicker-apply', function (event, dateRange) {
fromDate = dateRange.date1 != "Invalid Date" ? dateRange.date1.getTime() / 1000 : null;
toDate = dateRange.date2 != "Invalid Date" ? dateRange.date2.getTime() / 1000 : null;
});
$('#btn-draw-graphs').on('click', function () {
var deviceId = $('#device_id').val();
console.log("device id:"+deviceId);
getStats(deviceId, fromDate, toDate);
});
function getStats(deviceId, from, to) {
var requestData = new Object();
requestData['deviceId'] = deviceId;
if (from) {
requestData['from'] = from;
}
if (to) {
requestData['to'] = to;
}
var getStatsRequest = $.ajax({
url: "api/stats",
method: "GET",
data: requestData
});
getStatsRequest.done(function (stats) {
updateGraphs(JSON.parse(stats));
});
getStatsRequest.fail(function (jqXHR, textStatus) {
alert("Request failed: " + textStatus);
});
}
function getUrlParameter(paramName) {
var pageURL = window.location.search.substring(1);
var urlVariables = pageURL.split('&');
for (var i = 0; i < urlVariables.length; i++) {
var parameterName = urlVariables[i].split('=');
if (parameterName[0] == paramName) {
return parameterName[1];
}
}
}
function updateGraphs(stats) {
var temperatureData = stats['temperatureData'];
updateTemperatureGraph(convertStatsToGraphData(temperatureData));
var lightData = stats['lightData'];
updateLightGraph(convertStatsToGraphData(lightData));
var motionData = stats['motionData'];
updateMotionGraph(convertStatsToGraphData(motionData));
var sonarData = stats['sonarData'];
updateSonarGraph(convertStatsToGraphData(sonarData));
}
function convertStatsToGraphData(stats) {
var graphData = new Array();
for (var i = 0; i < stats.length; i++) {
graphData.push({x: parseInt(stats[i]['time']) * 1000, y: stats[i]['value']})
}
return graphData;
}

@ -1,61 +0,0 @@
var lightChart;
nv.addGraph(function () {
lightChart = nv.models.lineChart()
.interpolate("linear")
.options({
transitionDuration: 300,
useInteractiveGuideline: true
})
;
lightChart.xScale(d3.time.scale());
// chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
lightChart.xAxis
.axisLabel("Date/Time")
.ticks(d3.time.seconds)
.tickFormat(function (d) {
return d3.time.format('%m/%d/%Y %I:%M:%S %p')(new Date(d))
})
.staggerLabels(true)
;
lightChart.yAxis
.axisLabel('Light')
;
d3.select('.chart2 svg')
.datum(getLightChartData())
.call(lightChart);
nv.utils.windowResize(lightChart.update);
return lightChart;
});
function getLightChartData() {
return [
{
area: true,
values: [],
key: "Light",
color: "#34500e"
}
];
}
function updateLightGraph(lightData) {
var chartData = getLightChartData();
chartData[0]['values'] = lightData;
//TODO
//d3.select('.chart2 svg')
// .datum(chartData)
// .transition().duration(500)
// .call(lightChart);
}

@ -1,60 +0,0 @@
var motionChart;
nv.addGraph(function () {
motionChart = nv.models.lineChart()
.interpolate("linear")
.options({
transitionDuration: 300,
useInteractiveGuideline: true
})
;
motionChart.xScale(d3.time.scale());
// chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
motionChart.xAxis
.axisLabel("Date/Time")
.ticks(d3.time.seconds)
.tickFormat(function (d) {
return d3.time.format('%m/%d/%Y %I:%M:%S %p')(new Date(d))
})
.staggerLabels(true)
;
motionChart.yAxis
.axisLabel('Motion')
;
d3.select('.chart3 svg')
.datum(getMotionChartData())
.call(motionChart);
nv.utils.windowResize(motionChart.update);
return motionChart;
});
function getMotionChartData() {
return [
{
area: true,
values: [],
key: "Motion",
color: "#34500e"
}
];
}
function updateMotionGraph(motionData) {
var chartData = getMotionChartData();
chartData[0]['values'] = motionData;
d3.select('.chart3 svg')
.datum(chartData)
.transition().duration(500)
.call(motionChart);
}

@ -1,60 +0,0 @@
var sonarChart;
nv.addGraph(function () {
sonarChart = nv.models.lineChart()
.interpolate("linear")
.options({
transitionDuration: 300,
useInteractiveGuideline: true
})
;
sonarChart.xScale(d3.time.scale());
// chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
sonarChart.xAxis
.axisLabel("Date/Time")
.ticks(d3.time.seconds)
.tickFormat(function (d) {
return d3.time.format('%m/%d/%Y %I:%M:%S %p')(new Date(d))
})
.staggerLabels(true)
;
sonarChart.yAxis
.axisLabel('Sonar')
;
d3.select('.chart4 svg')
.datum(getSonarChartData())
.call(sonarChart);
nv.utils.windowResize(sonarChart.update);
return sonarChart;
});
function getSonarChartData() {
return [
{
area: true,
values: [],
key: "Sonar",
color: "#34500e"
}
];
}
function updateSonarGraph(sonarData) {
var chartData = getSonarChartData();
chartData[0]['values'] = sonarData;
d3.select('.chart4 svg')
.datum(chartData)
.transition().duration(500)
.call(sonarChart);
}

@ -1,35 +0,0 @@
/* Inspired by Lee Byron's test data generator. */
function stream_layers(n, m, o) {
if (arguments.length < 3) o = 0;
function bump(a) {
var x = 1 / (.1 + Math.random()),
y = 2 * Math.random() - .5,
z = 10 / (.1 + Math.random());
for (var i = 0; i < m; i++) {
var w = (i / m - y) * z;
a[i] += x * Math.exp(-w * w);
}
}
return d3.range(n).map(function() {
var a = [], i;
for (i = 0; i < m; i++) a[i] = o + o * Math.random();
for (i = 0; i < 5; i++) bump(a);
return a.map(stream_index);
});
}
/* Another layer generator using gamma distributions. */
function stream_waves(n, m) {
return d3.range(n).map(function(i) {
return d3.range(m).map(function(j) {
var x = 20 * j / m - i / 3;
return 2 * x * Math.exp(-.5 * x);
}).map(stream_index);
});
}
function stream_index(d, i) {
return {x: i, y: Math.max(0, d)};
}

@ -1,60 +0,0 @@
var temperatureChart;
nv.addGraph(function () {
temperatureChart = nv.models.lineChart()
.interpolate("linear")
.options({
transitionDuration: 300,
useInteractiveGuideline: true
})
;
temperatureChart.xScale(d3.time.scale());
// chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
temperatureChart.xAxis
.axisLabel("Date/Time")
.ticks(d3.time.seconds)
.tickFormat(function (d) {
return d3.time.format('%m/%d/%Y %I:%M:%S %p')(new Date(d))
})
.staggerLabels(true)
;
temperatureChart.yAxis
.axisLabel('Temperature (C)')
;
d3.select('.chart1 svg')
.datum(getTemperatureChartData())
.call(temperatureChart);
nv.utils.windowResize(temperatureChart.update);
return temperatureChart;
});
function getTemperatureChartData() {
return [
{
area: true,
values: [],
key: "Temperature",
color: "#34500e"
}
];
}
function updateTemperatureGraph(temperatureData) {
var chartData = getTemperatureChartData();
chartData[0]['values'] = temperatureData;
d3.select('.chart1 svg')
.datum(chartData)
.transition().duration(500)
.call(temperatureChart);
}

@ -1,80 +0,0 @@
{{#zone "topCss"}}
<link href="{{self.publicURL}}/css/nv.d3.css" rel="stylesheet"/>
<link href="{{self.publicURL}}/css/daterangepicker.css" rel="stylesheet"/>
{{/zone}}
{{#zone "topJs"}}
<!-- -->
<script src="{{self.publicURL}}/js/d3.min.js"></script>
<script src="{{self.publicURL}}/js/nv.d3.js"></script>
<script src="{{self.publicURL}}/js/stream_layers.js"></script>
<script src="{{self.publicURL}}/js/moment.min.js"></script>
<script src="{{self.publicURL}}/js/jquery.daterangepicker.js"></script>
{{/zone}}
{{#zone "main"}}
<div class="container container-bg white-bg">
<div class=" margin-top-double">
<div class="row row padding-top-double padding-bottom-double margin-bottom-double ">
<div class="col-lg-12 margin-top-double">
<h1 class="grey ">Sense Bot</h1>
<hr>
</div>
</div>
<div class="row float-right margin-top">
<div class="right margin-right">
<p style="color:#000;float:left;margin-top:25px">Device Id:</p>
<input class="margin-right" id="device_id" value="" style="margin-top:
20px" />
<input class="right margin-right" id="date-range1" size="60" value="" style="margin-top: 20px">
<button type="button" id="btn-draw-graphs" class="btn btn-primary" style="margin-top: 20px">
Draw Graphs
</button>
</div>
</div>
<div class="clear"></div>
<div class="row margin-double">
<div class="chart1">
<h2 class="grey ">Temperature</h2>
<hr>
<svg></svg>
</div>
<hr>
</div>
<div class="row margin-double padding-double "></div>
<!--<div class="row margin-double">-->
<!--<div class="chart2">-->
<!--<h2 class="grey ">Light</h2>-->
<!--<hr>-->
<!--<svg></svg>-->
<!--</div>-->
<!--<hr>-->
<!--</div>-->
<div class="row margin-double">
<div class="chart3">
<h2 class="grey ">Motion</h2>
<hr>
<svg></svg>
</div>
<hr>
</div>
<div class="row margin-double">
<div class="chart4">
<h2 class="grey ">Sonar</h2>
<hr>
<svg></svg>
</div>
<hr>
</div>
</div>
</div>
<!-- TODO : Move these scripts to a bottomJs zone.
When they are moved the script tags get repeated for some reason :-(
-->
<script src="{{self.publicURL}}/js/graph_util.js"></script>
<script src="{{self.publicURL}}/js/bulb.js"></script>
<script src="{{self.publicURL}}/js/temperature_graph.js"></script>
<script src="{{self.publicURL}}/js/light_graph.js"></script>
<script src="{{self.publicURL}}/js/motion_graph.js"></script>
<script src="{{self.publicURL}}/js/sonar_graph.js"></script>
{{/zone}}

@ -1,4 +0,0 @@
function onRequest(context){
context.sketchPath = "../api/device/sketch";
return context;
}

@ -0,0 +1,24 @@
<project name="Arduino" basedir="." default="deploy">
<import file="../common.xml"/>
<property name="sample_type" value="arduino"/>
<property name="data_source" value="ArduinoDM_DB.h2.db"/>
<target name="deploy" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/>
<copy toDir="${sketches_dir}/${sample_type}">
<fileset dir="sketch"/>
</copy>
<copy toDir="${units_dir}/${sample_type}">
<fileset dir="units"/>
</copy>
</target>
<target name="clean">
<delete file="${database_dir}/${data_source}"/>
<delete dir="${sketches_dir}/${sample_type}"/>
<delete dir="${units_dir}/${sample_type}"/>
</target>
</project>

@ -0,0 +1,18 @@
<project name="IoTServerSamples" basedir="." default="deploy">
<macrodef name="iterate">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<fileset dir="." includes="*/build.xml"/>
</subant>
</sequential>
</macrodef>
<target name="deploy">
<iterate target="deploy"/>
</target>
<target name="clean">
<iterate target="clean"/>
</target>
</project>

@ -0,0 +1,5 @@
<project>
<property name="database_dir" value="../../repository/database"/>
<property name="sketches_dir" value="../../repository/resources/sketches"/>
<property name="units_dir" value="../../repository/deployment/server/jaggeryapps/iotserver/units"/>
</project>

@ -0,0 +1,24 @@
<project name="DigitalDisplay" basedir="." default="deploy">
<import file="../common.xml"/>
<property name="sample_type" value="digital_display"/>
<property name="data_source" value="DigitalDisplayDM_DB.h2.db"/>
<target name="deploy" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/>
<copy toDir="${sketches_dir}/${sample_type}">
<fileset dir="sketch"/>
</copy>
<copy toDir="${units_dir}/${sample_type}">
<fileset dir="units"/>
</copy>
</target>
<target name="clean">
<delete file="${database_dir}/${data_source}"/>
<delete dir="${sketches_dir}/${sample_type}"/>
<delete dir="${units_dir}/${sample_type}"/>
</target>
</project>

@ -0,0 +1,24 @@
<project name="FireAlarm" basedir="." default="deploy">
<import file="../common.xml"/>
<property name="sample_type" value="firealarm"/>
<property name="data_source" value="FireAlarmDM_DB.h2.db"/>
<target name="deploy" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/>
<copy toDir="${sketches_dir}/${sample_type}">
<fileset dir="sketch"/>
</copy>
<copy toDir="${units_dir}/${sample_type}">
<fileset dir="units"/>
</copy>
</target>
<target name="clean">
<delete file="${database_dir}/${data_source}"/>
<delete dir="${sketches_dir}/${sample_type}"/>
<delete dir="${units_dir}/${sample_type}"/>
</target>
</project>

@ -0,0 +1,28 @@
<project name="Arduino" basedir="." default="deploy">
<import file="../common.xml"/>
<property name="sample_type" value="sensebot"/>
<property name="data_source" value="SensebotDM_DB.h2.db"/>
<target name="deploy" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/>
<copy toDir="${sketches_dir}/${sample_type}">
<fileset dir="sketch"/>
</copy>
<copy toDir="${sketches_dir}/${sample_type}_wifi">
<fileset dir="sketch_wifi"/>
</copy>
<copy toDir="${units_dir}/${sample_type}">
<fileset dir="units"/>
</copy>
</target>
<target name="clean">
<delete file="${database_dir}/${data_source}"/>
<delete dir="${sketches_dir}/${sample_type}"/>
<delete dir="${sketches_dir}/${sample_type}_wifi"/>
<delete dir="${units_dir}/${sample_type}"/>
</target>
</project>

@ -1,155 +0,0 @@
/**********************************************************************************************
Use the below variables when required to set a static IP for the WifiSheild
***********************************************************************************************/
// byte dns2[] = { 8, 8, 8, 8 };
// byte subnet[] = { 255, 255, 255, 0 };
// byte gateway[] = { 10, 100, 9, 254 };
// byte deviceIP[4] = { 10, 100, 9, 9 };
// byte gateway[] = { 192, 168, 1, 1 };
// byte deviceIP[4] = { 192, 168, 1, 219 };
// uint32_t ip, ddns, ssubnet, ggateway;
//mac - c0:4a:00:1a:08:da
// c0:4a:00:1a:03:f8
// b8:27:eb:88:37:7a
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);
}
cc3000.setMacAddress(mac); // Set your own mac and print it to re-check
// uint8_t address[6];
// cc3000.getMacAddress(address);
// if(DEBUG){
// Serial.print(address[0], HEX); Serial.print(":");
// Serial.print(address[1], HEX); Serial.print(":");
// Serial.print(address[2], HEX); Serial.print(":");
// Serial.print(address[3], HEX); Serial.print(":");
// Serial.print(address[4], HEX); Serial.print(":");
// Serial.println(address[5], HEX);
// }
// }
/**********************************************************************************************
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);
}
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); // ToDo: Insert a DHCP timeout!
}
/* Display the IP address DNS, Gateway, etc. */
while (! displayConnectionDetails()) {
delay(1000);
}
pushClient = cc3000.connectTCP(sserver, SERVICE_PORT); //SERVICE_PORT
if (pushClient.connected()) {
if(CON_DEBUG) Serial.println(F("pushClient Connected to server"));
} else {
if(CON_DEBUG) Serial.println(F("pushClient Connection 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 = "{\"owner\":\"";
jsonPayLoad += DEVICE_OWNER;
jsonPayLoad += "\",\"deviceId\":\"";
jsonPayLoad += DEVICE_ID;
jsonPayLoad += "\",\"reply\":\"";
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 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(){
pushClient = cc3000.connectTCP(sserver, SERVICE_PORT); //SERVICE_PORT
if (pushClient.connected()) {
if(CON_DEBUG) Serial.println(F("pushClient Connected to server"));
} else {
while( !cc3000.checkConnected() ){
connectHttp();
}
if(CON_DEBUG) Serial.println(F("pushClient Connection failed"));
}
}

@ -1,70 +0,0 @@
#ifndef FireAlarmWifiAgent_H
#define FireAlarmWifiAgent_H
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
// 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 LISTEN_PORT 80 // What TCP port to listen on for connections.
// The HTTP protocol uses port 80 by default.
#define MAX_ACTION 6 // Maximum length of the HTTP action that can be parsed.
#define MAX_PATH 10 // Maximum length of the HTTP request path that can be parsed.
// There isn't much memory available so keep this short!
#define BUFFER_SIZE MAX_ACTION + MAX_PATH + 10 // Size of buffer for incoming request data.
// Since only the first line is parsed this
// needs to be as large as the maximum action
// and path plus a little for whitespace and
// HTTP version.
#define TIMEOUT_MS 500 // Amount of time in milliseconds to wait for
// an incoming request to finish. Don't set this
// too high or your server could be slow to respond.
#define WLAN_SSID "SSID" // cannot be longer than 32 characters!
#define WLAN_PASS "PASSWORD"
#define WLAN_SECURITY WLAN_SEC_WPA
// 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 DEVICE_TOKEN "${DEVICE_REFRESH_TOKEN}"
#define SERVICE_PORT 9763
#define SERVICE_EPOINT "/firealarm/controller/"
#define TEMP_PIN A5
#define BULB_PIN A4
#define FAN_PIN A3
#define DEBUG false
#define CON_DEBUG true
static unsigned long pushTimestamp = 0;
byte server[4] = { 192, 168, 1, 101 };
String host, jsonPayLoad;
String responseMsg, subStrn;
uint32_t ipAddress;
#define PUSH_INTERVAL 30000
byte mac[6] = { 0xc0, 0x4a, 0x00, 0x1a, 0xb8, 0xbb };
#endif

@ -1,81 +0,0 @@
#include "FireAlarmWifiAgent.h"
#include <Adafruit_CC3000.h>
#include <avr/wdt.h>
#include <SPI.h>
#include "dht.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 pushClient;
Adafruit_CC3000_Server httpServer(LISTEN_PORT);
uint32_t sserver;
/**********************************************************************************************
0. Check with a sample Wifi code of the Adafruit_CC3000 library to ensure that the sheild is working
1. Set the ip of the server(byte array below) where the Web-Rest API for the FireAlarm is running
2. Check whether the "SERVICE_EPOINT" is correct in the 'FireAlarmWifiAgent.h' file
3. Check whether the "SERVICE_PORT" is the same (9763) for the server running. Change it if needed
4. Check whether the pins have been attached accordingly in the Arduino
5. Check whether all reqquired pins are added to the 'digitalPins' array
***********************************************************************************************/
void setup() {
if (CON_DEBUG) Serial.begin(9600);
pinMode(BULB_PIN, OUTPUT);
pinMode(FAN_PIN, OUTPUT);
pinMode(TEMP_PIN, INPUT);
setupResource();
do {
connectHttp();
} while (!cc3000.checkConnected());
while (!pushClient.connected()) {
setupClient();
}
registerIP();
httpServer.begin();
wdt_enable(WDTO_8S);
}
void loop() {
while (!cc3000.checkConnected()) {
connectHttp();
}
wdt_reset();
if (millis() - pushTimestamp > PUSH_INTERVAL) {
wdt_reset();
while (!pushClient.connected()) {
setupClient();
}
pushData();
pushTimestamp = millis();
}
readControls();
wdt_reset();
if (subStrn.equals("ON")) {
if (responseMsg.equals("BULB")) {
digitalWrite(BULB_PIN, HIGH);
} else if (responseMsg.equals("FAN")) {
digitalWrite(FAN_PIN, HIGH);
}
} else if (subStrn.equals("OFF")) {
if (responseMsg.equals("BULB")) {
digitalWrite(BULB_PIN, LOW);
} else if (responseMsg.equals("FAN")) {
digitalWrite(FAN_PIN, LOW);
}
}
wdt_reset();
}

@ -1,95 +0,0 @@
uint8_t buffer[BUFFER_SIZE + 1];
int bufindex = 0;
char action[MAX_ACTION + 1];
char path[MAX_PATH + 1];
void readControls() {
// Try to get a client which is connected.
Adafruit_CC3000_ClientRef client = httpServer.available();
if (client) {
bufindex = 0;
memset(&buffer, 0, sizeof(buffer));
// Clear action and path strings.
memset(&action, 0, sizeof(action));
memset(&path, 0, sizeof(path));
// Set a timeout for reading all the incoming data.
unsigned long endtime = millis() + TIMEOUT_MS;
// Read all the incoming data until it can be parsed or the timeout expires.
bool parsed = false;
while (!parsed && (millis() < endtime) && (bufindex < BUFFER_SIZE)) {
if (client.available()) {
buffer[bufindex++] = client.read();
}
parsed = parseRequest(buffer, bufindex, action, path);
}
wdt_reset();
if (parsed) {
if (strcmp(action, "GET") == 0) {
responseMsg = path;
if (DEBUG) {
Serial.println(responseMsg);
}
int index = responseMsg.lastIndexOf("/");
int newLine = responseMsg.indexOf("/");
subStrn = responseMsg.substring(index + 1);
responseMsg = responseMsg.substring(newLine + 1, index);
if (DEBUG) {
Serial.print(responseMsg);
Serial.print(" - ");
Serial.println(subStrn);
Serial.println("-------------------------------");
}
}
if (responseMsg == "TEMP") {
int temperature = (uint8_t) getTemperature();
client.fastrprintln(F("HTTP/1.1 200 OK"));
client.fastrprintln(F("Connection: close"));
client.fastrprintln(F(""));
client.fastrprint(String(temperature).c_str());
}
}
delay(100);
// Close the connection when done.
Serial.println(F("Listener Client disconnected"));
client.flush();
client.close();
wdt_reset();
}
}
bool parseRequest(uint8_t *buf, int bufSize, char *action, char *path) {
// Check if the request ends with \r\n to signal end of first line.
if (bufSize < 2)
return false;
if (buf[bufSize - 2] == '\r' && buf[bufSize - 1] == '\n') {
parseFirstLine((char *) buf, action, path);
return true;
}
return false;
}
// Parse the action and path from the first line of an HTTP request.
void parseFirstLine(char *line, char *action, char *path) {
// Parse first word up to whitespace as action.
char *lineaction = strtok(line, " ");
if (lineaction != NULL)
strncpy(action, lineaction, MAX_ACTION);
// Parse second word up to whitespace as path.
char *linepath = strtok(NULL, " ");
if (linepath != NULL)
strncpy(path, linepath, MAX_PATH);
}

@ -1,33 +0,0 @@
void registerIP() {
pushClient.fastrprint(F("GET "));
pushClient.fastrprint(SERVICE_EPOINT); pushClient.fastrprint(F("register/"));
pushClient.fastrprint(DEVICE_OWNER); pushClient.fastrprint(F("/"));
pushClient.fastrprint(DEVICE_ID); pushClient.fastrprint(F("/"));
// pushClient.fastrprint(deviceIP.c_str());
pushClient.fastrprint(String((uint8_t)(ipAddress >> 24)).c_str());
pushClient.fastrprint(".");
pushClient.fastrprint(String((uint8_t)(ipAddress >> 16)).c_str());
pushClient.fastrprint(".");
pushClient.fastrprint(String((uint8_t)(ipAddress >> 8)).c_str());
pushClient.fastrprint(".");
pushClient.fastrprint(String((uint8_t)ipAddress).c_str());
pushClient.fastrprint(F(" HTTP/1.1")); pushClient.fastrprint(F("\n"));
pushClient.fastrprint(host.c_str()); pushClient.fastrprint(F("\n"));
pushClient.println();
if (DEBUG) {
Serial.print("GET "); Serial.print(SERVICE_EPOINT); Serial.print("register/");
Serial.print(DEVICE_OWNER); Serial.print("/"); Serial.print(DEVICE_ID);
Serial.print("/");
// Serial.print(deviceIP);
Serial.print(" HTTP/1.1"); Serial.println();
Serial.print(host); Serial.println(); Serial.println();
}
delay(100);
pushClient.flush();
pushClient.close();
}

@ -1,131 +0,0 @@
void pushData(){
String payLoad = "Data";
payLoad = payLoad + "\",\"value\":\"";
payLoad += (uint8_t)getTemperature();
payLoad += ":";
payLoad += ( digitalRead(BULB_PIN) == HIGH )?"ON":"OFF";
payLoad += ":";
payLoad += ( digitalRead(FAN_PIN) == HIGH )?"ON":"OFF";
payLoad += "\"}";
pushClient.fastrprint(F("POST "));
pushClient.fastrprint(SERVICE_EPOINT); pushClient.fastrprint(F("pushalarmdata"));
pushClient.fastrprint(F(" HTTP/1.1")); pushClient.fastrprint(F("\n"));
pushClient.fastrprint(host.c_str()); pushClient.fastrprint(F("\n"));
pushClient.fastrprint(F("Content-Type: application/json")); pushClient.fastrprint(F("\n"));
pushClient.fastrprint(F("Content-Length: "));
int payLength = jsonPayLoad.length() + payLoad.length();
pushClient.fastrprint(String(payLength).c_str()); pushClient.fastrprint(F("\n"));
pushClient.fastrprint(F("\n"));
if(DEBUG) {
Serial.print("POST ");
Serial.print(SERVICE_EPOINT); Serial.print("pushalarmdata");
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()) {
pushClient.print(jsonPayLoad.substring(i*chunkSize, jsonPayLoad.length()));
if(DEBUG) Serial.print(jsonPayLoad.substring(i*chunkSize, jsonPayLoad.length()));
i = jsonPayLoad.length();
} else {
pushClient.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()) {
pushClient.print(payLoad.substring(i*chunkSize, payLoad.length()));
if(DEBUG) Serial.print(payLoad.substring(i*chunkSize, payLoad.length()));
i = payLoad.length();
} else {
pushClient.print(payLoad.substring(i*chunkSize, (i+1)*chunkSize));
if(DEBUG) Serial.print(payLoad.substring(i*chunkSize, (i+1)*chunkSize));
}
}
pushClient.fastrprint(F("\n"));
if(DEBUG) Serial.println();
delay(100);
pushClient.flush();
pushClient.close();
wdt_reset();
// if(true) {
// while (pushClient.available()) {
// char response = pushClient.read();
// if(DEBUG) Serial.print(response);
// }
// }
if(DEBUG) {
Serial.println();
Serial.println("-------------------------------");
}
payLoad = "";
}
double getTemperature(){
dht DHT;
if(DEBUG) {
Serial.println("-------------------------------");
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
Serial.print("DHT11, \t");
}
int chk = DHT.read11(TEMP_PIN);
switch (chk)
{
case DHTLIB_OK:
if(DEBUG) Serial.print("OK,\t");
break;
case DHTLIB_ERROR_CHECKSUM:
if(DEBUG) Serial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
if(DEBUG) Serial.print("Time out error,\t");
break;
case DHTLIB_ERROR_CONNECT:
if(DEBUG) Serial.print("Connect error,\t");
break;
case DHTLIB_ERROR_ACK_L:
if(DEBUG) Serial.print("Ack Low error,\t");
break;
case DHTLIB_ERROR_ACK_H:
if(DEBUG) Serial.print("Ack High error,\t");
break;
default:
if(DEBUG) Serial.print("Unknown error,\t");
break;
}
// DISPLAY DATA
if(DEBUG) {
Serial.print("\t");
Serial.print(DHT.temperature, 1);
Serial.print(",\t\t");
Serial.println(DHT.humidity, 1);
Serial.println("-------------------------------");
}
return DHT.temperature;
}

@ -1,2 +0,0 @@
templates=FireAlarmWifiAgent.h
zipfilename=FireAlarmWifiAgent.zip
Loading…
Cancel
Save