针对目前串口通信组件设计中的异步调用与并发运行的问题,以及功能上局限在串口管理或简单数据收发的缺陷,采用分布式对象组件模型(DCOM)提出了一种新的设计方案。设计了异步缓冲区模板类和线程管理器,实现了通信组件的异步访问接口。通过IDL设计并实现了便于调用的参数传递方式,通过接口查询实现组件内COM对象间的调用。调试与运行测试结果表明,该组件可被本地或远程调用,并可反复运行且无资源泄漏。
According to the problems as asynchronous accessing and parallel running and the shortcoming that functions is within the limit of serial port manage or simple data I/O in current serial communication component design.The asynchronous accessing to serial communication interface's method is implemented via self-designed asynchronous buffer class template and thread management class.A convenience parameters transfer method is designed via IDL,and inter-access between COM objects inside component is achieved via interface query.Either debugging or running test shows that this component can be accessed in local or remote mode,and run repeatability without any leaked resource.