Top > 日記 > 2011-11-14

11月は何も書いてなかったのに気づいた。 (^_-
何もやってなかったわけではなく、D-STAR関係で公開できないものを含んでいたので書いてなかったところもあり。

Announce Bot

現在、ID-91+DVAPにてリフレクターREF047に接続していることが多い。そのREF047上にIn/Outしてくる局をリスト表示だけでなく、接続している局に(正確には、接続しているmodule[A/B/C]のうちの1つmodule上の局へ)音声でコールサインを知らせる機能をもたせてみた。

  1. 方法
    ID-91をコントロールしているソフトRS-91が起動している同PC上にEcholinkも起動させているが、このEcholinkの音声発生機能をAPI経由で利用し、REF047上に流す。
    【音声の流れ】 Echolink(PC audio_Out) → ID-91(Mic_In) → DVAR HotSpot → REF047
           このままだと、コールサイン発生音量がQSO音声より若干大きいため、案内をするときだけ、マスタVolを下げるようにした。
  2. 用途
    モービル移動中だったり、ナガラワッチをしている局へコールサインと接続/切断をお知らせするもの。
  3. scan.vbs
    Dim fso1, fso2, reader1, reader2, src1, src2, sw, sa, dCall1, dCall2
    set Echo1 = WScript.CreateObject("EchoLink.EchoLinkSession","Echo_")
    set ws = CreateObject("WScript.Shell")
    ws.Run "c:\appli\uwsc\uwsc.exe c:\appli\uwsc\alt_u.uws"  ← PCマスタVol アップ(別ソフトVic-3を常駐使用し、
                                   マスタVolのアップ・ダウンをさせている)
    sw=0
    sa=0
    Do while sw=0
    If sa=0 Then
    ws.Run "c:\appli\uwsc\uwsc.exe c:\appli\uwsc\alt_u.uws"
    end if
    If sa=1 Then
    wscript.sleep 1000
    sa=0
    else wscript.sleep 8000
    end if
    
    ws.Run "c:\Echolink\wget.exe -O null http://192.168.xxx.yyy/h2t.php", vbhide ← phpをバックグラウンドで
                                             アクセスする(DOS版Wget.exe使用)
    wscript.sleep 2000
    Set fso1 = CreateObject("Scripting.FileSystemObject")
    Set reader1 = fso1.OpenTextFile("u:\conn.txt", 1)
    Set src1 = fso1.GetFile("u:\conn.txt")
    
    If fso1.FileExists("u:\conn.txt") Then
      if src1.Size <> 0 Then
    	sa=1
    	ws.Run "c:\appli\uwsc\alt_d.uws"  ← PCマスタVol ダウン
    	dCall1 = reader1.ReadLine
    	Echo1.SayString "  " & dCall1
    	WScript.Echo Time() & " " & dCall1 & "In"
    	ws.Run "c:\appli\uwsc\alt_d.uws"
    	wscript.sleep 500
    	Echo1.SayPhrase 4
    	wscript.sleep 1500
      end if
    end if
    reader1.Close()
    
    Set fso2 = CreateObject("Scripting.FileSystemObject")
    Set reader2 = fso2.OpenTextFile("u:\discon.txt", 1)
    Set src2 = fso2.GetFile("u:\discon.txt")
    
    If fso2.FileExists("u:\discon.txt") Then
      if src2.Size <> 0 Then
    	sa=1
    	ws.Run "c:\appli\uwsc\alt_d.uws"
        dCall2 = reader2.ReadLine
    	Echo1.SayString "  " & dCall2
    	WScript.Echo Time() & " " & dCall2 & "Out"
    	ws.Run "c:\appli\uwsc\alt_d.uws"
    	wscript.sleep 500
    	Echo1.SayPhrase 11
    	wscript.sleep 1500
      end if
    end if
    reader2.Close()
    loop
    Wscript.Quit
    --------------
    (注1) u:\conn.txt → 下記サーバの/home/share/conn.txt を指す
  4. h2t.php
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=x-sjis">
    <title>REF047_IN/OUT STATUS</title>
    </head>
    <body>
    
    <?php
    $tmp_f = "/home/share/call_o.txt";
    $con_f = "/home/share/conn.txt";
    $discon_f = "/home/share/discon.txt";
    $str_n = "";
    $call_t = "";
    
    if (file_exists($tmp_f)){
      $call_t = file($tmp_f);
      unlink($tmp_f);
    }
    
    $source_file = "http://ref047.dstargateway.org/";
    $fp_in  = fopen($source_file, "r");
    $i = 0;
    $j = 0;
    $k = 0;
    
    while (! feof($fp_in)) {
      $str[$i] = trim(fgetss($fp_in, 1000));
      if (strrpos($str[$i],"ype") == 1) {
        $j = $i;
      }
      if (strrpos($str[$i],"ast Heard") == 1) {
        $k = $i;
      }
      $i++;
    }
    fclose($fp_in);
    array_shift ($str);
    $j = $j + 2;
    $k = $k - 7;
    for($i = $j; $i < $k; $i++){
        $str_a = substr($str[$i],0,6) . ",";
        $str_n = $str_n . $str_a;
        $i = $i + 5;
    }
     
    $fno = fopen($tmp_f, "w");// call_o.txt
    fwrite($fno, $str_n);
    fclose($fno);
    
    $call = split(",",$str_n);// to array $call
    sort($call);
    
    $call_o = split(",",$call_t[0]);
    sort($call_o);
    $fo_con = fopen($con_f, "w");
    $diff1 = array_diff($call, $call_o);
    while(list($key,$val) = each($diff1)) {
      if(strlen($val) > 0){
        print $val . " Connected<br>";
        fwrite($fo_con, $val." ");
      }
    }
    print "<BR>";
    fclose($fo_con);
    
    $fo_discon = fopen($discon_f, "w");
    $diff2 = array_diff($call_o, $call);
    while(list($key,$val) = each($diff2)) {
      if(strlen($val) > 0){
        print $val . " disconnected<br>";
        fwrite($fo_discon, $val." ");
      }
    }
    print "<BR>";
    fclose($fo_discon);
    ?>

    URL B I U SIZE Black Maroon Green Olive Navy Purple Teal Gray Silver Red Lime Yellow Blue Fuchsia Aqua White


リロード   新規 下位ページ作成 凍結解除 差分 コピー 名前変更   ホーム 一覧 検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS
Last-modified: Wed, 11 Jan 2012 23:10:05 JST (4488d)