當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript SerialPort.parsers類代碼示例

本文整理匯總了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")
    });
}
開發者ID:ArtemZag,項目名稱:DefinitelyTyped,代碼行數:7,代碼來源:serialport-tests.ts

示例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();
 }
開發者ID:pierreca,項目名稱:msshuttle,代碼行數:11,代碼來源:gpsreader.ts

示例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) => {});
}
開發者ID:enlight,項目名稱:DefinitelyTyped,代碼行數:38,代碼來源:serialport-tests.ts

示例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');
開發者ID:chutungwnz,項目名稱:gyro3d,代碼行數:31,代碼來源:server.ts


注:本文中的SerialPort.parsers類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。