lib/address_space/alarms_and_conditions/alarm_condition.js
// cannot be called with an ObjectId of the ShelvedStateMachineType Node
cannot be called with an ObjectId of the ShelvedStateMachineType Node
cannot be called with an ObjectId of the ShelvedStateMachineType Node
function _oneShotShelve_method(inputArguments, context, callback) {
    assert(inputArguments.length === 0);
    var shelvingState = context.object;
    if (shelvingState.getCurrentState() == "OneShotShelved") {
        return callback(null, {statusCode: StatusCodes.BadConditionAlreadyShelved});
    }
    var alarmNode = context.object.parent;
    if (!(alarmNode instanceof UAAlarmConditionBase)) {
        return callback(null, {statusCode: StatusCodes.BadNodeIdInvalid});
    }
    _clear_timer_if_any(shelvingState);
    shelvingState.setState("OneShotShelved");
    var maxTimeShelved = alarmNode.getMaxTimeShelved();
    assert(_.isFinite(maxTimeShelved));
    assert(maxTimeShelved !== UAAlarmConditionBase.MaxDuration);
    shelvingState._sheveldTime = new Date(); 
    shelvingState._duration    = maxTimeShelved;
    assert(!shelvingState._timer);
    if (maxTimeShelved != UAAlarmConditionBase.MaxDuration) {
        shelvingState._timer = setTimeout(_automatically_unshelve.bind(null,shelvingState),shelvingState._duration);
    }
    return callback(null, {statusCode: StatusCodes.Good});
}
function _oneShotShelve_method ( inputArguments , context , callback ) { assert ( inputArguments . length === 0 ) ; var shelvingState = context . object ; if ( shelvingState . getCurrentState ( ) == "OneShotShelved" ) { return callback ( null , { statusCode : StatusCodes . BadConditionAlreadyShelved } ) ; } var alarmNode = context . object . parent ; if ( ! ( alarmNode instanceof UAAlarmConditionBase ) ) { return callback ( null , { statusCode : StatusCodes . BadNodeIdInvalid } ) ; } _clear_timer_if_any ( shelvingState ) ; shelvingState . setState ( "OneShotShelved" ) ; var maxTimeShelved = alarmNode . getMaxTimeShelved ( ) ; assert ( _ . isFinite ( maxTimeShelved ) ) ; assert ( maxTimeShelved !== UAAlarmConditionBase . MaxDuration ) ; shelvingState . _sheveldTime = new Date ( ) ; shelvingState . _duration = maxTimeShelved ; assert ( ! shelvingState . _timer ) ; if ( maxTimeShelved != UAAlarmConditionBase . MaxDuration ) { shelvingState . _timer = setTimeout ( _automatically_unshelve . bind ( null , shelvingState ) , shelvingState . _duration ) ; } return callback ( null , { statusCode : StatusCodes . Good } ) ; }
cannot be called with an ObjectId of the ShelvedStateMachineType Node
cannot be called with an ObjectId of the ShelvedStateMachineType Node
// checking duration ... // istanbul ignore next // now // set automatic unshelving timer