本文整理汇总了TypeScript中SerialPort.parsers.readline方法的典型用法代码示例。如果您正苦于以下问题:TypeScript parsers.readline方法的具体用法?TypeScript parsers.readline怎么用?TypeScript parsers.readline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerialPort.parsers
的用法示例。
在下文中一共展示了parsers.readline方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test_connect_config
function test_connect_config() {
let port = new SerialPort("", {
baudrate: 0,
disconnectedCallback: function () { },
parser: SerialPort.parsers.readline("\n")
});
}
示例2: constructor
public constructor(realData: boolean, comPort:string) {
this.realData = realData;
if(this.realData) {
this.serialPort = new serial.SerialPort(comPort, {
baudrate: 9600,
parser: serial.parsers.readline('\r\n')
});
}
this.started = false;
this.status = new GpsPosition();
}
示例3: test_connect_config
function test_connect_config() {
let port1 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.raw
}, (err: any) => {});
let port2 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.readline('\n', 'ascii')
}, (err: any) => {});
let port3 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.byteLength(7)
}, (err: any) => {});
let port4 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.byteDelimiter([3, 4, 5])
}, (err: any) => {});
let port5 = new SerialPort('', {
autoOpen: false,
lock: false,
baudRate: 115200,
dataBits: 5,
stopBits: 2,
parity: 'odd',
rtscts: true,
xon: true,
xoff: true,
bufferSize: 1024,
platformOptions: {
vmin: 1,
vtime: 1
}
}, (err: any) => {});
}
示例4: require
socket = require('./routes/socket'),
http = require('http'),
path = require('path'),
jf = require('./services/jsonfile');
var config = jf.readFileSync("config.json");
var app = module.exports = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
io.set('log level', 1);
var SerialPort = serialport.SerialPort;
serialPort = new SerialPort(config.serialPort,
{ baudrate: 115200,
parser: serialport.parsers.readline("\n") });
var portUp = false;
process.on('uncaughtException', function (err) {
console.error(err);
console.log("Continuing...");
});
/**
* Configuration
*/
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/../public/views');
app.set('view engine', 'jade');