Something like:
IOIOLooper createIOIOLooper(String type, Object extra) {
if (type.equals("ioio.lib.android.bluetooth.BluetoothIOIOConnection")) {
return new MyBluetoothLooper();
} else {
return new MyUsbLooper();
}
}
Where MyBluetoothLooper and MyUsbLooper are two classes you implement, one
for each IOIO, with different logic in them. They will each run on a
separate thread and have a separate lifecycle.
On Wed, Jul 22, 2015 at 9:58 AM, Eric Rule <[email protected]> wrote:
> I'm only using one IOIO over bluetooth, the other is through USB. I
> noticed that the framework automatically distinguished between the two and
> held separate connections for each one, I was just unsure where the
> differentiating factor came in. I am somewhat new to android and IOIO
> though, and I'm still trying to wrap my head around the lower-level
> details, so I apologize if the answers to my questions are obvious.
>
> I have a specific scenario I'm trying to implement: I have the two
> IOIO's, and I'm trying to toggle the same pin on each of them, but
> independently. If I override the createIOIOLooper(String, Object) method
> instead, how can do I use those arguments, for example, to create two
> DigitalOutputs on the same pin?
>
> Sorry for the rushed response, I have a deadline today I'm trying to meet,
> and this is the last barrier to my problem.
>
> Thanks so much
>
> On Tuesday, July 21, 2015 at 4:17:45 PM UTC-7, Ytai wrote:
>>
>> If instead of overriding createIOIOLooper() you override
>> createIOIOLooper(...) you'll get two arguments that allow you to
>> distinguish the IOIOs by their connection.
>> The multiple IOIO scenario should work fine. If you're using more than
>> one IOIO over Bluetooth you may run into some flakiness, which I suspect
>> has to do with Android and might have been resolved on recent versions of
>> it.
>>
>> On Tue, Jul 21, 2015 at 12:43 PM, Eric Rule <[email protected]> wrote:
>>
>>> Hey everyone, I'm trying to control two IOIO boards (latest,
>>> models/firmware) simultaneously, but individually; so I may toggle pins
>>> separately. One board is connected through USB OTG to my phone and the
>>> other through Bluetooth (same phone).
>>>
>>> My question: how can I differentiate between the two IOIO's in my
>>> application? I've read into the IOIO interface and creating an instance for
>>> each board, but I'm a little confused.
>>>
>>> Have any of you successfully controlled two or more IOIO's from one
>>> phone?
>>>
>>> Any help is appreciated.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "ioio-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/ioio-users.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "ioio-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/ioio-users.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.