----------------------------------------------------------------------------- Remove a switch point from the schedule -----------------------------------------------------------------------------
| 3570 | // Remove a switch point from the schedule |
| 3571 | //----------------------------------------------------------------------------- |
| 3572 | bool Manager::RemoveSwitchPoint |
| 3573 | ( |
| 3574 | ValueID const& _id, |
| 3575 | uint8 const _hours, |
| 3576 | uint8 const _minutes |
| 3577 | ) |
| 3578 | { |
| 3579 | bool res = false; |
| 3580 | |
| 3581 | if( ValueID::ValueType_Schedule == _id.GetType() ) |
| 3582 | { |
| 3583 | if( Driver* driver = GetDriver( _id.GetHomeId() ) ) |
| 3584 | { |
| 3585 | LockGuard LG(driver->m_nodeMutex); |
| 3586 | if( ValueSchedule* value = static_cast<ValueSchedule*>( driver->GetValue( _id ) ) ) |
| 3587 | { |
| 3588 | uint8 idx; |
| 3589 | res = value->FindSwitchPoint( _hours, _minutes, &idx ); |
| 3590 | |
| 3591 | if( res ) |
| 3592 | { |
| 3593 | res = value->RemoveSwitchPoint( idx ); |
| 3594 | } |
| 3595 | value->Release(); |
| 3596 | } else { |
| 3597 | OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to RemoveSwitchPoint"); |
| 3598 | } |
| 3599 | } |
| 3600 | } else { |
| 3601 | OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to RemoveSwitchPoint is not a Schedule Value"); |
| 3602 | } |
| 3603 | |
| 3604 | return res; |
| 3605 | } |
| 3606 | |
| 3607 | //----------------------------------------------------------------------------- |
| 3608 | // <Manager::ClearSwitchPoints> |
nothing calls this directly
no test coverage detected