siriproxy-samsungremote 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,10 @@
1
1
  = SiriProxy-SamsungRemote
2
2
 
3
- Description goes here.
3
+ Okay so this is a mushup of two projects. First the SiriProxy and plugins. Full credit to plamoni (Pete) [https://github.com/plamoni].
4
+ When I found this the other night I though how great it would be to use it for my TV remote so I went in search of details on the iPhone app that Samsung released.
5
+ I found that it's been decoded and a Perl script published at [http://forum.samygo.tv/viewtopic.php?f=12&t=1792] by pjnewman. Also fantastic work, full credit goes to him.
6
+
7
+ So I decided to re-write it in Ruby and use it as a plugin to SiriProxy. So here it is... well here it comes!
4
8
 
5
9
  == Contributing to SiriProxy-SamsungRemote
6
10
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "siriproxy-samsungremote"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve Kingsley"]
12
- s.date = "2011-12-06"
12
+ s.date = "2011-12-07"
13
13
  s.description = "Bringing together the work of plamoni on the SiriProxy and pjnewman's iPhone Protocol Decoded (SamyGo forum), this plugin is intended to allow the use of Siri to control my Samsung LE40C650 and hopefully other Samsung smart TV's"
14
14
  s.email = "steve@codebed.com"
15
15
  s.extra_rdoc_files = [
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "SiriProxy-SamsungRemote.gemspec",
27
27
  "VERSION",
28
- "lib/SiriProxy-SamsungRemote.rb",
28
+ "lib/siriproxy-samsungremote.rb",
29
29
  "test/helper.rb",
30
30
  "test/test_SiriProxy-SamsungRemote.rb"
31
31
  ]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -0,0 +1,80 @@
1
+ require 'socket'
2
+ require 'base64'
3
+
4
+ class SiriProxy::Plugin::SamsungRemote < SiriProxy::Plugin
5
+ attr_accessor :tvip, :myip, :mymac, :port
6
+
7
+ @@appstring = "iphone..iapp.samsung" #W hat the iPhone app reports
8
+ @@tvappstring = "iphone.LE40C650.iapp.samsung" # Might need changing to match your TV type
9
+ @@remotename = "Ruby Samsung Remote" # What gets reported when it asks for permission/also shows in General->Wireless Remote Control menu
10
+
11
+
12
+ def initialize(config = {})
13
+
14
+ self.tvip = config["tvip"]
15
+ self.myip = config["myip"]
16
+ self.mymac = config["mymac"]
17
+ self.port = '55000'
18
+ end
19
+
20
+
21
+ listen_for(/test remote control/i) do
22
+ say "Remote control responding"
23
+ request_completed #always complete your request! Otherwise the phone will "spin" at the user!
24
+ end
25
+
26
+ listen_for(/test settings/i) do
27
+ say "Television IP address is #{self.tvip}"
28
+ say "My IP address is #{self.myip}"
29
+ say "My MAC address is #{self.mymac}"
30
+ say "The port is #{self.port}"
31
+
32
+ request_completed #always complete your request! Otherwise the phone will "spin" at the user!
33
+
34
+ end
35
+
36
+ listen_for(/test command/i) do
37
+ say "About to test"
38
+ send_command "MUTE"
39
+ say "Command sent"
40
+ request_completed #always complete your request! Otherwise the phone will "spin" at the user!
41
+
42
+ end
43
+
44
+ def send_command(command)
45
+ s = TCPSocket.open(self.tvip, self.port)
46
+
47
+ ipencoded = Base64.encode64(self.myip)
48
+ macencoded = Base64.encode64(self.mymac)
49
+ puts ipencoded
50
+ puts macencoded
51
+
52
+ messagepart1 = 0x64.chr + 0x00.chr + ipencoded.length.chr + 0x00.chr + ipencoded + macencoded.length.chr + 0x00.chr + macencoded + Base64.encode64(@@remotename).length.chr + 0x00.chr + Base64.encode64(@@remotename)
53
+ puts messagepart1
54
+ part1 = 0x00.chr + @@appstring.length.chr + 0x00.chr + @@appstring + messagepart1.length.chr + 0x00.chr + messagepart1
55
+ puts part1
56
+ s.send(part1, part1.length)
57
+
58
+ messagepart2 = 0xc8.chr + 0x00.chr
59
+ puts messagepart2
60
+ part2 = 0x00.chr + @@appstring.length.chr + 0x00.chr + @@appstring + messagepart2.length.chr + 0x00.chr + messagepart2
61
+ puts part2
62
+
63
+ s.send(part2, part2.length)
64
+
65
+ #Send remote key
66
+ # key = "KEY_" + command;
67
+ # puts key
68
+ # say "Sending #{command}"
69
+ # messagepart3 = 00.chr + 00.chr + 00.chr + Base64.encode64(key).length.chr + 00.chr + Base64.encode64(key)
70
+ # part3 = 00.chr + @@tvappstring.length.chr + 00.chr + @@tvappstring + messagepart3.length.chr + 00.chr + messagepart3
71
+ # s.puts(part3, part3.length)
72
+ # puts part3
73
+
74
+
75
+ # s.close # Close the socket when done
76
+ end
77
+
78
+
79
+
80
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: siriproxy-samsungremote
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Steve Kingsley
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-12-06 00:00:00 Z
13
+ date: 2011-12-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: shoulda
@@ -74,7 +74,7 @@ files:
74
74
  - Rakefile
75
75
  - SiriProxy-SamsungRemote.gemspec
76
76
  - VERSION
77
- - lib/SiriProxy-SamsungRemote.rb
77
+ - lib/siriproxy-samsungremote.rb
78
78
  - test/helper.rb
79
79
  - test/test_SiriProxy-SamsungRemote.rb
80
80
  homepage: http://github.com/slarti42uk/SiriProxy-SamsungRemote
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
- hash: 2246832756429950389
93
+ hash: -4369213998295026125
94
94
  segments:
95
95
  - 0
96
96
  version: "0"
@@ -1,24 +0,0 @@
1
- require 'socket'
2
- require 'base64'
3
-
4
- class SiriProxy::Plugin::SamsungRemote < SiriProxy::Plugin
5
- attr_accessor :host
6
-
7
- @tvip = "192.168.1.109"; # IP Address of TV
8
- @myip = "192.168.1.123"; # Doesn't seem to be really used
9
- @mymac = "00-0c-29-3e-b1-4f"; # Used for the access control/validation, but not after that AFAIK
10
- @appstring = "iphone..iapp.samsung"; #W hat the iPhone app reports
11
- @tvappstring = "iphone.LE40C650.iapp.samsung"; # Might need changing to match your TV type
12
- @remotename = "Ruby Samsung Remote"; # What gets reported when it asks for permission/also shows in General->Wireless Remote Control menu
13
-
14
-
15
- def initialize(config = {})
16
- self.host = config["host"]
17
- end
18
-
19
-
20
- listen_for(/test remote control/i) do
21
- say "Remote control responding"
22
- end
23
-
24
- end