Added IDataReceiverSink and refactored to separate the EventSink from the GarbageData...
[lwes-dotnet/github-mirror.git] / Org.Lwes / Listener / IEventListener.cs
blobe13edc5b887284294c9fbe6292f6d784e9ba1241
1 //
2 // This file is part of the LWES .NET Binding (LWES.net)
3 //
4 // COPYRIGHT© 2009, Phillip Clark (phillip[at*flitbit[dot*org)
5 // original .NET implementation
6 //
7 // LWES.net is free software: you can redistribute it and/or modify
8 // it under the terms of the Lesser GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
12 // LWES.net is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // Lesser GNU General Public License for more details.
17 // You should have received a copy of the Lesser GNU General Public License
18 // along with LWES.net. If not, see <http://www.gnu.org/licenses/>.
20 namespace Org.Lwes.Listener
22 using System;
23 using System.Net;
25 /// <summary>
26 /// Interface for event listener implementations.
27 /// </summary>
28 public interface IEventListener : IDisposable
30 /// <summary>
31 /// Occurs when an LWES event arrives.
32 /// </summary>
33 event OnLwesEventArrived OnEventArrived;
35 /// <summary>
36 /// Occurs when garbage data is received by the listener.
37 /// </summary>
38 event OnLwesGarbageArrived OnGarbageArrived;
40 /// <summary>
41 /// The ip address where the listener will listen.
42 /// </summary>
43 /// <exception cref="System.InvalidOperationException">thrown if the listener has already been initialized</exception>
44 IPAddress Address
46 get;
47 set;
50 /// <summary>
51 /// The ip port where the listener will listen.
52 /// </summary>
53 /// <exception cref="System.InvalidOperationException">thrown if the listener has already been initialized</exception>
54 int Port
56 get;
57 set;
60 /// <summary>
61 /// Initializes the listener.
62 /// </summary>
63 /// <exception cref="System.InvalidOperationException">thrown if the listener has already been initialized</exception>
64 void Initialize();
66 /// <summary>
67 /// Registers a data receiver sink with the listener without activating the
68 /// event sink.
69 /// </summary>
70 /// <param name="sink">the sink to register</param>
71 /// <returns>A registration key for the sink</returns>
72 /// <remarks>Sinks will not begin to recieve notification
73 /// until <em>after</em> the registration key's <see cref="ISinkRegistrationKey.Activate"/>
74 /// method is called.</remarks>
75 ISinkRegistrationKey RegisterDataReceiverSink(IDataReceiverSink sink);
77 /// <summary>
78 /// Registers an event sink with the listener without activating the
79 /// event sink.
80 /// </summary>
81 /// <param name="sink">the event sink to register</param>
82 /// <returns>A registration key for the event sink</returns>
83 /// <remarks>Sinks will not begin to recieve event notification
84 /// until <em>after</em> the registration key's <see cref="ISinkRegistrationKey.Activate"/>
85 /// method is called.</remarks>
86 ISinkRegistrationKey RegisterEventSink(IEventSink sink);
88 /// <summary>
89 /// Registers a garbage sink with the listener without activating.
90 /// </summary>
91 /// <param name="sink">the sink to register</param>
92 /// <returns>A registration key for the sink</returns>
93 /// <remarks>Sinks will not begin to recieve garbage notification
94 /// until <em>after</em> the registration key's <see cref="ISinkRegistrationKey.Activate"/>
95 /// method is called.</remarks>
96 ISinkRegistrationKey RegisterGarbageSink(IGarbageSink sink);