Aterm WD701CVのuPnPにアクセスする
ATERMの情報をなるべく簡単に記録する方法を探していたら、uPnPで情報が取れるらしいとのこと。
ルートデバイス
http://web.setup:2869/upnp/rootdevice.xml
PPPコネクション
http://web.setup:2869/upnp/WANPPPConn1.xml
インターフェースコンフィグ
http://web.setup:2869/upnp/WANCommonIFC1.xml
uPnP経由で取得できる情報
- PPPコネクション:WANIP、最大ビットレート(上り、下り)、接続ステータス、他
- インターフェースコンフィグ:総バイト数(送信、受信)、総パケット数(送信、受信)、接続時間、他
サンプルperlプログラム
- use SOAP::Lite +trace => debug; を有効にすると通信内容が表示できるので、レスポンスの確認に便利。
- PPM(Perl Packeage Manager)でSOAP-Liteインストール時、Class-Inspectorが自動で入らないので、自分で追加する必要がある。
- direction:inの項目を指定すると設定(+再起動)してしまうので、注意
- X_GetICSStatisticsで取得できるビットレート情報は、GetTotalXXXと同じもののようだ
use SOAP::Lite;
#use SOAP::Lite +trace => debug;
$internalip="192.168.116.1";
print "## WANPPPConnection ##\n";
my $soap = SOAP::Lite
->ns('urn:schemas-upnp-org:service:WANPPPConnection:1')
->proxy("http://$internalip:2869/upnp/control/WANPPPConn1");
my $som = $soap->GetConnectionTypeInfo();
my $ConnectionType = $som->valueof('//GetConnectionTypeInfoResponse/NewConnectionType');
print "ConnectionType: $ConnectionType\n";
my $PossibleConnectionTypes = $som->valueof('//GetConnectionTypeInfoResponse/NewPossibleConnectionTypes');
print "PossibleConnectionTypes: $PossibleConnectionTypes\n";
my $som = $soap->GetStatusInfo();
my $ConnectionStatus = $som->valueof('//GetStatusInfoResponse/NewConnectionStatus');
print "ConnectionStatus: $ConnectionStatus\n";
my $LastConnectionError = $som->valueof('//GetStatusInfoResponse/NewLastConnectionError');
print "LastConnectionError: $LastConnectionError\n";
my $som = $soap->GetNATRSIPStatus();
my $RSIPAvailable = $som->valueof('//GetNATRSIPStatusResponse/NewRSIPAvailable');
print "RSIPAvailable: $RSIPAvailable\n";
my $NATEnabled = $som->valueof('//GetNATRSIPStatusResponse/NewNATEnabled');
print "NATEnabled: $NATEnabled\n";
my $som = $soap->GetLinkLayerMaxBitRates();
my $UpstreamMaxBitRate = $som->valueof('//GetLinkLayerMaxBitRatesResponse/NewUpstreamMaxBitRate');
print "Upstream MaxBitRate: $UpstreamMaxBitRate\n";
my $DownstreamMaxBitRate = $som->valueof('//GetLinkLayerMaxBitRatesResponse/NewDownstreamMaxBitRate');
print "Downstream MaxBitRate: $DownstreamMaxBitRate\n";
#my $som = $soap->GetNATRSIPStatus();
#my $som = $soap->GetGenericPortMappingEntry();
#my $som = $soap->GetSpecificPortMappingEntry();
my $som = $soap->GetExternalIPAddress();
my $ExternalIPAddress = $som->valueof('//GetExternalIPAddressResponse/NewExternalIPAddress');
print "ExternalIPAddress:$ExternalIPAddress\n";
print "\n## WANCommonInterfaceConfig ##\n";
my $soap = SOAP::Lite
->ns('urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1')
->proxy("http://$internalip:2869/upnp/control/WANCommonIFC1");
my $som = $soap->GetCommonLinkProperties();
my $WANAccessType = $som->valueof('//GetCommonLinkPropertiesResponse/NewWANAccessType');
print "WANAccessType: $WANAccessType\n";
my $som = $soap->GetTotalBytesSent();
my $TotalBytesSent = $som->valueof('//GetTotalBytesSentResponse/NewTotalBytesSent');
print "TotalBytesSent: $TotalBytesSent\n";
my $som = $soap->GetTotalBytesReceived();
my $TotalBytesReceived = $som->valueof('//GetTotalBytesReceivedResponse/NewTotalBytesReceived');
print "TotalBytesReceived: $TotalBytesReceived\n";
my $som = $soap->GetTotalPacketsSent();
my $TotalPacketsSent = $som->valueof('//GetTotalPacketsSentResponse/NewTotalPacketsSent');
print "TotalPacketsSent: $TotalPacketsSent\n";
my $som = $soap->GetTotalPacketsReceived();
my $TotalPacketsReceived = $som->valueof('//GetTotalPacketsReceivedResponse/NewTotalPacketsReceived');
print "TotalPacketsReceived: $TotalPacketsReceived\n";
my $som = $soap->X_GetICSStatistics();
my $TotalBytesSent = $som->valueof('//X_GetICSStatisticsResponse/TotalBytesSent');
print "TotalBytesSent: $TotalBytesSent\n";
my $TotalBytesReceived = $som->valueof('//X_GetICSStatisticsResponse/TotalBytesReceived');
print "TotalBytesReceived: $TotalBytesReceived\n";
my $TotalPacketsSent = $som->valueof('//X_GetICSStatisticsResponse/TotalPacketsSent');
print "TotalPacketsSent: $TotalPacketsSent\n";
my $TotalBytesReceived = $som->valueof('//X_GetICSStatisticsResponse/TotalPacketsReceived');
print "TotalPacketsReceived: $TotalPacketsReceived\n";
my $Layer1DownstreamMaxBitRate = $som->valueof('//X_GetICSStatisticsResponse/Layer1DownstreamMaxBitRate');
print "Layer1DownstreamMaxBitRate: $Layer1DownstreamMaxBitRate\n";
my $Uptime = $som->valueof('//X_GetICSStatisticsResponse/Uptime');
print "Uptime: $Uptime";
« TSJ-BTR001(Willcom WS026Tのバッテリー)互換バッテリーを探す | トップページ | アコードCE1のエアコンパネル修理 »
この記事へのコメントは終了しました。
« TSJ-BTR001(Willcom WS026Tのバッテリー)互換バッテリーを探す | トップページ | アコードCE1のエアコンパネル修理 »
コメント