Skip to main content
Version: Dev (main)

Session

Typedefs Index​

typedefvoid(* qar_session_lifecycle_callback_t)(const QarSessionLifecycleInfo *info, void *user_state)

Callback of qar_session_subscribe_lifecycle(). More...

Functions Index​

static QarResultqar_session_find_render_target (const QarSession *session, const char *connection, QarPeerId *out_peer)

Find an already-connected render target from its connection string. More...

static QarResultqar_session_get_graphics_device_id (const QarSession *session, QarGraphicsDeviceId *out_device_id, bool *out_present)

The GPU adapter the session's graphics devices were created on. More...

static QarResultqar_session_get_id (const QarSession *session, QarSessionId *out_session_id)

Get the current session id. More...

static QarResultqar_session_get_lifecycle_state (const QarSession *session, QarSessionLifecycleInfo *out_info)

The session's current lifecycle state. More...

static voidqar_session_handle_destroy (QarSession *handle)

Destroy a session opaque handle. More...

static QarResultqar_session_open_qaros_view (QarSession *session, const QarOpenQarosViewInfo *info)

Open a predefined view of the QAROS Visualizer of this session's QAROS: the Pair Headset QR code, the Room Origin marker or the setup of one device type. More...

static QarResultqar_session_subscribe_lifecycle (QarSession *session, qar_session_lifecycle_callback_t callback, void *user_state, QarCancelToken *token)

Subscribe to the session's lifecycle: every state change from now on, the current state first. More...

Typedefs​

qar_session_lifecycle_callback_t​

typedef void(* qar_session_lifecycle_callback_t)(const QarSessionLifecycleInfo *info, void *user_state)

Callback of qar_session_subscribe_lifecycle().

Documented in api.h (qar_session_subscribe_lifecycle).

Parameters
info

The new state; valid only during the callback, info->reason included. Copy what you keep.

user_state

The pointer passed to qar_session_subscribe_lifecycle().

Definition at line 3955 of file qar_streaming.h.

Functions​

qar_session_find_render_target()​

QarResult qar_session_find_render_target (const QarSession * session, const char * connection, QarPeerId * out_peer)
inline static

Find an already-connected render target from its connection string.

Definition at line 3862 of file qar_streaming.h.

qar_session_get_graphics_device_id()​

QarResult qar_session_get_graphics_device_id (const QarSession * session, QarGraphicsDeviceId * out_device_id, bool * out_present)
inline static

The GPU adapter the session's graphics devices were created on.

Every render sender's frame textures live on this adapter, so create your own graphics device on it. It is the adapter actually in use: the one a chained QarGraphicsDeviceId named, else the one QAROS selected - the GPU of the target named in the launch invite of an application QAROS started - else the one the library picked.

Parameters
session

Active session handle.

out_device_id

Receives id_type, and luid (Windows) or uuid (other platforms). Initialize it with qar_graphics_device_id_default(); its header is left untouched so it can be chained as it is. Left unchanged when no adapter is known.

out_present

Receives whether the session knows its adapter.

Returns

Success, QAR_STATUS_LOGIC_ERROR for an invalid handle or a null output, or QAR_STATUS_GRAPHICS_DEVICE_NOT_INITIALIZED for a session created with QarGraphicsDeviceDisabledExt (out_present is false).

Definition at line 3885 of file qar_streaming.h.

qar_session_get_id()​

QarResult qar_session_get_id (const QarSession * session, QarSessionId * out_session_id)
inline static

Get the current session id.

Definition at line 3858 of file qar_streaming.h.

qar_session_get_lifecycle_state()​

QarResult qar_session_get_lifecycle_state (const QarSession * session, QarSessionLifecycleInfo * out_info)
inline static

The session's current lifecycle state.

Session lifecycle: rotation, join, reset

A session follows its hub by itself, in place. When the hub starts a new session (its operator's New session, a member hub's Leave) or joins another hub as its member, the same QarSession moves into the new session:

  • Kept, nothing to do: this QarSession and every handle obtained from it; the app volumes, GUI panels and rooms this session created or took over with a get_or_create call (one a previous run of the app left, say), which it proposes again in the new session; its render and video senders, which renegotiate through their reconnect path (create them with QarRenderSenderInit::enable_auto_reconnects or QarVideoSenderInit::enable_reconnects, or recreate them after a move); its subscriptions, which keep delivering; its peer id.
  • Interrupted: frames stop for the move (a few seconds) while senders renegotiate. Objects owned by other peers disappear until their owners have moved too.
  • Changed: qar_session_get_id() answers the new id. Anything the app keyed by the session id (its own files, caches, a shared link) belongs to the old session.
  • Lost for good: QAR_SESSION_LIFECYCLE_STATE_RE_PAIR_REQUIRED (the approval was revoked, the hub was reset to a new install, or it missed too many rotations). Nothing is retried: destroy the session, onboard again, and recreate what you own in the new session.

Subscribe with qar_session_subscribe_lifecycle() to learn about each step: react to a change of QarSessionLifecycleInfo::session_id (re-read session-scoped state, re-announce what only the app knows), to HUB_UNREACHABLE (show it, keep running), and to RE_PAIR_REQUIRED (reinitialize). An app that only polls sees a move as a new qar_session_get_id().

Recommended pattern: on a new session_id, and after onboarding again on RE_PAIR_REQUIRED, call qar_app_volumes_get_or_create() and qar_gui_panels_get_or_create() again for every common name the app owns. The calls are idempotent: each returns the same id, takes the object over when it is there and re-creates it when it is missing (a move that outran it, or a new install after a re-pair, where nothing else brings it back).

Parameters
session

Active session handle.

out_info

Initialized with qar_session_lifecycle_info_default(); receives the state, the current session id and, after a move, the previous one and its cause. reason is set to NULL. Its header is left untouched.

Returns

Success; QAR_STATUS_LOGIC_ERROR for an invalid handle or a null output; QAR_STATUS_ARGUMENT_NOT_SUPPORTED when out_info->header.type is not QAR_STRUCTURE_TYPE_SESSION_LIFECYCLE_INFO.

Definition at line 3944 of file qar_streaming.h.

qar_session_handle_destroy()​

void qar_session_handle_destroy (QarSession * handle)
inline static

Destroy a session opaque handle.

Tears down the active session while keeping persisted state, so a later qar_runtime_rejoin can restore it without onboarding.

Definition at line 3854 of file qar_streaming.h.

qar_session_open_qaros_view()​

QarResult qar_session_open_qaros_view (QarSession * session, const QarOpenQarosViewInfo * info)
inline static

Open a predefined view of the QAROS Visualizer of this session's QAROS: the Pair Headset QR code, the Room Origin marker or the setup of one device type.

The same dialog the matching qaros://visualizer link opens, in the QAROS whose hub this session joined, never another one running beside it. The app needs neither the link, nor the qaros:// scheme to be registered, nor to find that QAROS itself:

  • Installed QAROS: its own qaros.exe opens the view.
  • Developer setup (a QAROS run from a build folder, the app started with its QAR_INSTANCE): the qaros.exe of the instance's runtime folder, else of the folder QarRuntimeInit::runtime_binaries_folder_path named, else of the folder this library was loaded from. The registered qaros:// handler is never used: it may belong to another build.

That qaros.exe hands the view to its running QAROS, or starts that QAROS when it does not run. The Visualizer brings the dialog to the front, and shows only that dialog while its main window is hidden.

Only a session onboarded as a local app (QarOnboardLocalAppExt) can open a view: its hub is the QAROS of this PC. Returns once the view was handed over, not when it shows. Windows only.

Added after a release: an app built against this header that runs with an older runtime gets QAR_STATUS_NOT_IMPLEMENTED.

Parameters
session

Active session handle.

info

The view; initialize with qar_open_qaros_view_info_default().

Returns

Success: the view was handed to this session's QAROS.

Return Values
QAR_STATUS_ARGUMENT_NOT_SUPPORTED

info->header.type is not QAR_STRUCTURE_TYPE_SESSION_OPEN_QAROS_VIEW_INFO; an unknown view or device kind; no device kind for QAR_QAROS_VIEW_DEVICE_SETUP or one for another view; or the session was not onboarded as a local app, so no QAROS of this PC is behind it.

QAR_STATUS_ONBOARDING_HUB_UNREACHABLE

this session's QAROS has no qaros.exe where it should be (its build or install is gone), or it could not be started.

QAR_STATUS_NOT_IMPLEMENTED

not Windows, or a runtime older than this function.

QAR_STATUS_LOGIC_ERROR

an invalid session handle or a null info.

Definition at line 4038 of file qar_streaming.h.

qar_session_subscribe_lifecycle()​

QarResult qar_session_subscribe_lifecycle (QarSession * session, qar_session_lifecycle_callback_t callback, void * user_state, QarCancelToken * token)
inline static

Subscribe to the session's lifecycle: every state change from now on, the current state first.

A move reports MIGRATING (still the old session_id), then CONNECTED with the new session_id, the previous one and the cause (QAR_SESSION_CHANGE_CAUSE_ROTATED or QAR_SESSION_CHANGE_CAUSE_JOINED_PRIMARY). A move whose new session does not answer in time reports HUB_UNREACHABLE with the new id and later CONNECTED without a previous id, so compare session_id with the last one you saw rather than waiting for one particular state. A callback that falls behind may miss intermediate states, never the newest one.

Callbacks run on a library thread, one at a time. Keep them short: copy the info and do the reinitialization on a thread of your own. Never destroy the session or the library from the callback. See Session lifecycle for what the session keeps by itself.

Parameters
session

Active session handle.

callback

Required.

user_state

Passed to every callback; keep it valid until the subscription has ended.

token

Required; cancelling or destroying it ends the subscription and waits for a running callback, see Ending a subscription.

Returns

Success; QAR_STATUS_LOGIC_ERROR for an invalid handle, a null callback or a null token.

Definition at line 3988 of file qar_streaming.h.


Generated via doxygen2docusaurus 2.2.1 by Doxygen 1.9.8.