Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devicelist.cgi extended by device_id #79

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion xmlapi/devicelist.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if {[info exists sid] && [check_session $sid]} {

set show_internal 0
set show_remote 0
set device_id 0
catch {
set input $env(QUERY_STRING)
set pairs [split $input &]
Expand All @@ -21,23 +22,36 @@ if {[info exists sid] && [check_session $sid]} {
set show_remote $val
continue
}
if {0 != [regexp "^device_id=(.*)$" $pair dummy val]} {
set device_id $val
continue
}
}
}

array set res [rega_script {

integer show_internal = "} $show_internal {";
integer show_remote = "} $show_remote {";
string device_id = "} $device_id {";

integer DIR_SENDER = 1;
integer DIR_RECEIVER = 2;
! string TYPE_VIRTUAL = "29";
string PARTNER_INVALID = "65535";

string sDevIdList;
string sDevId;
string sChnId;
string sDPId;
foreach (sDevId, root.Devices().EnumUsedIDs())

if( (device_id == 0) ) {
sDevIdList = root.Devices().EnumUsedIDs();
} else {
sDevIdList = device_id.Split(",");
}

foreach (sDevId, sDevIdList)
{
object oDevice = dom.GetObject(sDevId);
integer iDevInterfaceId = oDevice.Interface();
Expand Down
1 change: 1 addition & 0 deletions xmlapi/index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ if {[info exists sid] && [check_session $sid]} {
<tr><td><a href=./checkuptodate.cgi?sid=$sid>checkuptodate.cgi</a></td><td>????</td></tr>
<tr><td><a href=./devicelist.cgi?sid=$sid>devicelist.cgi</a></td><td><b>Lists all devices with channels. Contain names, serial number, device type and ids.</b><br/>
<i>sid=string</i> - security access token id<br/>
<i>device_id=list</i> - returns values of specified devices (e.g. "1234,5678") (optional)<br/>
<i>show_internal=0/1</i> - adds internal channels also (default=0)<br/>
<i>show_remote=0/1</i> - adds output of virtual remote channels (default=0)
</td></tr>
Expand Down