and it goes well, as far as sending text commands at button press can go
Also the discussion about b/o protection just about to take an unexpected turn: i changed batteries for a new set of 5 x aaa...
and now, pf and tf command does not brown out any more and the speed, it's MASSIVE
can't wait to test it outdoors.
In the mean time, also looking which way better to share what I wrote...
I will paste patches into this post.
(I changed the BluetoothChatFragment.java and fragment_bluetooth_chat.xml and the BluetoothChatService.java)
- Code: Select all
Index: Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1252
===================================================================
--- Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatService.java (revision )
+++ Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatService.java (revision )
@@ -46,11 +46,11 @@
private static final String NAME_SECURE = "BluetoothChatSecure";
private static final String NAME_INSECURE = "BluetoothChatInsecure";
- // Unique UUID for this application
+ // Unique UUID for this application // el_es : serial port profile UUID
private static final UUID MY_UUID_SECURE =
- UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
+ UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); //fa87c0d0-afac-11de-8a39-0800200c9a66");
private static final UUID MY_UUID_INSECURE =
- UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
+ UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); //8ce255c0-200a-11e0-ac64-0800200c9a66");
// Member fields
private final BluetoothAdapter mAdapter;
- Code: Select all
Index: Application/src/main/res/layout/fragment_bluetooth_chat.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- Application/src/main/res/layout/fragment_bluetooth_chat.xml (revision )
+++ Application/src/main/res/layout/fragment_bluetooth_chat.xml (revision )
@@ -45,5 +45,68 @@
android:layout_height="wrap_content"
android:text="@string/send" />
</LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="63dp"
+ android:orientation="horizontal" >
+ <Button
+ android:id="@+id/button_lf"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Left \nFull" />
+ <Button
+ android:id="@+id/button_dc"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Dir \nCenter" />
+ <Button
+ android:id="@+id/button_rf"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Right \nFull" />
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="horizontal"
+ android:gravity="right">
+ <Button
+ android:id="@+id/button_pf"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Forward \nFull" />
+ <Button
+ android:id="@+id/button_p8"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Forward \nHalf" />
+ <Button
+ android:id="@+id/button_p5"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Forward \nQuarter" />
+
+ </LinearLayout>
+ </LinearLayout>
+ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="63dp"
+ android:orientation="horizontal"
+ android:gravity="right">
+ <Button
+ android:id="@+id/button_tf"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Reverse \nFull" />
+ <Button
+ android:id="@+id/button_t5"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Reverse \nQuarter" />
+ <Button
+ android:id="@+id/button_s"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Full \nStop" />
+ </LinearLayout>
</LinearLayout>
- Code: Select all
Index: Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1252
===================================================================
--- Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java (revision )
+++ Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java (revision )
@@ -60,6 +60,15 @@
private ListView mConversationView;
private EditText mOutEditText;
private Button mSendButton;
+ private Button mRFButton;
+ private Button mLFButton;
+ private Button mDCButton;
+ private Button mPFButton;
+ private Button mP8Button;
+ private Button mP5Button;
+ private Button mTFButton;
+ private Button mT5Button;
+ private Button mStopButton;
/**
* Name of the connected device
@@ -151,6 +160,15 @@
mConversationView = (ListView) view.findViewById(R.id.in);
mOutEditText = (EditText) view.findViewById(R.id.edit_text_out);
mSendButton = (Button) view.findViewById(R.id.button_send);
+ mRFButton = (Button) view.findViewById(R.id.button_rf);
+ mLFButton = (Button) view.findViewById(R.id.button_lf);
+ mDCButton = (Button) view.findViewById(R.id.button_dc);
+ mPFButton = (Button) view.findViewById(R.id.button_pf);
+ mP8Button = (Button) view.findViewById(R.id.button_p8);
+ mP5Button = (Button) view.findViewById(R.id.button_p5);
+ mTFButton = (Button) view.findViewById(R.id.button_tf);
+ mT5Button = (Button) view.findViewById(R.id.button_t5);
+ mStopButton = (Button) view.findViewById(R.id.button_s);
}
/**
@@ -176,6 +194,84 @@
TextView textView = (TextView) view.findViewById(R.id.edit_text_out);
String message = textView.getText().toString();
sendMessage(message);
+ }
+ }
+ });
+
+ mRFButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("RF");
+ }
+ }
+ });
+
+ mDCButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("L0");
+ }
+ }
+ });
+
+ mLFButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("LF");
+ }
+ }
+ });
+
+ mPFButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("PF");
+ }
+ }
+ });
+ mP8Button.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("P8");
+ }
+ }
+ });
+ mP5Button.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("P5");
+ }
+ }
+ });
+ mTFButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("TF");
+ }
+ }
+ });
+
+ mT5Button.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("T5");
+ }
+ }
+ });
+
+ mStopButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ View view = getView();
+ if (null != view) {
+ sendMessage("S");
}
}
});