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