]> rtime.felk.cvut.cz Git - orte.git/blob - orte/examples/reliable/ReliablePublisher.c
Added prerelease of ORTE-0.2 (Real Time Publisher Subscriber communication protocol...
[orte.git] / orte / examples / reliable / ReliablePublisher.c
1 /*
2  *  $Id: ReliablePublisher.c,v 0.0.0.1  2003/12/27 
3  *
4  *  DEBUG:  section                     ReliablePublisher
5  *  AUTHOR: Petr Smolik                 petr.smolik@wo.cz
6  *
7  *  ORTE - OCERA Real-Time Ethernet     http://www.ocera.org/
8  *  --------------------------------------------------------------------
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *  
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *  
20  */ 
21
22 #include <stdio.h>
23 #ifdef __RTL__
24   #include <posix/pthread.h>
25 #endif
26 #include "orte_api.h"
27
28 ORTEDomain        *d;
29 char              instance2Send[64];
30
31 int 
32 main(int argc, char *args[]) {
33   ORTEPublication *p;
34   NtpTime         persistence;
35   int             i=1;            
36
37   ORTEInit();
38   //ORTEVerbositySetOptions("ALL,10");
39   d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL);
40   ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,64);
41   NTPTIME_BUILD(persistence,3); 
42   p=ORTEPublicationCreate(
43        d,
44       "Reliable HelloMsg",
45       "HelloMsg",
46       &instance2Send,
47       &persistence,
48       1,
49       NULL,
50       NULL,
51       NULL);
52   while (1) {
53     ORTESleepMs(1000);
54     printf("Sampling publication, count %d\n", i);
55     sprintf(instance2Send,"Hello Universe! (%d)",i++);
56     ORTEPublicationSend(p);
57   }
58   return 0;
59 }
60
61 #ifdef __RTL__
62 void 
63 hello_init(void) {
64   main(0,NULL);
65 }
66 void 
67 hello_exit(void) {
68   ORTEDomainAppDestroy(d);
69 }
70 MODULE_LICENSE("GPL");
71 module_init(hello_init);
72 module_exit(hello_exit);
73 #endif
74