urtware / inc / urt_service.h @ 1f7ffcff
History | View | Annotate | Download (3.432 KB)
1 |
/*
|
---|---|
2 |
µRtWare is a lightweight publish/subscribe middleware for real-time
|
3 |
applications. It was developed as part of the software habitat for the
|
4 |
Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well.
|
5 |
|
6 |
Copyright (C) 2018..2020 Thomas Schöpping et al.
|
7 |
|
8 |
This program is free software: you can redistribute it and/or modify
|
9 |
it under the terms of the GNU General Public License as published by
|
10 |
the Free Software Foundation, either version 3 of the License, or
|
11 |
(at your option) any later version.
|
12 |
|
13 |
This program is distributed in the hope that it will be useful,
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
GNU General Public License for more details.
|
17 |
|
18 |
You should have received a copy of the GNU General Public License
|
19 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 |
*/
|
21 |
|
22 |
#ifndef URTWARE_SERVICE_H
|
23 |
#define URTWARE_SERVICE_H
|
24 |
|
25 |
#include <urt_types.h> |
26 |
#include <urtware.h> |
27 |
|
28 |
/******************************************************************************/
|
29 |
/* CONSTANTS */
|
30 |
/******************************************************************************/
|
31 |
|
32 |
/******************************************************************************/
|
33 |
/* SETTINGS */
|
34 |
/******************************************************************************/
|
35 |
|
36 |
/******************************************************************************/
|
37 |
/* CHECKS */
|
38 |
/******************************************************************************/
|
39 |
|
40 |
/******************************************************************************/
|
41 |
/* DATA STRUCTURES AND TYPES */
|
42 |
/******************************************************************************/
|
43 |
|
44 |
/**
|
45 |
* @brief service
|
46 |
*/
|
47 |
typedef struct urt_service |
48 |
{ |
49 |
urt_service_t* next; |
50 |
urt_serviceid_t id; |
51 |
urt_osMutex_t lock; |
52 |
urt_servicefunc_t* callback; |
53 |
#if (URT_CFG_RPC_PROFILING)
|
54 |
uint64_t sumDurations; |
55 |
uint64_t numCalls; |
56 |
uint64_t numTimeouts; |
57 |
urt_delay_t minDuration; |
58 |
urt_delay_t maxDuration; |
59 |
#endif /* URT_CFG_RPC_PROFILING */ |
60 |
}urt_service_t; |
61 |
|
62 |
/******************************************************************************/
|
63 |
/* MACROS */
|
64 |
/******************************************************************************/
|
65 |
|
66 |
/******************************************************************************/
|
67 |
/* EXTERN DECLARATIONS */
|
68 |
/******************************************************************************/
|
69 |
|
70 |
#if defined(__cplusplus)
|
71 |
extern "C" { |
72 |
#endif /* defined(__cplusplus) */ |
73 |
|
74 |
urt_status_t urtServiceInit(urt_service_t* service, urt_serviceid_t id, urt_servicefunc_t* callback); |
75 |
urt_status_t urtServiceCall(urt_service_t* service, void* arg, void* ret, urt_delay_t timeout); |
76 |
|
77 |
urt_status_t urt_servicefunc_t(void* arg, void* ret, urt_delay_t timeout); |
78 |
#if defined(__cplusplus)
|
79 |
} |
80 |
#endif /* defined(__cplusplus) */ |
81 |
|
82 |
/******************************************************************************/
|
83 |
/* INLINE FUNCTIONS */
|
84 |
/******************************************************************************/
|
85 |
|
86 |
#endif /* URTWARE_SERVICE_H */ |