function connectBluetooth(){
	var name = process.argv[2];
	console.log("BlueTooth Program Started");
	 
	serial.on('found', function(address, name) {
		console.log("address1: ", address);
	    console.log("name1: ", name);
	 
	    if(address === "98-d3-31-fc-2f-06"){
		    serial.findSerialPortChannel(address, function(channel) {
		    	console.log("address2: ", address);
		    	console.log("channel: ", channel);
		        serial.connect(address, channel, function() {
		            console.log('Bluetooth connected to Panel!');
		            serialConnected = true;
		            socket_io.emit("bluetooth_connected");

		            // ## UNCOMMENT THIS SECTION TO ALLOW FOR TERMINAL INPUTS ## //
		      //       process.stdin.resume();
		      //       process.stdin.setEncoding('utf8');
		      //       serialConnection = serial;
		 
		      //       process.stdin.on('data', function (data) {
		            	
	       //      		console.log("input:", data);
	       //      		var tempBuf = new ArrayBuffer(data.length*2); // 2 bytes for each char
					  	// var buffer = new Uint8Array(tempBuf);
					  	// for (var i=0, dataLen=data.length; i<dataLen; i++) {
					   //  	buffer[i] = data.charCodeAt(i);
					  	// }
	            		
	       //      		//serial.write(buffer);
	       //      		serial.write(buffer, function(err, bytesWritten) {
			     //            if (err) console.log(err);
			     //        });
		      //       });

		      		// ## ## //
		 
		            serial.on('data', function(data) {
		                console.log('Received: ' + data);
		            });
		        }, function () {
		            console.log('cannot connect');
		        }); //End bracket for serial.connect()
		    });//End bracket for serial.findSerialPortChannel()
		}//End bracket for if statement
	});//End bracket for serial.on()

	//Starts searching for bluetooth devices. When a device is found a 'found' event will be emitted
	serial.inquire();
}
// Looks for the bluetooth module on the Panel and make bluetooth connection
Looks for the bluetooth module on the Panel and make bluetooth connection
Looks for the bluetooth module on the Panel and make bluetooth connection
function connectBluetooth(){
	var name = process.argv[2];
	console.log("BlueTooth Program Started");
	serial.on('found', function(address, name) {
		console.log("address1: ", address);
	    console.log("name1: ", name);
	    if(address === "98-d3-31-fc-2f-06"){
		    serial.findSerialPortChannel(address, function(channel) {
		    	console.log("address2: ", address);
		    	console.log("channel: ", channel);
		        serial.connect(address, channel, function() {
		            console.log('Bluetooth connected to Panel!');
		            serialConnected = true;
		            socket_io.emit("bluetooth_connected");
		            serial.on('data', function(data) {
		                console.log('Received: ' + data);
		            });
		        }, function () {
		            console.log('cannot connect');
		        }); 
		    });
		}
	});
	serial.inquire();
}
function connectBluetooth ( ) { var name = process . argv [ 2 ] ; console . log ( "BlueTooth Program Started" ) ; serial . on ( 'found' , function ( address , name ) { console . log ( "address1: " , address ) ; console . log ( "name1: " , name ) ; if ( address === "98-d3-31-fc-2f-06" ) { serial . findSerialPortChannel ( address , function ( channel ) { console . log ( "address2: " , address ) ; console . log ( "channel: " , channel ) ; serial . connect ( address , channel , function ( ) { console . log ( 'Bluetooth connected to Panel!' ) ; serialConnected = true ; socket_io . emit ( "bluetooth_connected" ) ; serial . on ( 'data' , function ( data ) { console . log ( 'Received: ' + data ) ; } ) ; } , function ( ) { console . log ( 'cannot connect' ) ; } ) ; } ) ; } } ) ; serial . inquire ( ) ; }
Looks for the bluetooth module on the Panel and make bluetooth connection
Looks for the bluetooth module on the Panel and make bluetooth connection
// ## UNCOMMENT THIS SECTION TO ALLOW FOR TERMINAL INPUTS ## // //       process.stdin.resume(); //       process.stdin.setEncoding('utf8'); //       serialConnection = serial; //       process.stdin.on('data', function (data) { //      		console.log("input:", data); //      		var tempBuf = new ArrayBuffer(data.length*2); // 2 bytes for each char // var buffer = new Uint8Array(tempBuf); // for (var i=0, dataLen=data.length; i<dataLen; i++) { //  	buffer[i] = data.charCodeAt(i); // } //      		//serial.write(buffer); //      		serial.write(buffer, function(err, bytesWritten) { //            if (err) console.log(err); //        }); //       }); // ## ## // //End bracket for serial.connect() //End bracket for serial.findSerialPortChannel() //End bracket for if statement //End bracket for serial.on() //Starts searching for bluetooth devices. When a device is found a 'found' event will be emitted