From 1946ffe145749d5f5f5d0636c2ca3239e387fe55 Mon Sep 17 00:00:00 2001 From: Maik2208 <79879510+Maik2208@users.noreply.github.com> Date: Fri, 15 Mar 2024 00:39:52 +0100 Subject: [PATCH] Update devicelist.cgi Only process devices. This fixes #93 --- xmlapi/devicelist.cgi | 200 +++++++++++++++++++++--------------------- 1 file changed, 101 insertions(+), 99 deletions(-) diff --git a/xmlapi/devicelist.cgi b/xmlapi/devicelist.cgi index 80c378f..ed5eb3b 100755 --- a/xmlapi/devicelist.cgi +++ b/xmlapi/devicelist.cgi @@ -54,115 +54,117 @@ if {[info exists sid] && [check_session $sid]} { foreach (sDevId, sDevIdList) { object oDevice = dom.GetObject(sDevId); - integer iDevInterfaceId = oDevice.Interface(); - object oDeviceInterface = dom.GetObject(iDevInterfaceId); - - boolean bDevReady = oDevice.ReadyConfig(); - boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType()) || ("HmIP-RCV-50" == oDevice.HssType()) ); - - if( (oDeviceInterface) && (true == bDevReady) && ( ( isRemote == false ) || ( show_remote == 1 ) ) ) - { - string sDevInterface = oDeviceInterface.Name(); - string sDevType = oDevice.HssType(); - - Write(""); - - foreach(sChnId, oDevice.Channels()) - { - object oChannel = dom.GetObject(sChnId); - - boolean show = false; + if( (oDevice.IsTypeOf(OT_DEVICE)) ) { + integer iDevInterfaceId = oDevice.Interface(); + object oDeviceInterface = dom.GetObject(iDevInterfaceId); - if (false == oChannel.Internal() ) { - show = true; - } + boolean bDevReady = oDevice.ReadyConfig(); + boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType()) || ("HmIP-RCV-50" == oDevice.HssType()) ); - if ( show_internal == 1){ - show = true; - } + if( (oDeviceInterface) && (true == bDevReady) && ( ( isRemote == false ) || ( show_remote == 1 ) ) ) + { + string sDevInterface = oDeviceInterface.Name(); + string sDevType = oDevice.HssType(); + + Write(""); + + foreach(sChnId, oDevice.Channels()) + { + object oChannel = dom.GetObject(sChnId); + + boolean show = false; + + if (false == oChannel.Internal() ) { + show = true; + } - if (show == true){ - integer iChnDir = oChannel.ChnDirection(); - string sChnDir = "UNKNOWN"; - if (DIR_SENDER == iChnDir) { sChnDir = "SENDER"; } - if (DIR_RECEIVER == iChnDir) { sChnDir = "RECEIVER"; } - string sChnPartnerId = oChannel.ChnGroupPartnerId(); - if (PARTNER_INVALID == sChnPartnerId) { sChnPartnerId = ""; } - boolean bChnAESAvailable = false; - if (0 != oChannel.ChnAESOperation()) { bChnAESAvailable = true; } - string sChnMode = "DEFAULT"; - if (true == oChannel.ChnAESActive()) { sChnMode = "AES"; } - - ! boolean bChnReady = oChannel.ReadyConfig(); - ! integer iChnLinkCount = oChannel.ChnLinkCount(); - ! integer iChnProgramCount = oChannel.DPUsageCount(); - ! if (ID_ERROR == iChnProgramCount) { iChnProgramCount = 0; } - ! boolean bChnVirtual = false; - ! if (TYPE_VIRTUAL == sChnType) { bChnVirtual = true; } - ! boolean bChnReadable = false; - ! boolean bChnWritable = false; - ! boolean bChnEventable = false; - ! foreach (sDPId, oChannel.DPs()) - ! { - ! object oDP = dom.GetObject(sDPId); - ! if (false == oDP.Internal()) - ! { - ! integer iDPOperations = oDP.Operations(); - ! if (OPERATION_READ & iDPOperations) { bChnReadable = true; } - ! if (OPERATION_WRITE & iDPOperations) { bChnWritable = true; } - ! if (OPERATION_EVENT & iDPOperations) { bChnEventable = true; } - ! } - ! } - ! - Write(""); + Write(" ready_config='" # oChannel.ReadyConfig() # "'"); + ! Write(" link_count='" # iChnLinkCount # "'"); + ! Write(" program_count='" # iChnProgramCount # "'"); + ! Write(" virtual='" # bChnVirtual # "'"); + ! Write(" readable='" # bChnReadable # "'"); + ! Write(" writable='" # bChnWritable # "'"); + ! Write(" eventable='" # bChnEventable # "'"); + + if (false == oChannel.Internal()) { + Write(" operate='"); + if( oChannel.UserAccessRights(iulOtherThanAdmin) == iarFullAccess ) { + Write("true"); + } else { + Write("false"); + } + } else { + Write(" operate='"); + } + + Write("' />"); + } } - } - Write(""); + Write(""); + } } } }]