This section will guide you on how to configure the Android Sense to get alerts on rapid accelerations and device turns. The accelerometer sensor on the Android Sense device type helps the user identify sudden vigorous movements of the device if it exceeds 60 kph (kilometer per hour), and notify the user of such incidents via email.Â
Follow the steps given below to configure the accelerometer sensor:Â
Configure the turn and speed subscriber emails address.
Navigate to the <CDM-PLUGINS>/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/speed_sensor/speed_publisher/
speed_publisher.xml
file and configure the email settings.
 Click here for more information.
<eventPublisher xmlns="http://wso2.org/carbon/eventpublisher" name="speed_publisher" statistics="disable" trace="disable">
<from streamName="org.wso2.iot.devices.speed" version="1.0.0" />
<mapping customMapping="disable" type="text" />
<to eventAdapterType="email">
<property name="email.subject">Email Alerts Speed</property>
<property name="email.address">{ENTER YOUR EMAIL ADDRESS}</property>
<property name="email.type">text/html</property>
</to>
</eventPublisher>
Example:
<eventPublisher xmlns="http://wso2.org/carbon/eventpublisher" name="speed_publisher" statistics="disable" trace="disable">
<from streamName="org.wso2.iot.devices.speed" version="1.0.0" />
<mapping customMapping="disable" type="text" />
<to eventAdapterType="email">
<property name="email.subject">Email Alerts Speed</property>
<property name="email.address">bob@gmail.com</property>
<property name="smtp">text/html</property>
</to>
</eventPublisher>
Navigate to the <CDM-PLUGINS>/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/turn_sensor/turn_publisher/
turn_publisher.xml
 file and configure the email settings.
 Click here for more information.
<eventPublisher xmlns="http://wso2.org/carbon/eventpublisher" name="turn_publisher" statistics="disable" trace="disable">
<from streamName="org.wso2.iot.devices.turn" version="1.0.0" />
<mapping customMapping="disable" type="text" />
<to eventAdapterType="email">
<property name="email.subject">Email Alerts Turn</property>
<property name="email.address">{DEFINE THE EMAIL ADDRESS}</property>
<property name="email.type">text/html</property>
</to>
</eventPublisher>
Example:
<eventPublisher xmlns="http://wso2.org/carbon/eventpublisher" name="turn_publisher" statistics="disable" trace="disable">
<from streamName="org.wso2.iot.devices.turn" version="1.0.0" />
<mapping customMapping="disable" type="text" />
<to eventAdapterType="email">
<property name="email.subject">Email Alerts Turn</property>
<property name="email.address">user@gmail.com</property>
<property name="email.type">text/html</property>
</to>
</eventPublisher>
Adapter Property | Description | Configurationfileproperty | Example |
---|
Email Address | Email address of the client. Register the publisher for multiple email IDs' by separating them with commas. | email.address |
user@gmail.com
|
Subject | The subject of the email to be sent to the defined email address | email.subject | This is a test mail.
|
Email Type | The email format to be sent to the defined email address. | email.type | text/plain
|
Navigate to the <CDM-PLUGINS>/components/
iot-plugins/
iot-analytics
directory via the terminal and build it.
- Copy the
speed.car
file and turn.car
files from the <CDM_PLUGINS>/components/iot-plugins/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/target/carbonapps
directory. - Paste the copied .car files in the
<IoTS_HOME>/repository/deployment/server/carbonapps
directory. Configure the email adapter settings that is under <adapterConfig type="email">
in the <IoTS_HOME>/conf/output-event-adapters.xml
file.
 Click here for more information.
<adapterConfig type="email">
<!-- Comment mail.smtp.user and mail.smtp.password properties to support connecting SMTP servers which use trust
based authentication rather username/password authentication -->
<property key="mail.smtp.from">abcd@gmail.com</property>
<property key="mail.smtp.user">abcd</property>
<property key="mail.smtp.password">xxxx</property>
<property key="mail.smtp.host">smtp.gmail.com</property>
<property key="mail.smtp.port">587</property>
<property key="mail.smtp.starttls.enable">true</property>
<property key="mail.smtp.auth">true</property>
<!-- Thread Pool Related Properties -->
<property key="minThread">8</property>
<property key="maxThread">100</property>
<property key="keepAliveTimeInMillis">20000</property>
<property key="jobQueueSize">10000</property>
</adapterConfig>Â
MinThreads
:Â Defines the minimum number of threads that needs to be available in the underlying thread pool when the email sender functionality is initialized.
MaxThreads
 : Defines the maximum number of threads that should serve email sending at any given time.
KeepAliveTimeInMillis
 : Defines the duration a connection should be kept alive. If the thread pool has initialized more connections than what was defined in MinThreads
, and they have been idle for more than the KeepAliveDuration
, those idle connections will be terminated
JobQueueSize
:Â Defines the maximum concurrent email sending tasks that can be queued up.
Example:
<adapterConfig type="email">
<!-- Comment mail.smtp.user and mail.smtp.password properties to support connecting SMTP servers which use trust
based authentication rather username/password authentication -->
<property key="mail.smtp.from">no-reply@foo.com</property>
<property key="mail.smtp.user">foo</property>
<property key="mail.smtp.password">$foo1234</property>
<property key="mail.smtp.host">smtp.gmail.com</property>
<property key="mail.smtp.port">587</property>
<property key="mail.smtp.starttls.enable">true</property>
<property key="mail.smtp.auth">true</property>
<!-- Thread Pool Related Properties -->
<property key="minThread">8</property>
<property key="maxThread">100</property>
<property key="keepAliveTimeInMillis">20000</property>
<property key="jobQueueSize">10000</property>
</adapterConfig>
Restart WSO2 IoTS.
- Install the Android SenseÂ
.apk
and publish data.