| 441 | } |
| 442 | |
| 443 | bool CCECClient::ChangeDeviceType(const cec_device_type from, const cec_device_type to) |
| 444 | { |
| 445 | if (from == to) |
| 446 | return true; |
| 447 | |
| 448 | LIB_CEC->AddLog(CEC_LOG_NOTICE, "changing device type '%s' into '%s'", ToString(from), ToString(to)); |
| 449 | |
| 450 | { |
| 451 | CLockObject lock(m_mutex); |
| 452 | |
| 453 | // get the previous device that was allocated |
| 454 | CCECBusDevice *previousDevice = GetDeviceByType(from); |
| 455 | if (!previousDevice) |
| 456 | return false; |
| 457 | |
| 458 | // change the type in the device type list |
| 459 | bool bChanged(false); |
| 460 | for (uint8_t iPtr = 0; iPtr < 5; iPtr++) |
| 461 | { |
| 462 | if (m_configuration.deviceTypes.types[iPtr] == CEC_DEVICE_TYPE_RESERVED) |
| 463 | continue; |
| 464 | |
| 465 | if (m_configuration.deviceTypes.types[iPtr] == from) |
| 466 | { |
| 467 | bChanged = true; |
| 468 | m_configuration.deviceTypes.types[iPtr] = to; |
| 469 | } |
| 470 | else if (m_configuration.deviceTypes.types[iPtr] == to && bChanged) |
| 471 | { |
| 472 | // ensure that dupes are removed |
| 473 | m_configuration.deviceTypes.types[iPtr] = CEC_DEVICE_TYPE_RESERVED; |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | // re-register the client to set the new ackmask |
| 479 | if (!m_processor->RegisterClient(this)) |
| 480 | return false; |
| 481 | |
| 482 | SaveConfiguration(m_configuration); |
| 483 | |
| 484 | return true; |
| 485 | } |
| 486 | |
| 487 | bool CCECClient::SetLogicalAddress(const cec_logical_address iLogicalAddress) |
| 488 | { |
no test coverage detected