@ -1,59 +1,89 @@
|
||||
# cdmf-devicetype-archetype
|
||||
# Install cdmf-devicetype-archetype
|
||||
|
||||
To install this maven archetype
|
||||
First you need to download this maven archetype. To download
|
||||
|
||||
go to this folder `cdmf-devicetype-archetype`
|
||||
git clone https://github.com/GPrathap/cdmf-devicetype-archetype.git
|
||||
|
||||
mvn clean install
|
||||
To install this maven archetype into your local system, inside the cdmf-devicetype-archetype
|
||||
|
||||
To create new project
|
||||
mvn clean install
|
||||
|
||||
go to this folder `/wso2iots-1.0.0-SNAPSHOT/samples`
|
||||
# Create sample device type plugin using cdmf-devicetype-archetype
|
||||
|
||||
mvn archetype:generate -DarchetypeCatalog=local
|
||||
First download WOS2 IoT Server and copy the downloaded file to a preferred location and unzip it. The unzipped folder rename as IOTS_HOME.
|
||||
To create new project go to this folder: IOTS_HOME/samples
|
||||
|
||||
Then select the `cdmf.devicetype:cdmf-devicetype-archetype` as new archetype. Then you need to provide groupId, artifactId,
|
||||
version, packaging, name of your device type and name for sensor as shown bellow.
|
||||
mvn archetype:generate -DarchetypeCatalog=local
|
||||
|
||||
Then select the cdmf.devicetype:cdmf-devicetype-archetype as new archetype.
|
||||
|
||||
jobs@jobs-ThinkPad-T530:~/wso2/IoT/m3/product/IOTS_HOME/samples$
|
||||
mvn archetype:generate -DarchetypeCatalog=local
|
||||
[INFO] Scanning for projects...
|
||||
[INFO]
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Building Maven Stub Project (No POM) 1
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO]
|
||||
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom >>>
|
||||
[INFO]
|
||||
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom <<<
|
||||
[INFO]
|
||||
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
|
||||
[INFO] Generating project in Interactive mode
|
||||
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
|
||||
Choose archetype:
|
||||
1: local -> org.apache.synapse:synapse-package-archetype (This archetype can be used to create Maven projects that bundle a mediation
|
||||
into a standalone distribution ready to be executed)
|
||||
2: local -> org.wso2.mdm:mdm-android-agent-archetype (Creates a MDM-Android agent project)
|
||||
3: local -> org.wso2.cdmf.devicetype:cdmf-devicetype-archetype (WSO2 CDMF Device Type Archetype)
|
||||
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 3
|
||||
|
||||
|
||||
Then you need to provide groupId, artifactId, version, packaging, name of your device type and name for sensor as shown below.
|
||||
|
||||
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 3
|
||||
Define value for property 'groupId': : org.homeautomation
|
||||
Define value for property 'artifactId': : safeLocker
|
||||
Define value for property 'artifactId': : currentsensor
|
||||
Define value for property 'version': 1.0-SNAPSHOT: : 1.0.0-SNAPSHOT
|
||||
Define value for property 'package': org.homeautomation: :
|
||||
Define value for property 'deviceType': : safeLocker
|
||||
Define value for property 'nameOfTheSensor': : lock
|
||||
Define value for property 'deviceType': : currentsensor
|
||||
Define value for property 'nameOfTheSensor': : current
|
||||
Confirm properties configuration:
|
||||
groupId: org.homeautomation
|
||||
artifactId: safeLocker
|
||||
artifactId: currentsensor
|
||||
version: 1.0.0-SNAPSHOT
|
||||
package: org.homeautomation
|
||||
deviceType: safeLocker
|
||||
nameOfTheSensor: lock
|
||||
deviceType: currentsensor
|
||||
nameOfTheSensor: current
|
||||
|
||||
|
||||
To install sample app into IOTS
|
||||
open `device-deployer.xml` which is located in wso2iots-1.0.0-SNAPSHOT directory
|
||||
|
||||
Under modules tag add name of sample which you created as module
|
||||
# Configure the device-deployer.xml file that is in the IoTS_HOME directory.
|
||||
|
||||
<module>samples/safeLocker</module>
|
||||
Add the new module under the <modules> tag.
|
||||
|
||||
Under featureArtifacts tag add feature artifact definition as below
|
||||
<modules>
|
||||
<module>samples/currentsensor</module>
|
||||
</modules>
|
||||
|
||||
<featureArtifactDef>
|
||||
org.homeautomation:org.homeautomation.safeLocker.feature:1.0.0-SNAPSHOT
|
||||
</featureArtifactDef>
|
||||
Add the device type feature under the `<featureArtifacts>` tag.
|
||||
|
||||
Under features tag add feature group definition as below
|
||||
<featureArtifactDef>org.homeautomation:org.homeautomation.currentsensor.feature:1.0.0-SNAPSHOT
|
||||
</featureArtifactDef>
|
||||
|
||||
|
||||
Add the device type feature group under the <features> tag.
|
||||
|
||||
<features>
|
||||
<feature>
|
||||
<id>org.homeautomation.safeLocker.feature.group</id>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<id>org.homeautomation.currentsensor.feature.group</id>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</feature>
|
||||
</features>
|
||||
|
||||
Finally to deploy sample device type into IoT Server
|
||||
|
||||
mvn clean install -f device-deployer.xml
|
||||
To deploy sample device type into IoT Server
|
||||
|
||||
Note: This command should be executed place where `device-deployer.xml` is located
|
||||
mvn clean install -f device-deployer.xml
|
||||
|
||||
Note: This command should be executed place where `device-deployer.xml` is located
|
||||
|
Before Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 10 KiB |
@ -1,31 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
#
|
||||
|
||||
[Device-Configurations]
|
||||
owner=${DEVICE_OWNER}
|
||||
deviceId=${DEVICE_ID}
|
||||
device-name=${DEVICE_NAME}
|
||||
controller-context=/${deviceType}/controller
|
||||
device-type=${deviceType}
|
||||
mqtt-ep=${MQTT_EP}
|
||||
https-ep=${HTTPS_EP}
|
||||
auth-method=token
|
||||
auth-token=${DEVICE_TOKEN}
|
||||
refresh-token=${DEVICE_REFRESH_TOKEN}
|
||||
push-interval=15
|
||||
|
||||
|