Giter VIP home page Giter VIP logo

node-iremocon's Introduction

iRemocon client library for Node.js

これは何?

iRemocon を操作する Node.js 用モジュールです。

インストール

$ npm install iremocon

使い方

まず、以下のようにモジュールを読み込みます。

var iRemocon = new require('iRemocon')
  , iremocon = new iRemocon('192.168.0.1') // iRemocon の IP を指定
;

iRemocon のコマンドはひと通り揃えてあります。 各コマンドの詳細については公式サイトの開発者向け情報(http://i-remocon.com/development/)を御覧ください。

// すべてのメソッドにはコールバックを指定することができます
iremocon.au(function(err, msg) {
	if (!err) console.log('DETECTED!');
})

コールバック時のエラーは code, error, detail の3つの情報を保持しています。

// code   : エラーコード(999 は iRemocon で定義されていないエラー)
// error  : エラーの概略
// detail : エラーの詳細
iremocon.ic(1 /* 1〜1500 の ID */, function(err, msg) {
	if (err) {
		console.error(err.code, err.error, err.detail);
		// e.g. 003 受信エラー 不正なリモコンデータを受信した
		return;
	}
	console.log(msg);
	// e.g. ic;ok
});

コールバックは省略することもできます。

iremocon.is(1);

また、ネットワーク内の iRemocon を見つけることもできます。

var iRemocon = new require('iRemocon');

var ips = []
for (var i = 1; i < 255; ++i) {
	ips.push('192.168.0.' + i);
}
iRemocon.search(ips, function(ip) {
	var iremocon = new iRemocon(ip);
	iremocon.is(10);
})

詳細

その他詳細は Twitter:@hecomi へご質問いただくか、http://d.hatena.ne.jp/hecomi/ をご参照下さい。

node-iremocon's People

Contributors

hecomi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.