IR Remote control app

纵然是瞬间 提交于 2019-12-05 21:17:43

The "irda" service is only available on Samsung devices prior to KitKat. On KitKat and upwards, all IR commands are handled in Consumer IR API.

The same code you have published works for me, but it has a simple and tiny error...

At the method irInit4JellyBean() you have the Object irService which you made the getSystemService("irda") that works only for Samsung devices according i have read

then, after that, you use irSend4JellyBean() and when you made the irWrite.invoke(irdaService, data); the variable irdaService is not equal to irService,so it means irdaService never got a value at all, so i rename at the top of the class irdaService by irService and i run it, and works in a Samsung Galaxy S4 and also a Samsung Galaxy Tab 3 10'1.

also i have the codes for LG TV

here is it:

private String power_on = "0000 006d 0022 0002 0157 00ac 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0689 0157 0056 0015 0e94";

private String power_off = "0000 006d 0022 0002 0157 00ac 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0689 0157 0056 0015 0e94";

private String channel_next="0000 006D 0022 0002 0157 00AC 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0689 0157 0056 0015 0E94";

private String channel_prev = "0000 006D 0022 0002 0157 00AC 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0689 0157 0056 0015 0E94";

private String vol_up = "0000 006D 0022 0002 0157 00AC 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0689 0157 0056 0015 0E94";

private String vol_down = "0000 006D 0022 0002 0157 00AC 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0689 0157 0056 0015 0E94";

I tried this code ,and is works great!

final ConsumerIrManager mCIR;
mCIR = (ConsumerIrManager) getSystemService(Context.CONSUMER_IR_SERVICE);
int[] pattern_off = {8918 ,4446, 572, 546 ,572 ,546 ,572, 1638, 572, 546, 572, 546,
                     572 ,546 ,572 ,546 ,572 ,546 ,572 ,1638 ,572 ,1638 ,572 ,546 ,572 ,1638 ,572 ,
                     1638, 572 ,1638 ,572 ,1638 ,572 ,1638 ,572 ,1638 ,572 ,546 ,572 ,1638 ,572,
                     546, 572 ,546, 572 ,546, 572, 1638, 572, 1638, 572, 546, 572, 1638, 572 ,546,
                     572, 1638, 572, 1638, 572, 1638, 572, 546, 572, 546, 572, 39598, 8892, 2210, 572, 95186};
mCIR.transmit(38000,pattern_off);

How can I send this type hex code (For example: 0x000000000000847B)??

begin remote

  bits           16
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       9042  4558
  one           555  1682
  zero          555   570
  ptrail        544
  repeat       9041  2296
  pre_data_bits   16
  pre_data       0x213C
  gap          108556
  min_repeat      0
  toggle_bit      0


      begin codes
          KEY_POWER                0x000000000000847B        #  Was: power
          KEY_1                    0x0000000000000CF3        #  Was: 1
          KEY_2                    0x000000000000946B        #  Was: 2
          KEY_3                    0x0000000000009C63        #  Was: 3
          KEY_4                    0x00000000000014EB        #  Was: 4
          KEY_5                    0x00000000000004FB        #  Was: 5
          KEY_6                    0x0000000000001CE3        #  Was: 6
          KEY_7                    0x0000000000004CB3        #  Was: 7
          KEY_8                    0x00000000000054AB        #  Was: 8
          KEY_9                    0x00000000000044BB        #  Was: 9
          KEY_EXIT                 0x0000000000008C73        #  Was: exit
          KEY_0                    0x000000000000CC33        #  Was: 0
          KEY_0                    0x000000000000F40B        #  Was: 10
          KEY_MUTE                 0x000000000000A45B        #  Was: mute
          KEY_ENTER                0x0000000000005CA3        #  Was: return
          KEY_VOLUMEUP             0x000000000000649B        #  Was: vol+
          KEY_VOLUMEDOWN           0x000000000000E41B        #  Was: vol-
          KEY_CHANNELUP            0x000000000000AC53        #  Was: channel+
          KEY_CHANNELDOWN          0x000000000000EC13        #  Was: channel-
          KEY_INFO                 0x000000000000748B        #  Was: guide
          mosaic                   0x0000000000006C93
          yes                      0x000000000000C43B
          KEY_UP                   0x000000000000D42B        #  Was: up
          KEY_DOWN                 0x00000000000024DB        #  Was: down
          KEY_LEFT                 0x0000000000002CD3        #  Was: left
          KEY_RIGHT                0x000000000000DC23        #  Was: right
          ?                        0x00000000000034CB
          KEY_KPPLUS               0x0000000000003CC3        #  Was: +
          orange                   0x0000000000007C83
          KEY_GREEN                0x000000000000B44B        #  Was: green
          KEY_YELLOW               0x000000000000BC43        #  Was: yellow
          KEY_BLUE                 0x000000000000FC03        #  Was: blue
          envelope                 0x000000000000C23D
          KEY_B                    0x00000000000042BD        #  Was: B
          KEY_A                    0x000000000000827D        #  Was: A
          KEY_I                    0x00000000000002FD        #  Was: i
      end codes

end remote
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!