summaryrefslogtreecommitdiff
path: root/tags/host/0.8.1/src/org/reprap/comms/Communicator.java
blob: f59ede6e533384c8019f0e1dbfb7d15998b202f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package org.reprap.comms;

import java.io.IOException;

import org.reprap.Device;
import org.reprap.comms.OutgoingMessage;

/**
 *
 */
public interface Communicator {
	
	/**
	 * @param device
	 * @param messageToSend
	 * @return IncomingContext
	 * @throws IOException
	 */
	public IncomingContext sendMessage(Device device,
			OutgoingMessage messageToSend) throws IOException;

	/**
	 * @param message
	 * @throws IOException
	 */
	public void receiveMessage(IncomingMessage message) throws IOException;
	
	/**
	 * @param message
	 * @param timeout
	 * @throws IOException
	 */
	public void receiveMessage(IncomingMessage message, long timeout) throws IOException;
	
	/**
	 * 
	 */
	public void close();
	
	/**
	 * 
	 */
	public void dispose();
	
	/**
	 * @return Address
	 */
	public Address getAddress();
	
	// These methods will be removed when the asynchronous contexts are completed
	/**
	 * 
	 */
	public void lock();
	
	/**
	 * 
	 */
	public void unlock();
}