TMExtendedStartSession Overview Group

The TMExtendedStartSession API call takes as an argument a port number “PortNum” and a port type “PortType” of the 1-Wire network to be used. It can also optionally take a pointer to a long that represents enhanced options. It returns the session handle number if the session has been established, and 0 to indicate that the 1-Wire network is busy with another session in progress. A session handle of less than 0 indicates that there is no driver for the indicated type number. See the section Microsoft Windows TMEX Considerations for details on what drivers are associated with which type numbers. It is recommended that the API call TMGetTypeVersion be used to verify the port type. A session handle should be used and then as soon as possible ended with TMEndSession. The session handle is good indefinitely if no other application attempts to start a new session on that 1-Wire network port. The session handle can become invalid under the following circumstances:


long far pascal TMExtendedStartSession(

short PortNum,             // Port number to get a session to
short PortType,            // Port type number to get a session to
void far *EnhancedOptions  // A pointer for enhanced options (an optional parameter)
);

For a description of the above types, see the TMEX Type Descriptions.


Parameters

PortNum

Specifies the port number that a session is desired on. The valid port number is 0 to 15.

PortType

Specifies the port type number that a session is desired on. This number will indicate which hardware driver is used. The hardware port type drivers are configurable. The valid port type number is 0 to 15.

*EnhancedOptions (an optional parameter)

This parameter is optional. If not needed, then pass a NULL pointer. EnhancedOptions is a pointer to a long (32 byte signed integer) with the following bit field options:

SESSION_INFINITE          0x0001   session does not expire
SESSION_RSRC_RELEASE      0x0002   port resources are released at each session
SESSION_NO_FORCE_REG_SPD  0x0004   regular speed is not forced on each session


Return Value

>0 => session on port given session_handle returned

=0 => port not available, it is being used by another application

<0 => TMEX Session Error Return Codes

Code Example


See Also

TMValidSession, TMEndSession