赞
踩
基于ARM+Linux的车载系统
本项目计划主要应用于家用,办公等领域轿车中实施的基于物联网云平台的车载系统项目,既能够为车主在行驶过程中提供舒适的体验,又能提供一定的安全保障。
资源链接:毕设&竞赛&项目&实训-基于ARM+Linux的车载系统(完整工程代码用户开发手册)资源-CSDN文库
本项目在实现了基本的功能包括实时时钟,天气预报,车内温湿度获取,照片显示,音乐播放器等功能还增加了汽车倾倒短信报警,APP数据互传,温度过高报警等功能,其中控制方面通过APP,触摸屏两种方式对车载系统的控制与数据显示,且能够将当前车内的环境与信息显示在触摸屏与APP上,并搭配温度传感器,陀螺仪等模块实现基本的智能化数据收集,搭配上GPS模块与短信模块,实现汽车倾倒时将准确经纬度信息发送至指定的用户手机上。部署在华为云服务器上实现远程数据通信与控制,使人们能够无距离限制地查看当前汽车所处的准确经纬度信息与当前车内的环境,通过网络模块,获取当前的网络时间与未来五天的天气情况,能够方便车主更好地预防位置的天气变化,提高了生活和事业上的效率,并且在车载系统中提供了音乐播放器功能,不仅实现了市面上存在的音乐播放器的所有功能,还提高了UI界面的美观性。通过上述功能的全方位服务,不仅实现了汽车在行驶过程中舒适的体验,更提高了车主的安全保障,真正让车主放心,家人安心的智能车载系统。
该系统不仅能保证车主在形式过程中安全地驾驶,并且因为加上了短信模块与GPS模块,通过姿态传感器检测当前汽车行驶的状态,当检测到汽车倾倒时,就可以立即通过短信模块,将当前的GPS信息,即经纬度信息发送给指定的用户,能够让对方立即接收到车祸的信息,并且能够及时地进行报警与打电话急救,这极大地保证了用户的安全性,并且加上网络模块,在车载系统中添加APP互传功能,当用户登录APP时,就可以随时查看当前汽车所处的位置与车内信息,如果用户发现异常时,就可以即使做出处理
通过网络模块的帮助,用户能够实时查看车内信息以及汽车的形式状态,无论是汽车在行驶过程中还是停下,或是进入隧道,用户都可以通过手机APP,实时地查看汽车。
通过QT实现的UI界面,在完成基本的汽车车载系统的功能下还尽可能的美化界面,QT作为嵌入式上位机设计软件,是市面上最常见的UI界面设计软件,能够满足大部分的界面的设计,并且,也能够保证所有的功能正常运行。
该车载系统不仅能够完成危险报警与APP数据互传控制,在极尽美观的基础上,还完成了车载系统该有的功能,包括音乐播放器,图片显示,天气预报获取,车内温湿度查看等多种功能。
在如今许多家庭都已经买车的基础上,车载系统作为汽车必备的功能,无论是上百万元的高档车还是几万的家用型轿车,都存在着车载系统,因此该项目是被市场普遍认可的,市场接受能力极高。
在台湾车载资通讯产业2012年的产值约为4,026亿新台币。透过经济部之推动协助,台湾产业于2015年时达成突破6,000亿元年产值的目标。进而整合ITS/Telematics创新技术应用,提供全面“智慧化交通运输服务”,进行整体交通网络与跨运具之计划,建立智慧车载系统,达成流畅交通路网服务与无缝隙智慧旅运生活 [1] 。此外,台湾产业界近年来亦积极投入车联网智慧车载产品之研发,如科技大厂华硕(ASUS)、宏碁(ACER)与新创公司谛诺科技(ADENOVO)...等均争相投入这块新蓝海。
在国际中由全球移动通信系统协会(GSMA)近期发布的报告指出,从2012年原先的130亿欧元(5千亿台币),预估到2018年全球车载资通讯系统的市场规模将达到约390亿欧元(新台币1.5兆元),显示智慧联网结合车载资通讯系统之商机正逐年翻倍成长。
(1)音乐播放器:车载系统中的音乐播放器是最常见的功能,因此该项目中,音乐播放器也作为主要的项目开发进行,不仅摆脱了传统音乐播放器中丑陋的UI界面与操作难,更提升了音质与蓝牙音乐播放
(2)实时时钟:车载系统中,通过网络模块,获取当前的北京时间,方便车主实时查看时间,安排生活或办公的计划,并且,可以设置提醒功能,当某个时间需要做某事时,可以设定提醒功能,方便日常生活和工作的安排
(3)照片显示:在车载系统中,可以存放车主的照片,并且选择自己喜欢的照片作为车载系统的主页
(1)汽车倾倒短信报警:通过姿态检测模块,实时检测汽车的姿态,当检测到汽车发生倾倒时,及时地通过短信模块,将当前的GPS信息通过短信方式发送至指定的用户手机,使得车主能第一时间得到治疗,极大地保证了车主的安全。
(2)车内温湿度:车内温湿度信息的显示,不仅方便车主查看,及时地调整,还方便用户通过手机APP查看该信息,并且当检测到车内有人而温度又过高的情况下会触发短信报警以及蜂鸣器报警向路人请求援助,避免当有人在车内时,车门紧锁而导致温度过高发生的惨状
(3)上位机APP开发:手机APP的实现,使得车主的家人能够足不出户就可以观察到车主当前所处汽车的状态,并且当车主发生危险时,及时地进行报警,并且当用户在汽车内时,也可以通过APP实现切歌,更换相册等功能。
(4)天气预报显示:在车载系统中,提供了未来五天的天气情况显示,并且支持三个城市间的切换,当方便车主及时地根据未来几天的天气情况安排出行。
在完成市面上的车载系统基本的音乐播放器,实时时钟,天气预报等功能的实现的基础上,额外增加了温度过高报警,手机APP上位机实现,汽车倾倒报警,车载系统主界面DIY设计等功能,保护了车主的人身安全,并且增加了车载系统的美观度
该项目硬件方面是选择了I.MX6ULL,操作系统使用Linux,并且在此基础上,增加了QT作为UI界面开发工具,I.MX6ULL作为ARM公司生产的A7系列芯片,能够满足该项目的开发需求,并且Linux作为项目的车载系统,因为其稳定,开源,兼容各种硬件的优点,是主流的嵌入式操作系统,而QT作为嵌入式开发上位机的应用程序,有大量的插件与开源库提供,为项目成功开发提供了稳定的报账
陀螺仪模块所选择的是MPU6050,因为其便宜,功能稳定,使用I2C通信的特性,所以方便在项目开发中使用
温湿度检测通过DHT11实现,该模块使用单总线通信,能够同时识别温湿度,并且占用IO资源少,精度高
通过QT实现的车载系统界面的设计,该软件不仅在市面上得到了广泛的应用,还支持各平台的兼容性,因此可靠性得到了极大的保证,并且QT中还提供了多种UI界面的选择,也为车载系统UI界面美化设计提供了便利。
手机上位机APP也是通过QT进行开发,因此能够完美地实现与车载系统的通信,无论是基本的数据传输还是车载系统控制,该APP都能过完美地实现。
通过GPS模块实现,该模块连接北斗系统,能够实时地获取当前模块所处的经纬度信息,并且通过串口,将数据传给车载系统与上位机中。
该项目需要实现陀螺仪(MPU6050),蜂鸣器,DHT11,串口等底层驱动的实现,因为不同的模块所需要的底层驱动代码不同,而公用一个设备树,因此就需要将所有的驱动和设备树进行匹配,并且完成设备的初始化与注册。
- #include "main_window.h"
- #include "ui_main_window.h"
- #include <QDebug>
- #include <QRect>
- #include <QToolButton>
- #include <QColor>
- #include <QMovie>
- #include <QTimer>
- #include <QtNetwork/QNetworkAccessManager>
- #include <QtNetwork/QNetworkRequest>
- #include <QtNetwork/QNetworkReply>
- #include <QtWidgets/QWidget>
- #include <QTextCodec>
- #include <QString>
- #include <QUrl>
- #include <QThread>
- #include <QMediaPlayer>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <QString>
- #include "mpu6050.h"
- Main_Window::Main_Window(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::Main_Window)
- {
-
- ui->setupUi(this);
- this->Beep_page = new Beep_window;//实例化led窗口
- this->Music_page = new Music_window;
- this->Pichoose_page = new Pichoose_window;
- this->Map_page = new Map_window;
- this->dht11_obj = new dht11;
- this->mpu6050_obj = new Mpu6050;
- /*dht11与mpu6050的初始化*/
- ui->dht11temp->setText("x");
- ui->dht11hum->setText("x");
-
- mpu6050_dht11_init();
-
- ui->change->installEventFilter(this);
- time_weather_data my_data(this);
- weather_init(city_id);
- my_data.get_time(&(this->year),&(this->month),&(this->day),&(this->hour),&(this->minute),&(this->second),&(this->time_flag));
- timer_obj = new QTimer(this);
- connect(this->timer_obj,&QTimer::timeout,[=](){
- this->second++;
- /*更新dht11和mpu6050的值*/
- if(this->second%2==0){
- show_mpu6050_dht11();
- }
- if(old_picture_flag != picture_flag){
- QPixmap pbuty;
- //QString str = QString::number();
- picture_name.append(Pichoose_page->PicturePath);
- picture_name.append(Pichoose_page->fileList.at(picture_flag));
- pbuty.load(picture_name);
- ui->gif_label->setPixmap(pbuty);
- ui->gif_label->setScaledContents(true);
- picture_name = "\0";
- old_picture_flag = picture_flag;
- }
- if(this->second >= 60){
- this->second = 0;
- this->minute++;
- // weather_init();
- if(this->minute >=60){
-
- this->minute = 0;
- this->hour++;
- if(this->hour>=24){
- this->hour = 0;
- this->day++;
- weather_init(city_id);
- //接下来做月份,闰年判断,不想写了
- }
- }
- update();
- }
- });
- this->show_mainwindow();
- timer_obj->start(1000);
- }
- void Main_Window::show_mpu6050_dht11(){
- int ret = dht11_obj->read_dht11_data(dht11_obj->dht11_temp,dht11_obj->dht11_hum);
- if(ret == 0){
- QString str1(dht11_obj->dht11_temp);
-
- ui->dht11temp->setText(str1);
- QString str2(dht11_obj->dht11_hum);
- ui->dht11hum->setText(str2);
- }
- // qDebug()<<"read mpu6050\r\n";
- mpu6050_obj->read_mpu6050_data(mpu6050_obj->acce_x,mpu6050_obj->acce_y,mpu6050_obj->acce_z,mpu6050_obj->gyro_x,mpu6050_obj->gyro_y,mpu6050_obj->gyro_z);
- QString str1(mpu6050_obj->acce_x);
- ui->accex->setText(str1);
- QString str2(mpu6050_obj->acce_y);
- ui->accey->setText(str2);
- QString str3(mpu6050_obj->acce_z);
- ui->accez->setText(str3);
- QString str4(mpu6050_obj->gyro_x);
- ui->gyrox->setText(str4);
- QString str5(mpu6050_obj->gyro_y);
- ui->gyroy->setText(str5);
- QString str6(mpu6050_obj->gyro_z);
- ui->gyroz->setText(str6);
- // qDebug()<<mpu6050_data<<"\r\n ok \r\n";
- }
- void Main_Window::mpu6050_dht11_init(){
- QPalette dht11_pe;
- dht11_pe.setColor(QPalette::WindowText,Qt::white);
- ui->dht11temp->setPalette(dht11_pe);
- ui->dht11hum->setPalette(dht11_pe);
- ui->accex->setPalette(dht11_pe);
- ui->accey->setPalette(dht11_pe);
- ui->accez->setPalette(dht11_pe);
- ui->gyrox->setPalette(dht11_pe);
- ui->gyroy->setPalette(dht11_pe);
- ui->gyroz->setPalette(dht11_pe);
- }
- void Main_Window::show_mainwindow(){
-
- QPalette pe;
- pe.setColor(QPalette::WindowText,Qt::white);
-
- QPixmap pic(":/picture/weather_window/切换.png");
- ui->change->setPixmap(pic);
- ui->change->setScaledContents(true);
- /*主菜单栏的右侧*/
- QPalette pex;
- pex.setColor(QPalette::ButtonText,Qt::white); //文字颜色
- pex.setColor(QPalette::Button ,QColor(0,64,128)); //背景色
-
- ui->Beep_but->setStyleSheet("QToolButton{background-color: rgb(0,64,128);border:2px groove gray;border-radius:10px;padding:2px 4px;border-style: outset;}"
- "QToolButton:hover{background-color:rgb(0,64,128); color: white;}"
- "QToolButton:pressed{background-color:rgb(0,54,108);border-style: inset;}");
-
- ui->Crema_but->setStyleSheet("QToolButton{background-color: rgb(0,64,128);border:2px groove gray;border-radius:10px;padding:2px 4px;border-style: outset;}"
- "QToolButton:hover{background-color:rgb(0,64,128); color: white;}"
- "QToolButton:pressed{background-color:rgb(0,54,108);border-style: inset;}");
- ui->Picture_but->setStyleSheet("QToolButton{background-color: rgb(0,64,128);border:2px groove gray;border-radius:10px;padding:2px 4px;border-style: outset;}"
- "QToolButton:hover{background-color:rgb(0,64,128); color: white;}"
- "QToolButton:pressed{background-color:rgb(0,54,108);border-style: inset;}");
- ui->Music_but->setStyleSheet("QToolButton{background-color: rgb(0,64,128);border:2px groove gray;border-radius:10px;padding:2px 4px;border-style: outset;}"
- "QToolButton:hover{background-color:rgb(0,64,128); color: white;}"
- "QToolButton:pressed{background-color:rgb(0,54,108);border-style: inset;}");
-
-
- ui->Beep_but->setPalette(pex);
- ui->Crema_but->setPalette(pex);
- ui->Picture_but->setPalette(pex);
- ui->Music_but->setPalette(pex);
-
- ui->Beep_but->setIcon(QIcon(":/picture/main_window/喇叭.png"));
- ui->Beep_but->setIconSize(QSize(201,105));
- ui->Beep_but->setText(QString::fromLocal8Bit("喇叭"));
- ui->Beep_but->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-
- ui->Crema_but->setIcon(QIcon(":/picture/main_window/天气.png"));
- ui->Crema_but->setIconSize(QSize(201,105));
- ui->Crema_but->setText(QString::fromLocal8Bit("天气"));
- ui->Crema_but->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-
- ui->Picture_but->setIcon(QIcon(":/picture/main_window/picture.png"));
- ui->Picture_but->setIconSize(QSize(201,105));
- ui->Picture_but->setText(QString::fromLocal8Bit("照片"));
- ui->Picture_but->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-
- ui->Music_but->setIcon(QIcon(":/picture/main_window/music.png"));
- ui->Music_but->setIconSize(QSize(201,105));
- ui->Music_but->setText(QString::fromLocal8Bit("音乐"));
- ui->Music_but->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-
- /*桌面照片*/
- QPixmap pbuty;
- QString str = QString::number(picture_flag);
- picture_name.append(Pichoose_page->PicturePath);
- picture_name.append(str);
- picture_name.append(".jpg");
- pbuty.load(picture_name);
- ui->gif_label->setPixmap(pbuty);
- ui->gif_label->setScaledContents(true);
- picture_name = "\0";
- }
- Main_Window::~Main_Window()
- {
- delete ui;
- }
- void Main_Window::paintEvent(QPaintEvent *event){
- QPainter my_painter(this);
- QPen pen(QColor(255,255,255));
- QFont font;
- font.setFamily("Microsoft YaHei");
-
- my_painter.setPen(pen);
-
- /*背景颜色*/
- my_painter.setBrush(QBrush(QColor(234,254,254)));
- my_painter.drawRect(this->rect());
- /*第一个框*/
- my_painter.setBrush(QBrush(QColor(0,64,128)));
- QRectF first_rect(9,9,330,151);
- my_painter.drawRoundedRect(first_rect, 10, 10);
- //时分妙
- font.setPointSize(60);
- my_painter.setFont(font);
- char strNum[5];
- sprintf(strNum,"%02d",this->hour);//整形到字符串的转换,并且自动补0
- my_painter.drawText(QRect(14,5,150,100),strNum);
-
- my_painter.drawText(QRect(105,0,20,100),":");
- sprintf(strNum,"%02d",this->minute);
- my_painter.drawText(QRect(130,5,150,100),strNum);
- font.setPointSize(30);
- my_painter.setFont(font);
-
- if(this->time_flag == 0) my_painter.drawText(QRect(235,50,100,100),"AM");
- else if(this->time_flag == 1) my_painter.drawText(QRect(235,50,100,100),"PM");
- //分界线
- my_painter.drawLine(QPoint(9,120),QPoint(338,120));
- //年月日
- font.setPointSize(16);
- my_painter.setFont(font);
-
- sprintf(strNum,"%04d",this->year);
- my_painter.drawText(QRect(16,125,100,100),strNum);
- my_painter.drawText(QRect(70,125,100,100),"年");
- sprintf(strNum,"%02d",this->month);
- my_painter.drawText(QRect(100,125,100,100),strNum);
- my_painter.drawText(QRect(130,125,100,100),"月");
- sprintf(strNum,"%02d",this->day);
- for(int i=1;i<=31;i++){
- if(i==this->day) my_painter.drawText(QRect(160,125,100,100),strNum);
- }
- my_painter.drawText(QRect(190,125,100,100),"日");
- /*第二个框*/
- QRectF second_rect(9,166,330,151);
- my_painter.drawRoundedRect(second_rect, 10, 10);
- //天气
- font.setPointSize(13);
- my_painter.setFont(font);
-
- // qputenv("QT_IM_MODULE", QByteArray("xyinput"));
- switch (this->weather) {
- case 0:{my_painter.drawPixmap(200,180,100,100,QPixmap(":/picture/main_window/weather/晴天.png"));
- my_painter.drawText(QRect(230,285,150,50),"晴天");
- }break;
- case 1:{my_painter.drawPixmap(200,180,100,100,QPixmap(":/picture/main_window/weather/雨天.png"));
- my_painter.drawText(QRect(230,285,150,50),"雨天");
- }break;
- case 2:{my_painter.drawPixmap(200,180,100,100,QPixmap(":/picture/main_window/weather/多云.png"));
- my_painter.drawText(QRect(230,285,150,50),"多云");
- }break;
- case 3:{my_painter.drawPixmap(200,180,100,100,QPixmap(":/picture/main_window/weather/阵雪.png"));
- my_painter.drawText(QRect(230,285,150,50),"雪天");
- }break;
- case 4:{my_painter.drawPixmap(200,180,100,100,QPixmap(":/picture/main_window/weather/阴天.png"));
- my_painter.drawText(QRect(230,285,150,50),"阴天");
- }break;
- }
- //地点
- font.setPointSize(25);
- my_painter.setFont(font);
- my_painter.drawText(QRect(14,166,150,50),Map_page->city_name);
- //温度
- font.setPointSize(45);
- my_painter.setFont(font);
- sprintf(strNum,"%02d",this->tempature);
- my_painter.drawText(QRect(14,210,150,80),strNum);
- my_painter.drawText(QRect(90,210,150,80),"°C");
- //第三个框
- QRectF third_rect(9,323,330,151);
- my_painter.drawRoundedRect(third_rect, 10, 10);
- font.setPointSize(13);
- my_painter.setFont(font);
- /* if(this->wifi_state == 1){
- my_painter.drawPixmap(50,340,100,100,QPixmap(":/picture/main_window/wifi.png"));
- my_painter.drawText(QRect(70,440,150,80),"已连接");
- }
- else{
- my_painter.drawPixmap(50,340,100,100,QPixmap(":/picture/main_window/没wifi.png"));
- my_painter.drawText(QRect(70,440,150,80),"未连接");
- }*/
-
-
-
-
- /* if(this->lanya_state == 0){
- my_painter.drawPixmap(200,340,100,100,QPixmap(":/picture/main_window/蓝牙-关.png"));
- my_painter.drawText(QRect(220,440,150,80),"未连接");
- }
- else{
- my_painter.drawPixmap(200,340,100,100,QPixmap(":/picture/main_window/蓝牙.png"));
- my_painter.drawText(QRect(220,440,150,80),"已连接");
- }*/
-
- }
-
-
- void Main_Window::on_Beep_but_clicked()
- {
- this->hide();
- this->Beep_page->show();
- this->GPIO_File->open(QIODevice::WriteOnly);
- this->GPIO_File->write("19",2);
- this->GPIO_File->close();
- }
-
- void Main_Window::on_Crema_but_clicked()
- {
- this->hide();
- this->Map_page->show();
- }
- void Main_Window::on_Music_but_clicked()
- {
- this->hide();
- this->Music_page->show();
- }
- void Main_Window::weather_init(QString id){
- QString webaddr="http://wthrcdn.etouch.cn/weather_mini?citykey=";
- webaddr.append(id);
- QNetworkRequest network_request;
- network_request.setUrl(QUrl(webaddr));
- connect(manage,SIGNAL(finished(QNetworkReply *)),this,SLOT(replyfinished(QNetworkReply*)));
- manage->get(network_request);
- }
- void Main_Window::replyfinished(QNetworkReply *reply)
- {
- QVariant status_code = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
-
- if(reply->error() == QNetworkReply::NoError)
- {
- QString all = reply->readAll();
- // qDebug()<<all;
- weather_dispose(all);
- }
- reply->deleteLater();
- }
- void Main_Window::weather_dispose(QString str){
- QByteArray byte_array;
- QJsonParseError json_error;
- QJsonDocument document = QJsonDocument::fromJson(byte_array.append(str),&json_error);
- if(json_error.error == QJsonParseError::NoError)
- {
- QJsonObject obj = document.object();
- QJsonValue value = obj.take("desc");//qjsonvalue生成json文档中对象的值的对象
- if(value.toString() != "OK")
- {
- QMessageBox::warning(this,QString::fromLocal8Bit("抱歉"),QString::fromLocal8Bit("暂无此城市信息"),QMessageBox::Ok,QMessageBox::Ok);
- QMessageBox::warning(this,"抱歉","暂无此城市的天气情况",QMessageBox::Ok,QMessageBox::Ok);
- return;
- }
- QJsonValue da = obj.take("data");//获取data数据对象里面的值
-
- QString wendu = da.toObject().take("low").toString();
- this->tempature = wendu.toInt();
-
- QJsonValue da1 = da.toObject().take("forecast");
- QJsonArray array = da1.toArray();
-
- qDebug()<<array;
- QJsonValue value1 = array.at(0);
- QJsonObject obj1 = value1.toObject();
- QString type1 = obj1.take("type").toString();
- QString low1 = obj1.take("low").toString();
- QString high1 = obj1.take("high").toString();
- QString date1 = obj1.take("date").toString();
-
- this->Map_page->day1_l = low1.mid(3);
- this->Map_page->temp_now = low1.mid(3);
- QStringList list = low1.mid(3).split("℃");
- this->tempature = list.at(0).toInt();
- qDebug()<<list.at(0);
- this->Map_page->day1_h = high1.mid(3);
- this->Map_page->day1_time = date1;
-
- // qDebug()<<low1<< this->Map_page->day1_l<<high1<<high1.toInt();
- if(type1 == "晴"){
- this->Map_page->day1_tq = 0;
- this->Map_page->tq_flag = 0;
- }
- else if(type1 == "大雨" || type1 == "小雨"){
- this->Map_page->day1_tq = 1;
- this->Map_page->tq_flag = 1;
- }
- else if(type1 == "多云"){
- this->Map_page->day1_tq = 2;
- this->Map_page->tq_flag = 2;
- }
- else if(type1 == "小雪" ||type1 == "大雪"){
- this->Map_page->day1_tq = 3;
- this->Map_page->tq_flag = 3;
- }
- else if(type1 == "阴"){
- this->Map_page->day1_tq = 4;
- this->Map_page->tq_flag = 4;
- }
- QJsonValue value2 = array.at(1);
- QJsonObject obj2 = value2.toObject();
- QString type2 = obj2.take("type").toString();
- QString low2 = obj2.take("low").toString();
- QString high2 = obj2.take("high").toString();
- QString date2 = obj2.take("date").toString();
-
- this->Map_page->day2_l = low2.mid(3);
-
- // this->tempature = this->Map_page->temp_now;
- this->Map_page->day2_h = high2.mid(3);
- this->Map_page->day2_time = date2;
- if(type2 == "晴"){
- this->Map_page->day2_tq = 0;
- }
- else if(type2 == "小雨"||type2 == "大雨"){
- this->Map_page->day2_tq = 1;
- }
- else if(type2 == "多云"){
- this->Map_page->day2_tq = 2;
- }
- else if(type2 == "小雪"||type2 == "大雪"){
- this->Map_page->day2_tq = 3;
- }
- else if(type2 == "阴"){
- this->Map_page->day2_tq =4;
- }
- QJsonValue value3 = array.at(2);
- QJsonObject obj3 = value3.toObject();
- QString type3 = obj3.take("type").toString();
- QString low3 = obj3.take("low").toString();
- QString high3 = obj3.take("high").toString();
- QString date3 = obj3.take("date").toString();
-
- this->Map_page->day3_l = low3.mid(3);
-
- // this->tempature = this->Map_page->temp_now;
- this->Map_page->day3_h = high3.mid(3);
- this->Map_page->day3_time = date3;
- if(type3 == "晴"){
- this->Map_page->day3_tq = 0;
- }
- else if(type3 == "小雨"||type3 == "大雨"){
- this->Map_page->day3_tq = 1;
- }
- else if(type3 == "多云"){
- this->Map_page->day3_tq = 2;
- }
- else if(type3 == "小雪"||type3=="大雪"){
- this->Map_page->day3_tq = 3;
- }
- else if(type3 == "阴"){
- this->Map_page->day3_tq =4;
- }
-
- QJsonValue value4 = array.at(3);
- QJsonObject obj4 = value4.toObject();
- QString type4 = obj4.take("type").toString();
- QString low4 = obj4.take("low").toString();
- QString high4 = obj4.take("high").toString();
- QString date4 = obj4.take("date").toString();
-
- this->Map_page->day4_l = low4.mid(3);
-
- // this->tempature = this->Map_page->temp_now;
- this->Map_page->day4_h = high4.mid(3);
- this->Map_page->day4_time = date4;
- if(type4 == "晴"){
- this->Map_page->day4_tq = 0;
- }
- else if(type4 == "小雨"||type4 =="大雨"){
- this->Map_page->day4_tq = 1;
- }
- else if(type4 == "多云"){
- this->Map_page->day4_tq = 2;
- }
- else if(type4 == "小雪"||type4 =="大雪"){
- this->Map_page->day4_tq = 3;
- }
- else if(type4 == "阴"){
- this->Map_page->day4_tq =4;
- }
-
- QJsonValue value5 = array.at(4);
- QJsonObject obj5 = value5.toObject();
- QString type5 = obj5.take("type").toString();
- QString low5 = obj5.take("low").toString();
- QString high5 = obj5.take("high").toString();
- QString date5 = obj5.take("date").toString();
-
- this->Map_page->day5_l = low5.mid(3);
-
- // this->tempature = this->Map_page->temp_now;
- this->Map_page->day5_h = high5.mid(3);
- this->Map_page->day5_time = date5;
- if(type5 == "晴"){
- this->Map_page->day5_tq = 0;
- }
- else if(type5 == "小雨"||type5 == "大雨"){
- this->Map_page->day5_tq = 1;
- }
- else if(type5 == "多云"){
- this->Map_page->day5_tq = 2;
- }
- else if(type5 == "小雪"||type5 == "大雪"){
- this->Map_page->day5_tq = 3;
- }
- else if(type5 == "阴"){
- this->Map_page->day5_tq =4;
- }
-
- if(type1 == "晴"){
- this->weather = 0;
- }
- else if(type1 == "小雨"|| type1 =="大雨"){
- this->weather = 1;
- }
- else if(type1 == "多云"){
- this->weather = 2;
- }
- else if(type1 == "小雪"||type1 == "大雪"){
- this->weather = 3;
- }
- else if(type1 =="阴"){
- this->weather = 4;
- }
- }
- update();
- }
-
- bool Main_Window::eventFilter(QObject *obj, QEvent *event)
- {
- QPixmap pic;
-
- if (obj == ui->change)//指定某个QLabel
- {
- if (event->type() == QEvent::MouseButtonPress) //鼠标点击
- {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); // 事件转换
- if(mouseEvent->button() == Qt::LeftButton)
- {
- if(this->Map_page->city_flag == 0){
- this->Map_page->city_name = "厦门";
- city_id = "101230201";
- this->Map_page->city_flag=1;
-
- }
- else if(this->Map_page->city_flag == 1){
- this->Map_page->city_name = "泉州";
- this->Map_page->city_flag=2;
- city_id = "101230501";
- }
- else if(this->Map_page->city_flag == 2){
- this->Map_page->city_name = "兰州";
- this->Map_page->city_flag=0;
- city_id = "101160101";
- }
- weather_init(city_id);
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- }
- void Main_Window::on_Picture_but_clicked()
- {
- this->hide();
- Pichoose_page->show();
- }
能够实现与车载系统的通信与控制功能,并保证不会发生误触断连,无效控制或数据出错的情况,并且尽量保证APP界面的美观
作为车载系统的UI界面,要在实现市面上车载系统所拥有的功能的基础上,增加界面的美观性,并且提供安全保障的额外功能
作为该项目的特色,需要在实现倾倒报警与温度过高报警功能的基础上,保证不会因为汽车上坡或者传感器检测错误而导致的误报警
1,通过对主界面图片的更改测试图片切换功能
2,倾倒车载系统,测试能否获得到GPS信息,并把GPS信息发送到指定的手机上
3,通过APP调节最高温度,测试当温度过高并且红外传感器检测到有人时能否触发蜂鸣器报警
4,APP连接车载系统后,通过对音乐播放器的选择,测试能否和车载系统进行通信
5,在车载系统中,在音乐播放器界面,测试音乐播放功能
在本项目中,车载系统的UI界面基本设计完成,并且在此基础上进行了一定的美化,并且增加了主界面自主选择功能,满足了车载系统自主DIY喜欢的界面
在本项目中,能够时刻检测汽车的状态,并且当汽车发生倾倒时,立刻将当前的经纬度信息发送到用户手机,并且,能够避免清位晃动而导致的误报警
在本项目中,通过DHT11模块,能够获取温度信息,当温度高于最大温度车内又同时检测到有人时,就会触发蜂鸣器警报,其中最大温度可以通过手机APP进行设置,能够满足不同环境的要求
在本项目中,通过QT实现了手机APP的设计,能够满足与车载系统的基本通信与控制,控制与显示效果能够满足与其,不会发生中途断连的现象。
在本项目中,音乐播放器与市面上的音乐播放器相同,并且支持三种模式的切换,音量控制,列表播放等基础功能
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。