|
@@ -2,6 +2,9 @@
|
|
|
|
|
|
#include "gnss_coordinate_convert.h"
|
|
|
|
|
|
+#include "decition_type.h"
|
|
|
+#include "decition.pb.h"
|
|
|
+
|
|
|
namespace iv {
|
|
|
|
|
|
|
|
@@ -26,8 +29,26 @@ void ivdecision::modulerun()
|
|
|
mpahmimsg = iv::modulecomm::RegisterRecvPlus(mstrhmimsgname.data(),funhmi);
|
|
|
mpapadmsg = iv::modulecomm::RegisterRecvPlus(mstrpadmsgname.data(),funhmi);
|
|
|
|
|
|
+ mpaDecition = iv::modulecomm::RegisterSend(mstrdecisionmsgname.data(),10*sizeof(iv::decition::DecitionBasic),1);
|
|
|
+ mpaVechicleState = iv::modulecomm::RegisterSend(mstrbrainstatemsgname.data(),10000,10);
|
|
|
+
|
|
|
+ iv::brain::brainstate xbs;
|
|
|
+ iv::brain::decition xdecition;
|
|
|
+
|
|
|
+ qint64 nSpace = 10;
|
|
|
+ qint64 nLastDecTime = 0;
|
|
|
+
|
|
|
while(mbrun)
|
|
|
{
|
|
|
+ if((QDateTime::currentMSecsSinceEpoch() - nLastDecTime)<nSpace)
|
|
|
+ {
|
|
|
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ nLastDecTime = QDateTime::currentMSecsSinceEpoch();
|
|
|
+ std::cout<<"running."<<std::endl;
|
|
|
+ getdecision(xdecition,xbs);
|
|
|
+ sharemsg(xdecition,xbs);
|
|
|
//RunDecision
|
|
|
//ShareMsg
|
|
|
}
|
|
@@ -41,6 +62,41 @@ void ivdecision::modulerun()
|
|
|
iv::modulecomm::Unregister(mpagpsmsg);
|
|
|
}
|
|
|
|
|
|
+void ivdecision::sharemsg(brain::decition &xdecition, brain::brainstate &xbs)
|
|
|
+{
|
|
|
+ int nsize = xdecition.ByteSize();
|
|
|
+ char * str = new char[nsize];
|
|
|
+ std::shared_ptr<char> pstr;
|
|
|
+ pstr.reset(str);
|
|
|
+ if(xdecition.SerializeToArray(str,nsize))
|
|
|
+ {
|
|
|
+// if(ServiceCarStatus.mbRunPause == false)
|
|
|
+// {
|
|
|
+
|
|
|
+ iv::modulecomm::ModuleSendMsg(mpaDecition,str,nsize);
|
|
|
+// }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<"iv::decition::BrainDecition::ShareDecition serialize error."<<std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
+ nsize = xbs.ByteSize();
|
|
|
+ str = new char[nsize];
|
|
|
+ // std::shared_ptr<char> pstr;
|
|
|
+ pstr.reset(str);
|
|
|
+ if(xbs.SerializeToArray(str,nsize))
|
|
|
+ {
|
|
|
+ iv::modulecomm::ModuleSendMsg(mpaVechicleState,str,nsize);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout<<"iv::decition::BrainDecition::ShareBrainstate serialize error."<<std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
void ivdecision::UpdateGPS(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
{
|
|
|
(void )&index;
|