Statistics
| Branch: | Revision:

urtware / doc / activitydiagrams / service / urtServiceInit.uml @ ee83a495

History | View | Annotate | Download (2.618 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
/'### INTRO ##################################################################'/
23

    
24
@startuml
25

    
26
title **µRtWare**\nurtServiceInit()\n
27

    
28
/'### PARAMETERS & RETURN ####################################################'/
29

    
30
note
31
  -- **service** : urt_service_t* --
32
  The service to initialize.
33
  Must not be ""NULL"".
34
  -- **id** : urt_serviceid_t --
35
  Unique, numeric identifier of the service.
36
  -- **callback** : urt_servicefunc_t* --
37
  Callabck function to be executed by this service.
38
  Must not be ""NULL"".
39
  ====
40
  -- **return** : urt_status_t --
41
  Returns ""URT_STATUS_OK"" on success.
42
  Returns ""URT_STATUS_ERROR"" if another service with the same identifier already exists.
43
endnote
44

    
45
/'### PROCEDURE ##############################################################'/
46

    
47
start
48
:initialize members;
49
note
50
  **next** ← ""NULL""
51
  **id** ← id
52
  urtMutexInit(**lock**)
53
  **callback** ← callback
54
  .. URT_CFG_RPC_QOS_JITTERCHECKS == true || URT_CFG_RPC_PROFILING == true ..
55
  **minDuration** ← 0xF..F
56
  **maxDuration** ← 0
57
  .. URT_CFG_RPC_PROFILING == true ..
58
  **sumDurations** ← 0
59
  **numCalls** ← 0
60
  **numTimeouts** ← 0
61
endnote
62
:lock core;
63
:access first service;
64
while (Service is not ""NULL""\nand service ID is lower?) is (yes)
65
  :proceed to next service;
66
endwhile (no)
67
if (Current service is ""NULL""?) then (yes)
68
  :append self to core's list of services;
69
  :unlock core;
70
  stop
71
  note
72
    Returns ""URT_STATUS_OK"":
73
  endnote
74
elseif (Current service ID is greater?) then (yes)
75
  :insert self in front of current service;
76
  :unlock core;
77
  stop
78
  note
79
    Returns ""URT_STATUS_OK"":
80
  endnote
81
else (no)
82
  :unlock core;
83
  stop
84
  note
85
    Returns ""URT_STATUS_ERROR"":
86
  endnote
87
endif
88

    
89
/'### OUTRO ##################################################################'/
90

    
91
@enduml