3

I am trying to send Pronto IR Command using Android KitKat IR API. Android throws error saying that "Non-Positive Slice". I have tried below sample Pronto Hex command which I want to send using Android IR Manager API. Please help me to resolve the issue.

Pronto IR Hex command: 0000 006D 0000 000D 0006 0115 0006 0115 0006 00BB 0006 00BB 0006 00BB 0006 00BB 0006 00BB 0006 00BB 0006 00BB 0006 00BB 0006 00BB 0006 0115 0006 0900

Array of Patterns: int[] data = [0,109,0,13,6,277,6,277,6,277,6,277,6,187,6,277,6,187,6,187,6,187,6,277,6,187,6,187,6,2304]

irManager.transmit(38000, data);

jkstar
  • 467
  • 2
  • 7
  • 19

2 Answers2

4

I am not 100% sure, but I guess 0 is not allowed.

Generally, you do not need the first four digits. The Pronto Hex Format consists of 3 Parts:

  • Preamble
  • Burst Pair Sequence 1
  • Burst Pair Sequence 2 (Optional)

The Preamble contains 4 Digits:

  1. Allways 0.
  2. Frequency. If n is the second digit, the Frequency is calculated by: 1000000/(n*0,241246)
  3. Number of Burst Pairs in Sequence 1
  4. Number of Burst Pairs in Sequence 2

So the first four Digits in the Sequence have to be deleted.

Note: The Android API is not 100% correct. https://developer.android.com/reference/android/hardware/ConsumerIrManager.html#transmit(int, int[])

The alternating on/off pattern in microseconds to transmit.

But on some Android Versions, depending on the Device too, you have to send the Pulse Count instead of the time in microseconds. The Pulse Count is depending on the Frequency.The Number of Pulses each second is 1000000/Frequency. You have to multiply each digit with this value first before transmitting.

0

I know it's not strictly what you are looking for, but I had this problem too, and it turned out that I was trying to use the wrong codes and in the wrong way.

I found this resource: https://irdatabase.globalcache.com/irdatabase.htm and it seems solid, at least for my Samsung TV.

To use it, you have to sign up with yahoo/google/facebook (which I found weird.... but the website I found it on, http://www.power7.net/SamsungIR.html says it's fine, and they haven't spammed me yet...) and pick out which device you need. Then, you'll get something that looks like this:

sendir,1:1,1,38226,1,1,170,171,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,>65,21,22,21,22,21,22,21,22,21,22,21,22,21,65,21,22,21,22,21,22,21,22,21,22,21,22,21,65,21,22,2>1,65,21,65,21,65,21,65,21,65,21,65,21,1783,170,171,21,22,21,4892

Remove the "sendir,1:1,1," and you'll find 38226 as your frequency. Then, the next ",1,1" should also be removed and the rest is what you need to transmit. Like the other answer said, I needed to multiply each number like: * 1000000/frequency;

For example, the first few numbers of the above in my int[] look like this:

int[0] = 4447 //(originally 170)
int[1] = 4473 //(originally 171)
int[2] = 549  //(originally 21) 

Good luck, and I hope this helps you!

Dwebtron
  • 777
  • 13
  • 27