1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package com.intel.bluetooth;
22
23 import java.io.IOException;
24
25 import javax.bluetooth.BluetoothStateException;
26 import javax.bluetooth.DeviceClass;
27 import javax.bluetooth.DiscoveryListener;
28 import javax.bluetooth.RemoteDevice;
29 import javax.bluetooth.ServiceRegistrationException;
30 import javax.bluetooth.UUID;
31
32 class BluetoothStackToshiba implements BluetoothStack, DeviceInquiryRunnable, SearchServicesRunnable {
33
34 private boolean initialized = false;
35
36 BluetoothStackToshiba() {
37
38 }
39
40
41
42 public String getStackID() {
43 return BlueCoveImpl.STACK_TOSHIBA;
44 }
45
46 public String toString() {
47 return getStackID();
48 }
49
50
51
52
53
54
55 public int getFeatureSet() {
56 return 0;
57 }
58
59
60
61
62
63
64 public native boolean isNativeCodeLoaded();
65
66
67
68
69
70
71 public LibraryInformation[] requireNativeLibraries() {
72 return LibraryInformation.library(BlueCoveImpl.NATIVE_LIB_TOSHIBA);
73 }
74
75 public native int getLibraryVersion();
76
77 public native int detectBluetoothStack();
78
79 public native void enableNativeDebug(Class nativeDebugCallback, boolean on);
80
81 private native boolean initializeImpl() throws BluetoothStateException;
82
83 private native void destroyImpl();
84
85 public void initialize() throws BluetoothStateException {
86 if (!initializeImpl()) {
87 throw new BluetoothStateException("TOSHIBA BluetoothStack not found");
88 }
89 initialized = true;
90 }
91
92 public void destroy() {
93 if (initialized) {
94 destroyImpl();
95 initialized = false;
96 DebugLog.debug("TOSHIBA destroyed");
97 }
98 }
99
100
101
102
103
104
105 public boolean isCurrentThreadInterruptedCallback() {
106 return UtilsJavaSE.isCurrentThreadInterrupted();
107 }
108
109
110
111 public native String getLocalDeviceBluetoothAddress() throws BluetoothStateException;
112
113 public DeviceClass getLocalDeviceClass() {
114
115 return null;
116 }
117
118
119
120
121
122
123 public void setLocalDeviceServiceClasses(int classOfDevice) {
124
125 }
126
127 public String getLocalDeviceName() {
128
129 return null;
130 }
131
132 public boolean isLocalDevicePowerOn() {
133
134 return false;
135 }
136
137 public String getLocalDeviceProperty(String property) {
138
139 return null;
140 }
141
142 public int getLocalDeviceDiscoverable() {
143
144 return 0;
145 }
146
147 public boolean setLocalDeviceDiscoverable(int mode) throws BluetoothStateException {
148
149 return false;
150 }
151
152 public String getRemoteDeviceFriendlyName(long address) throws IOException {
153
154 return null;
155 }
156
157
158
159 public boolean authenticateRemoteDevice(long address) throws IOException {
160 return false;
161 }
162
163
164
165
166
167
168
169 public boolean authenticateRemoteDevice(long address, String passkey) throws IOException {
170 return false;
171 }
172
173
174
175 public boolean startInquiry(int accessCode, DiscoveryListener listener) throws BluetoothStateException {
176 return DeviceInquiryThread.startInquiry(this, this, accessCode, listener);
177 }
178
179 public int runDeviceInquiry(DeviceInquiryThread startedNotify, int accessCode, DiscoveryListener listener)
180 throws BluetoothStateException {
181
182 return 0;
183 }
184
185 public void deviceDiscoveredCallback(DiscoveryListener listener, long deviceAddr, int deviceClass,
186 String deviceName, boolean paired) {
187
188 }
189
190 public boolean cancelInquiry(DiscoveryListener listener) {
191
192 return false;
193 }
194
195
196
197 public int runSearchServices(SearchServicesThread startedNotify, int[] attrSet, UUID[] uuidSet,
198 RemoteDevice device, DiscoveryListener listener) throws BluetoothStateException {
199 return SearchServicesThread.startSearchServices(this, this, attrSet, uuidSet, device, listener);
200 }
201
202 public int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice device, DiscoveryListener listener)
203 throws BluetoothStateException {
204
205 return 0;
206 }
207
208 public boolean cancelServiceSearch(int transID) {
209
210 return false;
211 }
212
213 public boolean populateServicesRecordAttributeValues(ServiceRecordImpl serviceRecord, int[] attrIDs)
214 throws IOException {
215
216 return false;
217 }
218
219
220
221 public long connectionRfOpenClientConnection(BluetoothConnectionParams params) throws IOException {
222
223 return 0;
224 }
225
226 public void connectionRfCloseClientConnection(long handle) throws IOException {
227
228
229 }
230
231 public int rfGetSecurityOpt(long handle, int expected) throws IOException {
232 return expected;
233 }
234
235
236
237
238
239
240 public boolean rfEncrypt(long address, long handle, boolean on) throws IOException {
241 return false;
242 }
243
244
245
246 public long rfServerOpen(BluetoothConnectionNotifierParams params, ServiceRecordImpl serviceRecord)
247 throws IOException {
248
249 return 0;
250 }
251
252 public void rfServerClose(long handle, ServiceRecordImpl serviceRecord) throws IOException {
253
254
255 }
256
257 public void rfServerUpdateServiceRecord(long handle, ServiceRecordImpl serviceRecord, boolean acceptAndOpen)
258 throws ServiceRegistrationException {
259
260
261 }
262
263 public long rfServerAcceptAndOpenRfServerConnection(long handle) throws IOException {
264
265 return 0;
266 }
267
268 public void connectionRfCloseServerConnection(long handle) throws IOException {
269
270 }
271
272
273
274 public void connectionRfFlush(long handle) throws IOException {
275
276
277 }
278
279 public int connectionRfRead(long handle) throws IOException {
280
281 return 0;
282 }
283
284 public int connectionRfRead(long handle, byte[] b, int off, int len) throws IOException {
285
286 return 0;
287 }
288
289 public int connectionRfReadAvailable(long handle) throws IOException {
290
291 return 0;
292 }
293
294 public void connectionRfWrite(long handle, int b) throws IOException {
295
296
297 }
298
299 public void connectionRfWrite(long handle, byte[] b, int off, int len) throws IOException {
300
301
302 }
303
304 public long getConnectionRfRemoteAddress(long handle) throws IOException {
305
306 return 0;
307 }
308
309
310
311
312
313
314
315
316
317 public long l2OpenClientConnection(BluetoothConnectionParams params, int receiveMTU, int transmitMTU)
318 throws IOException {
319
320 return 0;
321 }
322
323
324
325
326
327
328 public void l2CloseClientConnection(long handle) throws IOException {
329
330 }
331
332
333
334
335
336
337
338 public long l2ServerOpen(BluetoothConnectionNotifierParams params, int receiveMTU, int transmitMTU,
339 ServiceRecordImpl serviceRecord) throws IOException {
340
341 return 0;
342 }
343
344
345
346
347
348
349
350 public void l2ServerUpdateServiceRecord(long handle, ServiceRecordImpl serviceRecord, boolean acceptAndOpen)
351 throws ServiceRegistrationException {
352
353 }
354
355
356
357
358
359
360 public long l2ServerAcceptAndOpenServerConnection(long handle) throws IOException {
361
362 return 0;
363 }
364
365
366
367
368
369
370 public void l2CloseServerConnection(long handle) throws IOException {
371
372
373 }
374
375
376
377
378
379
380
381 public void l2ServerClose(long handle, ServiceRecordImpl serviceRecord) throws IOException {
382
383
384 }
385
386 public int l2GetSecurityOpt(long handle, int expected) throws IOException {
387 return expected;
388 }
389
390
391
392
393
394
395 public boolean l2Ready(long handle) throws IOException {
396
397 return false;
398 }
399
400
401
402
403
404
405 public int l2Receive(long handle, byte[] inBuf) throws IOException {
406
407 return 0;
408 }
409
410
411
412
413
414
415 public void l2Send(long handle, byte[] data) throws IOException {
416
417 }
418
419
420
421
422
423
424 public int l2GetReceiveMTU(long handle) throws IOException {
425
426 return 0;
427 }
428
429
430
431
432
433
434 public int l2GetTransmitMTU(long handle) throws IOException {
435
436 return 0;
437 }
438
439
440
441
442
443
444 public long l2RemoteAddress(long handle) throws IOException {
445
446 return 0;
447 }
448
449
450
451
452
453
454 public boolean l2Encrypt(long address, long handle, boolean on) throws IOException {
455
456 return false;
457 }
458 }