21 obs->insTime = util::time::GetCurrentInsTime();
22 if (packet.type() == uart::protocol::Packet::Type::TYPE_BINARY)
24 packet.extractUint16();
26 std::array<uint8_t, 6> mac{};
27 std::ranges::generate(mac, [&]() {
return packet.extractUint8(); });
29 obs->macAddress = fmt::format(
"{:02X}:{:02X}:{:02X}:{:02X}:{:02X}:{:02X}",
30 mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
31 std::ranges::transform(obs->macAddress, obs->macAddress.begin(), ::toupper);
33 int rtt = packet.extractInt32();
35 int rttStd = packet.extractInt32();
36 obs->distanceStd =
static_cast<double>(rttStd) *
InsConst::C_AIR * 1e-12 / 2;
38 InsTime_YMDHMS yearMonthDayHMS(packet.extractInt32(), packet.extractInt32(), packet.extractInt32(), packet.extractInt32(), packet.extractInt32(), packet.extractInt32());
39 InsTime timeOfMeasurement(yearMonthDayHMS,
UTC);
40 [[maybe_unused]] uint32_t microseconds = packet.extractUint32();
41 obs->insTime = timeOfMeasurement + std::chrono::microseconds(microseconds);
43 std::shared_ptr<vendor::vectornav::TimeOutputs> timeOutputs = std::make_shared<vendor::vectornav::TimeOutputs>();
44 obs->timeOutputs.syncInCnt = packet.extractUint32();
45 obs->timeOutputs.timeSyncIn = packet.extractUint64();
47 LOG_DATA(
"WiFiObs mac Address: {}, measured distance: {}, time of measurement: {}", obs->macAddress, obs->distance, obs->insTime);
51 LOG_DATA(
"Received non-binary packet. Ignoring.");