Connecting to multiple bluetooths?

80 views
Skip to first unread message

MightyThor

unread,
May 13, 2013, 1:44:31 PM5/13/13
to amarino...@googlegroups.com
Hello,

I'm trying to expand the SensorGraph example to display multiple graphs from data gathered from several different sensors. 

Afraid I'm fairly new to java and Android, but I seem to be having problems running the Amarino.connect more than once.  Could someone help me with this?

Much appreciated.

Bonifaz Kaufmann

unread,
May 13, 2013, 2:02:48 PM5/13/13
to amarino...@googlegroups.com
You can call Amarino.connect more than once, but you have to make sure
you use a different BT address and that the devices you want to connect
with are paired and added to the Amarino app.

To display several different data streams with the SensorGraph, you
might have to modify the Graph code.
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Amarino Toolkit" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to amarino-toolk...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

MightyThor

unread,
May 14, 2013, 4:21:25 PM5/14/13
to amarino...@googlegroups.com
Both devices were not paired and added to Amarino app as I only have one bluetooth device at the moment (another on order).

But I am able to make up a BT address and get Amarino to try and connect.  So I thought if I had one real address and one made up address I could see it try and connect to both at the least.  Instead it is throwing an error.

Is there a way to post the code for sharing and review?  Maybe I should use Github?

MightyThor

unread,
May 17, 2013, 2:53:58 PM5/17/13
to amarino...@googlegroups.com
Doesn't look like pairing is the problem.  Paired two bluetooths and have them stored in Amarino but still can't modify SensorGraph to connect to both.

To define the the addresses I have

public class SensorGraph extends Activity {
    private static final String TAG = "SensorGraph"

    private static final String DEVICE_ADDRESS = "00:06:66:05:61:E4"
    private static final String DEVICE_ADDRESS_2 = "00:12:11:28:13:50"

    private GraphView mGraph:
    private GraphView mgraph2;
    private TextView mValueTV;

    private ArduinoReceiver arduinoReceiver = new ArduinoReceiver();
    private ArduinoReceiver2 arduinoReceiver2 = new ArduinoReceiver();
    ...


And then later on to connect I have

@Override
protected void onStart() {
    super.onStart();

    registerReceiver(arduinoReceiver, new IntentFilter(AmarinoIntent.ACTION_RECEIVED));

    Amarino.connect(this, DEVICE_ADDRESS);

    registerReceiver(arduinoReceiver2, new IntentFilter(AmarinoIntent.ACTION_RECEIVED2));

    Amarino.connect(this, DEVICE_ADDRESS_2);
}


And when it runs I get a popup on the phone stating

Sorry!
The application Amarino 2.0 (process at.abraxas.amarino) has stopped unexpectedly.  Please try again.



Any thoughts?


On Monday, May 13, 2013 11:02:48 AM UTC-7, Bonifaz wrote:

Bonifaz Kaufmann

unread,
May 17, 2013, 3:53:47 PM5/17/13
to amarino...@googlegroups.com
register for the CONNECTED intent with a broadcastreceiver and connect to your second device once the first device has been connected successfully.

sent from my tablet

Javed Hasan

unread,
May 20, 2013, 8:10:51 AM5/20/13
to amarino...@googlegroups.com
Hi.....
I am also working on this.
I installed the amarino android application with plugins in my phone successfully and also placed the meetandroid library on right place, every thing is working fine.
The Amarino App by itself can connect fine to my BT module but as i  try to open show events i got this "The application Amarino 2.0 (process at.abraxas.amarino) has stopped unexpectedly. please try again"
 Any help would be appreciated. Thanks.

MightyThor

unread,
May 21, 2013, 1:11:56 PM5/21/13
to amarino...@googlegroups.com
My method of calling the CONNECTED intent appears to be wrong.

I have

protected void onStart() {
    super.onStart();
    registerReceiver(arduinoReceiver, new IntentFilter(AmarinoIntent.ACTION_RECEIVED));
    registerReceiver(arduinoReceiver2, new IntentFilter(AmarinoIntent.ACTION_RECEIVED));

    registerReceiver(BluetoothConnected, new IntentFilter(AmarinoIntent.ACTION_CONNECTED));

    Amarino.connect(this, DEVICE_ADDRESS);
}

BluetoothConnected is declared above, and then is defined as

public class BluetoothConnected extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Amarino.connect(null, DEVICE_ADDRESS_2);
    }
}

This throws the same Amarino error.  Is it a bad idea to connect to the second device in this manner?  Or have I just messed up the context that Amarino is looking for?

Thanks again for all your help!

MightyThor

unread,
May 21, 2013, 1:13:04 PM5/21/13
to amarino...@googlegroups.com
Hi Javed!

Glad to hear there are more people tackling this.  I'll keep you posted of any progress that I make!
Reply all
Reply to author
Forward
0 new messages