int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MyWindow window;
    window.showMaximized();

    QThread thread;
    Detector *detector = new Detector();
    detector->moveToThread(&thread);
    detector->connect(&thread,SIGNAL(started()),SLOT(work()));


    QThread thread2;
    MyBluetooth *bt = new MyBluetooth();
    bt->moveToThread(&thread2);
    bt->connect(&thread2,SIGNAL(started()),SLOT(scanList()));
    bt->connect(&window,SIGNAL(updateScan()),SLOT(scanList()));
    bt->connect(detector,SIGNAL(detected()),SLOT(checkAlert()));

    //typedef std::list<Phone> listPhone;
    qRegisterMetaType<std::list<Phone*> >("List<Phone>");
    window.connect(bt,SIGNAL(finishedScan(std::list<Phone*>)),SLOT(setList(std::list<Phone*>)));
    window.connect(bt,SIGNAL(finishedCheck(std::list<Phone*>)),SLOT(checkAlert(std::list<Phone*>)));

    thread.start();
    thread2.start();

    return a.exec();
}
Exemple #2
0
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QCoreApplication::setOrganizationName("Rabitsa");
    QCoreApplication::setApplicationName("test");

    QSettings set;
    set.setValue("/db/db","filter1s");


    RxModbus r;

    r.loadList(":/text/list.txt");
    r.setHostName("10.0.3.1");
    r.setPort(502);

    QVector<IoDev*> src; // джерела даних.
    src << &r;
    Logging l(src);

    r.start();

    IoNetServer s(src);

    Alert al(&r);
    al.loadList(":/text/alert.txt");

    QObject::connect(&r,SIGNAL(updateData()),&al,SLOT(checkAlert()));
    QObject::connect(&al,SIGNAL(newAlert(QString)),&s,SLOT(sendAlert(QString)));

    QObject::connect(&r,SIGNAL(Alert(QString)),&s,SLOT(sendAlert(QString)));


    return a.exec();
}
 long waitFor(long sequence, long timeout, TimeUnit units) throw(AlertException) {
   checkAlert();
   return waitStrategy_.waitFor(sequence, cursorSequence_, dependentSequences_, *this, timeout, units);
 }
 long waitFor(long sequence) throw(AlertException) {
   checkAlert();
   return waitStrategy_.waitFor(sequence, cursorSequence_, dependentSequences_, *this);
 }