sony_camera_remote_api 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ba7d1e1b188a89b32ac00f09022e38ee5d3dbcf
4
+ data.tar.gz: 4112984f354c1a976bf2854c53a61f628cb24bd4
5
+ SHA512:
6
+ metadata.gz: 69d588186eef16daba33ce7c752c2cd9ec6a6e2ca1e720072c1468e3982262d811483c6f58392172ac4e16f192ac28ca431ab3c8606078ef33259f225afafcd2
7
+ data.tar.gz: 6c1368088275f231ca69f159ca888b627f259f4b275067a537edd70d640bc9a1265cc4285b26ed6151a0fe471ef720b46e2f58508d7f946b93e50b0e8c24f097
data/.gitignore ADDED
@@ -0,0 +1,55 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
51
+
52
+ /.idea/
53
+ .byebug_history
54
+ example_status.txt
55
+ test.rb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.simplecov ADDED
@@ -0,0 +1,16 @@
1
+ if !ENV['COVERAGE'].nil?
2
+ SimpleCov.start do
3
+ add_filter '/spec'
4
+ # Merge all tests run in 1.5 hours
5
+ use_merging true
6
+ merge_timeout 5400
7
+ command_name "cmd_#{Time.now}"
8
+ puts 'SimpleCov started!!!'
9
+ # minimum_coverage(91.69)
10
+ end
11
+
12
+ # For forked process
13
+ SimpleCov.at_exit do
14
+ SimpleCov.result.format!
15
+ end
16
+ end
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.4
5
+ before_install: gem install bundler -v 1.13.0
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at kota65535@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sony_camera_remote_api.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sony_camera_remote_api (0.1.0)
5
+ activesupport
6
+ bindata
7
+ frisky
8
+ highline
9
+ httpclient
10
+ nokogiri
11
+ thor
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ activesupport (5.0.0.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (~> 0.7)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ bindata (2.3.3)
22
+ concurrent-ruby (1.0.2)
23
+ diff-lcs (1.2.5)
24
+ docile (1.1.5)
25
+ em-synchrony (1.0.5)
26
+ eventmachine (>= 1.0.0.beta.1)
27
+ eventmachine (1.2.0.1)
28
+ frisky (0.1.2)
29
+ em-synchrony
30
+ eventmachine (>= 1.0.0)
31
+ log_switch (~> 1.0.0)
32
+ highline (1.7.8)
33
+ httpclient (2.8.2.4)
34
+ i18n (0.7.0)
35
+ json (2.0.2)
36
+ log_switch (1.0.0)
37
+ mini_portile2 (2.1.0)
38
+ minitest (5.9.0)
39
+ nokogiri (1.6.8)
40
+ mini_portile2 (~> 2.1.0)
41
+ pkg-config (~> 1.1.7)
42
+ pkg-config (1.1.7)
43
+ rake (10.5.0)
44
+ rspec (3.5.0)
45
+ rspec-core (~> 3.5.0)
46
+ rspec-expectations (~> 3.5.0)
47
+ rspec-mocks (~> 3.5.0)
48
+ rspec-core (3.5.3)
49
+ rspec-support (~> 3.5.0)
50
+ rspec-expectations (3.5.0)
51
+ diff-lcs (>= 1.2.0, < 2.0)
52
+ rspec-support (~> 3.5.0)
53
+ rspec-mocks (3.5.0)
54
+ diff-lcs (>= 1.2.0, < 2.0)
55
+ rspec-support (~> 3.5.0)
56
+ rspec-support (3.5.0)
57
+ simplecov (0.12.0)
58
+ docile (~> 1.1.0)
59
+ json (>= 1.8, < 3)
60
+ simplecov-html (~> 0.10.0)
61
+ simplecov-html (0.10.0)
62
+ thor (0.19.1)
63
+ thread_safe (0.3.5)
64
+ tzinfo (1.2.2)
65
+ thread_safe (~> 0.1)
66
+
67
+ PLATFORMS
68
+ ruby
69
+
70
+ DEPENDENCIES
71
+ bundler (~> 1.11)
72
+ rake (~> 10.0)
73
+ rspec (~> 3.5)
74
+ simplecov
75
+ sony_camera_remote_api!
76
+
77
+ BUNDLED WITH
78
+ 1.13.0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016 Tomohiko Ozawa
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # Sony Remote Camera API Wrapper
2
+
3
+ A Ruby Gem that facilitates the use of Sony Remote Camera API.
4
+
5
+ - [Backgrounds](#backgrounds)
6
+ - [Features](#features)
7
+ - [Supported version](#supported-version)
8
+ - [Installation](#installation)
9
+ - [Usage](#usage)
10
+ - [Development](#development)
11
+ - [Contributing](#contributing)
12
+ - [License](#license)
13
+
14
+
15
+ ## Backgrounds
16
+
17
+ [Sony Camera Remote API](https://developer.sony.com/develop/cameras/) allows us to control a number of Sony cameras, including Sony Action cams, Sony Alpha cameras and Lens Style cameras, wirelessly from another device.
18
+ These APIs are quite low-level, so that we have to implement a lot of sequences while considering many pitfalls, which are less documented in their API reference.
19
+ The aim of this gem is providing wrapper methods that make it easy to use Sony camera functions for higher-level applications.
20
+
21
+
22
+ ## Features
23
+
24
+ * Streaming live-view images by one method
25
+ * Simplified contents transfer
26
+ * Consistent interface for changing parameters safely
27
+ * Auto reconnection
28
+ * Also supports the low-level APIs call
29
+ * Client application bundled
30
+
31
+
32
+ ## Supported version
33
+
34
+ Ruby 2.0 or higher
35
+
36
+ ## Installation
37
+
38
+ Add this line to your application's Gemfile:
39
+
40
+ ```ruby
41
+ gem 'sony_camera_remote_api'
42
+ ```
43
+
44
+ And then execute:
45
+
46
+ $ bundle
47
+
48
+ Or install it yourself as:
49
+
50
+ $ gem install sony_camera_remote_api
51
+
52
+
53
+ ## Usage
54
+
55
+ 1. Connect to the camera by Direct Wi-Fi
56
+ 2. Create SonyCameraRemoteAPI::Camera object. It takes a little time because of SSDP search.
57
+ 3. Now you can call not only wrapper methods but also original APIs as a method!
58
+
59
+ If you are using Linux, you can use bundled scripts and its interface method.
60
+ and then If you want to take a picture and save it:
61
+
62
+ ```ruby
63
+ require 'sony_camera_remote_api'
64
+ require 'sony_camera_remote_api/scripts'
65
+
66
+ interface = "wlan0"
67
+ ssid = "DIRECT-xxxx:ILCE-QX1"
68
+ pass = "xxxxxxxx"
69
+
70
+ SonyCameraRemoteAPI::Scripts.connect interface, ssid, pass
71
+ cam = SonyCameraRemoteAPI::Camera.new
72
+ cam.change_function_to_shoot 'still', 'Single'
73
+ cam.capture_still
74
+ # => Captured jpeg file is transferred to your PC
75
+ ```
76
+
77
+ For more information, see [Wiki](https://github.com/kota65535/sony_camera_remote_api/wiki).
78
+
79
+
80
+ ## TODO
81
+
82
+ * Remote playback function
83
+
84
+
85
+ ## Development
86
+
87
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
88
+
89
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
90
+
91
+
92
+ ## Contributing
93
+
94
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kota65535/sony_camera_remote_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
95
+
96
+
97
+ ## License
98
+
99
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,145 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ # The available camera models for shooting test
5
+ # model_tags = [:HDR_AZ1, :FDR_X1000V, :DSC_RX100M4, :ILCE_QX1]
6
+ model_tags = [:DSC_RX100M4, :ILCE_QX1, :FDR_X1000V]
7
+
8
+ # The available camera models for contents test
9
+ model_tags_contents = [:HDR_AZ1]
10
+
11
+ # The available camera models for contents test
12
+ model_tag_reconnection = :HDR_AZ1
13
+
14
+ # The available camera model for contents preparing
15
+ model_tag_prepare = :HDR_AZ1
16
+
17
+
18
+ def define_model_tasks(model_tags, *namespaces)
19
+ namespaces.map! { |n| n.to_s }
20
+ sub_pattern = namespaces.join '/'
21
+ sub_task_name = namespaces.join ':'
22
+ model_tags.each do |m|
23
+ desc "Run #{sub_task_name} test by model '#{m}'"
24
+ RSpec::Core::RakeTask.new(m) do |t|
25
+ t.pattern = "spec/#{sub_pattern}/*_spec.rb"
26
+ t.rspec_opts = "--tag #{m.to_s}"
27
+ end
28
+ RSpec::Core::RakeTask.new("#{m}-of") do |t|
29
+ t.pattern = "spec/#{sub_pattern}/*_spec.rb"
30
+ t.rspec_opts = "--tag #{m.to_s} --only-failures"
31
+ end
32
+ end
33
+ desc "Run #{sub_task_name} test by all models, retrying until all examples passes."
34
+ task :all do
35
+ model_tags.each do |m|
36
+ unless system "rake #{sub_task_name}:#{m}"
37
+ while !system "rake #{sub_task_name}:#{m}-of"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+
45
+ #--------------------Rake Tasks--------------------
46
+
47
+ # rake
48
+ task :default => :all
49
+
50
+
51
+ # rake all
52
+ task :all do
53
+ ENV['COVERAGE'] = 'true'
54
+ %w(shooting group contents reconnection other).each do |t|
55
+ Rake::Task[t].invoke
56
+ end
57
+ end
58
+
59
+
60
+ # rake all_but_group
61
+ task :all_but_group do
62
+ ENV['COVERAGE'] = 'true'
63
+ %w(shooting contents reconnection other).each do |t|
64
+ Rake::Task[t].invoke
65
+ end
66
+ end
67
+
68
+
69
+ # rake shooting
70
+ # rake shooting:lib
71
+ # rake shooting:client
72
+ # rake shooting:lib:<model>
73
+ # rake shooting:client:<model>
74
+ desc "Same as 'rake shooting:all'"
75
+ task :shooting => ['shooting:all']
76
+ namespace :shooting do
77
+ namespace :lib do
78
+ define_model_tasks model_tags, :shooting, :lib
79
+ end
80
+ namespace :client do
81
+ define_model_tasks model_tags, :shooting, :client
82
+ end
83
+ desc "Same as 'rake shooting:lib:all'"
84
+ task :lib => ['lib:all']
85
+ desc "Same as 'rake shooting:client:all'"
86
+ task :client => ['client:all']
87
+ desc "Run shooting test of lib/client for all models"
88
+ task :all => %w(lib client)
89
+ end
90
+
91
+
92
+ desc "Same as 'rake group:all'"
93
+ task :group => ['group:all']
94
+ namespace :group do
95
+ define_model_tasks model_tags, :group
96
+ end
97
+
98
+
99
+ # rake contents
100
+ # rake contents:lib
101
+ # rake contents:client
102
+ # rake contents:lib:<model>
103
+ # rake contents:client:<model>
104
+ # rake contents:prepare
105
+ desc "Same as 'rake contents:all'"
106
+ task :contents => ['contents:all']
107
+ namespace :contents do
108
+ namespace :lib do
109
+ define_model_tasks model_tags_contents, :contents, :lib
110
+ end
111
+ namespace :client do
112
+ define_model_tasks model_tags_contents, :contents, :client
113
+ end
114
+
115
+ desc "Same as 'rake contents:lib:all'"
116
+ task :lib => ['lib:all']
117
+ desc "Same as 'rake contents:client:all'"
118
+ task :client => ['client:all']
119
+ desc "Run contents test of lib/client for all camera models"
120
+ task :all => %w(lib client) do
121
+ puts 'About to run CONTENTS TEST! Please insert contents-prepared SD.'
122
+ end
123
+
124
+ # rake contents:prepare
125
+ desc "Prepare contents for contents test"
126
+ RSpec::Core::RakeTask.new(:prepare) do |t|
127
+ t.pattern = 'spec/contents/prepare_contents.rb'
128
+ t.rspec_opts = "--tag #{model_tag_prepare}"
129
+ end
130
+ end
131
+
132
+
133
+ # rake reconnection
134
+ desc "Run reconnection test for lib/client"
135
+ RSpec::Core::RakeTask.new(:reconnection) do |t|
136
+ t.pattern = 'spec/reconnection/**/*_spec.rb'
137
+ t.rspec_opts = "--tag #{model_tag_reconnection}"
138
+ end
139
+
140
+
141
+ # rake other
142
+ desc "Run other test for lib/client"
143
+ RSpec::Core::RakeTask.new(:other) do |t|
144
+ t.pattern = 'spec/other/**/*_spec.rb'
145
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sony_camera_remote_api"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/sonycam ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
4
+ require 'sony_camera_remote_api/client/main'
5
+
6
+ SonyCameraRemoteAPI::Client::Main.start
@@ -0,0 +1,15 @@
1
+ class Hash
2
+ # Get result element of API response.
3
+ def result
4
+ self['result']
5
+ end
6
+ # Get id element of API response.
7
+ def id
8
+ self['id']
9
+ end
10
+ # Get error element of API response.
11
+ def error
12
+ self['error']
13
+ end
14
+ end
15
+