|
@@ -15,6 +15,11 @@ Radio::Radio()
|
|
|
m_bEnBusyRoad=false;
|
|
|
m_bEnDangerDrive=false;
|
|
|
m_bEnUpRespond=false;
|
|
|
+ //20211009,jiaolili
|
|
|
+ mivlog = new iv::Ivlog("v2r");
|
|
|
+ //shareMem:send
|
|
|
+ mpmem_radio_send_addr = iv::modulecomm::RegisterSend("v2r_send",100,1);
|
|
|
+ /////////////////////////////
|
|
|
}
|
|
|
Radio::~Radio()
|
|
|
{
|
|
@@ -52,32 +57,61 @@ void Radio::getDangerDrive(bool en)
|
|
|
void Radio::outLight(lightMessage light)
|
|
|
{
|
|
|
if(m_bEnBusyRoad|m_bEnCollisionWarning|m_bEnDangerDrive|m_bEnTrafficBroadcast) {
|
|
|
- //protobuffer ui
|
|
|
+ iv::v2r::v2r_send protobuf;
|
|
|
+ protobuf.set_radiolighttype(light.lightType);
|
|
|
+ protobuf.set_radiolightremain(light.timeRemaining);
|
|
|
+ sendProto(protobuf);
|
|
|
}
|
|
|
- //protobuffer control
|
|
|
-}
|
|
|
|
|
|
+}
|
|
|
+void Radio::sendProto(iv::v2r::v2r_send radio_protobuf_send)
|
|
|
+{
|
|
|
+ char * strser;
|
|
|
+ bool bser;
|
|
|
+ int nbytesize;
|
|
|
+ nbytesize = radio_protobuf_send.ByteSize();
|
|
|
+ strser = new char[nbytesize];
|
|
|
+ bser = radio_protobuf_send.SerializeToArray(strser,nbytesize);
|
|
|
+ if(bser)
|
|
|
+ iv::modulecomm::ModuleSendMsg(mpmem_radio_send_addr,strser,nbytesize);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mivlog->error("sendData","[%s:] radio serialize error.",__func__);
|
|
|
+// gfault->SetFaultState(1, 0, "radio serialize err");
|
|
|
+ }
|
|
|
+ delete strser;
|
|
|
+}
|
|
|
void Radio::outRealtimeTraffic(realtimeTrafficMessage realtimeTraffic)
|
|
|
{
|
|
|
if(m_bEnTrafficBroadcast) {
|
|
|
- //protobuffer ui
|
|
|
- }
|
|
|
- //protobuffer control
|
|
|
+ iv::v2r::v2r_send protobuf;
|
|
|
+ float lat=((float)realtimeTraffic.lat)/1000000.0;
|
|
|
+ float lon=((float)realtimeTraffic.lng)/1000000.0;
|
|
|
+ protobuf.set_radiobroadcastgpslat(lat);
|
|
|
+ protobuf.set_radiobroadcastgpslat(lon);
|
|
|
+ protobuf.set_radiobroadcastrange(realtimeTraffic.scope);
|
|
|
+ protobuf.set_radiobroadcasttraffictype(realtimeTraffic.trafficInfo);
|
|
|
+ protobuf.set_radiobroadcastspeedlimit(realtimeTraffic.speedLimit);
|
|
|
+ sendProto(protobuf);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void Radio::outCollisionWarning(collisionEarlyWarningMessage collisionWarning)
|
|
|
{
|
|
|
if(m_bEnCollisionWarning) {
|
|
|
- //protobuffer ui
|
|
|
+ iv::v2r::v2r_send protobuf;
|
|
|
+ protobuf.set_radiowarningtype(collisionWarning.warningType);
|
|
|
+ protobuf.set_radiowarningspeedlimit(collisionWarning.speedLimit);
|
|
|
+ sendProto(protobuf);
|
|
|
}
|
|
|
- //protobuffer control
|
|
|
-
|
|
|
}
|
|
|
|
|
|
void Radio::outCongestionIdenti(congestionIdentificationMessage congestionIdenti)
|
|
|
{
|
|
|
if(m_bEnBusyRoad) {
|
|
|
- //protobuffer ui
|
|
|
+ iv::v2r::v2r_send protobuf;
|
|
|
+ protobuf.set_radioidentistart(congestionIdenti.openCommand);
|
|
|
+ sendProto(protobuf);
|
|
|
}
|
|
|
}
|
|
|
|