TMSearch Overview Group

The TMSearch API call is a general purpose 1-Wire search. The search can have an optional 1-Wire reset performed before the search (PerformReset=1) or not (PerformReset=0). The ResetSearch parameter optionally resets the 1-Wire search parameters (ResetSearch=1) so that the API finds the ‘first’ device. The SearchCmd command supplies the 1-Wire search command to use.


short far pascal TMSearch(

long session_handle,    // session handle for the desired 1-Wire network
void far *state_buffer, // state buffer provided for the 1-Wire network session
short ResetSearch,      // ResetSearch=1 will reset 1-Wire search parameters
short PerformReset,     // 1-Wire reset performed before the search or not at all
short SrchCmd           // the 1-wire search command to use
);

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

Parameters

session_handle

Specifies the session handle returned from the API function TMExtendedStartSession that specifies the desired 1-Wire network port. This parameter is required by most TMEX API functions.

state_buffer

Specifies a pointer to a memory location that TMEX keeps all of the state information for the 1-Wire networks. This parameter is required by most TMEX API functions.

ResetSearch

Optionally resets the 1-Wire search parameters (ResetSearch=1) so that the API finds the ‘first’ device. With ResetSearch=0, the function will not reset the 1-Wire search parameters.

PerformReset

Specifies an optional 1-Wire reset performed before the search (PerformReset=1) or not (PerformReset=0).

SrchCmd.

Supplies the 1-Wire search command to use. Currently, there are two search commands available. The first is 0xFO (hexadecimal) for a regular search-rom command and the second is 0XEC (hexadecimal) for an interrupt (alarm) search.

Return Value

1 => 1-Wire device found

<0 => TMEX Network Error Return Code

Code Example

See Also

TMFirst, TMFirstAlarm, TMNext, TMNextAlarm