How to send json data to paired device uisng bluetooth serial and read data


#1

Hello
Can any one help me to send json data to paired device using bluetooth and read data aswell
this is my code
sendData(){
var data = new Uint8Array(4);
data[0] = 0x41;
data[1] = 0x42;
data[2] = 0x43;
data[3] = 0x44;

this.bluetoothSerial.write(data).then((data)=>{
  this.bluetoothSerial.subscribe('\n').subscribe((res)=>{
      alert(res+'for success writing data');
  },err=>{
      alert(err+'for error writing data');
  });

});

}
Am I coding wrong ? it is urgent helpe me


#2

can you give us more information? like which plugin, do you get any errors …

thanks


#3

I am using bluetooth serial plugin for this.I can pair with device successfully.
sendData(){

this.bluetoothSerial.write("Hello world").then((data)=>{
  
      alert(data+'for success writing data');
  },err=>{
      alert(err+'for error writing data');
 

});

}

It shows the success message
But I wanted to know where actually it stored on paired device


#4

Well principal you have only to fire this https://github.com/don/BluetoothSerial#read or https://github.com/don/BluetoothSerial#subscribe

But by the way I never used this plugin. :wink:
I guess it is also better for you to get better answers that you ask via the “issues” on github. https://github.com/don/BluetoothSerial/issues


#5

not working! waste of time!


#6

I am also getting the sucess ok message but the other paired device hasnt yet received the data I sent and neither am I able to find the location of the data. Has anybody able to get a solution to that?