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 package com.intel.bluetooth.tcpobex;
26
27 import java.io.IOException;
28
29 import javax.bluetooth.ServiceRecord;
30 import javax.bluetooth.ServiceRegistrationException;
31 import javax.obex.Authenticator;
32 import javax.obex.ClientSession;
33 import javax.obex.HeaderSet;
34 import javax.obex.Operation;
35 import javax.obex.ServerRequestHandler;
36 import javax.obex.SessionNotifier;
37
38 import com.ibm.oti.connection.CreateConnection;
39 import com.intel.bluetooth.BluetoothConnectionNotifierServiceRecordAccess;
40 import com.intel.bluetooth.BluetoothConsts;
41 import com.intel.bluetooth.MicroeditionConnector;
42
43
44
45
46
47
48
49
50
51
52
53 public class Connection implements CreateConnection, ClientSession, SessionNotifier,
54 BluetoothConnectionNotifierServiceRecordAccess {
55
56 private javax.microedition.io.Connection impl;
57
58 public Connection() {
59 impl = null;
60 }
61
62 public void setParameters(String spec, int access, boolean timeout) throws IOException {
63 impl = MicroeditionConnector.open(BluetoothConsts.PROTOCOL_SCHEME_TCP_OBEX + ":" + spec, access, timeout);
64 }
65
66 public javax.microedition.io.Connection setParameters2(String spec, int access, boolean timeout) throws IOException {
67 setParameters(spec, access, timeout);
68 return this;
69 }
70
71 public void close() throws IOException {
72 impl.close();
73 }
74
75 public HeaderSet connect(HeaderSet headers) throws IOException {
76 return ((ClientSession) impl).connect(headers);
77 }
78
79 public HeaderSet createHeaderSet() {
80 return ((ClientSession) impl).createHeaderSet();
81 }
82
83 public HeaderSet delete(HeaderSet headers) throws IOException {
84 return ((ClientSession) impl).delete(headers);
85 }
86
87 public HeaderSet disconnect(HeaderSet headers) throws IOException {
88 return ((ClientSession) impl).disconnect(headers);
89 }
90
91 public Operation get(HeaderSet headers) throws IOException {
92 return ((ClientSession) impl).get(headers);
93 }
94
95 public long getConnectionID() {
96 return ((ClientSession) impl).getConnectionID();
97 }
98
99 public Operation put(HeaderSet headers) throws IOException {
100 return ((ClientSession) impl).put(headers);
101 }
102
103 public void setAuthenticator(Authenticator auth) {
104 ((ClientSession) impl).setAuthenticator(auth);
105
106 }
107
108 public void setConnectionID(long id) {
109 ((ClientSession) impl).setConnectionID(id);
110 }
111
112 public HeaderSet setPath(HeaderSet headers, boolean backup, boolean create) throws IOException {
113 return ((ClientSession) impl).setPath(headers, backup, create);
114 }
115
116 public javax.microedition.io.Connection acceptAndOpen(ServerRequestHandler handler) throws IOException {
117 return ((SessionNotifier) impl).acceptAndOpen(handler);
118 }
119
120 public javax.microedition.io.Connection acceptAndOpen(ServerRequestHandler handler, Authenticator auth)
121 throws IOException {
122 return ((SessionNotifier) impl).acceptAndOpen(handler, auth);
123 }
124
125
126
127
128
129
130 public ServiceRecord getServiceRecord() {
131 return ((BluetoothConnectionNotifierServiceRecordAccess) impl).getServiceRecord();
132 }
133
134
135
136
137
138
139 public void updateServiceRecord(boolean acceptAndOpen) throws ServiceRegistrationException {
140 ((BluetoothConnectionNotifierServiceRecordAccess) impl).updateServiceRecord(acceptAndOpen);
141 }
142
143 }