module COpenKellyCockLedNotification
    use COperationScenariosVariables
    implicit none
    contains
    
    subroutine Evaluate_OpenKellyCockLed()
        implicit none
        
        
!        if (DriveType == TopDrive_DriveType) then
!#ifdef OST
!        print*, 'Evaluate_OpenKellyCockLed=TopDrive'
!#endif
!        endif
!        if (DriveType == Kelly_DriveType) then
!#ifdef OST
!        print*, 'Evaluate_OpenKellyCockLed=Kelly'
!#endif
!        endif
        
        
        
    end subroutine
    
    ! subroutine Subscribe_OpenKellyCockLed()
    !     use CDrillingConsoleVariables
    !     implicit none
    !     call OnOpenKellyCockPress%Add(ButtonPress_OpenKellyCock)
    ! end subroutine
    
    subroutine ButtonPress_OpenKellyCock()
        implicit none
        
        
        if (Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'ButtonPress_OpenKellyCock=TopDrive'
#endif
        endif
        
        
        
        
        if (Hoisting%DriveType == Kelly_DriveType) then
#ifdef OST
            print*, 'ButtonPress_OpenKellyCock=Kelly'
#endif
            !OPERATION-CODE=65
            if (Get_OperationCondition() == OPERATION_DRILL .and.&
                Get_OpenKellyCockLed() == .false. .and.&
                Get_CloseKellyCockLed()) then
                call Set_OpenKellyCockLed(.true.)
                call Set_CloseKellyCockLed(.false.)
                return
            end if
        endif
        
        
        
    end subroutine
    
end module COpenKellyCockLedNotification