本文整理汇总了C++中MyWindow::network方法的典型用法代码示例。如果您正苦于以下问题:C++ MyWindow::network方法的具体用法?C++ MyWindow::network怎么用?C++ MyWindow::network使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyWindow
的用法示例。
在下文中一共展示了MyWindow::network方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
// setup GPIO interface - uncomment when needed
// needs to run with root via sudo in terminal.
wiringPiSetup();
pinMode(Physical::OM0, OUTPUT);
pinMode(Physical::OM1, OUTPUT);
pinMode(Physical::OM2, OUTPUT);
pinMode(Physical::OM3, OUTPUT);
pinMode(Physical::OM4, OUTPUT);
pinMode(Physical::OM5, OUTPUT);
pinMode(Physical::OM6, OUTPUT);
pinMode(Physical::ORL, OUTPUT);
pinMode(Physical::OSL, OUTPUT);
pinMode(Physical::OAL, OUTPUT);
pinMode(Physical::IM0, INPUT);
pinMode(Physical::IM1, INPUT);
pinMode(Physical::IM2, INPUT);
pinMode(Physical::IM3, INPUT);
pinMode(Physical::IM4, INPUT);
pinMode(Physical::IM5, INPUT);
pinMode(Physical::IM6, INPUT);
pinMode(Physical::IRL, INPUT);
pinMode(Physical::ISL, INPUT);
pinMode(Physical::IAL, INPUT);
digitalWrite(Physical::OM0, false); // defaulted to false
digitalWrite(Physical::OM1, false); // defaulted to false
digitalWrite(Physical::OM2, false); // defaulted to false
digitalWrite(Physical::OM3, false); // defaulted to false
digitalWrite(Physical::OM4, false); // defaulted to false
digitalWrite(Physical::OM5, false); // defaulted to false
digitalWrite(Physical::OM6, false); // defaulted to false
digitalWrite(Physical::ORL, false); // in case turn off prgm before it returend to false
digitalWrite(Physical::OSL, false);
digitalWrite(Physical::OAL, false); // defaulted to f
pthread_mutex_init(&changingCableMutex, NULL);
pthread_cond_init(&cableChangedCondition, NULL); // Just for the sake of 3.4 shared bool variables: TO REMOVE FOR 3.5
qRegisterMetaType<QVector<bool> >("QVector<bool>");
// setup Qt GUI
QApplication a(argc, argv);
MyWindow w;
w.show();
// starting worker thread(s)
int rc;
pthread_t send_thread;
rc = pthread_create(&send_thread, NULL, send, (void*) w.network());
if (rc) {
qDebug() << "main.h/main: Unable to start send thread.";
exit(1);
}
pthread_t read_thread;
rc = pthread_create(&read_thread, NULL, read, (void*) w.network());
if (rc) {
qDebug() << "main.h/main: Unable to start read thread.";
exit(1);
}
// start window event loop
qDebug() << "main.h/main: Starting event loop...";
int ret = a.exec();
qDebug() << "main.h/main: Event loop stopped.";
// cleanup pthreads
// pthread_exit(NULL);
// exit
return ret;
}