module CTdsIbopLedNotification
    use OperationScenariosModule
    implicit none
    contains
    
    subroutine Evaluate_IbopLed()
        use CCommon
        implicit none
        
        
        if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'Evaluate_IbopLed=TopDrive'
#endif




            !TOPDRIVE-CODE=61
            if (Get_IbopLed() == .false. .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == TdsPower_OFF .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveIbop == .false.) then
            
                call Set_IbopLed(.true.)
                data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltLed = LED_OFF
                return
            end if




            !TOPDRIVE-CODE=62
            if (Get_IbopLed() .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveTdsPowerState == TdsPower_OFF .and.&
                data%EquipmentControl%TopDrivePanel%TopDriveIbop) then
            
                call Set_IbopLed(.false.)
                data%EquipmentControl%TopDrivePanel%TopDriveLinkTiltLed = LED_ON
                return
            end if





        endif
        
        
        
        
        
        
        
        
!        if (DriveType == Kelly_DriveType) then
!#ifdef OST
!            print*, 'Evaluate_IbopLed=Kelly'
!#endif
!
!        endif
        
        
        
        
        
    end subroutine
    
    ! subroutine Subscribe_IbopLed()
    !     implicit none
    ! end subroutine
    
end module CTdsIbopLedNotification