/*
 *
 * Read and decode Pelco D CCTV commands from a Serial Port / COM Port (using node-serialport)
 * Copyright 2016 Roger Hardiman
 *
 */

// External Dependencies
var SerialPort = require('serialport').SerialPort;
var PelcoD_Decoder = require('./pelcod_decoder');

// User Settings
var SERIAL_PORT = 'COM2';    // or /dev/ttyUSB0 on Linux
var BAUD_RATE = 2400;

// Globals
var pelco_d_decoder = new PelcoD_Decoder();
var port = new SerialPort(SERIAL_PORT, {
    baudrate: BAUD_RATE,
    parity: 'none',
    dataBits: 8,
    stopBits: 1,
});


// Callback - Open
port.on('open', function(err) {
    if (err) {
        console.log('Serial Port Error : ' + err);
    } else {
        console.log('Serial Port ' + SERIAL_PORT + ' open');
    }
});

// Callback - Data
port.on('data', function(buffer) {
    pelco_d_decoder.processBuffer(buffer);
});
@@ -26,16 +26,28 @@
 Pelco D 
+and Pelco P 
 CCTV com
@@ -142,16 +142,334 @@
 iman%0A *%0A
+ * You will need to set the SERIAL_PORT and the BAUD_RATE%0A * Note that the Serial Port varies between operating systems%0A * E.g.   COM1 on Windows%0A * E.g.   /dev/ttyUSB0 on Linux%0A * E.g.   /dev/cu.usbserial-141 on Mac%0A *%0A * The Baud Rate for Pelco D is often 2400 8-N-1%0A * The Baud Rate for Pelco P is often 4800 8-N-1%0A
  */%0A%0A// 
@@ -632,24 +632,8 @@
  = '
-COM2';    // or 
 /dev
@@ -640,25 +640,18 @@
 /ttyUSB0
- on Linux
+';
 %0Avar BAU
@@ -1145,12 +1145,13 @@
 buffer);%0A%7D);
+%0A

Add notes on Pelco P serial port baud rate