Sending data from JAVA app: avoid OK+CONN bonded message


#1

Hi,

I’m trying to send some data to the Blueduino from a JAVA application on a Raspbian image.

The code I’m using JAVA side is:

Runtime.getRuntime().exec("sudo gatttool -i hci0 -b AA:BB:CC:DD:EE:FF:GG --char-write-req -a 0x0029 -n myValue");

The code on the Blueduino is:

#define BAUD_RATE 9600

void setup() {
  Serial.begin(BAUD_RATE);
  Serial1.begin(BAUD_RATE);

  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.println("Hello!");
}

void loop() {
  if (Serial1.available() > 0) {
    Serial.print(char(Serial1.read()));
  }
}

I do receive the data I’m sending but I also “receive” those two more lines:

OK+CONN
bonded
myValue

Is there a way to get read of OK+CONN and bonded to just receive the data?

Thanks a lot :slight_smile:


#2

Which auth mode do you use? Please check the document for AT+AUTH command. We’ll check the auth mode for bonded response.


#3

Hi aprilpea,

Thanks again for the support.
I think you are right, I remembered I put the auth mode to 3: auth and bond

Sadly I can’t manage to run AT command anymore and have no idea why…
I uploaded an empty sketch and used termite with a USB to UART converter that I used previously to update to last firmware but it give me no answers…


#4

Do you want to upgrade firmware again? For test AT command, you should just upload the sketch hardwareSerialMonitor