Skip to content

Training ‐ 3. Driver Development: Creating Driver Framework and Adding to Build

Michael Elmore edited this page Nov 17, 2023 · 3 revisions

Requirements

  • Java Programming Language: Entry Level Experience
  • Training 2 complete

Create Sensor Module from sensorhub-driver-template

Copy Driver Template

  • Right-click and copy sensorhub-driver-template

step1

Paste Template Back Into Sensors Directory

  • Right-click the sensors folder and paste

step2

Name Module

Assign a new name, in this case, sensorhub-driver-simulation

step3

Successfully Created Module

step4

Updating Package Name

Refactor Package Name

  1. Navigate to the driver package and right-click on the package
  2. Select Rename

step5

Change Package Name

  1. Provide a new name; in this case, simulated
  2. Select Refactor

step6

Refactored Package Name

step7

Updating Driver Build Scripts

Editing Driver build.gradle

Open sensorhub-driver-simulation/build.gradle

step8

Update Driver Name

Edit description: This field contains the name that will be assigned to your driver and is visible in OpenSensorHub

Simulated Sensor Driver

step9

Update Driver Description

Edit ext.details: This field contains the description assigned to your driver and is visible in OpenSensorHub

Driver Simulation - OpenSensorHub Driver Development Labs

step10

Update Manifest Details

Edit the Details within the ext.pom block

id – nickaname, e-mail, etc
name – self-explanatory
organization – company name
organizationUrl – self-explanatory

step11

Adding sensor-driver-simulation to Build Target

Updating and Building

Updating Project – Adding Driver

  1. Open project wide build.gradle
  2. Dependencies block shown with some examples commented out
  3. Add dependency for driver and comment out the template

// implementation project(':sensorhub-driver-template')
implementation project(':sensorhub-driver-simulation')

step12

Make Gradle Recognize Sensor Driver Module

  1. Open settings.gradle
  2. Uncomment FileTree Builder if it is not already

step13

Modify FileTree Builder — Exclude Driver Template

  1. Add statement to ignore project folders with "template" in name

if (!projectFolder.name.contains("template")) {

  1. Refresh Gradle

step14