⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 call_impl.cpp

📁 PXA270开发板+GPRS
💻 CPP
字号:
#include "call_impl.h"#include "call.h"/************************************************************************/call_impl::call_impl( QWidget* parent,  const char* name, bool modal, WFlags fl ,int _fd)    : call( parent, name, modal, fl ),fd(_fd){	Init_Sys();	Init_Pic();    // signals and slots connections	QObject::connect(Btn_exit,SIGNAL(clicked () ),this,SLOT(close()));	QObject::connect(Btn_Dial,SIGNAL(clicked () ),this,SLOT(Dial_slot()));	QObject::connect(Btn_UnDial,SIGNAL(clicked () ),this,SLOT(UnDial_slot()));	QObject::connect(Btn_Message,SIGNAL(clicked () ),this,SLOT(Message_slot()));		//number and fun	QObject::connect(Btn_1,SIGNAL(clicked () ),this,SLOT(n1_slot()));	QObject::connect(Btn_2,SIGNAL(clicked () ),this,SLOT(n2_slot()));	QObject::connect(Btn_3,SIGNAL(clicked () ),this,SLOT(n3_slot()));	QObject::connect(Btn_4,SIGNAL(clicked () ),this,SLOT(n4_slot()));	QObject::connect(Btn_5,SIGNAL(clicked () ),this,SLOT(n5_slot()));	QObject::connect(Btn_6,SIGNAL(clicked () ),this,SLOT(n6_slot()));	QObject::connect(Btn_7,SIGNAL(clicked () ),this,SLOT(n7_slot()));	QObject::connect(Btn_8,SIGNAL(clicked () ),this,SLOT(n8_slot()));	QObject::connect(Btn_9,SIGNAL(clicked () ),this,SLOT(n9_slot()));	QObject::connect(Btn_0,SIGNAL(clicked () ),this,SLOT(n0_slot()));	QObject::connect(Btn_c,SIGNAL(clicked () ),this,SLOT(c_slot()));	QObject::connect(Btn_sharp,SIGNAL(clicked () ),this,SLOT(sharp_slot()));}/************************************************************************/call_impl::~call_impl(){}/************************************************************************/void call_impl::Init_Sys(){	if(fd!=0)        {                Txt_State->insertLine("Serial port already open.",-1);        }	else if(fd==0)	{		if((fd=MySerial::open_port(fd,1))<0){                         Txt_State->insertLine("Open port error",-1);                         return;                }                else                        Txt_State->insertLine("Open port success",-1);                                                                                                                                                       if((MySerial::set_opt(fd,9600,8,'N',1))<0){                        Txt_State->insertLine("Set port error",-1);                        return;                }                else                        Txt_State->insertLine("Set port success",-1);	}	Txt_Num->setText("10086");	}/************************************************************************/void call_impl::Init_Pic(){	QString strPicDir="/pic/";	Img_Bak->setPixmap(QPixmap (strPicDir+"call.png"));	Btn_Message->setPixmap(QPixmap (strPicDir+"3_message.png"));	Btn_Dial->setPixmap(QPixmap (strPicDir+"3_dial.png"));	Btn_UnDial->setPixmap(QPixmap (strPicDir+"3_undial.png"));	Btn_exit->setPixmap(QPixmap (strPicDir+"3_exit.png"));	Btn_0->setPixmap(QPixmap (strPicDir+"3_0.png"));	Btn_1->setPixmap(QPixmap (strPicDir+"3_1.png"));	Btn_2->setPixmap(QPixmap (strPicDir+"3_2.png"));	Btn_3->setPixmap(QPixmap (strPicDir+"3_3.png"));	Btn_4->setPixmap(QPixmap (strPicDir+"3_4.png"));	Btn_5->setPixmap(QPixmap (strPicDir+"3_5.png"));	Btn_6->setPixmap(QPixmap (strPicDir+"3_6.png"));	Btn_7->setPixmap(QPixmap (strPicDir+"3_7.png"));	Btn_8->setPixmap(QPixmap (strPicDir+"3_8.png"));	Btn_9->setPixmap(QPixmap (strPicDir+"3_9.png"));	Btn_c->setPixmap(QPixmap (strPicDir+"3_c.png"));	Btn_sharp->setPixmap(QPixmap (strPicDir+"3_#.png"));}/************************************************************************/void call_impl::Dial_slot(){	if(fd>0)	{		QString DialNum=Txt_Num->text();		if(DialNum.length()==0)		{			Txt_State->insertLine("You should put num!",-1);			return;		}		else		{			QString DialCommand="ATD"+DialNum+";\r\n";			MySerial::nwrite(fd,DialCommand.latin1(),DialCommand.length());		}	}}/************************************************************************/void call_impl::UnDial_slot(){	MySerial::nwrite(fd,"ATH\r\n",sizeof("ATH\r\n"));}/************************************************************************/void call_impl::Message_slot(){	close();}/************************************************************************/void call_impl::n1_slot(){	SetNum("1");}/************************************************************************/void call_impl::n2_slot(){	SetNum("2");}/************************************************************************/void call_impl::n3_slot(){	SetNum("3");}/************************************************************************/void call_impl::n4_slot(){	SetNum("4");}/************************************************************************/void call_impl::n5_slot(){	SetNum("5");}/************************************************************************/void call_impl::n6_slot(){	SetNum("6");}/************************************************************************/void call_impl::n7_slot(){	SetNum("7");}/************************************************************************/void call_impl::n8_slot(){	SetNum("8");}/************************************************************************/void call_impl::n9_slot(){	SetNum("9");}/************************************************************************/void call_impl::n0_slot(){	SetNum("0");}/************************************************************************/void call_impl::c_slot(){	QString tmp=Txt_Num->text();	int i=tmp.length();	Txt_Num->setText(tmp.left(i-1));}/************************************************************************/void call_impl::sharp_slot(){}/************************************************************************/void call_impl::SetNum(QString str){	Txt_Num->setText(Txt_Num->text()+str);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -