ç§èå㮓æãªããã®”é¨åå±ãããéã¾ã「ç§èåã©ã¸ãªã¹ãã¢ã¼」ã64å¹´ã®æ´å²ã«å¹ãéã、2013å¹´11æ30æ¥ã§é館ããã¨çºè¡¨ããã¾ãã。「ç§èåã©ã¸ãªã¹ãã¢ã¼」ã¯、ãã®ååã¾ã§ã¯èªèãã¦ããªãã¨ã「JRç§èåé§ ããä¸å¤®éãã«åºããã¨ããã¨è¦ããã、ã¬ã¼ãä¸ã®ãã¡ãã£ã¨ããç´ äººãæã風ã®è·¯å°」ã¨ããã°ãããã¾ãã§ãããã。ãã®ä¸è§ã¯ããã¤ãã®å»ºç©?ã®éåä½ãªã®ã§ãã、ãã®ãã¡ã®ã²ã¨ã¤ã「ç§èåã©ã¸ãªã¹ãã¢ã¼」ã§ã。ç§èåã¯ã©ã¸ãª(é»åé¨å)ã®è¡→é»æ°è£½åã®è¡→PCã®è¡→èãã®è¡、ã¨ãããããªå¤é·ãçµã¦ãã¾ãã、ãã®「é»åé¨åã®è¡」ã®é ããå ¨ããã®æ¯è²ãå¤ãã£ã¦ããªã、ã¶・ç§èåã¨ããé°å²æ°ãæ®ãä¸è§ã¨ãããã§ããã。
ãã®「ç§èåã©ã¸ãªã¹ãã¢ã¼」ãé館ãã!?ã¨èã、æããã®ç§èåã¦ã¼ã¶ã¨ãã¦ã¯ãã¦ããã£ã¦ãããããRICOH THETAãæã£ã¦、ãã®é°å²æ°ãè¨é²ããããã«「åæã¹ããªã¼ããã¥ã¼」ãæ®å½±ãã¦ã¾ããã¾ãã。è¡åçã«、åæã«æ®ã£ã¦ãã¾ãã¾ããããããªãã!
ä¸è¨å°å³ã®é丸ãæ®å½±å°ç¹ã§ã。é ã«å°å³å³å´ãã、ç»åãã¯ãªãã¯ããã¨ããã©ãã«é£ã³ã¾ã
å°å³ä¸ã®ãåºã赤ã示ããã¦ããã¨ããã「ç§èåã©ã¸ãªã¹ãã¢ã¼」ã§ã。éè·¯ãã¯ããã§å対å´ã¯「ã©ã¸ãªã»ã³ã¿ã¼」ã¨ããå¥ã®å»ºç©ã§、ãã¡ãã¯ä»åé館ã®ã¢ãã¦ã³ã¹ã¯ããã¾ãã。ãã®ããã、ã©ã¸ãªã¹ãã¢ã¼ãé館ãããã©ãããæ¯è²ã«ãªããã§ãããã…。
ä»åã®æ®å½±ã¯RICOH THETAãé ä¸ã«ããã、èªä½ã¹ã¯ãªããã§5ç§ã«ä¸åãªã¢ã¼ãã·ã£ãã¿ã¼ã§èªåçã«ã·ã£ãã¿ã¼ãåãç¶ããããã«ã»ããããã®ã¾ã¾éè·¯ãæ©ãã¦æ®å½±ãã¾ãã。éè·¯ã®ç«¯ãã端ã¾ã§1åãããã§ãããã。THETAã®æ©ååã®é«ããæ´»ãããããªã¨æãã¾ã。
åèã¾ã§ã«、THETAã§ãªã¢ã¼ãã·ã£ãã¿ã¼ãåãã¹ã¯ãªãã(Perl)ã以ä¸ã«ç¤ºãã¾ã。Androidã§ã¯SL4A+Perl for Androidã®çµã¿åããã§ç«¯æ«ä¸ã§å®è¡å¯è½ã§ã。æ¬ã¹ã¯ãªããã¯ã·ã£ãã¿ã¼ã1ååãã ãã§ãã、PTP_OC_InitiateCaptureã®é¨åãç¹°ãè¿ããã¨ã§è¤æ°åã·ã£ãã¿ã¼ãç¹°ãè¿ããããã¨ãå¯è½ã§ã。
THETAã¯WiFiçµç±ã§ã¯PTP-IPã§éä¿¡ãã¦ããããã§、å¶å¾¡ã¯ãã¡ãã®ããã¥ã¡ã³ããªã©ãåèã«ãã¾ãã。
※ãã®ã¹ã¯ãªããã¯ãã®å¾ãã¼ã¸ã§ã³ã¢ãããã¦ãã¾ã。詳細ã¯ãã¡ãã®ãã¼ã¸ãããããã ãã
#!/usr/bin/perl # ------------------------------------------------------- # RICOH THETA Remote shutter # ------------------------------------------------------- use IO::Socket; #use Encode; # ----- TARGET THETA my $Addr = "192.168.1.1"; my $Port = 15740; # ----- My profile my $Name = "THETA_Shutter"; my $GUID = "8a7ab04f-ebda-4f33-8649-8bf8c1cdc838"; my ($command_sock, $event_sock, $result, $session_id, $transaction_id); # Init_Command $command_sock = &PTPIP_Open_Connection; &PTPIP_Init_Command_Request($command_sock); ($result, $session_id) = &PTPIP_Wait_Init_Command_Ack($command_sock); if ($result == 0) { die "No Init_Command_Ack"; } # Init_Event $event_sock = &PTPIP_Open_Connection; &PTPIP_Init_Event_Request($event_sock,$session_id); ($result) = &PTPIP_Wait_Event_Request_Ack($event_sock); if ($result == 0) { die "No Init_Event_Ack"; } $transaction_id = 0; # PTP_OC_OpenSession &PTPIP_Cmd_Request($command_sock, $transaction_id++, 0x1002, $session_id ); ($result) = &PTPIP_Wait_Cmd_Response($command_sock); if ($result == 0) { die "No Cmd_Response"; } # PTP_OC_InitiateCapture &PTPIP_Cmd_Request($command_sock, $transaction_id++, 0x100E, 0, 0 ); ($result) = &PTPIP_Wait_Cmd_Response($command_sock); if ($result == 0) { die "No Cmd_Response"; } &PTPIP_Close_Connection($event_sock); &PTPIP_Close_Connection($command_sock); exit; # ------------------------------------------------------- # Init_Command # ------------------------------------------------------- sub PTPIP_Init_Command_Request { my $sock = shift; my $payload = ""; $payload .= pack("H8H4H4H4H12",split('-',$GUID)); # GUID $payload .= Encode_UTF16LE($Name."\x00"); $payload .= pack("V",1); print $sock &PTPIP_pack_command( 1, $payload); } sub PTPIP_Wait_Init_Command_Ack { my $sock = shift; my ($result,$session_id,$target_guid,$target_name,$unknown1); my @error_response = (0,0); my ($cmd,$payload) = &PTPIP_Recv_Response($sock); if ($cmd != 2) { @error_response; exit; } $session_id = unpack("V",$payload); $payload = substr($payload,4); my (@guid) = unpack("H8H4H4H4H12",$payload); $target_guid = join('-',@guid); $payload = substr($payload,16); $target_name = Decode_UTF16LE(substr($payload,0,-4)); $payload = substr($payload,-4); $unknown1 = unpack("V",$payload); print "Target GUID :".$target_guid."\n"; print "Target Name :".$target_name."\n"; (1, $session_id); } # ------------------------------------------------------- # Init_Event # ------------------------------------------------------- sub PTPIP_Init_Event_Request { my $sock = shift; my $session_id = shift; my $payload = ""; $payload .= pack("V",$session_id); print $sock &PTPIP_pack_command( 3, $payload); } sub PTPIP_Wait_Event_Request_Ack { my $sock = shift; my @error_response = (0); my ($cmd,$payload) = &PTPIP_Recv_Response($sock); if ($cmd != 4) { @error_response; exit; } 1; } # ------------------------------------------------------- # Cmd_Request # ------------------------------------------------------- sub PTPIP_Cmd_Request { my $sock = shift; my $transaction_id = shift; my $cmd = shift; my @args = @_; my $payload = ""; $payload .= pack("V",1); $payload .= pack("v",$cmd); $payload .= pack("V",$transaction_id); $payload .= pack("V*",@args); print $sock &PTPIP_pack_command( 6, $payload); } sub PTPIP_Wait_Cmd_Response { my $sock = shift; my @error_response = (0); my ($cmd,$payload) = &PTPIP_Recv_Response($sock); # if ($cmd != 4) { @error_response; exit; } 1; } # ------------------------------------------------------- # PTPIP utils # ------------------------------------------------------- sub PTPIP_Open_Connection { my $sock = new IO::Socket::INET(PeerAddr=>$Addr,PeerPort=>$Port,Proto=>'tcp',TimeOut=>2); die "IO::Socket : $!" unless $sock; $sock; } sub PTPIP_Close_Connection { my $sock = shift; close($sock); } sub PTPIP_pack_command { my $cmd = shift; my $payload = shift; pack("VV",(length($payload)+8),$cmd).$payload; } sub PTPIP_Recv_Response { my $sock = shift; my ($buf,$len,$command_type,$packet_len); my @error_response = (0,''); # packet length $len = read($sock,$buf,4); if ($len != 4) { @error_response; exit; } $packet_len = unpack("V",$buf); if ($packet_len > 1024) { @error_response; exit; } if ($packet_len < 8 ) { @error_response; exit; } # command $len = read($sock,$buf,4); if ($len != 4) { @error_response; exit; } $command_type = unpack("V",$buf); # payload $len = read($sock,$buf,$packet_len-8); if ($len != ($packet_len-8)) { @error_response; exit; } ($command_type,$buf); } sub Encode_UTF16LE { my $str = shift; # encode('UTF16LE', $str); pack("v*",unpack("c*",$str)); } sub Decode_UTF16LE { my $str = shift; # decode('UTF16LE', $str) pack("c*",unpack("v*",$str)); }å½åã®ç®çã ã£ã「ãªã¢ã¼ãã·ã£ãã¿ã¼」ãåãããããããããã¼、ã¨ã³ãã³ãã®ã¬ã¹ãã³ã¹ãã¼ã¹é¨ãéä¸ã§ã»ã£ããããã¦ããã¾ããï½、PTPIP_Wait_Cmd_Response ã®é¨åãããã¡ãã£ã¨ã¡ããã¨ä½ã£ã¦é·ããã¤ãã¼ããåãåããããã«ãªãã¨ããããã¨ã§ããå¶å¾¡ãåºããã¯ã。ãã®ãããã¯ã¾ãå¾æ¥、ã¨ãããã¨ã§。 ãã®「åæã¹ããªã¼ããã¥ã¼」ãä½ãã360度ããã©ãã«ã¡ã©、RICOH THETAã«ã¤ãã¦ã¯ ã«è©³ããã¬ãã¥ã¼ãã¦ããã¾ãã®ã§、ãããããã°ãã¡ããã©ãã。