Connect Phidget RFID 1024 to android tablet otg/micro usb

Supporting 4.1 and up
sjamientje
Fresh meat
Posts: 4
Joined: Wed Sep 17, 2014 3:36 am
Contact:

Connect Phidget RFID 1024 to android tablet otg/micro usb

Postby sjamientje » Wed Sep 17, 2014 3:50 am

Hi guys,

I'm new on this forum so first a hello from the Netherlands :)

Here is the thing. I'd like to connect the PhidgetsRFID 1024 to a tablet. It is a pretty custom tablet: rockchip-pt201 (micro USB).

I have an OTG cable connected. So far so good. The device is also "recognized" in Eclipse. I'm using this code snipped for that.

manager = (UsbManager) getSystemService(Context.USB_SERVICE);
deviceList = manager.getDeviceList();

When i instantiate the RFIDPhidget and set setAntennaOn(true) it throws the error: Device unattached.

Unfortunately my tablet doesn't have the correct permissions. All the efforts to push the android.hardware.usb.host.xml file have failed, no root access :(

So i'm looking for a solution, a different tablet, which will work instantly. Does any of you know which tablet will work if any (with micro USB)?

Regards,

Chamin Hardeman

erik
King of the Lab
Posts: 476
Joined: Fri Mar 06, 2009 12:42 pm
Location: Calgary, Canada
Contact:

Re: Connect Phidget RFID 1024 to android tablet otg/micro us

Postby erik » Wed Sep 17, 2014 8:22 am

The tablet that we use here is the Asus Transformer TF101 with the keyboard dock that has two USB ports, running Android 4.0.3.

I would expect a permissions error instead of a "Device unattached" error, which is usually a sign that the Phidget hardware has not had enough time to initialize after the object has been instantiated and opened.

If you are using attach events, you can call setAntennaOn inside the event handler.

If you are not using attach events, after you call open on the RFID object you will need to call waitForAttachment(int) which is a blocking call that waits until the RFID hardware has been properly initialized.

If you haven't already seen, we have a few simple Android examples.

sjamientje
Fresh meat
Posts: 4
Joined: Wed Sep 17, 2014 3:36 am
Contact:

Re: Connect Phidget RFID 1024 to android tablet otg/micro us

Postby sjamientje » Thu Sep 18, 2014 7:36 am

OK i've rooted the device and added the xml's to system/etc/permissions

I'm using the HelloWorld example and get the following output:

System.out.println("Device: "+device.getDeviceName()); <- RFID Read Write.

1) Does that mean that i am able to use the usb device directly connected to the tablet?
2) I'm not able to implement a attachEvent :( , can you send a snippet?

erik
King of the Lab
Posts: 476
Joined: Fri Mar 06, 2009 12:42 pm
Location: Calgary, Canada
Contact:

Re: Connect Phidget RFID 1024 to android tablet otg/micro us

Postby erik » Thu Sep 18, 2014 10:38 am

1) The HelloWorld example simply lists any connected devices. Since it detects the RFID device

2) The examples are located here: http://www.phidgets.com/docs/OS_-_Android#Quick_Downloads. There is an example for a network attached PhidgetInterfacekit and for a USB connected InterfaceKit. Follow the sequence for adding an AttachListener to the device object, as well as the Runnable class, AttachDetachRunnable.

sjamientje
Fresh meat
Posts: 4
Joined: Wed Sep 17, 2014 3:36 am
Contact:

Re: Connect Phidget RFID 1024 to android tablet otg/micro us

Postby sjamientje » Fri Sep 19, 2014 5:31 am

Hi erik, we've got the HelloWorld working, hello and goodbye are showing. But now we're stuck on the device (Phidget) - rfid (RFIDPhidget) part :S struggling...

Can we do something like typecast the device to RFIDPhidget?

sjamientje
Fresh meat
Posts: 4
Joined: Wed Sep 17, 2014 3:36 am
Contact:

Re: Connect Phidget RFID 1024 to android tablet otg/micro us

Postby sjamientje » Fri Sep 19, 2014 6:17 am

We've got it! \o/ Thanks!

tbseven
Fresh meat
Posts: 2
Joined: Tue Feb 03, 2015 4:27 pm
Contact:

Re: Connect Phidget RFID 1024 to android tablet otg/micro us

Postby tbseven » Tue Feb 03, 2015 4:34 pm

someone used the cordova?


Return to “Android”

Who is online

Users browsing this forum: No registered users and 3 guests