这里可以直接看下HUD导航的接口,我这里弄了两个就,是因为导航的距离只有在距离为100的时候才会出现,所以导航有两个接口,一个是设置方向,一个是设置距离,代码同[GC9-14]相似,宏定义+接口
//导航方向 #define NAVIGATIONDIRECTION_OFF 0 #define NAVIGATIONDIRECTION_STRAIGHT 1 //直行 #define NAVIGATIONDIRECTION_TURNLEFT 2 //左转 #define NAVIGATIONDIRECTION_TURNRIGHT 3 //右转 #define NAVIGATIONDIRECTION_FRONTLEFT 4 //左前方 #define NAVIGATIONDIRECTION_FRONTRIGHTT 5 //右前方 #define NAVIGATIONDIRECTION_LEFTREAR 6 //左后方 #define NAVIGATIONDIRECTION_RIGHTREAR 7 //右后方 #define NAVIGATIONDIRECTION_TURNROUND 8 //掉头 //导航距离 #define NAVIGATIONDISTANCE_1 0 //0距离 #define NAVIGATIONDISTANCE_2 1 //1距离 #define NAVIGATIONDISTANCE_3 2 //2距离
void HUD::set_NavigationDirection(int direction) { switch (direction) { case NAVIGATIONDIRECTION_OFF: ui->label_point->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_down->hide(); ui->label_left->hide(); ui->label_leftDown->hide(); ui->label_leftUp->hide(); ui->label_right->hide(); ui->label_rightDown->hide(); ui->label_rightUp->hide(); ui->label_turnRound->hide(); ui->label_up->hide(); break; case NAVIGATIONDIRECTION_STRAIGHT: ui->label_point->show(); ui->label_down->show(); ui->label_up->show(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->hide(); ui->label_leftDown->hide(); ui->label_leftUp->hide(); ui->label_right->hide(); ui->label_rightDown->hide(); ui->label_rightUp->hide(); ui->label_turnRound->hide(); break; case NAVIGATIONDIRECTION_TURNLEFT: ui->label_point->show(); ui->label_down->show(); ui->label_up->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->show(); ui->label_leftDown->hide(); ui->label_leftUp->hide(); ui->label_right->hide(); ui->label_rightDown->hide(); ui->label_rightUp->hide(); ui->label_turnRound->hide(); break; case NAVIGATIONDIRECTION_TURNRIGHT: ui->label_point->show(); ui->label_down->show(); ui->label_up->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->hide(); ui->label_leftDown->hide(); ui->label_leftUp->hide(); ui->label_right->show(); ui->label_rightDown->hide(); ui->label_rightUp->hide(); ui->label_turnRound->hide(); break; case NAVIGATIONDIRECTION_FRONTLEFT: ui->label_point->show(); ui->label_down->show(); ui->label_up->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->hide(); ui->label_leftDown->hide(); ui->label_leftUp->show(); ui->label_right->hide(); ui->label_rightDown->hide(); ui->label_rightUp->hide(); ui->label_turnRound->hide(); break; case NAVIGATIONDIRECTION_FRONTRIGHTT: ui->label_point->show(); ui->label_down->show(); ui->label_up->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->hide(); ui->label_leftDown->hide(); ui->label_leftUp->hide(); ui->label_right->hide(); ui->label_rightDown->hide(); ui->label_rightUp->show(); ui->label_turnRound->hide(); break; case NAVIGATIONDIRECTION_LEFTREAR: ui->label_point->show(); ui->label_down->show(); ui->label_up->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->hide(); ui->label_leftDown->show(); ui->label_leftUp->hide(); ui->label_right->hide(); ui->label_rightDown->hide(); ui->label_rightUp->hide(); ui->label_turnRound->hide(); break; case NAVIGATIONDIRECTION_RIGHTREAR: ui->label_point->show(); ui->label_down->show(); ui->label_up->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->hide(); ui->label_leftDown->hide(); ui->label_leftUp->hide(); ui->label_right->hide(); ui->label_rightDown->show(); ui->label_rightUp->hide(); ui->label_turnRound->hide(); break; case NAVIGATIONDIRECTION_TURNROUND: ui->label_point->hide(); ui->label_down->hide(); ui->label_up->hide(); ui->label_dial_1->hide(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); ui->label_line->hide(); ui->label_left->hide(); ui->label_leftDown->hide(); ui->label_leftUp->hide(); ui->label_right->hide(); ui->label_rightDown->hide(); ui->label_rightUp->hide(); ui->label_turnRound->show(); break; default: break; } }
void HUD::set_NavigationDistance(int distance) { ui->label_line->hide(); switch (distance) { case NAVIGATIONDISTANCE_1: ui->label_dial_1->show(); ui->label_dial_2->hide(); ui->label_dial_3->hide(); break; case NAVIGATIONDISTANCE_2: ui->label_dial_1->show(); ui->label_dial_2->show(); ui->label_dial_3->hide(); break; case NAVIGATIONDISTANCE_3: ui->label_dial_1->show(); ui->label_dial_2->show(); ui->label_dial_3->show(); break; default: break; } }
#define WARNINGTYPE_GASOLINE 1 //油量警告 #define WARNINGTYPE_ESP 2 //电子稳定系统,电子限滑
void HUD::set_Warning(int warningType,bool isOn) { switch (warningType) { case WARNINGTYPE_GASOLINE: if(isOn) { ui->label_gasoline->show(); } else { ui->label_gasoline->hide(); } break; case WARNINGTYPE_ESP: if(isOn) { ui->label_esp->show(); } else { ui->label_esp->hide(); } break; default: break; } }
以上就是HUD的内容了,目前HUD所有的界面显示接口已经完成,HUD所有接口如下所以,在后面与控制台交互中,计划将增加一个HUD的数据接口,专门用来与控制台交互。
/* * 设置汽车速度,单位为千米每小时 */ void set_Current_Speed(int temp); /* * 设置转向灯 */ void set_TurnLight(int signalType,bool isOn); /* * 设置车道偏离 */ void set_LaneDeparture(int position, bool isOn); /* * 设置智适应巡航模式 */ void set_AdaptiveCruiseControl(int controlModel); /* * 设置车距 */ void set_CarDistance(int level); /* * 设置警告 */ void set_Warning(int warningType, bool isOn); /* * 设置导航方向 */ void set_NavigationDirection(int direction); /* * 设置导航距离 */ void set_NavigationDistance(int distance);