----------------------------------------------------------------------------- Get the index of the switch point at the specified time -----------------------------------------------------------------------------
| 322 | // Get the index of the switch point at the specified time |
| 323 | //----------------------------------------------------------------------------- |
| 324 | bool ValueSchedule::FindSwitchPoint |
| 325 | ( |
| 326 | uint8 const _hours, |
| 327 | uint8 const _minutes, |
| 328 | uint8* o_idx |
| 329 | )const |
| 330 | { |
| 331 | for( uint8 i=0; i<m_numSwitchPoints; ++i ) |
| 332 | { |
| 333 | if( m_switchPoints[i].m_hours == _hours ) |
| 334 | { |
| 335 | if( m_switchPoints[i].m_minutes == _minutes ) |
| 336 | { |
| 337 | // Found a match |
| 338 | if( o_idx ) |
| 339 | { |
| 340 | *o_idx = i; |
| 341 | } |
| 342 | return true; |
| 343 | } |
| 344 | |
| 345 | if( m_switchPoints[i].m_minutes > _minutes ) |
| 346 | { |
| 347 | // Gone past any possible match |
| 348 | return false; |
| 349 | } |
| 350 | } |
| 351 | else if( m_switchPoints[i].m_hours > _hours ) |
| 352 | { |
| 353 | // Gone past any possible match |
| 354 | return false; |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | // No match found |
| 359 | return false; |
| 360 | } |
| 361 | |
| 362 | string const ValueSchedule::GetAsString() const { |
| 363 | /* we should actuall find a way to return the arrays of switchpoints nicely */ |