I am using the "Partner CD 7220" (Connection : USB PORT), customer display for my POS system. The POS system is implemented using PHP and jquery, which runs in Firefox web browser. My problem is how to display a value in a specific field in customer display and clear it, using jquery function. Please help me to solve this problem .
What I have tried:
var connectionId = -1;
openPort("COM3");
function openPort(port){
var onOpen = function(connectionInfo) {
if (!connectionInfo || connectionInfo.connectionId == -1) {
return;
}
connectionId = connectionInfo.connectionId;
}
}
function closePort() {
if (connectionId == -1) {
return;
}
var onDisconnect = function(connectionInfo) {
connectionId = -1;
}
chrome.serial.disconnect(connectionId, onDisconnect);
}
function sendData(str){
chrome.serial.flush(connectionId, function(){});
chrome.serial.send(connectionId, str2ab(str), function(){});
}
function str2ab(str) {
var buf = new ArrayBuffer(str.length);
var bufView = new Uint8Array(buf);
for (var i = 0; i < str.length; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
sendData("dsadsads");