]> rtime.felk.cvut.cz Git - orte.git/blob - orte/liborte/ORTEPublicationTimer.c
957d834301263f6f6b9ca7c53b467ac7ab52f2ed
[orte.git] / orte / liborte / ORTEPublicationTimer.c
1 /*
2  *  $Id: ORTEPublicationTimer.c,v 0.0.0.1 2003/12/15
3  *
4  *  DEBUG:  section 32                  Publication Timer
5  *
6  *  -------------------------------------------------------------------  
7  *                                ORTE                                 
8  *                      Open Real-Time Ethernet                       
9  *                                                                    
10  *                      Copyright (C) 2001-2006                       
11  *  Department of Control Engineering FEE CTU Prague, Czech Republic  
12  *                      http://dce.felk.cvut.cz                       
13  *                      http://www.ocera.org                          
14  *                                                                    
15  *  Author:              Petr Smolik    petr.smolik@wo.cz             
16  *  Advisor:             Pavel Pisa                                   
17  *  Project Responsible: Zdenek Hanzalek                              
18  *  --------------------------------------------------------------------
19  *
20  *  This program is free software; you can redistribute it and/or modify
21  *  it under the terms of the GNU General Public License as published by
22  *  the Free Software Foundation; either version 2 of the License, or
23  *  (at your option) any later version.
24  *  
25  *  This program is distributed in the hope that it will be useful,
26  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
27  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28  *  GNU General Public License for more details.
29  *  
30  */ 
31
32 #include "orte_all.h"
33
34 /*****************************************************************************/
35 int
36 PublicationCallBackTimer(ORTEDomain *d,void *vcstWriter) {
37   CSTWriter        *cstWriter=(CSTWriter*)vcstWriter;
38   ORTEPublProp     *pp;
39   ORTESendInfo     info;  
40   
41   pp=(ORTEPublProp*)cstWriter->objectEntryOID->attributes;
42   CSTWriterTryDestroyBestEffortIssue(cstWriter);
43
44   if (cstWriter->csChangesCounter<pp->sendQueueSize) {
45     info.status=NEED_DATA;
46     info.topic=(char*)pp->topic;
47     info.type=(char*)pp->typeName;
48     info.senderGUID=cstWriter->objectEntryOID->guid;
49     cstWriter->objectEntryOID->sendCallBack(&info,
50                           cstWriter->objectEntryOID->instance,
51                           cstWriter->objectEntryOID->callBackParam);
52     ORTEPublicationSendLocked(cstWriter,NULL);
53   }
54
55   eventAdd(d,
56       cstWriter->objectEntryOID->objectEntryAID,
57       &cstWriter->objectEntryOID->sendCallBackDelayTimer,
58       0,   
59       "PublicationCallBackTimer",
60       PublicationCallBackTimer,
61       &cstWriter->lock,
62       cstWriter,
63       &cstWriter->objectEntryOID->sendCallBackDelay);               
64   return 0;
65 }