1 /****************************************************************************
2 ** ui.h extension file, included from the uic-generated form implementation.
4 ** If you wish to add, delete or rename functions or slots use
5 ** Qt Designer which will update this file, preserving your code. Create an
6 ** init() function in place of a constructor, and a destroy() function in
7 ** place of a destructor.
8 *****************************************************************************/
12 void FSubscriber::init()
15 domain=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
16 ORTETypeRegisterBoxType(domain);
17 subscriberBlue=subscriberGreen=subscriberRed=NULL;
18 subscriberBlack=subscriberYellow=NULL;
19 pthread_mutex_init(&mutex,NULL);
22 void FSubscriber::closeEvent( QCloseEvent *e )
28 void FSubscriber::destroy()
31 ORTEDomainAppDestroy(domain);
33 pthread_mutex_destroy(&mutex);
38 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
39 BoxType *boxType=(BoxType*)vinstance;
40 FSubscriber *s=(FSubscriber*)recvCallBackParam;
43 switch (info->status) {
45 pthread_mutex_lock(&s->mutex);
47 boxType->rectangle.top_left_x,
48 boxType->rectangle.top_left_y,
49 boxType->rectangle.bottom_right_x,
50 boxType->rectangle.bottom_right_y);
51 s->view->activateObject(boxType->color,boxType->color,boxType->shape);
52 s->view->setPosition(boxType->color,rect);
53 pthread_mutex_unlock(&s->mutex);
56 if (strcmp(info->topic,"Blue")==0)
57 s->view->deactivateObject(0);
58 if (strcmp(info->topic,"Green")==0)
59 s->view->deactivateObject(1);
60 if (strcmp(info->topic,"Red")==0)
61 s->view->deactivateObject(2);
62 if (strcmp(info->topic,"Black")==0)
63 s->view->deactivateObject(3);
64 if (strcmp(info->topic,"Yellow")==0)
65 s->view->deactivateObject(4);
71 void FSubscriber::initSubscribers( int iBlue, int iGreen, int iRed, int iBlack, int iYellow )
75 NtpTimeAssembFromMs(msBlue, 0, 0);
76 NtpTimeAssembFromMs(msGreen, 0, 0);
77 NtpTimeAssembFromMs(msRed, 0, 0);
78 NtpTimeAssembFromMs(msBlack, 0, 0);
79 NtpTimeAssembFromMs(msYellow, 0, 0);
80 NtpTimeAssembFromMs(deadline, 6, 0);
82 subscriberBlue=ORTESubscriptionCreate(
93 combo->insertItem("Blue",combo->count());
96 subscriberGreen=ORTESubscriptionCreate(
107 combo->insertItem("Green",combo->count());
110 subscriberRed=ORTESubscriptionCreate(
121 combo->insertItem("Red",combo->count());
124 subscriberBlack=ORTESubscriptionCreate(
135 combo->insertItem("Black",combo->count());
138 subscriberYellow=ORTESubscriptionCreate(
149 combo->insertItem("Yellow",combo->count());
154 void FSubscriber::comboActivated( int )
156 if (combo->currentText()==QString("Blue"))
157 slider->setValue(msBlue.seconds);
158 if (combo->currentText()==QString("Green"))
159 slider->setValue(msGreen.seconds);
160 if (combo->currentText()==QString("Red"))
161 slider->setValue(msRed.seconds);
162 if (combo->currentText()==QString("Black"))
163 slider->setValue(msBlack.seconds);
164 if (combo->currentText()==QString("Yellow"))
165 slider->setValue(msYellow.seconds);
169 void FSubscriber::sliderValueChanged( int value)
174 NtpTimeAssembFromMs(minSep, value, 0);
175 if (combo->currentText()==QString("Blue")) {
177 ORTESubscriptionPropertiesGet(subscriberBlue,&sp);
178 sp.minimumSeparation=msBlue;
179 ORTESubscriptionPropertiesSet(subscriberBlue,&sp);
181 if (combo->currentText()==QString("Green")) {
183 ORTESubscriptionPropertiesGet(subscriberGreen,&sp);
184 sp.minimumSeparation=msGreen;
185 ORTESubscriptionPropertiesSet(subscriberGreen,&sp);
187 if (combo->currentText()==QString("Red")) {
189 ORTESubscriptionPropertiesGet(subscriberRed,&sp);
190 sp.minimumSeparation=msRed;
191 ORTESubscriptionPropertiesSet(subscriberRed,&sp);
193 if (combo->currentText()==QString("Black")) {
195 ORTESubscriptionPropertiesGet(subscriberBlack,&sp);
196 sp.minimumSeparation=msBlack;
197 ORTESubscriptionPropertiesSet(subscriberBlack,&sp);
199 if (combo->currentText()==QString("Yellow")) {
201 ORTESubscriptionPropertiesGet(subscriberYellow,&sp);
202 sp.minimumSeparation=msYellow;
203 ORTESubscriptionPropertiesSet(subscriberYellow,&sp);