I'm trying to learn how to send commands via Bluetooth using this Library : https://github.com/akexorcist/Android-BluetoothSPPLibrary
But when I try to send these commands in this form :
(Send: "$$$" Receive: "CMD"
Send: "S&,0404\r" Receive: "AOK"
Send: "S&,0400\r" Receive: "AOK"
Send: "---\r" Receive: "END")
I need put this commands to code down,
But I don't know how.
I want to get connected to an android device via Bluetooth and send Text.
void teplotahore() {
STup.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View view) {
teplotad++;
prevodst(teplotac, teplotad);
bt.send("Text", true);
}
}
);
}
public void send(String data, boolean CRLF) {
if(mChatService.getState() == BluetoothState.STATE_CONNECTED) {
if(CRLF)
data += "\r\n";
mChatService. write(data.getBytes());
}
}
Please Tell me how (Send: "S&,0404\r" Receive: "AOK" ) rewrite to Byte form for send via Bluetooth.
Or If someone have similar project, please send it to me. I want to learn it.
I leer more and more theory of these prolem, but it's no run for me.