• Stars
    star
    116
  • Rank 303,894 (Top 6 %)
  • Language
    CSS
  • License
    MIT License
  • Created about 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AndroidInfrared

Android Infrared is a infrared library drives IR LED built in Samsung devices, such as S4, Note 3.

Protocol Supported

Android Infrared supports most of popular protocols avaiable nowadays, including:

  • NEC
  • Sony
  • RC5
  • RC6
  • DISH
  • Sharp
  • Panasonic
  • JVC

Code Sample

        // Create ConsumerIrManager instance, which provides the unified and enhanced API across Samsung private API and KitKat API.
        ConsumerIrManager manager = ConsumerIrManager.getSupportConsumerIrManager(context);

        // Check whether IrEmitter is avaiable on the device.
        if (!manager.hasIrEmitter()) {
            Log.e("AndroidInfraredDemo", "Cannot found IR Emitter on the device");
        }

        // Build IR Command with predefined schemes.
        IrCommand necCommand = IrCommand.NEC.buildNEC(32, 0x723F);
        manager.transmit(necCommand);

        // Build IR Command from Pronto code
        IrCommand prontoCommand = IrCommand.Pronto.buildPronto("0000 0067 0000 0015 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 0018 0018 0018 0030 0018 0018 03f6");
        manager.transmit(prontoCommand);

        int FREQUENCY = 38028;  // T = 26.296 us
        int HDR_MARK = 342;
        int HDR_SPACE = 171;
        int BIT_MARK = 21;
        int ONE_SPACE = 60;
        int ZERO_SPACE = 21;

        // Build IR Command with Builder
        IrCommandBuilder builder = IrCommandBuilder.irCommandBuilder(NEC_FREQUENCY); // Static factory method
        IrCommand builderCommand = builder
                .pair(HDR_MARK, HDR_SPACE)  // Lead-in sequence
                .pair(BIT_MARK, ONE_SPACE)  // 1
                .pair(BIT_MARK, ONE_SPACE)  // 1
                .pair(BIT_MARK, ONE_SPACE)  // 1
                .pair(BIT_MARK, ONE_SPACE)  // 1
                .pair(BIT_MARK, ONE_SPACE)  // 1
                .pair(BIT_MARK, ONE_SPACE)  // 1
                .pair(BIT_MARK, ZERO_SPACE) // 0
                .pair(BIT_MARK, ZERO_SPACE) // 0
                .mark(BIT_MARK)             // lead-out sequence
                .build();

        // Simplify Sequence building process by using Sqeuence Definition
        IrCommandBuilder.SequenceDefinition necSequence = IrCommandBuilder.simpleSequence(BIT_MARK, ONE_SPACE, BIT_MARK, ZERO_SPACE);
        IrCommandBuilder sequenceBuilder = IrCommandBuilder.irCommandBuilder(NEC_FREQUENCY); // Static factory method
        IrCommand sequenceCommand = builder
                .pair(HDR_MARK, HDR_SPACE)  // Lead-in sequence
                .sequence(necSequence, 8, 0xFC000000) // As same as previous one
                .mark(BIT_MARK)             // lead-out sequence
                .build();

        // Build IR Command from Raw Data
        int[] sequence = IrCommandBuilder.buildRawSequence(
            HDR_MARK, HDR_SPACE,  // Lead-in sequence
            BIT_MARK, ONE_SPACE,  // 1
            BIT_MARK, ONE_SPACE,  // 1
            BIT_MARK, ONE_SPACE,  // 1
            BIT_MARK, ONE_SPACE,  // 1
            BIT_MARK, ONE_SPACE,  // 1
            BIT_MARK, ONE_SPACE,  // 1
            BIT_MARK, ZERO_SPACE, // 0
            BIT_MARK, ZERO_SPACE, // 0
            BIT_MARK              // lead-out sequence
        );
        manager.transmit(40000, sequence);
        

Sister Project

To decode and record the ir code from a existing remote control, such as TV remote or AirCon Remote, you can try IRRecorder.

Known Issue

Android Infrared uses the Samsung customized IR Blast API, and doesn't compatible with Android 4.4 KitKat standard ConsumerIrManager. The Adpoting to support KitKat standard API process is already in progress.

Road Map

  • Support Android 4.4 KitKat ConsumerIrManager API
  • Auto adpative between KitKat API and Samsung API
  • Support Proto code

More Repositories

1

irrecorder

Infrared Sequence Recorder
Ruby
21
star
2

reactx

A React.js Extension Library, add missing features form React.js
JavaScript
17
star
3

hexo-tag-asset-res

Hexo Tag that consumes asset files
JavaScript
16
star
4

msgpack-arduino

MSGPack ported for arduino
C
16
star
5

flutter_event_bus

Flutter Event Bus is an EventBus designed specific for Flutter app, which enable developer to write flutter app with Interactor pattern
Dart
15
star
6

hexo-tag-codepen

Hexo tag to embed code snippet from codepen.io
JavaScript
14
star
7

Arduino-Lcd12864

Arduino LCD12864 Driver Library. With Font and Graph Support
C++
9
star
8

react-fa-icon

React.js and FontAwesome integration
JavaScript
9
star
9

hexo-generator-atom-markdown-writer-meta

A Hexo generator that produces meta json files required by the Atom Markdown-Writer It generates posts.json, categories.json and tags.json under the root site.
CoffeeScript
8
star
10

sa-sdk-node

This is the home-brewed version of Node SDK for Sensors Data
JavaScript
6
star
11

hexo-console-clean-asset-folder

Hexo plugin that remove empty asset folders
JavaScript
6
star
12

hexo-console-rename

Hexo console plug-in to rename post file according to its title
JavaScript
6
star
13

Expensimplify

Expensimplify is Expensify + Simplify
Ruby
5
star
14

live-hall

JavaScript
5
star
15

hubot-bearychat

BearyChat Adapter for Hubot
CoffeeScript
5
star
16

singleton.dart

A dart library make singleton in dart easy and elegant again
Dart
5
star
17

ArduinoJsonWriter

A lightweight library to make it easy to generate json document on Arduino board
C++
4
star
18

sa-debug-viewer

JavaScript
4
star
19

werewolves

Werewolves is a web app that work as judge for Werewolves board game.
Java
4
star
20

gulp-tree-concat

A Gulp processor to merge multiple javascript files into one with hierarchy
CoffeeScript
4
star
21

hubot-jianliao

hubot-jianliao is an įŽ€čŠ Jianliao adapter for Hubot
CoffeeScript
4
star
22

vinyl-fs-mock

A fake implementation for vinyl-fs, which is used in gulp. Useful for gulp plugin test.
CoffeeScript
4
star
23

hexo-helper-simple-tagcloud

A simplified and improved tag cloud generator for Hexo.
JavaScript
3
star
24

jekyll-attachments

The attachment plugin for Jekyll and Octopress
Ruby
3
star
25

response_builder

A library helper Flutter App to consume all kind of data source, and provides some production-ready data source.
Dart
3
star
26

ExpressOverNode

JavaScript
3
star
27

text_field_suffix_button

Dart
1
star
28

minesweeper-flutter

Dart
1
star
29

routeMessage

Route method call according to a given path
CoffeeScript
1
star
30

timnew.github.com

My Blog
HTML
1
star
31

CiMonitor

This is a project build CI monitor lamp with Arduino and node.js
JavaScript
1
star
32

mutator

A function to convert plain javascript object(usually deserialized from JSON) into some class instance
CoffeeScript
1
star
33

DartScoreBoard

Java
1
star
34

lonely-planet

Ruby
1
star
35

kids_game

Dart
1
star
36

RemoteImagePicker

Java
1
star
37

elixir-kv

Elixir
1
star
38

PersonFinder2WeChat

JavaScript
1
star
39

teExt

Chrome Extension & Scheduler Server for T&E app
JavaScript
1
star
40

di.js

DI.js is a dependency injection framework for node.js, which is inspired by Scott Shaw's DI framework for Clojure
CoffeeScript
1
star
41

lnav-bunyan

Lnav format declaration for node-bunyan
1
star
42

pixel-blender

Ruby
1
star
43

MetaPaasProvisionDaemon

A windows service that rename the computer according to its ipaddresses
C#
1
star
44

epson_epos_printer

Dart
1
star
45

RemoteImageServer

CoffeeScript
1
star
46

EasyFreeGame

Factorio Mod Scenarios
Lua
1
star
47

zombie_game

A party game that created by David Lee. This is a simulator helps game host to figure out what is actually happend
Ruby
1
star