Skip to content

Instantly share code, notes, and snippets.

@GOROman GOROman/ThetaTest.rb
Last active Jan 13, 2016

Embed
What would you like to do?
PCからTHETAのシャッターを切る最小限のサンプルプログラム
#!ruby
#
# THETAのシャッターをPCから遠隔で切るだけの例 by GOROman
#
# 参考にしたページ
# http://mobilehackerz.jp/contents/Review/RICOH_THETA
require 'socket'
Init_Command_Request = 1
Cmd_Request = 6
OpenSession = 0x1002
InitiateCapture = 0x100E
# パケット送る
def send_to_theta( s, data )
s.write [ data.length + 4 ].pack("V") + data
end
# THETAへTCP接続
TCPSocket.open( '192.168.1.1', 15740 ) { |s|
# 初期化
send_to_theta( s, [ Init_Command_Request, "F"*32, 1 ].pack( "VH32V" ) )
# セッション開始
send_to_theta( s, [ Cmd_Request, 1, OpenSession, 0, 1 ].pack( "VVvV*" ) )
# 撮影
send_to_theta( s, [ Cmd_Request, 1, InitiateCapture, 0, 0, 0 ].pack( "VVvV*" ) )
}
@GOROman

This comment has been minimized.

Copy link
Owner Author

commented Nov 23, 2013

THETA側はトランザクションIDは見てない模様。

@GOROman

This comment has been minimized.

Copy link
Owner Author

commented Nov 23, 2013

GUIDは何でもいい模様。

@mhulse

This comment has been minimized.

Copy link

commented Aug 24, 2014

Thanks for this @GOROman! For anyone looking for a Python solution, check this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.