xseignard / cordovarduino

Cordova/Phonegap plugin for USB host serial communication from an Android device.
MIT License
166 stars 110 forks source link

Why do you return a set of data separately #96

Open zhuxuda opened 6 years ago

zhuxuda commented 6 years ago

true:[48,48,48] yours:[48][48]

xseignard commented 6 years ago

Please provide a more detailed issue

zhuxuda commented 6 years ago

the normal return data:[58,48,48,48,48] but the plugin return me data; [58] [48][48][48][48] it is divided.My data is returned by multiple times. Is it a problem of delay?

xseignard commented 6 years ago

PLEASE PROVIDE A MORE DETAILED ISSUE (e.g. SOME CODE OF YOURS, android AND usb serial device)

xseignard commented 6 years ago

AND SOME POLITENESS (LIKE HELLO, THANKS AND SO ON) WOULD BE THE BARE MINIMUM WHEN ASKING FOR HELP

zhuxuda commented 6 years ago

sorry,my English is very bad.Thank you for your patience. This is my dode var opts = { baudRate: 115200 }; $scope.allData = []; serial.requestPermission(function success(res){ console.log(res); serial.open(opts, function success(res){ console.log(res); }, function error(err){ console.log(err); }); }, function error(err){ console.log(err); }); var view = []; serial.registerReadCallback(function success(res) { var lin = new Uint8Array(res); view = view.concat(Array.from(lin)); },function error(error) { console.log(error) }); //发送指令 $scope.sendOrder = function(){ serial.writeHex(myOrderString, function success(res){ console.log(res); }, function error(err){ console.log(err); }); }

xseignard commented 6 years ago

Please check the example on the readme