Search code examples
unetstack

How can we write our own custom AT commands?


Is there a way that we can write a custom AT command for unetstack/subnero modems ? I refered Chapter 12 but could not find this information.


Solution

  • AT command shells (and Groovy shells) can be extended with shell extensions. Shell extensions implement a org.arl.fjage.shell.ShellExtension tag interface. Static methods (and attributes) of the shell extension class are made available in the shell as commands (and variables/constants). In the AT command shell, they are called using AT commands as briefly described in section 12.3 of the Unet handbook.

    For example, the handbook shows an example of loading the PhysicalShellExt via:

    AT~EXT=org.arl.unet.phy.PhysicalShellExt
    

    On loading this, static methods of this class become accessible using AT commands. For example, methods:

      static def plvl() {
        // code to get power level here
      }
    
      static String plvl(float p) {
        // code to set power level here
      }
    

    are accessed as:

    AT~PLVL
    AT~PLVL=-3
    

    respectively.