SVN commit 670289 by gulino: More testing && less verbose. M +5 -1 at_engine.cpp M +14 -2 testphonedevice.cpp M +7 -1 testphonedevice.h --- trunk/KDE/kdepim/kmobiletools/kmobiletools/engines/at_engine/at_engine.cpp #670288:670289 @@ -121,7 +121,7 @@ KMobileTools::Engine::processSlot(job); // kDebug() << "job Owner: " << p_job->jobOwner() << "; job class: " << p_job->className() << endl; if(job->property("owner") != objectName() ) return; - kDebug() << "KMobileTools::Engine::processSlot; jobType=" << job->type() << endl; +// kDebug() << "KMobileTools::Engine::processSlot; jobType=" << job->type() << endl; p_lastJob=0; // kDebug() << "is KMobileToolsJob: " << p_job->inherits("KMobileTools::Job") << endl; KMobileTools::DevicesConfig *wconfig=KMobileTools::DevicesConfig::prefs(objectName() ); @@ -206,6 +206,10 @@ p_calendar->dump(); #endif break; + case TestPhoneDevice: + TestPhoneDeviceJob *djob=(TestPhoneDeviceJob*)job; + if(djob->found()) kDebug() << "Found device in " << djob->path() << endl; + break; } } --- trunk/KDE/kdepim/kmobiletools/kmobiletools/engines/at_engine/testphonedevice.cpp #670288:670289 @@ -19,8 +19,11 @@ ***************************************************************************/ #include "testphonedevice.h" #include +#include +#include -TestPhoneDeviceJob::TestPhoneDeviceJob(const QString &devicename, AT_Engine* parent): kmobiletoolsATJob(NULL, parent) +TestPhoneDeviceJob::TestPhoneDeviceJob(const QString &devicename, AT_Engine* parent): kmobiletoolsATJob(NULL, parent), + b_found(false), enginedata(0) { this->deviceName=devicename; p_device=new KMobileTools::SerialManager(parent, parent->objectName(), devicename); @@ -30,10 +33,19 @@ TestPhoneDeviceJob::~TestPhoneDeviceJob() { delete p_device; + delete enginedata; } void TestPhoneDeviceJob::run() { - kDebug() << "TestPhoneDevice::run() on " << deviceName << endl; + if(! QFile::exists(deviceName)) return; + if(!p_device->open(this)) return; + enginedata=new KMobileTools::EngineData(0); + QString buffer; + const int probeTimeout=600; + buffer=p_device->sendATCommand(this, "AT+CGSN\r", probeTimeout); + kDebug() << "Sent CGSN probe, got " << buffer << endl; + p_device->close(); + b_found=true; } #include "testphonedevice.moc" --- trunk/KDE/kdepim/kmobiletools/kmobiletools/engines/at_engine/testphonedevice.h #670288:670289 @@ -24,8 +24,9 @@ #include "at_engine.h" /** - @author + @author Marco Gulino */ +class KMobileTools::EngineData; class TestPhoneDeviceJob : public kmobiletoolsATJob { Q_OBJECT @@ -34,9 +35,14 @@ ~TestPhoneDeviceJob(); JobType type() { return static_cast(AT_Engine::TestPhoneDevice); } + KMobileTools::EngineData *data() { return enginedata; } + bool found() { return b_found; } + QString path() const { return deviceName; } protected: void run (); QString deviceName; + KMobileTools::EngineData* enginedata; + bool b_found; }; #endif