Chapter 15 - Create Your Driver's Point Device Extension Component

In the Niagara AX framework driver control points reside under a special component that called a point device extension. The developer driver framework takes care of most of the details for you. All you need to do is define a class for your driver's point device extension, add one of your driver's point device extension components as a property to BYourDriverDevice, and override a method on BYourDriverProxyExt. From that method you will need to simply return the TYPE constant that belongs to your driver's point device extension.

This might sound complicated but it is very simple to do and will only take a matter of minutes. In fact, we believe this will be the simplest chapter in today's lesson!

While following the examples in this chapter, please replace the text jarFileName, yourDriver and yourCompany as previously described in the Preparation section):

  1. Make a Java class that extends BDdfPointDeviceExt. Name it BYourDriverPointDeviceExt. Create this in a package named com.yourCompany.yourDriver. Also add an empty slotomatic comment, with an empty properties section immediately after the opening brace for the class declaration.

    To do this, create a text file named BYourDriverPointDeviceExt.java in the jarFileName/src/com/yourCompany/yourDriver folder. Inside the text file, start with the following text:

    package com.yourCompany.yourDriver;
    
    import javax.baja.sys.*;
    import javax.baja.util.*;
    
    import com.tridium.ddf.*;
    
    import com.yourCompany.yourDriver.point.*;
    
    public class BYourDriverPointDeviceExt
      extends BDdfPointDeviceExt
    {
      /*-
      class BYourDriverPointDeviceExt
      {
        properties
        {
        }
      }
      -*/
    }
    

  2. Define the follow methods on BYourDriverPointDeviceExt:

      /**
       * Associates BYourDriverPointDeviceExt to BYourDriverDevice.
       */
      public Type getDeviceType()
      {
        return BYourDriverDevice.TYPE;
      }
      /**
       * Associates BYourDriverPointDeviceExt to BYourDriverPointFolder.
       */
      public Type getPointFolderType()
      {
        return BYourDriverPointFolder.TYPE;
      }
      /**
       * Associates BYourDriverPointDeviceExt to BYourDriverProxyExt
       */
      public Type getProxyExtType()
      {
        return BYourDriverProxyExt.TYPE;
      }
      /**
       * This can be left null, depending on how you decide to define
       * the discovery behavior in your driver. We will visit the
       * discovery process in further detail during another day's
       * lesson.
       */
      public BFolder getDiscoveryFolder()
      {
        return null;
      }
    

  3. Open the BYourDriverProxyExt.java file that you created in the previous chapters of today's lesson.
  4. Implement the getDeviceExtType method as follows:

      /**
       * This associates BYourDriverDeviceExt with
       * BYourDriverProxyExt within the Niagara AX
       * framework.
       */
      public Type getDeviceExtType()
      {
        return BYourDriverPointDeviceExt.TYPE;
      }
    

  5. Add the following import statement to the top of BYourDriverProxyExt.java (along with the other import statements)

    import com.yourCompany.yourDriver.*;
    

  6. Open the BYourDriverDevice.java file that you created in the previous day's lesson.
  7. Add a property named points whose type is BYourDriverPointDeviceExt

      /*-
      class BYourDriverDevice
      {
        properties
        {
          deviceId : BDdfIdParams
            -- This plugs in an instance of yourDriver's
            -- device id as this device's deviceId
            default {[new BYourDriverDeviceId()]}
          points : BYourDriverPointDeviceExt
            -- Adds the special point device extension
            -- component to the property sheet and the
            -- Niagara AX navigation tree. This special
            -- component will contain and process all
            -- control points for YourDriver
            default{[new BYourDriverPointDeviceExt()]}
    
        }
      }
      -*/
    

  8. Run slotomatic and perform a full build on your driver (as described in Chapter 2).