function sendMessageToPanel(message){
	if (serialConnected){
		var str = message.toString();
		var tempBuf = new ArrayBuffer(str.length*2); // 2 bytes for each char
	  	var buffer = new Uint8Array(tempBuf);
	  	for (var i=0, strLen=str.length; i<strLen; i++) {
	    	buffer[i] = str.charCodeAt(i);
	  	}
	            		
		serial.write(buffer, function(err, bytesWritten) {
        	if (err) {
        		console.log(err);
        	}
		});
	}
	else {
		socket_io.emit("bluetooth_not_connected");
	}
}
// Sends message to the panel through the Bluetooth serial connection
Sends message to the panel through the Bluetooth serial connection
Sends message to the panel through the Bluetooth serial connection
function sendMessageToPanel(message){
	if (serialConnected){
		var str = message.toString();
		var tempBuf = new ArrayBuffer(str.length*2); 
	  	var buffer = new Uint8Array(tempBuf);
	  	for (var i=0, strLen=str.length; i<strLen; i++) {
	    	buffer[i] = str.charCodeAt(i);
	  	}
		serial.write(buffer, function(err, bytesWritten) {
        	if (err) {
        		console.log(err);
        	}
		});
	}
	else {
		socket_io.emit("bluetooth_not_connected");
	}
}
function sendMessageToPanel ( message ) { if ( serialConnected ) { var str = message . toString ( ) ; var tempBuf = new ArrayBuffer ( str . length * 2 ) ; var buffer = new Uint8Array ( tempBuf ) ; for ( var i = 0 , strLen = str . length ; i < strLen ; i ++ ) { buffer [ i ] = str . charCodeAt ( i ) ; } serial . write ( buffer , function ( err , bytesWritten ) { if ( err ) { console . log ( err ) ; } } ) ; } else { socket_io . emit ( "bluetooth_not_connected" ) ; } }
Sends message to the panel through the Bluetooth serial connection
Sends message to the panel through the Bluetooth serial connection
// 2 bytes for each char