|
@@ -41,6 +41,8 @@ int gnDecitionNum = 0; //when is zero,send default;
|
|
|
const int gnDecitionNumMax = 100;
|
|
|
int gnIndex = 0;
|
|
|
|
|
|
+
|
|
|
+std::string vehtype; //1x 支持hunter 和 yuhesenfr09pro
|
|
|
boost::shared_ptr<iv::control::Controller> gcontroller; //实际车辆控制器
|
|
|
|
|
|
|
|
@@ -142,7 +144,7 @@ void executeDecition(const iv::brain::decition decition)
|
|
|
|
|
|
// gcontroller->cmd_checksum(0x10);
|
|
|
// gcontroller->cmd_checksum(0x11);
|
|
|
-// gcontroller->cmd_checksum(0x12);
|
|
|
+// gcontroller->cmd_checksum(2d0);
|
|
|
|
|
|
// qDebug("dangwei is %d mode is %d",decition.gear(),decition.mode());
|
|
|
}
|
|
@@ -197,41 +199,87 @@ void ExecSend()
|
|
|
// unsigned char * strp = (unsigned char *)&(ServiceControlStatus.command10.byte[0]);
|
|
|
// qDebug("%02x %02x %02x %02x %02x %02x %02x %02x",strp[0]
|
|
|
// ,strp[1],strp[2],strp[3],strp[4],strp[5],strp[6],strp[7]);
|
|
|
- xraw.set_id(ServiceControlStatus.command_ID111);
|
|
|
- xraw.set_data(ServiceControlStatus.command111.byte,8);
|
|
|
- xraw.set_bext(false);
|
|
|
- xraw.set_bremote(false);
|
|
|
- xraw.set_len(8);
|
|
|
- iv::can::canraw * pxraw = xmsg.add_rawmsg();
|
|
|
- pxraw->CopyFrom(xraw);
|
|
|
- xmsg.set_channel(0);
|
|
|
- xmsg.set_index(gnIndex);
|
|
|
-
|
|
|
- xraw.set_id(ServiceControlStatus.command_ID421);
|
|
|
- xraw.set_data(ServiceControlStatus.command421.byte,8);
|
|
|
-// int a = ServiceControlStatus.command11.byte[5]&0x0f;
|
|
|
-// if(a != 0x04)
|
|
|
-// {
|
|
|
-// qDebug("not D.");
|
|
|
-// }
|
|
|
- xraw.set_bext(false);
|
|
|
- xraw.set_bremote(false);
|
|
|
- xraw.set_len(8);
|
|
|
- iv::can::canraw * pxraw1 = xmsg.add_rawmsg();
|
|
|
- pxraw1->CopyFrom(xraw);
|
|
|
- xmsg.set_channel(0);
|
|
|
- xmsg.set_index(gnIndex);
|
|
|
-
|
|
|
- xraw.set_id(ServiceControlStatus.command_ID131);
|
|
|
- xraw.set_data(ServiceControlStatus.command131.byte,8);
|
|
|
- xraw.set_bext(false);
|
|
|
- xraw.set_bremote(false);
|
|
|
- xraw.set_len(8);
|
|
|
- iv::can::canraw * pxraw2 = xmsg.add_rawmsg();
|
|
|
- pxraw2->CopyFrom(xraw);
|
|
|
- xmsg.set_channel(0);
|
|
|
- xmsg.set_index(gnIndex);
|
|
|
+ if(vehtype=="hunter")
|
|
|
+ {
|
|
|
+ xraw.set_id(ServiceControlStatus.command_ID111);
|
|
|
+ xraw.set_data(ServiceControlStatus.command111.byte,8);
|
|
|
+ xraw.set_bext(false);
|
|
|
+ xraw.set_bremote(false);
|
|
|
+ xraw.set_len(8);
|
|
|
+ iv::can::canraw * pxraw = xmsg.add_rawmsg();
|
|
|
+ pxraw->CopyFrom(xraw);
|
|
|
+ xmsg.set_channel(0);
|
|
|
+ xmsg.set_index(gnIndex);
|
|
|
+
|
|
|
+ xraw.set_id(ServiceControlStatus.command_ID421);
|
|
|
+ xraw.set_data(ServiceControlStatus.command421.byte,8);
|
|
|
+ // int a = ServiceControlStatus.command11.byte[5]&0x0f;
|
|
|
+ // if(a != 0x04)
|
|
|
+ // {
|
|
|
+ // qDebug("not D.");
|
|
|
+ // }
|
|
|
+ xraw.set_bext(false);
|
|
|
+ xraw.set_bremote(false);
|
|
|
+ xraw.set_len(8);
|
|
|
+ iv::can::canraw * pxraw1 = xmsg.add_rawmsg();
|
|
|
+ pxraw1->CopyFrom(xraw);
|
|
|
+ xmsg.set_channel(0);
|
|
|
+ xmsg.set_index(gnIndex);
|
|
|
+
|
|
|
+ xraw.set_id(ServiceControlStatus.command_ID131);
|
|
|
+ xraw.set_data(ServiceControlStatus.command131.byte,8);
|
|
|
+ xraw.set_bext(false);
|
|
|
+ xraw.set_bremote(false);
|
|
|
+ xraw.set_len(8);
|
|
|
+ iv::can::canraw * pxraw2 = xmsg.add_rawmsg();
|
|
|
+ pxraw2->CopyFrom(xraw);
|
|
|
+ xmsg.set_channel(0);
|
|
|
+ xmsg.set_index(gnIndex);
|
|
|
+ }
|
|
|
+ if(vehtype=="yuhesenfr09pro")
|
|
|
+ {
|
|
|
+ xraw.set_id(ServiceControlStatus.cmd2d0pro_ID);
|
|
|
+ static unsigned char cnt=0;
|
|
|
+ if(cnt<0xff)
|
|
|
+ {
|
|
|
+ ServiceControlStatus.cmd2d0pro.bit.ads_cnt =cnt;
|
|
|
+ ServiceControlStatus.cmd7d0pro.bit.ads_cnt =cnt;
|
|
|
+ cnt=cnt+1;
|
|
|
+ }
|
|
|
|
|
|
+ unsigned int check_sum=0;
|
|
|
+ for(int i=0;i<7;i++)
|
|
|
+ {
|
|
|
+ check_sum^=(ServiceControlStatus.cmd2d0pro.byte[i]);
|
|
|
+ }
|
|
|
+ ServiceControlStatus.cmd2d0pro.byte[7]=check_sum;
|
|
|
+
|
|
|
+ xraw.set_data(ServiceControlStatus.cmd2d0pro.byte,8);
|
|
|
+ xraw.set_bext(true);
|
|
|
+ xraw.set_bremote(false);
|
|
|
+ xraw.set_len(8);
|
|
|
+ iv::can::canraw * pxraw2d0 = xmsg.add_rawmsg();
|
|
|
+ pxraw2d0->CopyFrom(xraw);
|
|
|
+ xmsg.set_channel(0);
|
|
|
+ xmsg.set_index(gnIndex);
|
|
|
+
|
|
|
+ xraw.set_id(ServiceControlStatus.cmd7d0pro_ID);
|
|
|
+ unsigned int check_7d0sum=0;
|
|
|
+ for(int i=0;i<7;i++)
|
|
|
+ {
|
|
|
+ check_7d0sum^=(ServiceControlStatus.cmd7d0pro.byte[i]);
|
|
|
+ }
|
|
|
+ ServiceControlStatus.cmd7d0pro.byte[7]=check_7d0sum;
|
|
|
+
|
|
|
+ xraw.set_data(ServiceControlStatus.cmd7d0pro.byte,8);
|
|
|
+ xraw.set_bext(true);
|
|
|
+ xraw.set_bremote(false);
|
|
|
+ xraw.set_len(8);
|
|
|
+ iv::can::canraw * pxraw7d0 = xmsg.add_rawmsg();
|
|
|
+ pxraw7d0->CopyFrom(xraw);
|
|
|
+ xmsg.set_channel(0);
|
|
|
+ xmsg.set_index(gnIndex);
|
|
|
+ }
|
|
|
gnIndex++;
|
|
|
xmsg.set_mstime(QDateTime::currentMSecsSinceEpoch());
|
|
|
int ndatasize = xmsg.ByteSize();
|
|
@@ -292,7 +340,7 @@ int main(int argc, char *argv[])
|
|
|
QString strpath = QCoreApplication::applicationDirPath();
|
|
|
|
|
|
if(argc < 2)
|
|
|
- strpath = strpath + "/controller_vv7.xml";
|
|
|
+ strpath = strpath + "/controller.xml";
|
|
|
else
|
|
|
strpath = argv[1];
|
|
|
std::cout<<strpath.toStdString()<<std::endl;
|
|
@@ -319,6 +367,9 @@ int main(int argc, char *argv[])
|
|
|
gstrmemdecition = xp.GetParam("dection","deciton");
|
|
|
gstrmemchassis = xp.GetParam("chassismsgname","chassis");
|
|
|
|
|
|
+ vehtype = xp.GetParam("vehType","hunter");
|
|
|
+ std::cout<<vehtype<<std::endl;
|
|
|
+
|
|
|
gpacansend = iv::modulecomm::RegisterSend(gstrmemcansend.data(),10000,1);
|
|
|
gpadecition = iv::modulecomm::RegisterRecv(gstrmemdecition.data(),ListenDeciton);
|
|
|
gpachassis = iv::modulecomm::RegisterRecv(gstrmemchassis.data(),UpdateChassis);
|