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:
And
a request for the same 1-Wire network has been made
And
Session handle expiration is not disabled
And
the handle is over 35 seconds old
And
a request for the same 1-Wire network has been made
And
Session handle expiration is not disabled
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
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
See Also