lib/address_space/alarms_and_conditions/alarm_condition.js
//   except if a MaxTimeShelved Property is provided.
except if a MaxTimeShelved Property is provided.
except if a MaxTimeShelved Property is provided .
function _unShelveTimeFunc(shelvingState) {
    if (shelvingState.getCurrentState() == "Unshelved") {
        return new Variant({
            dataType: DataType.StatusCode,
            value: StatusCodes.BadConditionNotShelved
        });
    }
    if (shelvingState.getCurrentState() == "OneShotShelved" &&  shelvingState._duration === UAAlarmConditionBase.MaxDuration ) {
        return new Variant({
            dataType: DataType.Double,
            value: UAAlarmConditionBase.MaxDuration
        });
    }
    var now =new Date();
    var timeToAutomaticUnshelvedState = shelvingState._duration - (now - shelvingState._sheveldTime) ;
    return new Variant({
        dataType: DataType.Double, 
        value: timeToAutomaticUnshelvedState
    });
}
function _unShelveTimeFunc ( shelvingState ) { if ( shelvingState . getCurrentState ( ) == "Unshelved" ) { return new Variant ( { dataType : DataType . StatusCode , value : StatusCodes . BadConditionNotShelved } ) ; } if ( shelvingState . getCurrentState ( ) == "OneShotShelved" && shelvingState . _duration === UAAlarmConditionBase . MaxDuration ) { return new Variant ( { dataType : DataType . Double , value : UAAlarmConditionBase . MaxDuration } ) ; } var now = new Date ( ) ; var timeToAutomaticUnshelvedState = shelvingState . _duration - ( now - shelvingState . _sheveldTime ) ; return new Variant ( { dataType : DataType . Double , value : timeToAutomaticUnshelvedState } ) ; }
except if a MaxTimeShelved Property is provided.
except if a MaxTimeShelved Property is provided .
// timeToAutomaticUnshelvedState should be greater than zero // duration