Aashi khanna
Lurker
I am using the following method in an android app to send data to UART over Bluetooth LE. However, at the receiver section, I am getting random characters. Can someone elaborate, in what form am I expected to get data if I use the below code, in general?
publicvoid onProgressChanged(SeekBar seekBar,int progressValue,boolean fromUser){
if(progressValue != progress){
progress = progressValue;
byte[] value;
try{
String cmdString ="led2 "+ progress / SLIDER_MAX; // logic for the pressed and non-pressed logic keys
System.out.println("CMDSTRING:"+cmdString);
value = cmdString.getBytes("UTF-8");
System.out.println("VALUE: "+value);
RxChar.setValue(value);
boolean status = mBluetoothGatt.writeCharacteristic(RxChar);
}
catch(UnsupportedEncodingException e){
//TODO Auto-generated catch block/ e.printStackTrace();
}
}
}
Ignore the syntax error, if any. Also suggest, what data conversion at the receiver end is needed to get the data in proper format.
publicvoid onProgressChanged(SeekBar seekBar,int progressValue,boolean fromUser){
if(progressValue != progress){
progress = progressValue;
byte[] value;
try{
String cmdString ="led2 "+ progress / SLIDER_MAX; // logic for the pressed and non-pressed logic keys
System.out.println("CMDSTRING:"+cmdString);
value = cmdString.getBytes("UTF-8");
System.out.println("VALUE: "+value);
RxChar.setValue(value);
boolean status = mBluetoothGatt.writeCharacteristic(RxChar);
}
catch(UnsupportedEncodingException e){
//TODO Auto-generated catch block/ e.printStackTrace();
}
}
}
Ignore the syntax error, if any. Also suggest, what data conversion at the receiver end is needed to get the data in proper format.