PageSourceSearch

https://ikalogic.com/assets/js/314b654b.dc2b4930.js

js ikalogic.com collected 2026-10-02 10:31:01 UTC 5,247 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkdocutest=globalThis.webpackChunkdocutest||[]).push([[2856],{19820(e,i,n){n.r(i),n.d(i,{assets:()=>o,contentTitle:()=>d,default:()=>p,frontMatter:()=>c,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"kb/la-api/common-code/device_descriptor","title":"Device Descriptor","description":"The devicedescriptort struct represents a logic analyzer device detected by the API. It provides basic information such as the device serial number and a descriptive string.","source":"@site/docs/kb/la-api/common-code/device_descriptor.md","sourceDirName":"kb/la-api/common-code","slug":"/kb/la-api/common-code/device_descriptor","permalink":"/kb/la-api/common-code/device_descriptor","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":2,"frontMatter":{"title":"Device Descriptor","sidebar_position":2},"sidebar":"docs_la_api","previous":{"title":"Common error codes","permalink":"/kb/la-api/common-code/common_err"},"next":{"title":"Structures, Enums, and Defines","permalink":"/kb/la-api/sp259/sp259_types"}}');var r=n(74848),s=n(28453);const c={title:"Device Descriptor",sidebar_position:2},d="Device Descriptor",o={},a=[{value:"<strong>Struct Definition</strong>",id:"struct-definition",level:2},{value:"<strong>Field Descriptions</strong>",id:"field-descriptions",level:2},{value:"<strong>Usage Example</strong>",id:"usage-example",level:2},{value:"<strong>Conclusion</strong>",id:"conclusion",level:2}];function l(e){const i={code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.header,{children:(0,r.jsx)(i.h1,{id:"device-descriptor",children:"Device Descriptor"})}),"\n",(0,r.jsxs)(i.p,{children:["The ",(0,r.jsx)(i.code,{children:"device_descriptor_t"})," struct represents a logic analyzer device detected by the API. It provides basic information such as the device serial number and a descriptive string."]}),"\n",(0,r.jsx)(i.h2,{id:"struct-definition",children:(0,r.jsx)(i.strong,{children:"Struct Definition"})}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-cpp",children:"/**\n * @brief The device_descriptor_t struct defines any device detected by the API\n */\nstruct device_descriptor_t\n{\n    /**\n     * @brief sn pointer to Null terminated string for the serial number\n     */\n    char* sn;\n\n    /**\n     * @brief desc pointer to Null terminated string for the description of the device\n     */\n    char* desc;\n};\n"})}),"\n",(0,r.jsx)(i.h2,{id:"field-descriptions",children:(0,r.jsx)(i.strong,{children:"Field Descriptions"})}),"\n",(0,r.jsxs)(i.table,{children:[(0,r.jsx)(i.thead,{children:(0,r.jsxs)(i.tr,{children:[(0,r.jsx)(i.th,{children:"Field"}),(0,r.jsx)(i.th,{children:"Type"}),(0,r.jsx)(i.th,{children:"Description"})]})}),(0,r.jsxs)(i.tbody,{children:[(0,r.jsxs)(i.tr,{children:[(0,r.jsx)(i.td,{children:(0,r.jsx)(i.code,{children:"sn"})}),(0,r.jsx)(i.td,{children:(0,r.jsx)(i.code,{children:"char*"})}),(0,r.jsx)(i.td,{children:"Null-terminated string containing the device's serial number"})]}),(0,r.jsxs)(i.tr,{children:[(0,r.jsx)(i.td,{children:(0,r.jsx)(i.code,{children:"desc"})}),(0,r.jsx)(i.td,{children:(0,r.jsx)(i.code,{children:"char*"})}),(0,r.jsx)(i.td,{children:"Null-terminated string containing a human-readable description of the device"})]})]})]}),"\n",(0,r.jsx)(i.h2,{id:"usage-example",children:(0,r.jsx)(i.strong,{children:"Usage Example"})}),"\n",(0,r.jsx)(i.p,{children:"The following example demonstrates how to list all connected devices and print their descriptors:"}),"\n",(0,r.jsx)(i.pre,{children:(0,r.jsx)(i.code,{className:"language-cpp",children:'device_descriptor_t* devices;\nuint16_t device_count = 0;\n\n// Create a list of available devices\nihwapi_err_code_t status = sp209api_create_device_list(handle);\n\nif (status == IHWAPI_OK) {\n    sp209api_get_devices_count(handle, &device_count);\n    printf("Number of devices found: %d\\n", device_count);\n\n    for (uint8_t i = 0; i < device_count;
1 i++) {\n        sp209api_get_device_descriptor(handle, i, &devices[i]);\n        printf("Device %d: Serial Number: %s, Description: %s\\n", i, devices[i].sn, devices[i].desc);\n    }\n} else {\n    printf("Failed to create device list. Error code: %d\\n", status);\n}\n'})}),"\n",(0,r.jsx)(i.h2,{id:"conclusion",children:(0,r.jsx)(i.strong,{children:"Conclusion"})}),"\n",(0,r.jsxs)(i.p,{children:["The ",(0,r.jsx)(i.code,{children:"device_descriptor_t"})," struct is a fundamental part of the API, allowing users to enumerate available logic analyzers and retrieve essential device information."]})]})}function p(e={}){const{wrapper:i}={...(0,s.R)(),...e.components};return i?(0,r.jsx)(i,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},28453(e,i,n){n.d(i,{R:()=>c,x:()=>d});var t=n(96540);const r={},s=t.createContext(r);function c(e){const i=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(i):{...i,...e}},[i,e])}function d(e){let i;return i=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),t.createElement(s.Provider,{value:i},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.