Using SerialPort in Mobile


I have to read some data from serial port. For the purpose, I have used . Everything is OK except this that I am unable to fetch complete data from serial port. Only two character can be fetched by me.

Where I am wrong. My code is given below -

var opts = {baudRate: 9600,dataBits: 8,stopBits: 1,parity: 0,dtr: false };
 var view ;
 var timerRef;
Form1.onshow = function() {


function PerSuccess(){,OpSuccess,OpError);
function PerError(){
function OpSuccess() {
  alert(" Connection Established...");

function OpError() {
  alert(" Connection aborted..");

Button1.onclick = function() {,ReadError);

function ReadSuccess(data) {
  view = new Uint8Array(data);
   // alert("view : " + view);
  if (view.length == 0){,ReadError);
  var str='';
  var str1='';
  if(view.length >= 1) {
        for(var i=0; i < view.length; i++) {
            var temp_str = String.fromCharCode(view[i]);
            var str_esc = escape(temp_str);
            str = unescape(str_esc);
           // alert(str);
            if (str != 'undefined') {
              str1 += str;
    TextBox1.value= str1;

function ReadError() {
  alert("Can't read data...");

Please help.

Thanking you

Where does serial come from? It’s not part of AppStudio.

Serial come from phonegap.
Add to config.xml

<gap:plugin name=“cordova-plugin-serial” source=“npm” />

Topic refiled under PhoneGap.

The Serial plugin isn’t part of AppStudio, so there isn’t much we can do to provide support for it.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.