| 172 | } |
| 173 | |
| 174 | void SampleQueue::SaveCanMessage(const IChannelGroup& group, uint64_t time, |
| 175 | const CanMessage& msg) { |
| 176 | SampleRecord sample = group.GetSampleRecord(); |
| 177 | sample.timestamp = time; |
| 178 | RecalculateTime(group.RecordId(),sample); |
| 179 | |
| 180 | // Convert the CAN message to a sample record. Note that depending on the |
| 181 | // storage type, either the whole message buffer is stored (Max Length) or |
| 182 | // an index to a SD or a VLSD CG record is stored. The index cannot be |
| 183 | // calculated at this point as it have to be calculated before saving the |
| 184 | // recording to disc. Instead, is the buffer temporary hold by the |
| 185 | // SampleRecord struct and fixed just before saving to disc. |
| 186 | const bool save_index = group.StorageType() != MdfStorageType::MlsdStorage; |
| 187 | const uint32_t max_length = group.MaxLength(); |
| 188 | const std::string& group_name = group.Name(); |
| 189 | // Only checking the part of the group name as it may contain channel |
| 190 | // and message ID/Name as well. |
| 191 | if (group_name.find("_DataFrame") != std::string::npos) { |
| 192 | msg.TypeOfMessage(MessageType::CAN_DataFrame); |
| 193 | msg.ToRaw(MessageType::CAN_DataFrame, sample, max_length, save_index); |
| 194 | } else if (group_name.find("_RemoteFrame") != std::string::npos) { |
| 195 | msg.TypeOfMessage(MessageType::CAN_RemoteFrame); |
| 196 | msg.ToRaw(MessageType::CAN_RemoteFrame, sample, max_length, save_index); |
| 197 | } else if (group_name.find("_ErrorFrame") != std::string::npos) { |
| 198 | msg.TypeOfMessage(MessageType::CAN_ErrorFrame); |
| 199 | msg.ToRaw(MessageType::CAN_ErrorFrame, sample, max_length, save_index); |
| 200 | } else if (group_name.find("_OverloadFrame") != std::string::npos) { |
| 201 | msg.TypeOfMessage(MessageType::CAN_OverloadFrame); |
| 202 | msg.ToRaw(MessageType::CAN_OverloadFrame, sample,max_length, save_index); |
| 203 | } |
| 204 | AddSample(std::move(sample)); |
| 205 | } |
| 206 | |
| 207 | void SampleQueue::SaveLinMessage(const IChannelGroup& group, uint64_t time, |
| 208 | const LinMessage& msg) { |
nothing calls this directly
no test coverage detected