module CCloseKellyCockLedNotification
    use OperationScenariosModule
    implicit none
    contains
    
    subroutine Evaluate_CloseKellyCockLed()
        implicit none
        
        
!        if (DriveType == TopDrive_DriveType) then
!#ifdef OST
!            print*, 'Evaluate_CloseKellyCockLed=TopDrive'
!#endif
!        endif
!        
!        
!        
!        
!        
!        
!        
!        
!        
!        
!        if (DriveType == Kelly_DriveType) then
!#ifdef OST
!            print*, 'Evaluate_CloseKellyCockLed=Kelly'
!#endif
!        endif
        
        
    end subroutine
    
    ! subroutine Subscribe_CloseKellyCockLed()
    !     use CDrillingConsoleVariables
    ! use ConfigurationVariables
    ! use ConfigurationVariables
    !     implicit none
    !     call OnCloseKellyCockPress%Add(ButtonPress_CloseKellyCock)
    ! end subroutine
    
    subroutine ButtonPress_CloseKellyCock()
        implicit none
        
        
        if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'Evaluate_CloseKellyCockLed=TopDrive'
#endif
        endif
       
        if (data%Configuration%Hoisting%DriveType == Kelly_DriveType) then
#ifdef OST
            print*, 'Evaluate_CloseKellyCockLed=Kelly'
#endif
        
            !OPERATION-CODE=66
            if (Get_OperationCondition() == OPERATION_DRILL .and.&
                Get_CloseKellyCockLed() == .false. .and.&
                Get_OpenKellyCockLed()) then
                call Set_OpenKellyCockLed(.false.)
                call Set_CloseKellyCockLed(.true.)
                return
            end if


        endif
        
        
        
        
        
        
    end subroutine
    
end module CCloseKellyCockLedNotification