module COpenKellyCockLedNotification
    use OperationScenariosModule
    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
!@    use ConfigurationVariables
!@    use ConfigurationVariables
    !     implicit none
    !     call OnOpenKellyCockPress%Add(ButtonPress_OpenKellyCock)
    ! end subroutine
    
    subroutine ButtonPress_OpenKellyCock()
        implicit none
        
        
        if (data%Configuration%Hoisting%DriveType == TopDrive_DriveType) then
#ifdef OST
            print*, 'ButtonPress_OpenKellyCock=TopDrive'
#endif
        endif
        
        
        
        
        if (data%Configuration%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