}
}
-void CCECBusDevice::SetVendorId(const cec_datapacket &data)
-{
- if (data.size < 3)
- {
- AddLog(CEC_LOG_WARNING, "invalid vendor ID received");
- return;
- }
-
- uint64_t iVendorId = ((uint64_t)data[0] << 3) +
- ((uint64_t)data[1] << 2) +
- (uint64_t)data[2];
-
- SetVendorId(iVendorId, data.size >= 4 ? data[3] : 0);
-}
-
void CCECBusDevice::SetVendorId(uint64_t iVendorId, uint8_t iVendorClass /* = 0 */)
{
m_vendor.vendor = (cec_vendor_id)iVendorId;
bool CCECCommandHandler::HandleDeviceVendorCommandWithId(const cec_command &command)
{
- CCECBusDevice *device = GetDevice(command.initiator);
- if (device)
- device->SetVendorId(command.parameters);
-
+ SetVendorId(command);
return true;
}
bool CCECCommandHandler::HandleDeviceVendorId(const cec_command &command)
{
- CCECBusDevice *device = GetDevice(command.initiator);
- if (device)
- device->SetVendorId(command.parameters);
-
+ SetVendorId(command);
return true;
}
return device;
}
+
+
+void CCECCommandHandler::SetVendorId(const cec_command &command)
+{
+ if (command.parameters.size < 3)
+ {
+ m_busDevice->AddLog(CEC_LOG_WARNING, "invalid vendor ID received");
+ return;
+ }
+
+ uint64_t iVendorId = ((uint64_t)command.parameters[0] << 3) +
+ ((uint64_t)command.parameters[1] << 2) +
+ (uint64_t)command.parameters[2];
+
+ CCECBusDevice *device = GetDevice((cec_logical_address) command.initiator);
+ if (device)
+ device->SetVendorId(iVendorId, iVendorId);
+}
virtual CCECBusDevice *GetDevice(cec_logical_address iLogicalAddress) const;
virtual CCECBusDevice *GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress) const;
+
+ virtual void SetVendorId(const cec_command &command);
CCECBusDevice *m_busDevice;
};
};