Qualcomm Enhanced SDK (QESDK) API Reference (1)

Qualcomm Enhanced SDK (QESDK) API Reference (1)

  • 1 QESDK Overview
    • 1.1 QESDK Java API Overview
      • 1.1.1 Creator
      • 1.1.2 init
      • 1.1.3 IQesdkEventCallBack
      • 1.1.4 deinit
      • 1.1.5 Single subsystem init and de-init
      • 1.1.6 QESDK exception
      • 1.1.7 Sample code

1 QESDK Overview

Qualcomm Enhanced Software Development Kit (QESDK) provides a framework that allows QTI services to expose APIs directly to Android applications.

QESDK has Java and native (C/C++) SDKs/NDKs that allow calling supported QESDK APIs from Java/native applications.





Figure : 1. QESDK software architecture based on Android

Note
All subsystems (except activity recognition) support native (C/C++) and Java APIs and can be used by native and Java Android applications.

1.1 QESDK Java API Overview

The QESDK classes provide the main methods for registering Android application packages (APKs) and validating corresponding license files.

  • Creator
    Constructor of the QESDK interface. This method must be called in order to call the rest of the QESDK and subsystem APIs.

  • init
    Initialize a QESDK session with a user-supplied license key.

  • IQesdkEventCallBack
    When the QESDK framework calls onEvent() to notify the application that the service is disconnected, the application can call deinit() and init() in turn to reacquire the service.

  • deinit
    Applications gracefully interrupt QESDK connections on exit or by explicitly calling the QESDK deinit() function. Any API callbacks registered through the QESDK framework will be cancelled.

  • Individual subsystem init and de-init
    Applications can initialize and log out of services independently.

  • QESDK exception
    QESDK service and subsystem service exceptions are defined in QESDK Exceptions.

  • Sample code
    The following sample code demonstrates usage of the QESDK Java API:

1.1.1 Creator

Constructor of the QESDK interface. This method must be called in order to call the rest of the QESDK and subsystem APIs.

IQesdk createInstance(Context context)

  • Parameters
    context
    Requires current application context.

  • Return results
    IQesdk
    The Singleton object interface used by the APK when calling QESDK.

1.1.2 init

Initialize a QESDK session with a user-supplied license key.

int init(
      [String license],
      IQesdkEventCallBack cb
      )

Init supports both taking the license information directly as a parameter and embedding the license information as an asset of the APK (following directory and file name conventions). If using the embedded form, the license file license.qti is located in the license directory in the Assets folder of the APK.

Init will trigger the authentication call for QESDK and return status, that is, return a success or failure code depending on whether the authentication is successful.

Note:
A maximum of 5 invalid license attempts are allowed in an APP instance. As soon as the application is initialized with an invalid license five times, subsequent requests will fail, even if a valid license is provided.

This API is called only once per session.

Parameters

  • license
    Optional parameter; contains the license string

  • cb
    Callback used to notify the application subsystem that it has been disconnected.
    The callback format is as follows:

void onEvent(int opcode, int [] subsystem)

  • int opcode – The opcode of the disconnected subsystem.
  • int [] subsystems – List of opcodes: Disconnected subsystems.

Return results

Int
A status value greater than or equal to 0 indicates success, and a status value less than 0 indicates an error. Possible return values are as follows:

  • ≥ 0 – valid session
  • -1 – License file not found
  • -2 – Invalid license
  • -3 – Feature ID not supported
  • -4 – QESDK transport error

1.1.3 IQesdkEventCallBack

When the QESDK framework calls onEvent() to notify the application that the service is disconnected, the application can call deinit() and init() in sequence to reacquire the service.

IQesdkEventCallBack() {<!-- -->public void onEvent(int opcode, int[] subsys) {<!-- -->}};

Parameters

  • opcode
    The opcode of the disconnected subsystem listed in the other parameters.
  • subsystems
    Opcode list: Disconnected subsystems.

If the opcode is 0, the application should initialize all services again because opcode 0 indicates that the QESDK framework restarted due to an unexpected problem.

If the opcode is non-zero, the service corresponding to the opcode should be initialized again.

td>

Operation Code Service
11 Modem
19 Performance
17 Sensor
24 Position

If Java/native uses the same service, the given server (deinitialized) will notify native/Java accordingly.

For example: If a service is initialized in both Java and the native API, and the service’s session is deinitialized in the native API, this behavior will trigger a QESDK framework event callback application in Java. vice versa.

1.1.4 deinit

Applications gracefully interrupt QESDK connections on exit or by explicitly calling the QESDK deinit() function. Any API callbacks registered through the QESDK framework will be cancelled.

int deinit()

Note:
If the active QESDK application terminates or crashes, all QESDK resources associated with the session are automatically unregistered and released.

Parameters

int
Success (0) or error code (negative value).

1.1.5 Single subsystem init and de-init

Applications can initialize and log out of services independently.

init
.init() – Parameters and return values are the same as in the init call.

For example:

  • Java

    ```c
    ModemManager.init([String license], IQesdkEventCallBack cb)
    ```
    
  • Native

    ```c
    SensorsManager.init(char* license, size_t license_size, fwk_event_callback cb)
    ```
    

deinit

.deinit() – Parameters and return values are the same as in the deinit call.

For example:

  • Java

    ```c
    ModemManager.deinit()
    ```
    
  • Native

    ```c
    SensorsManager.deinit()
    ```
    

1.1.6 QESDK exception

QESDK service and subsystem service exceptions are defined in QESDK Exceptions.

abnormal

  • -1 – failed
  • -2 – Invalid parameter
  • -3 – Invalid status
  • -4 – Timeout or invalid session
  • -5 – Invalid API

1.1.7 Sample Code

The following sample code demonstrates usage of the QESDK Java API:

Need to import

import com.qualcomm.qti.qesdkIntf.IQesdk;
import com.qualcomm.qti.qesdkIntf.IQesdkEventCallBack;

Declare callback

IQesdkEventCallBack eventCallbackHandler = new IQesdkEventCallBack() {<!-- -->
        @Override
        public void onEvent(int opcode, int[] subsys) {<!-- -->
        // Handle QESDK event
        }
        };
      

initialization

IQesdk qesdkManager = IQesdk.createInstance(getApplicationContext());
        int statusId = qesdkManager.init(eventCallbackHandler);

Uninitialize

int ret = qesdkManager.deinit();