Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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");
Posted
Updated 17-Apr-16 20:48pm
v2
Comments
Sinisa Hajnal 19-Apr-16 3:13am    
Code above does not use html nor jQuery. You're showing the code sending data to the screen I presume. But not how the page handles the data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900