def _get_com(args):
"""Gets a list of configured COM ports for serial communication.
"""
from liveserial.monitor import ComMonitorThread as CMT
from multiprocessing import Queue
dataq, errorq = Queue(), Queue()
result = []
msg.info("Starting setup of ports {}.".format(args["port"]), 2)
if args["config"]:
for port in args["port"]:
if port.lower() != "aggregate":
#The aggregate port name is just a shortcut so that we can plot
#transforms between multiple sensor streams. It doesn't actually
#represent a physical port that will be monitored.
com = CMT.from_config(args["config"], port, dataq, errorq,
args["listen"], args["sensors"])
result.append(com)
else:
for port in args["port"]:
com = CMT(dataq, errorq, port, args["baudrate"],
args["stopbits"], args["parity"], args["timeout"],
args["listen"], args["virtual"])
result.append(com)
return result
评论列表
文章目录