QDMI v1.1.0
Quantum Device Management Interface
|
Provides functions to manage sessions between the driver and device.
A device session is a connection between a driver and a device that allows the driver to interact with the device. Sessions are used to authenticate with the device and to manage resources required for the interaction with the device.
The typical workflow for a device session is as follows:
Typedefs | |
typedef struct QDMI_Device_Session_impl_d * | QDMI_Device_Session |
A handle for a device session. | |
Functions | |
int | QDMI_device_session_alloc (QDMI_Device_Session *session) |
Allocate a new device session. | |
int | QDMI_device_session_set_parameter (QDMI_Device_Session session, QDMI_Device_Session_Parameter param, size_t size, const void *value) |
Set a parameter for a device session. | |
int | QDMI_device_session_init (QDMI_Device_Session session) |
Initialize a device session. | |
void | QDMI_device_session_free (QDMI_Device_Session session) |
Free a QDMI device session. | |
typedef struct QDMI_Device_Session_impl_d* QDMI_Device_Session |
A handle for a device session.
An opaque pointer to a type defined by the device that encapsulates all information about a session between a driver and a device.
int QDMI_device_session_alloc | ( | QDMI_Device_Session * | session | ) |
Allocate a new device session.
This is the main entry point for a driver to establish a session with a device. The returned handle can be used throughout the device session interface to refer to the session.
[out] | session | A handle to the session that is allocated. Must not be NULL . The session must be freed by calling QDMI_device_session_free when it is no longer used. |
session
is NULL
. int QDMI_device_session_set_parameter | ( | QDMI_Device_Session | session, |
QDMI_Device_Session_Parameter | param, | ||
size_t | size, | ||
const void * | value ) |
Set a parameter for a device session.
[in] | session | A handle to the session to set the parameter for. Must not be NULL . |
[in] | param | The parameter to set. Must be one of the values specified for QDMI_Device_Session_Parameter. |
[in] | size | The size of the data pointed by value in bytes. Must not be zero, except when value is NULL , in which case it is ignored. |
[in] | value | A pointer to the memory location that contains the value of the parameter to be set. The data pointed to by value is copied and can be safely reused after this function returns. If this is NULL , it is ignored. |
value
is not NULL
, the value of the parameter was set successfully. session
is NULL
,param
is invalid, orvalue
is not NULL
and size
is zero or not the expected size for the parameter (if specified by the QDMI_Device_Session_Parameter documentation). value
set to NULL
is expected to allow checking if the device supports the specified parameter without setting a value. See the QDMI_session_set_parameter documentation for an example. int QDMI_device_session_init | ( | QDMI_Device_Session | session | ) |
Initialize a device session.
This function initializes the device session and prepares it for use. The session must be initialized before it can be used as part of the device query interface or the device job interface. If a device requires authentication, the required authentication information must be set using QDMI_device_session_set_parameter before calling this function. A session may only be successfully initialized once.
[in] | session | The session to initialize. Must not be NULL . |
session
is NULL
. void QDMI_device_session_free | ( | QDMI_Device_Session | session | ) |
Free a QDMI device session.
This function frees the memory allocated for the session. Using a session handle after it was freed is undefined behavior.
[in] | session | The session to free. |