UNPKG

homebridge-globalcache-gc100

Version:
75 lines (59 loc) 4.88 kB
// Sample Marantz SR8001 IR Commands: var stereo_on = 'sendir,4:1,1,37000,4,1,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,2731,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,1200'; var stereo_off = 'sendir,4:1,2,37000,4,1,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,64,64,2731,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,64,64,1200'; // Sample Apple TV 2.0 Commands var atv_menu = 'sendir,4:2,5,39000,1,1,348,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,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,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1560,347,87,21,3702,347,87,21,3702,347,87,21,3702,347,87,21,3846'; var atv_play_pause = 'sendir,4:2,6,39000,1,1,348,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,65,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1393,347,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,65,21,22,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1558,347,87,21,3702,347,87,21,3702,347,87,21,3846'; var atv_enter = 'sendir,4:2,8,39000,1,1,348,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,22,21,22,21,65,21,65,21,65,21,22,21,65,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1480,347,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,65,21,22,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1559,347,87,21,3703,347,87,21,3702,347,87,21,3846'; var atv_right = 'sendir,4:2,9,39000,1,1,348,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,22,21,65,21,65,21,22,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1559,347,87,21,3701,347,87,21,3702,347,87,21,3701,347,87,21,3846'; var atv_left = 'sendir,4:2,10,39000,1,1,348,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,65,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1558,347,87,21,3701,347,87,21,3701,347,87,21,3701,347,87,21,3846'; var atv_up = 'sendir,4:2,12,39000,1,1,348,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,22,21,65,21,22,21,65,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1559,347,87,21,3701,347,87,21,3701,347,87,21,3701,347,87,21,3846'; var atv_down = 'sendir,4:2,14,39000,1,1,348,173,21,22,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,65,21,22,21,22,21,22,21,22,21,65,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,22,21,65,21,23,21,1560,347,87,21,3702,347,87,21,3702,347,87,21,3702,347,87,21,3846'; var command = atv_menu; // Sample Panasonic TH-42PWD8UK RS232 commands // tv_on = 'PON'; // tv_off = 'POF'; // $rs232_in = pack("H*" ,'02'.bin2hex($rs232_in).'03'); var net = require('net'); var HOST = '10.0.1.155'; var IR_PORT = 4998; var RS232_PORT = 4999; var client = new net.Socket(); /* // Marantz Stereo ON IR command: var command = 'sendir,4:1,1,37000,4,1,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,2731,32,32,32,32,32,32,64,32,32,32,32,32,32,161,32,32,32,64,32,32,64,32,32,32,32,32,32,32,32,32,32,32,32,64,32,1200'; client.connect(IR_PORT, HOST, function(){ console.log('CONNECTED TO: ' + HOST + ':' + IR_PORT); // Send the IR command to the GC100 client.write(command+"\r"); }).on('data', function(data) { // log the response from the GC100 console.log('DATA: ' + data); // Close the connection client.destroy(); }); */ var PON_MSG = new Buffer('\x02PON\x03', 'binary'); var POF_MSG = new Buffer('\x02POF\x03', 'binary'); var client = new net.Socket(); client.connect('4999','10.0.1.155', function() { console.log('CONNECTED'); // Replace `PON_MSG` with `POF_MSG` to do POF instead client.write(PON_MSG); }).on('data', function(data) { console.log('DATA: %j', data); // Close the connection client.destroy(); }); // var socket = net.createConnection(PORT, HOST); // console.log('Socket '+PORT+':'+HOST+' created.'); // socket.on('data', function(data) { // // Log the response from the server. // console.log('RESPONSE: ' + data); // client.destroy(); // }).on('connect', function() { // // Manually write an HTTP request. // socket.write(command+"\r"); // }).on('close', function(){ // console.log('DONE'); // });