Created
September 21, 2015 03:38
-
-
Save GOROman/b172663c0072cd1c6293 to your computer and use it in GitHub Desktop.
RubyでTHETA Sへセッションを貼るだけの例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/http' | |
HOST = '192.168.1.1' | |
PORT = 80 | |
Net::HTTP.start(HOST, PORT) do |http| | |
req = Net::HTTP::Post.new '/osc/commands/execute' | |
req.body = <<EOF | |
{ | |
"name": "camera.startSession", | |
"parameters": {} | |
} | |
EOF | |
# POSTする | |
res = http.request req | |
# 結果を見る | |
puts res.body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[実行結果]
$ ruby ThetaStartSession.rb
{"name":"camera.startSession","state":"done","results":{ "sessionId":"SID_0004","timeout":180}}