12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- # -*- coding:utf-8 -*-
- import os, sys, time
- from TST.SerialBoard import *
- '''
- 继承自TST serial,接口类废弃
- '''
- class SerialTool():
- def __init__(self):
- self.serialBoard = SerialBoard()
- '''
- 返回当前串口板的端口号
- [return] str Portname
- '''
- @staticmethod
- def GetPortName():
- return SerialBoard.GetPortName()
- '''
- 打开串口
- [return]Bool;
- 返回Bool 型,说明串口打开是否成功
- '''
- def open(self):
- return self.serialBoard.open()
- '''
- 关闭串口
- [return] Bool;
- 返回Bool型,说明串口关闭是否成功
- '''
- def close(self):
- return self.close()
- '''
- 新建txt文件用以存储Log
- [return]str LogFilePath
- 返回新建的txt文件路径
- '''
- def logFilePath(self):
- return self.serialBoard.logFilePath()
- '''
- 打开串口打印
- 1)当Recordtype为 both时,串口打印写入指定文件的同时在命令行同步显示
- 2)当Recordtype为OSD时,只在命令行显示串口打印
- 3)当Recordtype为Filewrite时,串口打印不在命令行显示,只写入文件
- [in] str Recordtype
- recordtype: ‘both’,'OSD','Filewrite' 三种类型
- [in]str LogFilepath
- 当Recordtype为‘OSD’时,此参数不传参
- 当Recordtype为‘both’和‘Filewrite’时,必须传参,否则报错
- 指定串口打印写入文件的路径
- [Return] Bool;
- '''
- def recordLogStart(self, recordType, logFilePath):
- return self.serialBoard.recordLogStart(recordType, logFilePath)
|