This documentation is for WSO2 IoT Server 3.2.0. View the documentation for the latest release.
Advanced Device Search - IoT Server 3.2.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

This section provides the details on how the advanced device search functions. WSO2 IoT Server maintains the details of the devices that are enrolled with it by running a background task. This task adds a few operations to the devices such as the device_info, device_location and the application_list. Further, you can add more device operations and execute the advanced search as explained below:

Prerequisite

This feature is only available on the WSO2 IoT Server 3.10-Update1 pack. Download the WSO2 IoT Server 3.10-Update1 pack to try it out.

  1. Navigate to the respective device types XML file in <IOTS_HOME>/repository/deployment/server/devicetypes/<DEVICE_TYPE>.xml file.

  2. Add the new operations under the task configurations operations tag as shown below:

    <TaskConfiguration>
       <Enable>true</Enable>
       <Frequency>600000</Frequency>
       <TaskClass>org.wso2.carbon.device.mgt.core.task.impl.DeviceDetailsRetrieverTask</TaskClass>
       <Operations>
          <Operation>
             <Name>{OPERATION_CODE}</Name>
             <RecurrentTimes>{HOW_OFTEN_THE_OPERATION_NEEDS_TO_BE_ADDED}</RecurrentTimes>
          </Operation>
       </Operations>
    </TaskConfiguration>

    For <RecurrentTimes> define how often the above operation should be called when running the task operation

    Example: If you define it as 5 that means the operation will be added to the task at every 5th run of the task.

    Example:

    <TaskConfiguration>
       <Enable>true</Enable>
       <Frequency>30000</Frequency>
       <TaskClass>org.wso2.carbon.device.mgt.core.task.impl.DeviceDetailsRetrieverTask</TaskClass>
       <Operations>
          <Operation>
             <Name>DEVICE_INFO</Name>
             <RecurrentTimes>1</RecurrentTimes>
          </Operation>
          <Operation>
             <Name>APPLICATION_LIST</Name>
             <RecurrentTimes>5</RecurrentTimes>
          </Operation>
          <Operation>
             <Name>DEVICE_LOCATION</Name>
             <RecurrentTimes>1</RecurrentTimes>
          </Operation>
       </Operations>
    </TaskConfiguration>
  3. The user executes the advanced search for devices via the WSO2 device management console or the REST API. 

     For more information on carrying out the advanced search via the device management console, click here.
    • To search for devices via the location, enter the location details and click Search.
    • To search using other options, click Add a custom search parameter, enter the required fields, and click Search.

      FieldDescription
      StateThere can be many search options as shown in the sample JSON definition. The field that connects the independent search is known as state. The following values can be assigned to state:
      • AND  : Defines if you want the search result has to match all the search conditions provided.
      • OR  : Defines if you want the search result to match either of the search conditions provided.
      KeyThe feature code. You can assign the following feature codes as the value for key:
      • DEVICE_MODEL : The model of the device.

      • VENDOR : The name of the Android device vendor.

      • OS_VERSION : The version of the device operating system.

      • BATTERY_LEVEL : The current level of the device battery.

      • INTERNAL_TOTAL_MEMORY : The total capacity of the internal memory available in the device.

      • INTERNAL_AVAILABLE_MEMORY : The unutilized internal memory capacity in the device.

      • EXTERNAL_TOTAL_MEMORY : The total capacity of the external memory available in the device.

      • EXTERNAL_AVAILABLE_MEMORY : The unutilized external memory capacity in the device.

      • CONNECTION_TYPE :

      • SSID : The name of the Wifi network that the device is connected to.

      • CPU_USAGE : The current CPU usage of the mobile device. 

      • TOTAL_RAM_MEMORY: The total capacity of the random access memory available in the device.
      • AVAILABLE_RAM_MEMORY: The unutilized random access memory capacity available in the device.
      Value

      Define the value for the key you provide.

      Example: If you provide the key as VERSION , you can provide the value as  5.1 , which indicates the version of the mobile device you are searching.

      Operator

      Define the search condition between the key and the value you provide. The following values can be used to define the search condition:

      • : Searches for devices where the key equals the value.
      • =!  : Searches for devices where the key is not equal to the value.
      • <=  : Searches for devices where the key is greater than or equal to the value.
      • >=  : Searches for devices where the key is less than or equal to the value.
      • : Searches for devices where the key is greater than the value.
      • : Searches for devices where the key is less than the value.

      Example: If you wish to get the devices that have the version as 5.1, you need to use the = o

  4. WSO2 IoTS goes through the search request received via the console or the REST API to check for the following details:
    • Checks if the values provided for Key field match the D EVICE_DETAILS database table properties. 

       Click here for more information on the DEVICE_DETAILS table properties
      • DEVICE_MODEL

      • VENDOR

      • OS_VERSION

      • BATTERY_LEVEL

      • INTERNAL_TOTAL_MEMORY

      • INTERNAL_AVAILABLE_MEMORY

      • EXTERNAL_TOTAL_MEMORY

      • EXTERNAL_AVAILABLE_MEMORY

      • CONNECTION_TYPE

      • SSID

      • CPU_USAGE

      • TOTAL_RAM_MEMORY

      • AVAILABLE_RAM_MEMORY

      • PLUGGED_IN

    • If the value you defined for the Key field is not a property in the D EVICE_DETAILS table, it will then form a key:value pair and pass the details to the D EVICE_INFO database table in WSO2 IoTS.
  5. Once WSO2 IoTS aggregates all the results for the given search query the final search result will be provided.
  • No labels