为访问找到并打开一个esafe设备,支持按目录id号和设备序列号打开。

参数
[in] hcontexthandle
一个已经成功打开的设备的句柄。
[in] puchname
打开设备时输入设备序列号或目录id号。
[in] ulnamelen
打开设备时输入设备序列号或目录id号的长度。
[in] ulflag
参数定义,如下所示:
esf_open_first:打开找到的第一个设备,此定义可以与esf_open_by_id和esf_open_return或esf_open_wait组合使用。
esf_open_next:打开找到的下一个设备,此定义可以与esf_open_by_id和esf_open_return或esf_open_wait组合使用。
esf_open_current:打开当前已经打开的设备,可与esf_open_return或esf_open_wait组合使用。
esf_open_serial:按序列号打开设备,可与esf_open_return或esf_open_wait组合使用。
esf_open_id: 使用目录id打开设备,不能单独使用,须和esf_open_first或esf_open_next组合使用。
要求
esfp_createcontext
返回值
esf_success:成功
esf_rv_device_in_use:设备正在使用中
esf_rv_handle_error:传入的句柄错误
其它:见“api返回码说明”。
示例代码
esf_rv irv;
esf_handle hcontexthandle;
irv = esfp_opendev(hcontexthandle, null, 0, esf_open_first | esf_open_wait);
if(irv != esf_rv_success)
1、esf_open_return:如果此设备已经被别的进程打开,则返回设备在使用中的错误。
2、esf_open_wait:如果此设备已经被别的进程打开,则等待直到其它进程释放设备后打开设备。
3、puchname仅在使用下列方式打开设备时使用:
esf_open_serial:此时puchname为指定的序列号,ulnamelen为序列号长度。
esf_open_by_id:此时puchname为应用目录的id号,ulnamelen为应用目录id的长度。
参见
esfp_closedev