1
+ % % Copyright 2010 Ulf Angermann
2
+ % %
3
+ % % Licensed under the Apache License, Version 2.0 (the "License");
4
+ % % you may not use this file except in compliance with the License.
5
+ % % You may obtain a copy of the License at
6
+ % %
7
+ % % http://www.apache.org/licenses/LICENSE-2.0
8
+ % %
9
+ % % Unless required by applicable law or agreed to in writing, software
10
+ % % distributed under the License is distributed on an "AS IS" BASIS,
11
+ % % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ % % See the License for the specific language governing permissions and
13
+ % % limitations under the License.
14
+
15
+ % %% -------------------------------------------------------------------
16
+ % %% Author : Ulf Angermann [email protected]
17
+ % %% Description :
18
+ % %%
19
+ % %% Created :
20
+ % %% -------------------------------------------------------------------
21
+ -module (receiver ).
22
+
23
+ -behaviour (gen_server ).
24
+ % % --------------------------------------------------------------------
25
+ % % Include files
26
+ % % --------------------------------------------------------------------
27
+ % % --------------------------------------------------------------------
28
+ % % External exports
29
+
30
+ % % gen_server callbacks
31
+ -export ([init /1 , handle_call /3 , handle_cast /2 , handle_info /2 , terminate /2 , code_change /3 ]).
32
+ -export ([start_link /0 ]).
33
+ -export ([start /0 ]).
34
+
35
+ % % ====================================================================
36
+ % % External functions
37
+ % % ====================================================================
38
+
39
+ % % --------------------------------------------------------------------
40
+ % % record definitions
41
+ % % --------------------------------------------------------------------
42
+ -record (state , {}).
43
+ % % ====================================================================
44
+ % % Server functions
45
+ % % ====================================================================
46
+ % %--------------------------------------------------------------------
47
+ % % Function: start_link() -> {ok,Pid} | ignore | {error,Error}
48
+ % % Description: Starts the server
49
+ % %--------------------------------------------------------------------
50
+ start_link () ->
51
+ gen_server :start_link ({local , ? MODULE }, ? MODULE , [], []).
52
+
53
+ start () ->
54
+ start_link ().
55
+ % % --------------------------------------------------------------------
56
+ % % Function: init/1
57
+ % % Description: Initiates the server
58
+ % % Returns: {ok, State} |
59
+ % % {ok, State, Timeout} |
60
+ % % ignore |
61
+ % % {stop, Reason}
62
+ % % --------------------------------------------------------------------
63
+ init ([]) ->
64
+ {ok , # state {}}.
65
+
66
+ % % --------------------------------------------------------------------
67
+ % % Function: handle_call/3
68
+ % % Description: Handling call messages
69
+ % % Returns: {reply, Reply, State} |
70
+ % % {reply, Reply, State, Timeout} |
71
+ % % {noreply, State} |
72
+ % % {noreply, State, Timeout} |
73
+ % % {stop, Reason, Reply, State} | (terminate/2 is called)
74
+ % % {stop, Reason, State} (terminate/2 is called)
75
+ % % --------------------------------------------------------------------
76
+ handle_call (Request , From , State ) ->
77
+ Reply = ok ,
78
+ {reply , Reply , State }.
79
+
80
+ % % --------------------------------------------------------------------
81
+ % % Function: handle_cast/2
82
+ % % Description: Handling cast messages
83
+ % % Returns: {noreply, State} |
84
+ % % {noreply, State, Timeout} |
85
+ % % {stop, Reason, State} (terminate/2 is called)
86
+ % % --------------------------------------------------------------------
87
+ handle_cast (Msg , State ) ->
88
+ {noreply , State }.
89
+
90
+ % % --------------------------------------------------------------------
91
+ % % Function: handle_info/2
92
+ % % Description: Handling all non call/cast messages
93
+ % % Returns: {noreply, State} |
94
+ % % {noreply, State, Timeout} |
95
+ % % {stop, Reason, State} (terminate/2 is called)
96
+ % % --------------------------------------------------------------------
97
+ handle_info (Info , State ) ->
98
+ {noreply , State }.
99
+
100
+ % % --------------------------------------------------------------------
101
+ % % Function: terminate/2
102
+ % % Description: Shutdown the server
103
+ % % Returns: any (ignored by gen_server)
104
+ % % --------------------------------------------------------------------
105
+ terminate (Reason , State ) ->
106
+ ok .
107
+
108
+ % % --------------------------------------------------------------------
109
+ % % Func: code_change/3
110
+ % % Purpose: Convert process state when code is changed
111
+ % % Returns: {ok, NewState}
112
+ % % --------------------------------------------------------------------
113
+ code_change (OldVsn , State , Extra ) ->
114
+ {ok , State }.
115
+
116
+ % % --------------------------------------------------------------------
117
+ % %% Internal functions
118
+ % % --------------------------------------------------------------------
119
+ % % --------------------------------------------------------------------
120
+ % %% Test functions
121
+ % % --------------------------------------------------------------------
122
+ % % --------------------------------------------------------------------
123
+ % %% Test functions
124
+ % % --------------------------------------------------------------------
125
+ -include_lib (" eunit/include/eunit.hrl" ).
126
+ -ifdef (TEST ).
127
+ -endif .
0 commit comments