下载
中文
注册

(可选)dev_get_device_list

接口声明

int dev_get_device_list(int type, unsigned int buffSize, unsigned char *buff, unsigned int device_name_len)

参数介绍

表1 参数说明

参数名

类型

说明

type

int

设备文件描述符

buff

unsigned char*

用来传递数据的缓存

buffSize

unsigned int

缓存数组空间大小

device_name_len

unsigned int

单个设备名所占数组空间

功能说明

动态获取指定类型模组的设备列表,把多个设备名写入一段连续的数组中,通过首地址偏移量划分不同设备名,“buffSize/device_name_len”值为缓存中最大允许写入的设备数量。(只有模组的dynamic字段设置为“true”的时候需要实现此接口,否则静态设备由产品规格配置文件定义无需实现此接口。)

buff解析

按照指定的“device_name_len”参数长度,通过首地址偏移的方式,将设备名保存在buff的指定内存段中,具体实现如下图所示。确保设备名的长度不大于指定“device_name_len”的最大长度;确保buff的空间大于保存该模组的所有设备信息所用空间。
图1 buff解析图