2 * $Id: HelloWorldSubscriber.c,v 0.0.0.1 2003/12/26
4 * DEBUG: section HelloWorldSubscriber
5 * AUTHOR: Petr Smolik petr.smolik@wo.cz
7 * ORTE - OCERA Real-Time Ethernet http://www.ocera.org/
8 * --------------------------------------------------------------------
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.
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.
22 #ifdef CONFIG_ORTE_RTL
23 #include <linux/module.h>
24 #include <posix/pthread.h>
25 #define printf rtl_printf
26 #elif defined CONFIG_ORTE_RTAI
27 #include <linux/module.h>
28 #include <rtai/compat.h>
29 #define printf rt_printk
36 char instance2Recv[64];
39 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
40 char *instance=(char*)vinstance;
42 switch (info->status) {
44 printf("%s\n",instance);
47 printf("deadline occured\n");
54 subscriberCreate(void *arg) {
56 NtpTime deadline,minimumSeparation;
58 ORTETypeRegisterAdd(d,"HelloMsg",NULL,NULL,64);
59 NTPTIME_BUILD(deadline,10);
60 NTPTIME_BUILD(minimumSeparation,0);
61 s=ORTESubscriptionCreate(
76 #ifndef CONFIG_ORTE_RT
79 main(int argc, char *args[]) {
81 d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,NULL,NULL,ORTE_FALSE);
83 printf("ORTEDomainAppCreate failed!\n");
86 subscriberCreate(NULL);
94 char manager[MAX_STRING_IPADDRESS_LENGTH]="127.0.0.1";
95 MODULE_PARM(manager,"s");
96 MODULE_PARM_DESC(manager,"IP address of local manager");
97 MODULE_LICENSE("GPL");
101 domainDestroy(void *arg) {
103 ORTEDomainAppDestroy(d);
112 ORTEDomainPropDefaultGet(&dp);
113 //ORTEVerbositySetOptions("ALL,10");
114 dp.appLocalManager=StringToIPAddress(manager);
115 d=ORTEDomainAppCreate(ORTE_DEFAULT_DOMAIN,&dp,NULL,ORTE_FALSE);
117 pthread_create(&thread,NULL,&subscriberCreate,NULL);
119 printf("ORTEDomainAppCreate failed!\n");
125 cleanup_module(void) {
127 pthread_join(thread,NULL);
128 pthread_create(&thread,NULL,&domainDestroy,NULL);
129 pthread_join(thread,NULL);