Skip to content

Instantly share code, notes, and snippets.

@GOROman
Created September 21, 2015 03:38
Show Gist options
  • Save GOROman/b172663c0072cd1c6293 to your computer and use it in GitHub Desktop.
Save GOROman/b172663c0072cd1c6293 to your computer and use it in GitHub Desktop.
RubyでTHETA Sへセッションを貼るだけの例
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
@GOROman
Copy link
Author

GOROman commented Sep 21, 2015

[実行結果]

$ ruby ThetaStartSession.rb
{"name":"camera.startSession","state":"done","results":{ "sessionId":"SID_0004","timeout":180}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment