bool RDMCommand::operator==(const RDMCommand &other) const { if (SourceUID() == other.SourceUID() && DestinationUID() == other.DestinationUID() && TransactionNumber() == other.TransactionNumber() && MessageCount() == other.MessageCount() && SubDevice() == other.SubDevice() && CommandClass() == other.CommandClass() && ParamId() == other.ParamId() && ParamDataSize() == other.ParamDataSize()) { return 0 == memcmp(ParamData(), other.ParamData(), ParamDataSize()); } return false; }
/** * Populate the RDMCommandHeader struct. * @param header a pointer to the RDMCommandHeader to populate * @param command the RDMCommand to use * @param the length of the packet excluding the start code. * @param source the source UID. * @param transaction_number the RDM transaction number * @param port_id the RDM port id */ void RDMCommandSerializer::PopulateHeader(RDMCommandHeader *header, const RDMCommand &command, unsigned int packet_length, const UID &source, uint8_t transaction_number, uint8_t port_id) { // ignore the checksum length for now packet_length -= CHECKSUM_LENGTH; header->sub_start_code = SUB_START_CODE; header->message_length = packet_length + 1; // add in start code as well command.DestinationUID().Pack(header->destination_uid, UID::UID_SIZE); source.Pack(header->source_uid, UID::UID_SIZE); header->transaction_number = transaction_number; header->port_id = port_id; header->message_count = command.MessageCount(); header->sub_device[0] = command.SubDevice() >> 8; header->sub_device[1] = command.SubDevice() & 0xff; header->command_class = command.CommandClass(); header->param_id[0] = command.ParamId() >> 8; header->param_id[1] = command.ParamId() & 0xff; header->param_data_length = command.ParamDataSize(); }