BluetoothSPPLibrary icon indicating copy to clipboard operation
BluetoothSPPLibrary copied to clipboard

no data incoming

Open dafeng0908 opened this issue 9 years ago • 2 comments

bt connect is ok.

in terminal mode, "send" is OK

I can send data to pc.

public void setup() {
    Button btnSend = (Button)findViewById(R.id.btnSend);
    btnSend.setOnClickListener(new OnClickListener(){
        public void onClick(View v){
            if(etMessage.getText().length() != 0) {
                bt.send(etMessage.getText().toString(), true);
                textRead.append("hello " + "\n");//-----------------------------  for Check
                etMessage.setText("");
            }
        }
    });
}

but i cant receive data from pc

bt.setOnDataReceivedListener(new OnDataReceivedListener() { public void onDataReceived(byte[] data, String message) { // Do something when data incoming textRead.append(message + "\n"); }

});

dafeng0908 avatar Mar 15 '16 02:03 dafeng0908

reference issue #13 add 0x0a 0x0d can fixed this issue

dafeng0908 avatar Mar 15 '16 02:03 dafeng0908

I've been struggling with the same issue and in my ESP32 application adding \r\n to my JSON string I'm sending makes it work! (note that just using \r did not work.

Thanks for the point in the right direction!

pvint avatar May 24 '19 20:05 pvint