예제 #1
0
파일: lsport.go 프로젝트: kezl/lsport
// Close restores the port to how it was before initialisation, closes the port and
// frees resources.
func Close(s *Conf) {
	C.sp_flush(s.Port, SP_BUF_BOTH)
	C.sp_free_config(s.newConfig)
	C.sp_set_config(s.Port, s.oldConfig)
	C.sp_free_config(s.oldConfig)

	C.sp_close(s.Port)
}
예제 #2
0
// Discard buffered output data.
func (p *Port) ResetOutput() error {
	return errmsg(C.sp_flush(p.p, C.SP_BUF_OUTPUT))
}
예제 #3
0
// Discard buffered input data.
func (p *Port) ResetInput() error {
	return errmsg(C.sp_flush(p.p, C.SP_BUF_INPUT))
}
예제 #4
0
// Discard buffered data.
func (p *Port) Reset() error {
	return errmsg(C.sp_flush(p.p, C.SP_BUF_BOTH))
}