LMS API Documentation: Initialization/deinitialization

LMS API Documentation v18.10.0

Typedefs | Functions
Initialization/deinitialization

## Typedefs
typedef void | lms_device_t
| LMS Device handle.
typedef char | lms_info_str_t[256]
| Convenience type for fixed length LMS Device information string.

## Functions
API_EXPORT int CALL_CONV | LMS_GetDeviceList (lms_info_str_t *dev_list)
API_EXPORT int CALL_CONV | LMS_Open (lms_device_t **device, const lms_info_str_t info, void *args)
API_EXPORT int CALL_CONV | LMS_Close (lms_device_t *device)
API_EXPORT int CALL_CONV | LMS_Disconnect (lms_device_t *device)
API_EXPORT bool CALL_CONV | LMS_IsOpen (lms_device_t *device, int port)

## Detailed Description

The functions in this section provide the ability to query available devices, initialize them, and deinitialize them.

## Function Documentation

## ◆ LMS_Close()

API_EXPORT int CALL_CONV LMS_Close | ( | lms_device_t * | device | ) |

Close device

Postcondition
  device is deallocated and may no longer be used.

Parameters

  device | Device handle previously obtained by LMS_Open().

Returns
  0 on success, (-1) on failure

## ◆ LMS_Disconnect()

API_EXPORT int CALL_CONV LMS_Disconnect | ( | lms_device_t * | device | ) |

Disconnect device but keep configuration cache (device is not deallocated).

Deprecated:
  use LMS_Close() to disconnect and close device

Parameters

  device | Device handle previously obtained by LMS_Open().

Returns
  0 on success, (-1) on failure

## ◆ LMS_GetDeviceList()

API_EXPORT int CALL_CONV LMS_GetDeviceList | ( | lms_info_str_t * | dev_list | ) |

Obtain a list of LMS devices attached to the system

Parameters

  [out] | dev_list | List of available devices

Returns
  number of devices in the list on success, (-1) on failure

## ◆ LMS_IsOpen()

API_EXPORT bool CALL_CONV LMS_IsOpen | ( | lms_device_t * | device,
|  | int | port
| ) |  |

Check if device port is opened

Deprecated:
  use return status of LMS_Open() as indication.

Parameters

  device | Device handle previously obtained by LMS_Open().
  port | port index (ignored if device has only 1 port)

Returns
  true(1) if port is open, false (0) if - closed

## ◆ LMS_Open()

API_EXPORT int CALL_CONV LMS_Open | ( | lms_device_t ** | device,
|  | const lms_info_str_t | info,
|  | void * | args
| ) |  |

Opens device specified by the provided lms_info_str_t string This function should be used to open a device based upon the results of LMS_GetDeviceList()

Precondition
  device should be initialized to NULL

Parameters

  [out] | device | Updated with device handle on success
  [in] | info | Device information string. If NULL, the first available device will be opened.
  [in] | args | additional arguments. Can be NULL.

Returns
  0 on success, (-1) on failure