基于(Linux)IM6ULL开辟板的车载终端体系(Qt开辟)

打印 上一主题 下一主题

主题 567|帖子 567|积分 1701

项目先容


  • 这个项目是基于正点原子阿尔法I.M6ULL开辟板编写的,本项目分为3个大模块(生存、应用、工具)。
  • 硬件需求:正点原子阿尔法I.M6ULL开辟板、usbwifi模块(购买板自带)、RGB屏(建议7寸)、OV5640摄像头。
  • 相信大家肯定关注一件事那就是开源,没错本项目开源下载毗连在文章底部。本人感觉,作为毕业课设难度应该够。
生存


其中有小模块,天气、相册、钟表、日历(Qt自带控件)
life.h
  1. #ifndef LIFE_H
  2. #define LIFE_H
  3. #include <QWidget>
  4. #include <QLabel>
  5. #include <QTimer>
  6. #include <QDebug>
  7. #include <weather/weather.h>
  8. #include <photoViem/photoviem.h>
  9. #include <date_biao/date_biao.h>
  10. namespace Ui {
  11. class Life;
  12. }
  13. class Life : public QWidget
  14. {
  15.     Q_OBJECT
  16. public:
  17.     explicit Life(QWidget *parent = nullptr,QWidget *parent1 = nullptr);
  18.     ~Life();
  19.     void weather_diaplay(bool);  //  显示天气界面
  20.     void wifi_judge(bool);       //  获取wifi是否可以使用
  21.     void hide_all();
  22. private slots:
  23.     void on_pushButton_photo_clicked();
  24. signals:
  25.     void hide_show_life();
  26. private:
  27.     Ui::Life *ui;
  28.     QLabel *photoLabel;
  29.     QTimer *photoTimer;
  30.     QWidget *life_ui;
  31.     Date_biao *date_biao;
  32.     PhotoViem *photoViem;
  33.     Weather *weather;
  34.     bool wifi_judge_;
  35. };
  36. #endif // LIFE_H
复制代码
life.cpp
  1. #include "life.h"
  2. #include "ui_life.h"
  3. Life::Life(QWidget *parent,QWidget *parent1) :
  4.     QWidget(parent),
  5.     ui(new Ui::Life)
  6. {
  7.     ui->setupUi(this);
  8.     //  相册label下的按键
  9.     ui->pushButton_photo->setFixedSize(ui->widget_photo->size());
  10.     ui->pushButton_photo->setFlat(true);
  11.     ui->pushButton_photo->raise();
  12.     life_ui = new QWidget(parent1);
  13.     life_ui->setFixedSize(1024,600);
  14.     life_ui->hide();
  15.     //  相册
  16.     photoViem = new PhotoViem(life_ui);
  17.     photoViem->hide();
  18.     photoLabel = new QLabel(ui->widget_photo);
  19.     //  钟表
  20.     date_biao = new Date_biao(ui->widget_meter);
  21.     date_biao->move(ui->widget_meter->width()/2-this->height()/4,-15);
  22.     date_biao->resize(this->width()/3,this->height()*2/3);//ui->widget_meter->width(), ui->widget_meter->height()
  23.     date_biao->raise();
  24.     //  天气
  25.     weather = new Weather(life_ui);
  26.     weather->hide();
  27.     ui->widget_meter->raise();  //  最上层
  28.     connect(weather,&Weather::pixmap_data,[=](QPixmap pixm){
  29.         pixm = pixm.scaled(ui->widget_meter->width(), ui->widget_meter->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
  30.         ui->label_watcher->setPixmap(pixm);
  31.         ui->label_watcher->lower();
  32.     });
  33.     connect(photoViem,&PhotoViem::at_pixmap,[=](QPixmap pix){
  34.         photoLabel->setFixedSize(ui->widget_photo->size());
  35.         photoLabel->setPixmap(pix.scaled(ui->widget_photo->width(), ui->widget_photo->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
  36.         photoLabel->lower();
  37.         ui->pushButton_photo->move(0,0);
  38.         ui->pushButton_photo->setFixedSize(pix.scaled(ui->widget_photo->width(), ui->widget_photo->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation).size());
  39.         //qDebug()<<ui->pushButton_photo->size()<<ui->pushButton_photo->x()<<ui->pushButton_photo->y()<<ui->widget_photo->x();
  40.     });
  41. }
  42. Life::~Life()
  43. {
  44.     delete ui;
  45. }
  46. void Life::weather_diaplay(bool aaa)
  47. {
  48.     if(wifi_judge_)//wifi_judge_
  49.     {
  50.         if(aaa) //  显示
  51.         {
  52.             weather->show();
  53.             life_ui->show();
  54.             emit hide_show_life();
  55.         }
  56.         else
  57.         {
  58.             weather->hide();
  59.         }
  60.     }
  61.     else
  62.         qDebug()<<"没用检测到网络信号!!!!";
  63. }
  64. void Life::wifi_judge(bool wifiJudge)
  65. {
  66.     wifi_judge_ = wifiJudge;
  67. }
  68. void Life::hide_all()
  69. {
  70.     photoViem->hide__();
  71.     weather->hide();
  72.     life_ui->hide();
  73.     weather_diaplay(false);
  74. }
  75. void Life::on_pushButton_photo_clicked()
  76. {
  77.     //qDebug()<<ui->widget_photo->size()<<photoLabel->width()<<photoLabel->height()<<ui->pushButton_photo->width()<<ui->pushButton_photo->height();
  78.     photoViem->show();
  79.     life_ui->show();
  80.     emit hide_show_life();
  81. }
复制代码
天气

会获取当前天气显示到钟表模块后,做为配景。应用模块的天气模块是以信号的形式打开该天气模块的ui界面(建议更换一个api)。
weather.h
wforecast.h
wather.cpp
wforecast.cpp
相册

获取相册文件夹的图片,轮流显示,单机ui图片打开相册功能,在功能中双击放大(有点卡必要等候)。

photoviem.h
pitherbig.h
photoviem.cpp
pitherbig.cpp
钟表

生存模块ui上的大表盘,获取体系时间显示。
data_biao.h
data_biao.cpp
应用


其中有视频、音乐、天气、地图模块。
use.h
  1. #ifndef USE_H
  2. #define USE_H
  3. #include <QWidget>
  4. #include <QDebug>
  5. #include <myMap/mymap.h>
  6. #include <musicplay/musicplay.h>
  7. #include <video/video.h>
  8. namespace Ui {
  9. class Use;
  10. }
  11. class Use : public QWidget
  12. {
  13.     Q_OBJECT
  14. public:
  15.     explicit Use(QWidget *parent = nullptr,QWidget *parent1 = nullptr);
  16.     ~Use();
  17.     void useName(bool);
  18.     void wifi_judge(bool);       //  获取wifi是否可以使用
  19.     void hide_all();
  20. private slots:
  21.     void on_pushButton_video_clicked();
  22.     void on_pushButton_music_clicked();
  23.     void on_pushButton_browser_clicked();
  24.     void on_pushButton_weather_clicked();
  25.     void on_pushButton_map_clicked();
  26.     void on_pushButton_radio_clicked();
  27. signals:
  28.     void weather_show();
  29.     void hide_show_use();
  30. private:
  31.     Ui::Use *ui;
  32.     MyMap *mymap;
  33.     MusicPlay *musicPlay;
  34.     Video *video;
  35.     QWidget *use_ui;
  36.     bool wifi_judge_;
  37. };
  38. #endif // USE_H
复制代码
use.cpp
  1. #include "use.h"
  2. #include "ui_use.h"
  3. Use::Use(QWidget *parent,QWidget *parent1) :
  4.     QWidget(parent),
  5.     ui(new Ui::Use)
  6. {
  7.     ui->setupUi(this);
  8.     use_ui = new QWidget(parent1);
  9.     use_ui->setFixedSize(1024,600);
  10.     use_ui->hide();
  11.     mymap = new MyMap(use_ui);
  12.     mymap->hide();
  13.     musicPlay = new MusicPlay(use_ui);
  14.     musicPlay->setAttribute(Qt::WA_StyledBackground); //  脱离父类窗口
  15.     musicPlay->hide();
  16.     video = new Video(use_ui);
  17.     video->hide();
  18. }
  19. Use::~Use()
  20. {
  21.     delete ui;
  22. }
  23. void Use::useName(bool use_name)
  24. {
  25.     if(use_name)  //  显示
  26.     {
  27.         ui->label_browser->show();
  28.         ui->label_map->show();
  29.         ui->label_music->show();
  30.         ui->label_raido->show();
  31.         ui->label_video->show();
  32.         ui->label_weather->show();
  33.     }
  34.     else
  35.     {
  36.         ui->label_browser->hide();
  37.         ui->label_map->hide();
  38.         ui->label_music->hide();
  39.         ui->label_raido->hide();
  40.         ui->label_video->hide();
  41.         ui->label_weather->hide();
  42.     }
  43. }
  44. void Use::wifi_judge(bool wifiJudge)
  45. {
  46.     wifi_judge_ = wifiJudge;
  47. }
  48. void Use::hide_all()
  49. {
  50.     mymap->hide();
  51.     musicPlay->hide();
  52.     video->hide();
  53.     use_ui->hide();
  54.     //use_ui->setStyleSheet("background-color: rgb(0, 0, 0);");
  55. }
  56. void Use::on_pushButton_video_clicked()
  57. {
  58.     use_ui->show();
  59.     video->show();
  60.     emit hide_show_use();
  61. }
  62. void Use::on_pushButton_music_clicked()
  63. {
  64.     use_ui->show();
  65.     //use_ui->setStyleSheet("background-color: rgb(81, 81, 81);");
  66.     musicPlay->show();
  67.     emit hide_show_use();
  68. }
  69. void Use::on_pushButton_browser_clicked() //浏览器
  70. {
  71.     qDebug()<<"\n暂无“浏览器”功能,作者会努力的!!!";
  72. }
  73. void Use::on_pushButton_weather_clicked()
  74. {
  75.     if(wifi_judge_)
  76.         emit weather_show();
  77.     else
  78.         qDebug()<<"没用检测到网络信号!!!";
  79. }
  80. void Use::on_pushButton_map_clicked()
  81. {
  82.     if(wifi_judge_)
  83.     {
  84.         use_ui->show();
  85.         mymap->show();
  86.         emit hide_show_use();
  87.     }
  88.     else
  89.         qDebug()<<"没用检测到网络信号!!!";
  90. }
  91. void Use::on_pushButton_radio_clicked()
  92. {
  93.     qDebug()<<"\n暂无“收音机”功能,作者会努力的!!!";
  94. }
复制代码
视频


video.h
video.cpp
音乐


musicplay.h
lyic.h
musicplay.cpp
lyic.cpp
地图


mymap.h
map.h
longitudelatitude.h
mymap.cpp
map.cpp
longitudelatitude.cpp
工具


其中有wifi、灯、倒车影像、文件夹、设置、使用先容、指南针模块。
tool.h
  1. #ifndef TOOL_H
  2. #define TOOL_H
  3. #include <QWidget>
  4. #include <QTimer>
  5. #include <QTextEdit>
  6. #include <QLabel>
  7. #include <QDebug>
  8. #include <compass/compass.h>
  9. #include <key/ap3216c.h>
  10. #include <key/icm20608.h>
  11. #include <key/led.h>
  12. #include <folder/folder.h>
  13. #include <wifi/wifi.h>
  14. #include <set_arm/set_arm.h>
  15. //#include <camera/camera.h>
  16. namespace Ui {
  17. class Tool;
  18. }
  19. class Tool : public QWidget
  20. {
  21.     Q_OBJECT
  22. public:
  23.     explicit Tool(QWidget *parent = nullptr,QWidget *parent1 = nullptr);
  24.     ~Tool();
  25.     void useName(bool);
  26.     void hide_all();
  27. private slots:
  28.     void on_pushButton_folder_clicked();
  29.     void on_pushButton_light_clicked();
  30.     void on_pushButton_backcar_clicked();
  31.     void on_pushButton_wifi_clicked();
  32.     void on_pushButton_instructions_clicked();
  33.     void on_pushButton_set_clicked();
  34. signals:
  35.     void wifi_judge(bool);
  36.     void hide_show_tool();
  37.     void bizi_path(QString);
  38.     void use_name(bool);
  39. private:
  40.     Ui::Tool *ui;
  41.     Folder *folder;
  42.     //Camera *camera;
  43.     QWidget *tool_ui;
  44.     QTextEdit *textEdit_instructions;
  45.     Compass *compss;
  46.     QLabel *compss_label;
  47.     Set_arm *set_arm;
  48. #ifdef Q_OS_LINUX
  49.     Led *led;
  50.     ICM20608 *icm20608;
  51.     Ap3216c *ap3216c;
  52.     Wifi *wifi;
  53.     bool led_state;
  54.     int led_big;
  55. #endif
  56.     QString instructions_QString = "\n#####使用说明#####\n\n"
  57.                                    "#欢迎大家使用,借鉴。本程序借鉴了很多网上大佬的开源资料,勿喷。\n"
  58.                                    "\n#程序是按照正点原子IMX6U阿尔法开发板来编写的,其中几个模块功能需要"
  59.                                    "板载硬件才可以实现。\n"
  60.                                    "\n#WiFi功能模块,是需要板子购买时赠送的wifiUSB模块的,wifi程序是直接"
  61.                                    "调用板载驱动,进行连接wifi和查看周围wifi。\n"
  62.                                    "\n#地图功能模块是(天地图)连接api,获取地图、经纬度数据,地名搜索经纬"
  63.                                    "度不太准确,导致地图图片不太准确,搜索地标性建筑还是可以的,建议"
  64.                                    "把api改为高德或者百度的应该会好一点。\n"
  65.                                    "\n#指南针是根据板载硬件ICM20608六轴传感器其中的x、y轴来计算的,指南"
  66.                                    "针不准(作者较为废物,建议修改一下)。\n"
  67.                                    "\n#倒车影像功能模块,使用OpenCV来实现的。\n"
  68.                                    "\n#天气功能模块,连接api获取天气,作者这个api比较捞(次数少),建议更"
  69.                                    "换,钟表后面显示当前天气状况,天气应用有两个界面,界面1,当天的天气情"
  70.                                    "况,单机屏幕切换界面2,未来5天的天气情况。\n"
  71.                                    "\n#键盘输入中文功能模块,是应用开源大佬\n"
  72.                                    "https://github.com/justdoit-mqr/softkeyboard。\n"
  73.                                    "\n#浏览器功能和收音机功能,暂时还没有开发,各位大佬可以自行研究。\n\n"
  74.                                    "\n#####建议#####\n\n"
  75.                                    "#有一些默认的路径可以自己根据自己电脑进行更改,如:默认连接的wifi,文件"
  76.                                    "夹功能模块下windows下的路径等。\n"
  77.                                    "\n#键盘功能开启了两次,可以自己优化为一次。\n"
  78.                                    "\n#语音识别功能模块(voice)是根据百度语音识别来实现的,因为有时不太"
  79.                                    "准确,本程序没有使用,可以自行添加该功能。也可以购买模块编写驱动来实现语音功能。\n";
  80. };
  81. #endif // TOOL_H
复制代码
tool.cpp
  1. #include "tool.h"
  2. #include "ui_tool.h"
  3. #include <math.h>
  4. Tool::Tool(QWidget *parent,QWidget *parent1) :
  5.     QWidget(parent),
  6.     ui(new Ui::Tool)
  7. {
  8.     ui->setupUi(this);
  9.     tool_ui = new QWidget(parent1);
  10.     tool_ui->setFixedSize(1024,600);
  11.     tool_ui->hide();
  12.     //  使用介绍
  13.     textEdit_instructions = new QTextEdit(tool_ui);
  14.     textEdit_instructions->setReadOnly(true);  //  只读
  15.     textEdit_instructions->setStyleSheet("font: 13pt "宋体";");
  16.     textEdit_instructions->resize(tool_ui->size());
  17.     textEdit_instructions->append(instructions_QString);
  18.     textEdit_instructions->hide();
  19.     //  指南针
  20.     compss = new Compass(ui->widget_compass);
  21.     compss_label = new QLabel(this);
  22.     compss_label->resize(140,40);
  23.     compss_label->move(this->width()*2/3+6,this->height()*7/8);
  24.     compss_label->setAlignment(Qt::AlignCenter);
  25.     compss_label->setStyleSheet("font: 28pt "宋体";");
  26.     compss_label->setText("指南针");
  27.     //  文件夹
  28.     folder = new Folder(tool_ui);
  29.     folder->hide();
  30.     //  设置
  31.     set_arm = new Set_arm(tool_ui);
  32.     set_arm->hide();
  33.     //  倒车影像
  34.     //camera = new Camera(tool_ui);
  35.     //camera->hide();
  36. #ifdef Q_OS_LINUX
  37.     //  灯
  38.     led = new Led(this);
  39.     led_state = false;
  40.     //  六轴传感器
  41.     icm20608 = new ICM20608(this);
  42.     //  光、距离、红外传感器i
  43.     ap3216c = new Ap3216c(this);
  44.     //  WFi
  45.     wifi = new Wifi(tool_ui);  //  会默认连接wifi
  46.     wifi->hide();
  47.     connect(wifi,&Wifi::wifi_judge,[=](bool judge){ //  获取wifi连接是否成功
  48.         emit wifi_judge(judge);
  49.     });
  50.     connect(ap3216c,&Ap3216c::ap3216cDataChanged,[=]{
  51.         if(ap3216c->alsData().toInt() <= 5 || ap3216c->alsData().toInt() >= 700)
  52.         {
  53.             if(led_big <= 0)
  54.             {
  55.                 on_pushButton_light_clicked();
  56.                 led_big=1;
  57.             }
  58.         }
  59.     });
  60.     connect(icm20608,&ICM20608::icm20608DataChanged,[=]{
  61.         //  温度
  62.         if(icm20608->tempData()>= 36)
  63.         {
  64.             ui->label_temp_number->setStyleSheet("color:red;");
  65.         }
  66.         else
  67.         {
  68.             ui->label_temp_number->setStyleSheet("color:black;");
  69.         }
  70.             ui->label_temp_number->setText(icm20608->tempData() + "℃");
  71.         //  指南针数据改变
  72.         float gxdata = icm20608->gxData().toFloat() * 10;
  73.         float gydata = icm20608->gyData().toFloat() * 10;
  74.         if(gxdata < 0)
  75.         {
  76.             if(gydata < 0)
  77.                 compss->set_direction(180+sqrt((-gxdata)*(-gxdata)+(-gydata)*(-gydata)));
  78.             else
  79.                 compss->set_direction(270+sqrt((-gxdata)*(-gxdata)+(-gydata)*(-gydata)));
  80.         }else{
  81.             if(gydata < 0)
  82.                 compss->set_direction(90+sqrt((-gxdata)*(-gxdata)+(-gydata)*(-gydata)));
  83.             else
  84.                 compss->set_direction(sqrt((-gxdata)*(-gxdata)+(-gydata)*(-gydata)));
  85.         }
  86.     });
  87. #endif
  88.     connect(set_arm,&Set_arm::bizi_path,[this](QString bizi_path_){
  89.                 emit bizi_path(bizi_path_);
  90.             });
  91.     connect(set_arm,&Set_arm::use_name,[this](bool use_name_){
  92.                 emit use_name(use_name_);
  93.             });
  94.     //connect(camera,&Camera::close_camera,this,&Tool::hide_all);
  95. }
  96. Tool::~Tool()
  97. {
  98.     delete ui;
  99. }
  100. void Tool::useName(bool use_name_xianshi)//  名字显示?
  101. {
  102.     if(use_name_xianshi)  //  显示
  103.     {
  104.         ui->label_backcar->show();
  105.         ui->label_folder->show();
  106.         ui->label_instructions->show();
  107.         ui->label_light->show();
  108.         ui->label_set->show();
  109.         ui->label_wifi->show();
  110.         compss_label->show();
  111.     }
  112.     else
  113.     {
  114.         ui->label_backcar->hide();
  115.         ui->label_folder->hide();
  116.         ui->label_instructions->hide();
  117.         ui->label_light->hide();
  118.         ui->label_set->hide();
  119.         ui->label_wifi->hide();
  120.         compss_label->hide();
  121.     }
  122. }
  123. void Tool::hide_all() // 关闭
  124. {
  125.     textEdit_instructions->hide();
  126.     folder->hide();
  127.     //camera->close_camera();//  关闭摄像头
  128.     //camera->hide();
  129.     tool_ui->hide();
  130.     set_arm->hide();
  131. #ifdef Q_OS_LINUX
  132.     wifi->hide();
  133. #endif
  134. }
  135. void Tool::on_pushButton_folder_clicked()
  136. {
  137.     folder->show();
  138.     tool_ui->show();
  139.     emit hide_show_tool();
  140. }
  141. void Tool::on_pushButton_light_clicked()
  142. {
  143. #ifdef Q_OS_LINUX
  144.     if(!led_state)
  145.     {
  146.         led->on_led_clicked(true);
  147.         ui->pushButton_light->setStyleSheet("border-image: url(:/car_terminall/light1.png);");
  148.         led_state = true;
  149.     }
  150.     else // 关灯
  151.     {
  152.         led->on_led_clicked(false);
  153.         ui->pushButton_light->setStyleSheet("border-image: url(:/car_terminall/light0.png);");
  154.         led_state = false;
  155.     }
  156. #endif
  157. #ifdef Q_OS_WIN32
  158.     qDebug()<<"\nWindow无法启用该模块!!!";
  159. #endif
  160. }
  161. void Tool::on_pushButton_backcar_clicked()
  162. {
  163.     //camera->show();
  164.     //camera->open_camera();
  165.     tool_ui->show();
  166.     emit hide_show_tool();
  167. }
  168. void Tool::on_pushButton_wifi_clicked()
  169. {
  170. #ifdef Q_OS_LINUX
  171.     wifi->show();
  172.     tool_ui->show();
  173.     emit hide_show_tool();
  174. #endif
  175. #ifdef Q_OS_WIN32
  176.     qDebug()<<"\nWindow无法启用该模块!!!";
  177. #endif
  178. }
  179. void Tool::on_pushButton_instructions_clicked()
  180. {
  181.     textEdit_instructions->show();
  182.     tool_ui->show();
  183.     emit hide_show_tool();
  184. }
  185. void Tool::on_pushButton_set_clicked()
  186. {
  187.     set_arm->show();
  188.     tool_ui->show();
  189.     emit hide_show_tool();
  190. }
复制代码
wifi


wifi.h
mima.h
wifi.cpp
mima.cpp


板载资源,按键旁的小灯。
led.h
led.cpp
倒车影像

window可以使用,linux也可以使用,就是烧录不到arm板。
camera.h
camera.cpp
文件夹


folder.h
folder.cpp
设置


set_arm.h
set_arm.cpp
指南针


compass.h
compass.cpp
留意


  • 该程序先毗连网络在启动,否则可能打不开
  • 打开应用后,按板子黄色按键退出应用。
  • 地图不支持双指超作,由于板子不支持,所以没法编写。
  • 浏览器和收音机模块,暂无开辟。
下载毗连

百度网盘:下载
链接:https://pan.baidu.com/s/10HYNU7tbgD5BJQ1SK5Zd9w?pwd=1111
提取码:1111
感谢各位大大的点赞。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

乌市泽哥

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表