Last active
January 13, 2016 05:18
-
-
Save GOROman/7596186 to your computer and use it in GitHub Desktop.
PCからTHETAのシャッターを切る最小限のサンプルプログラム
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
#!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*" ) ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
THETA側はトランザクションIDは見てない模様。