Home > LIB_Device > getByLcscIds
LIB_Device.getByLcscIds() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Batch get devices using LCSC C numbers
Signature
function getByLcscIds(
lcscIds: Array<string>,
libraryUuid?: string,
allowMultiMatch?: boolean,
): Promise<Array<ILIB_DeviceSearchItem>>;2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
lcscIds | Array<string> | Array of LCSC C numbers |
libraryUuid | string | (Optional) Library UUID, default is system library, you can use LIB_LibrariesList APIs in |
allowMultiMatch | boolean | (Optional) Whether a single LCSC C number is allowed to match multiple results |
Returns
Promise<Array<ILIB_DeviceSearchItem>>
List of searched device properties
Remarks
By default, if multiple devices with the same C number are matched in the same library, only the first result will be returned;
If you want to return multiple results, set allowMultiMatch to true;
This API is temporarily unavailable in the private deployment environment
Example
// 1. 单个 C 编号查询(默认搜索系统库)
const one = await eda.lib_Device.getByLcscIds('C1523');
console.log('single count:', one.length);
console.log('[0] uuid:', one[0].uuid, 'supplierId:', one[0].supplierId);
// 2. 批量查询多个 C 编号
const many = await eda.lib_Device.getByLcscIds(['C1523', 'C17168']);
console.log('batch count:', many.length);
many.forEach((item, i) => {
console.log(`[${i}] uuid:`, item.uuid, 'supplierId:', item.supplierId);
});2
3
4
5
6
7
8
9
10
11