NI Bluetooth Generation Toolkit 19.1 Help

Edition Date: October 2019

Part Number: 373432K-01

»View Product Info
Download Help (Windows Only)

int32 __stdcall niBTSG_OpenSession (char sessionName[], int32 toolkitCompatibilityVersion, niBTSGSession *session, int32 *isNewSession);


Looks up an existing niBT SG session using the sessionName parameter and returns the refnum that you can pass to subsequent niBT SG functions. If the lookup fails, the niBTSG_OpenSession function creates a new niBT SG session and returns a new refnum.


Name Type Description
sessionName char[]

Specifies the name of the session that you are looking up or creating. If a session with the same name already exists, this function returns a reference to that session. To get the reference to an already-opened session x, specify x as the session name.

You can obtain the reference to an existing session multiple times if you have not called the niBTSG_CloseSession function in that session. You do not need to close the session multiple times. To create an unnamed session, pass an empty string or NULL to the sessionName parameter.

Tip  NI recommends that you call the niBTSG_CloseSession function for each uniquely named instance of the niBTSG_OpenSession function or each instance of the niBTSG_OpenSession function with an unnamed session.
toolkitCompatibilityVersion int32 Specifies the version of the toolkit to which the current version of the toolkit is compatible. If the behavior of the toolkit changes in a new version, use this parameter to specify that you want to continue using the behavior of the previous release.

NIBTSG_VAL_TOOLKIT_COMPATIBILITY_VERSION_010000 (10000) Specifies that the current version of the toolkit is compatible with 1.0.0.
NIBTSG_VAL_TOOLKIT_COMPATIBILITY_VERSION_020000 (20000) Specifies that the current version of the toolkit is compatible with 2.0.0.
Name Type Description
session niBTSGSession* Returns the niBT SG session.
isNewSession int32* Indicates whether the function creates a new session.
NIBTSG_VAL_TRUE (0) Indicates that the function creates a new session.
NIBTSG_VAL_FALSE (1) Indicates that the function returns a reference to an existing session.

Return Value

Name Type Description
status int32 Returns the status code of this operation. The status code either indicates success or describes an error or warning. Examine the status code from each call to an niBT SG function to determine if an error has occurred.

To obtain a text description of the status code and additional information about the error condition, call the niBTSG_GetErrorString function.

The general meaning of the status code is as follows:

Value Meaning
0 Success
Positive Values Warnings
Negative Values Errors


Not Helpful