src/connectivity/bluetooth/core/bt-host/cobalt/cobalt_logger.cc
// Convert from the native Event type defined in bt::cobalt to the FIDL generated CobaltEvent type.
Convert from the native Event type defined in bt::cobalt to the FIDL generated CobaltEvent type.
Convert from the native Event type defined in bt :: cobalt to the FIDL generated CobaltEvent type .
::fuchsia::cobalt::CobaltEvent BtEventToFidlEvent(Event event) {
  ::fuchsia::cobalt::CobaltEvent fidl_event{};
  fidl_event.metric_id = event.metric_id;
  fidl_event.event_codes = std::move(event.event_codes);
  class Visitor {
   public:
    Visitor(::fuchsia::cobalt::EventPayload* const payload) : payload_(payload) {}
    ::fuchsia::cobalt::EventPayload* const payload_;
    void operator()(EventCount count) {
      ::fuchsia::cobalt::CountEvent fidl_count{};
      fidl_count.count = count.value;
      payload_->set_event_count(fidl_count);
    }
    void operator()(ElapsedMicros elapsed_micros) {
      payload_->set_elapsed_micros(elapsed_micros.value);
    }
  };
  ::fuchsia::cobalt::EventPayload fidl_payload{};
  std::visit(Visitor{&fidl_payload}, event.payload);
  fidl_event.payload = std::move(fidl_payload);
  return fidl_event;
}
:: fuchsia :: cobalt :: CobaltEvent BtEventToFidlEvent ( Event event ) { :: fuchsia :: cobalt :: CobaltEvent fidl_event { } ; fidl_event . metric_id = event . metric_id ; fidl_event . event_codes = std :: move ( event . event_codes ) ; class Visitor { public : Visitor ( :: fuchsia :: cobalt :: EventPayload * const payload ) : payload_ ( payload ) { } :: fuchsia :: cobalt :: EventPayload * const payload_ ; void operator () ( EventCount count ) { :: fuchsia :: cobalt :: CountEvent fidl_count { } ; fidl_count . count = count . value ; payload_ -> set_event_count ( fidl_count ) ; } void operator () ( ElapsedMicros elapsed_micros ) { payload_ -> set_elapsed_micros ( elapsed_micros . value ) ; } } ; :: fuchsia :: cobalt :: EventPayload fidl_payload { } ; std :: visit ( Visitor { & fidl_payload } , event . payload ) ; fidl_event . payload = std :: move ( fidl_payload ) ; return fidl_event ; }
Convert from the native Event type defined in bt::cobalt to the FIDL generated CobaltEvent type.
Convert from the native Event type defined in bt :: cobalt to the FIDL generated CobaltEvent type .