0

KitKat IR sdk
http://developer.android.com/reference/android/hardware/ConsumerIrManager.html

LG IR sdk
http://developer.lgmobile.com/MOBILE_HELP/topic/lge.mobilesdk.LGQRemote.api/Documents/reference/com/lge/hardware/IRBlaster/IRBlaster1.htm#sendIRPattern(int, int[])

I am developing android application which uses infrared transmitter. There are 2 buttons which should send given ir patter. I have used raspberry pi with lirc to read these codes from original remote for my device.

My pattern to be sent looks like this (It's decimal duration values):

1771     821    3499     823     869

Using LG IR sdk on LG2 I am able to send this data properly this using method mentioned above:

int frequency=38000;
int[] rawCodes=new int[]{1771,821,3499,823,869};
mIR.sendIRPattern(frequency, rawCodes);

I tested sent data with LG G2 again on raspberry pi with lirc and decoded values are nearly identical as values in given array. Unfortunately using KitKat sdk ConsumerIrManager on Samsung Galaxy S4:

int frequency=38000;
int[] rawCodes=new int[]{1771,821,3499,823,869};
irManager.transmit(frequency,rawCodes);

Sent data is diffrent than I expected. Reading data sent by samsung with lirc it looks like sometimes received data is correct but sometimes there are totatally different values (like 2 quite big values). Do you guys know what I am doing wrong? As far as I know there are no difference between LG sdk and Kitkat sdk methods so I don't know why these 2 phones sometimes send different signals.

Piotr Maj
  • 1
  • 2
  • hi Piotr, I have the same problem. I have an App on the store that sends IR commands, but it is nearly impossible to tell which api to call on which phone. To make matters worse, is that the same Android api version on the same phone model may work differently for different users (ROMS)... Also, when a user update his phone, the api may change and your app is now broken. I would really like some definite answers to the fragmented state of the IR apis. On the forums you get 'hacks' for different api's, but it is unsustainable. – Pieter Oct 20 '15 at 09:24

1 Answers1

0

I'm pondering doing this myself, so I haven't tried this yet, but this seems to be what you are looking for (the Android API): http://developer.android.com/reference/android/hardware/ConsumerIrManager.html

SirGeekALot
  • 395
  • 3
  • 7
  • James I am using this Android API but it look like it isn't working as intended as I described in my first post. Resulting waveforms had many problems and they were not repeatable. – Piotr Maj May 25 '15 at 12:23