本文整理匯總了TypeScript中SerialPort.parsers類的典型用法代碼示例。如果您正苦於以下問題:TypeScript parsers類的具體用法?TypeScript parsers怎麽用?TypeScript parsers使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了parsers類的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() {
const port1 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.Raw
}, (err: any) => {});
const port2 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.Readline('\n', 'ascii')
}, (err: any) => {});
const port3 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.ByteLength(7)
}, (err: any) => {});
const port4 = new SerialPort('', {
baudRate: 0,
parser: SerialPort.parsers.ByteDelimiter([3, 4, 5])
}, (err: any) => {});
const 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');