11.1.2 端口对象 Port Objects

Port objects, as returned by openport(), have the following methods:

端口对象由调用 openport() 得到, 它有以下方法:

closeport( )
Close the port. 关闭端口。

getfd( )
Return the file descriptor as an int. 传回描述档案的整数值。

getfilled( )
Return the number of filled samples. 传回已取得值的样本的数目。

getfillable( )
Return the number of fillable samples. 传回可以取值的样本的数目。

readsamps( nsamples)
Read a number of samples from the queue, blocking if necessary. Return the data as a string containing the raw data, (e.g., 2 bytes per sample in big-endian byte order (high byte, low byte) if you have set the sample width to 2 bytes).

从队列中读取一定数目的样本,以等候态直至读取完毕。 传回代表原始数据的字符串, (例如, 如你设定取样宽度为两个位元的话, 则每个样本以双字元大顺位次序存放 (高字元, 低字元)).

writesamps( samples)
Write samples into the queue, blocking if necessary. The samples are encoded as described for the readsamps() return value.

把样本写到队列中去, 以等候态直至写完。 样本的编码方式以 readsamps() 函数的传回值所描述的一样。

getfillpoint( )
Return the `fill point'. 传回 "填入点 fill point".

setfillpoint( fillpoint)
Set the `fill point'. 设置 “填入点 fill point".

getconfig( )
Return a configuration object containing the current configuration of the port.

传回一个配置对象, 其中包含了目前端口的配置。

setconfig( config)
Set the configuration from the argument, a configuration object.

用引数, 一个配置对象来设置端口。

getstatus( list)
Get status information on last error.

取得最近一次错误的状态资料。