  
    struct cereal_ModelData_LeadData leadd;
    cereal_read_ModelData_LeadData(&leadd, modeld.lead);
    d.lead = (LeadData){
        .dist = leadd.dist, .prob = leadd.prob, .std = leadd.std,
    };
  
    return d;
  }
  
 
</s> remove   } else if (eventd.which == cereal_Event_radarState) {
    struct cereal_RadarState datad;
    cereal_read_RadarState(&datad, eventd.radarState);
    struct cereal_RadarState_LeadData leaddatad;
    cereal_read_RadarState_LeadData(&leaddatad, datad.leadOne);
    s->scene.lead_status = leaddatad.status;
    s->scene.lead_d_rel = leaddatad.dRel;
    s->scene.lead_y_rel = leaddatad.yRel;
    s->scene.lead_v_rel = leaddatad.vRel;
    cereal_read_RadarState_LeadData(&leaddatad, datad.leadTwo);
    s->scene.lead_status2 = leaddatad.status;
    s->scene.lead_d_rel2 = leaddatad.dRel;
    s->scene.lead_y_rel2 = leaddatad.yRel;
    s->scene.lead_v_rel2 = leaddatad.vRel;
    s->livempc_or_radarstate_changed = true;
  } else if (eventd.which == cereal_Event_liveCalibration) {
    s->scene.world_objects_visible = true;
    struct cereal_LiveCalibrationData datad;
    cereal_read_LiveCalibrationData(&datad, eventd.liveCalibration);
 </s> add   } else if (which == cereal::Event::RADAR_STATE) {
    auto data = event.getRadarState();
    
    auto leaddatad = data.getLeadOne();
    scene.lead_status = leaddatad.getStatus();
    scene.lead_d_rel = leaddatad.getDRel();
    scene.lead_y_rel = leaddatad.getYRel();
    scene.lead_v_rel = leaddatad.getVRel();
    auto leaddatad2 = data.getLeadTwo();
    scene.lead_status2 = leaddatad2.getStatus();
    scene.lead_d_rel2 = leaddatad2.getDRel();
    scene.lead_y_rel2 = leaddatad2.getYRel();
    scene.lead_v_rel2 = leaddatad2.getVRel(); </s> remove     s->scene.frontview = datad.rearViewCam;
    if (!s->scene.frontview){s->controls_seen = true;}
 </s> add     scene.frontview = data.getRearViewCam();
    if (!scene.frontview){ s->controls_seen = true; } </s> remove   } else if (eventd.which == cereal_Event_liveMpc) {
    struct cereal_LiveMpcData datad;
    cereal_read_LiveMpcData(&datad, eventd.liveMpc);

    capn_list32 x_list = datad.x;
    capn_resolve(&x_list.p);

    for (int i = 0; i < 50; i++){
      s->scene.mpc_x[i] = capn_to_f32(capn_get32(x_list, i));
    }

    capn_list32 y_list = datad.y;
    capn_resolve(&y_list.p);
 </s> add   } else if (which == cereal::Event::LIVE_MPC) {
    auto data = event.getLiveMpc(); </s> remove     capn_list32 extrinsicl = datad.extrinsicMatrix;
    capn_resolve(&extrinsicl.p);  // is this a bug?
 </s> add     s->livempc_or_radarstate_changed = true;
  } else if (which == cereal::Event::LIVE_CALIBRATION) {
    scene.world_objects_visible = true;
    auto extrinsicl = event.getLiveCalibration().getExtrinsicMatrix(); </s> remove   } else if (eventd.which == cereal_Event_model) {
    s->scene.model = read_model(eventd.model);
 </s> add   } else if (which == cereal::Event::MODEL) {
    scene.model = read_model(event.getModel());
      .dist = leadd.getDist(), .prob = leadd.getProb(), .std = leadd.getStd(),
  
    struct cereal_ModelData_LeadData leadd;
    cereal_read_ModelData_LeadData(&leadd, modeld.lead);
    d.lead = (LeadData){
      .dist = leadd.getDist(), .prob = leadd.getProb(), .std = leadd.getStd(),
    };
  
    return d;
  }
  
keep keep keep keep replace keep keep keep keep keep
 UI: move c-capnp to c++ (#1455)

* ui:move c-capnp to c++

* move Subsockets into vector

* rename reader to msg

include cereal/gen/cpp/log.capnp

* fix some errors

restore some changes

restore previous

* cleanup codes

cleanup codes

* remove unused variable alert_size

* handle capnproto's enum in a robust way

add break to default

* switch -> std:map

* use static std::map instead of switch

do cleanup

* fix wrong variable name

* use FlatArrayMessageReader instead of custom MessageReader

remove messagehelp.h

Revert "use FlatArrayMessageReader instead of custom MessageReader"

This reverts commit 57d8b6b1e2b4bad908246f35eb068535b1627167.

use FlatArrayMessageReader instead of custom MessageReader

add header file

remove capnp_c lib,add kj lib

include serialize.h

fix

remove duplicate includes 
selfdrive/ui/ui.cc