# Interfaces
Source: [https://docs.qualcomm.com/doc/80-70014-7/topic/qsh_api_reference.html](https://docs.qualcomm.com/doc/80-70014-7/topic/qsh_api_reference.html)
The important QSH functions, classes, methods, and data structures are a few QSH
interfaces described here. These QSH interfaces are available for working with any kind
of hardware-based, software-based, pre-existing, or any other QSH-compliant sensors.
The QSH framework runs on the low-power processors and exposed APIs at application
processor. The QSH client APIs
are for the applications and the QSH sensor API is for the development of new sensors on
a low-power processor.
## QSH client APIs at application processor
Source: [https://docs.qualcomm.com/doc/80-70014-7/topic/qsh_api_reference.html](https://docs.qualcomm.com/doc/80-70014-7/topic/qsh_api_reference.html)
The QSH APIs provide a simple and easy interface to the client code that enables the QSH
functionality and develops an end-to-end sensor use case. The QSH supports the following
APIs:
**getSession()**
This API creates a session instance and returns a pointer to it. On success, the function
returns a pointer to an `ISession` object that represents the created
session. On failure, it returns `nullptr`.
**Syntax**
ISession* getSession();Copy to clipboard
**Parameters**
None.
**Response**
| **Return** | **Description** |
| --- | --- |
| `ISession*` | `ISession*`: Object upon success
`-nullptr`: Upon failure |
**Open()**
This API opens the session instance, establishes and initializes the communication
between the client and the QSH framework. The client must call this function only once
for a given session. The function returns `0` if the session opens
successfully, or `-1` if there is an error.
**Syntax**
int open();Copy to clipboard
**Parameters**
None.
**Response**
| **Return** | **Description** |
| --- | --- |
| `int ` | `0`: Upon success
`-1`: Upon failure |
**Close()**
This API closes the sensor session, terminates the communication between the client and
the QSH framework. The client must call this function at the end of the session to
release the resources and avoid memory leaks. The function does not take any
parameter.
**Syntax**
void close();Copy to clipboard
**Parameters**
None.
**Response**
| **Return** | **Description** |
| --- | --- |
| `void` | None |
**setCallBacks()**
This API sets the callbacks for a given SUID. A client must call this function only once
for a SUID. If the callback pointers are already registered with the given SUID, then
they are updated with the new callbacks. If all callback pointers are null and the given
SUID is already registered, then it is unregistered.
**Syntax**
virtual int setCallBacks(suid suid, respCallBack respCB, errorCallBack errorCB, eventCallBack eventCB) = 0;Copy to clipboard
**Parameters**
| **Parameter** | **Name** | **Description** |
| --- | --- | --- |
| `input ` | `suid` | SUID for which the callbacks are to be set. |
| `input ` | `respCB` | The response callback pointer is a mandatory parameter. The
client can pass `nullptr` if they do not need any
response callback. |
| `input` | `errorCB ` | The error callback pointer is a mandatory parameter. The client
can pass `nullptr` if they do not need any error
callback. |
| `input` | `eventCB` | The event callback pointer is a mandatory parameter. The client
can pass `nullptr` if they do not need any event
callback. |
**Response**
| **Return** | **Description** |
| --- | --- |
| `int ` | `0`: Upon success
`-1`: Upon failure |
**sendRequest()**
This API sends a protocol buffer (proto) encoded message to the QSH framework. This API
communicates with the sensors and allows the application to send specific requests and
receives data from the QSH framework. The message contains instructions or configuration
settings for the sensor identified by the SUID. A client must encode a proto message for
a given SUID.
**Syntax**
virtual int sendRequest(suid suid, std::string message) = 0;Copy to clipboard
**Parameters**
| **Parameter** | **Name** | **Description** |
| --- | --- | --- |
| `input ` | `suid` | Sensor unique identifier for which the data is being
requested |
| `input ` | `message ` | Proto-encoded request message to be sent |
**Response**
| **Return** | **Description** |
| --- | --- |
| `int ` | `0`: Upon success
`-1`: Upon failure |
For more information and example codes, see [Samples](https://docs.qualcomm.com/bundle/publicresource/topics/80-70014-7/samples.html).
## Low-power processor APIs
Source: [https://docs.qualcomm.com/doc/80-70014-7/topic/qsh_api_reference.html](https://docs.qualcomm.com/doc/80-70014-7/topic/qsh_api_reference.html)
The low-power processor APIs provide access to:
- QSH framework resources, such as services and utilities
- Core functionalities, such as the diag interface and timer
You can use the low-power processor APIs to create algorithms and sensor drivers
that comply with the QSH standards. This information is currently available for users
who have full access to the proprietary software shipped with Qualcomm Linux. For more
information, see *Interfaces* in [Qualcomm Linux Sensors Guide - Addendum](https://docs.qualcomm.com/bundle/resource/topics/80-70014-7A/overview.html).
Note: [Qualcomm Linux
Sensors Guide - Addendum](https://docs.qualcomm.com/bundle/resource/topics/80-70014-7A/overview.html) is accessible only
to the Authorized users.
Last Published: Jul 12, 2024
[Previous Topic
Architecture](https://docs.qualcomm.com/bundle/publicresource/80-70014-7/topics/architecture.md) [Next Topic
Software](https://docs.qualcomm.com/bundle/publicresource/80-70014-7/topics/software.md)