1

I am trying to send over 20 bytes in ionic ble native without success, first of all I send without response and then this response but still not working how I do this?

var newSend=this.myInput.match(/.{1,19}/g);
console.log(newSend);
for(var i = 0 ; i<newSend.length ; i++){

  var ddd = newSend[i].buffer;
  this.sendingtext=newSend[i];
console.log(i,newSend.length);
if(i == (newSend.length-1)){
  this.ble.write(bID, bService, bCharacteristic, ddd).then(
    function(data){
    //  console.log( this.myInput);
      console.log("write",data);


    }
  );
}else{
  this.ble.writeWithoutResponse(bID, bService, bCharacteristic, ddd).then(
    function(data){
    //  console.log( this.myInput);
      console.log("writeWithoutResponse",data);


    }
  );
}
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Haim
  • 11
  • 2

2 Answers2

0

That is not acceptable. BLE is low energy bluetooth, so it's protocol limit the packet size of a command. In general the maximum payload size you can send over BLE write is 20 bytes

Follow this link to read more about how to send larger 20 bytes over BLE

Android: Sending data >20 bytes by BLE

phapli
  • 627
  • 6
  • 16
0

It's a misconception that Write Without Response doesn't give a response; it does. You just don't have to wait for response. It is meant to decrease the time between successive packets, we can send and receive data between a client and server without waiting for a response after each message.

There are some restrictions:

You have to comply with the MTU of the server.

The receive buffer of the server must be large enough to hold the incoming packets.

There must be enough time for the server to empty the receive buffer.

GrooverFromHolland
  • 971
  • 1
  • 11
  • 18