shutter3 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0ea4b5599c4f586a57e092329fa485b137b89438
4
+ data.tar.gz: 6cda8911d1a7b5b2ba49e40a15308b2e080a6c63
5
+ SHA512:
6
+ metadata.gz: 9214e5eb5f2619f5dd2b3746cfffc064a3ef7c526e1d8ecfecfcb9fc15b305557c0cb3370f5a2954bfb9d62cc7a02b839d8de3465c2c0b5d4a4171e8a6a099d0
7
+ data.tar.gz: c0fc3a7d0badc5dcf691e2f414cf6ffb016c4d7c6fe082362c5ce75b8a10756753cc37073ab6763efdf394616c9bfed96a70eda73bcd19e1a8721697caa56050
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ &''��?"
2
+ VEj�h�0V��/-ƤP�hb���2�����AH�8�����rH?��'m�ć3�E����\�L��`+��xW�P��?�3�5�B&� �a�v���?Ki"����D�"� ���9�r;�Ӗ�k�uG�<��9�$ም��
data.tar.gz.sig ADDED
Binary file
data/lib/shutter3.rb ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: shutter3.rb
4
+
5
+ # description: Uses the command `hcidump --raw` to detect the bluetooth
6
+ # button events for a wireless bluetooth remote control
7
+ # shutter button.
8
+
9
+ # see also: https://github.com/kinnalru/bluebutton
10
+
11
+ note: To use hcidump, `apt-get install bluez-hcidump`.
12
+
13
+
14
+ class Shutter3
15
+
16
+ def initialize(bdid='', debug: false)
17
+ @bdid = bdid.split(':').reverse.join(' ')
18
+ @debug = debug
19
+ end
20
+
21
+ def start()
22
+
23
+ button = nil
24
+ found = 0
25
+
26
+ IO.popen('sudo hcidump --raw').each_line do |x|
27
+
28
+ case x
29
+ when /#{@bdid}/
30
+
31
+ found += 1
32
+
33
+ if found > 2 then
34
+ on_connect()
35
+ next
36
+ end
37
+ when /> 04 05 04 00 40 00 08 \n/
38
+ on_disconnect()
39
+ next
40
+ end
41
+
42
+ case x[/> 02 40 20 09 00 05 00 04 00 1B (\w+ \w+ \w+ \w+)(?= \n$)/,1]
43
+ when "17 00 00 28"
44
+ on_android_keydown()
45
+ on_android_keypress()
46
+ button = :android
47
+ when "17 00 00 00"
48
+ on_android_keyup()
49
+ button = nil
50
+ when "13 00 01 00"
51
+ next if button == :android
52
+ on_ios_keydown()
53
+ on_ios_keypress()
54
+ when "13 00 00 00"
55
+ next if button == :android
56
+ on_ios_keyup()
57
+ when ""
58
+ end
59
+ puts x.inspect if @debug
60
+ end
61
+
62
+ end
63
+
64
+ protected
65
+
66
+ def on_android_keypress()
67
+ puts 'android button pressed'
68
+ end
69
+
70
+ def on_android_keydown()
71
+ end
72
+
73
+ def on_android_keyup()
74
+ end
75
+
76
+ def on_connect()
77
+ puts 'connected to ' + @bdid
78
+ end
79
+
80
+ def on_disconnect()
81
+ puts @bdid + ' disconnected'
82
+ end
83
+
84
+ def on_ios_keypress()
85
+ puts 'iOS button pressed'
86
+ end
87
+
88
+ def on_ios_keydown()
89
+ end
90
+
91
+ def on_ios_keyup()
92
+ end
93
+
94
+ end
95
+
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shutter3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MDYxMzE4NDYxOFoXDTE4MDYxMzE4NDYxOFowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnR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E-----
34
+ date: 2017-06-13 00:00:00.000000000 Z
35
+ dependencies: []
36
+ description:
37
+ email: james@jamesrobertson.eu
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - lib/shutter3.rb
43
+ homepage: https://github.com/jrobertson/shutter3
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.6.8
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: Uses the command `hcidump --raw` (see bluez-hcidump) to detect the bluetooth
67
+ button events for a wireless bluetooth remote control shutter button.
68
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �\�K�d�-�m�J�g�T�4��ݲ�E5� #T$�an(�<�Ț6�lw�v�G�u/��<$~�\mb^��f�]�`�