forked from lz1asl/CaveSurvey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
no_bosch_library.patch
677 lines (672 loc) · 25.8 KB
/
no_bosch_library.patch
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
From 7fff67280ff05116e7a08dde61c705548c83e816 Mon Sep 17 00:00:00 2001
From: lz1asl <[email protected]>
Date: Tue, 2 Jun 2020 23:03:25 +0300
Subject: [PATCH] update bosch patch
---
build.gradle | 3 -
.../service/bluetooth/BluetoothService.java | 10 -
.../glm/AbstractBoschGLMBluetoothDevice.java | 208 ------------------
.../glm/BoschGLM100CBluetoothDevice.java | 58 -----
.../bosch/glm/BoschGLM50CBluetoothDevice.java | 59 -----
.../bosch/glm/BoschPLR30CBluetoothDevice.java | 54 -----
.../bosch/glm/BoschPLR40CBluetoothDevice.java | 55 -----
.../bosch/glm/BoschPLR50CBluetoothDevice.java | 57 -----
.../glm/GLMBluetoothConnectionWrapper.java | 75 -------
9 files changed, 579 deletions(-)
delete mode 100644 src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/AbstractBoschGLMBluetoothDevice.java
delete mode 100644 src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM100CBluetoothDevice.java
delete mode 100644 src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM50CBluetoothDevice.java
delete mode 100644 src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR30CBluetoothDevice.java
delete mode 100644 src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR40CBluetoothDevice.java
delete mode 100644 src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR50CBluetoothDevice.java
delete mode 100644 src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/GLMBluetoothConnectionWrapper.java
diff --git a/build.gradle b/build.gradle
index bd8a7d7..2af64a2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -25,9 +25,6 @@ dependencies {
implementation 'com.j256.ormlite:ormlite-android:4.48'
implementation 'org.apache.poi:poi:3.15'
- // Bosch internal protocol
- implementation files('../CaveSurveyBoschGLM/binary/CaveSurveyBoschGLM.jar')
-
// kotlin
implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/BluetoothService.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/BluetoothService.java
index 967a35a..52d109c 100644
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/BluetoothService.java
+++ b/src/main/java/com/astoev/cave/survey/service/bluetooth/BluetoothService.java
@@ -42,11 +42,6 @@ import com.astoev.cave.survey.service.bluetooth.device.comm.DistoXBluetoothDevic
import com.astoev.cave.survey.service.bluetooth.device.comm.LaserAceBluetoothDevice;
import com.astoev.cave.survey.service.bluetooth.device.comm.LeicaDistoD3aBtBluetoothDevice;
import com.astoev.cave.survey.service.bluetooth.device.comm.TruPulse360BluetoothDevice;
-import com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm.BoschGLM100CBluetoothDevice;
-import com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm.BoschGLM50CBluetoothDevice;
-import com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm.BoschPLR30CBluetoothDevice;
-import com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm.BoschPLR40CBluetoothDevice;
-import com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm.BoschPLR50CBluetoothDevice;
import com.astoev.cave.survey.service.bluetooth.lecommands.AbstractBluetoothCommand;
import com.astoev.cave.survey.service.bluetooth.lecommands.EnableNotificationCommand;
import com.astoev.cave.survey.service.bluetooth.lecommands.PullCharacteristicCommand;
@@ -94,11 +89,6 @@ public class BluetoothService {
SUPPORTED_BLUETOOTH_COM_DEVICES.add(new LaserAceBluetoothDevice());
SUPPORTED_BLUETOOTH_COM_DEVICES.add(new TruPulse360BluetoothDevice());
SUPPORTED_BLUETOOTH_COM_DEVICES.add(new DistoXBluetoothDevice());
- SUPPORTED_BLUETOOTH_COM_DEVICES.add(new BoschGLM50CBluetoothDevice());
- SUPPORTED_BLUETOOTH_COM_DEVICES.add(new BoschGLM100CBluetoothDevice());
- SUPPORTED_BLUETOOTH_COM_DEVICES.add(new BoschPLR30CBluetoothDevice());
- SUPPORTED_BLUETOOTH_COM_DEVICES.add(new BoschPLR40CBluetoothDevice());
- SUPPORTED_BLUETOOTH_COM_DEVICES.add(new BoschPLR50CBluetoothDevice());
SUPPORTED_BLUETOOTH_COM_DEVICES.add(new LeicaDistoD3aBtBluetoothDevice());
// LE devices
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/AbstractBoschGLMBluetoothDevice.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/AbstractBoschGLMBluetoothDevice.java
deleted file mode 100644
index 9b89a92..0000000
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/AbstractBoschGLMBluetoothDevice.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm;
-
-import android.util.Log;
-
-import com.astoev.cave.survey.Constants;
-import com.astoev.cave.survey.R;
-import com.astoev.cave.survey.activity.UIUtilities;
-import com.astoev.cave.survey.exception.DataException;
-import com.astoev.cave.survey.service.bluetooth.Measure;
-import com.astoev.cave.survey.service.bluetooth.device.comm.AbstractBluetoothRFCOMMDevice;
-import com.astoev.cave.survey.util.ConfigUtil;
-import com.bosch.mtprotocol.MtMessage;
-import com.bosch.mtprotocol.MtProtocol;
-import com.bosch.mtprotocol.glm100C.MtProtocolImpl;
-import com.bosch.mtprotocol.glm100C.event.MtProtocolFatalErrorEvent;
-import com.bosch.mtprotocol.glm100C.event.MtProtocolReceiveMessageEvent;
-import com.bosch.mtprotocol.glm100C.event.MtProtocolRequestTimeoutEvent;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCInputMessage;
-import com.bosch.mtprotocol.glm100C.message.sync.SyncInputMessage;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Bosch GLM protocol based devices.
- */
-
-public abstract class AbstractBoschGLMBluetoothDevice extends AbstractBluetoothRFCOMMDevice
- implements MtProtocol.MTProtocolEventObserver {
-
- protected MtProtocolImpl protocol;
- private MtMessage lastMessage = null;
- private boolean initSyncRequest;
- private boolean ownReadError = false;
-
- @Override
- public void triggerMeasures(OutputStream aStream, List<Constants.MeasureTypes> aMeasures) throws IOException {
- // no need to perform actions
- }
-
- @Override
- public List<Measure> decodeMeasure(byte[] aResponseBytes, List<Constants.MeasureTypes> aMeasures) throws DataException {
-
- List<Measure> measures = null;
-
- if (lastMessage != null && lastMessage instanceof SyncInputMessage) {
- SyncInputMessage syncMessage = (SyncInputMessage) lastMessage;
-
- Log.d(Constants.LOG_TAG_BT, "Decoding sync message: " + syncMessage.toString());
-
- measures = Arrays.asList(
- new Measure(Constants.MeasureTypes.distance, Constants.MeasureUnits.meters, syncMessage.getResult()),
- new Measure(Constants.MeasureTypes.slope, Constants.MeasureUnits.degrees, syncMessage.getAngle()));
-
- } else if (lastMessage != null && lastMessage instanceof EDCInputMessage) {
- EDCInputMessage message = (EDCInputMessage) lastMessage;
-
- Log.d(Constants.LOG_TAG_BT, "Decoding edc message: " + message.toString());
-
- measures = new ArrayList<>();
- if (EDCInputMessage.MODE_SINGLE_DISTANCE == message.getDevMode()) {
- // PLR 30 C and PLR 40 C - only distance available
- measures.add(new Measure(Constants.MeasureTypes.distance, Constants.MeasureUnits.meters, message.getResult()));
- } else if (EDCInputMessage.MODE_INDIRECT_LENGTH == message.getDevMode()) {
- // PLR 50 C, GLM 50 C - distance and clino in indirect length mode
- measures.add(new Measure(Constants.MeasureTypes.distance, Constants.MeasureUnits.meters, message.getComp1()));
- if (isMeasureSupported(Constants.MeasureTypes.slope)) { // just in case
- measures.add(new Measure(Constants.MeasureTypes.slope, Constants.MeasureUnits.degrees, message.getComp2()));
- }
- } else {
- warnToUseProperMode();
- }
- }
-
- // reset last message
- lastMessage = null;
-
- return measures;
- }
-
- @Override
- public boolean isFullPacketAvailable(byte[] aBytesBuffer) {
- return lastMessage != null || ownReadError;
- }
-
- @Override
- public void configure(InputStream anInput, OutputStream anOutput) {
-
- // initialize the internal Bosch protocol
- protocol = new MtProtocolImpl();
- protocol.addObserver(this);
- protocol.setTimeout(5000);
- protocol.initialize(new GLMBluetoothConnectionWrapper(this, anInput, anOutput));
-
- // instruct device to send events automatically
- initSyncRequest = true;
- MtMessage configMessage = createGLMConfigMessage();
- protocol.sendMessage(configMessage);
- }
-
- // turn sync on and enter desired mode
- protected abstract MtMessage createGLMConfigMessage();
-
- // used to check measurement mode is valid, e.g. not changed meanwhile
- protected abstract List<Integer> getGLMModes();
-
- // displayed to the user
- protected abstract int getGLMModesLabel();
-
- @Override
- public void onEvent(MtProtocol.MTProtocolEvent event) {
-
- // something happening on the device
- Log.i(Constants.LOG_TAG_BT, "Got " + event.getClass().getSimpleName());
-
- if(event instanceof MtProtocolFatalErrorEvent){
-
- // fatal error
- Log.e(Constants.LOG_TAG_BT, "Received MtProtocolFatalErrorEvent");
- UIUtilities.showNotification(R.string.error);
- } else if(event instanceof MtProtocolReceiveMessageEvent) {
-
- MtMessage message = ((MtProtocolReceiveMessageEvent) event).getMessage();
-
- if (message instanceof SyncInputMessage) {
- SyncInputMessage syncMessage = (SyncInputMessage) message;
-
- if(initSyncRequest) { // Ignore first response
- initSyncRequest = false;
- Log.d(Constants.LOG_TAG_BT, "Ignore syncMessage = " + syncMessage);
- return;
- }
-
- Log.i(Constants.LOG_TAG_BT, "SyncInputMessageReceived: " + syncMessage.toString());
- if (getGLMModes().contains(syncMessage.getMode())) {
- if (syncMessage.getLaserOn() == 1) {
- Log.d(Constants.LOG_TAG_BT, "Ignore laser 1 message");
- lastMessage = null;
- } else{
- Log.d(Constants.LOG_TAG_BT, "Store message");
- lastMessage = message;
- }
- } else {
- warnToUseProperMode();
- }
-
- } else if(message instanceof EDCInputMessage) {
-
- if (initSyncRequest) { // Ignore first response
- initSyncRequest = false;
- Log.d(Constants.LOG_TAG_BT, "Ignore syncMessage = " + message);
- return;
- }
- Log.d(Constants.LOG_TAG_BT, "Received EDC: " + message.toString());
- EDCInputMessage edcMessage = (EDCInputMessage) message;
- Log.d(Constants.LOG_TAG_BT, "EDCInputMessageReceived: " + edcMessage.toString());
- if(getGLMModes().contains(edcMessage.getDevMode())) {
- if (edcMessage.getLaserOn() == 1) {
- Log.d(Constants.LOG_TAG_BT, "Ignore laser 1 message");
- lastMessage = null;
- } else{
- lastMessage = message;
- }
- } else {
- warnToUseProperMode();
- }
- } else {
- Log.d(Constants.LOG_TAG_BT, "Received Unknown message");
- UIUtilities.showNotification(R.string.error);
- }
- } else if(event instanceof MtProtocolRequestTimeoutEvent){
- Log.d(Constants.LOG_TAG_BT, "Received MtProtocolRequestTimeoutEvent");
- UIUtilities.showNotification("Timeout");
- } else {
- Log.e(Constants.LOG_TAG_BT, "Received unknown event");
- UIUtilities.showNotification(R.string.error);
- }
- initSyncRequest = false;
- }
-
- private void warnToUseProperMode() {
- // warn user to use proper device mode
- String requiredMode = ConfigUtil.getContext().getString(getGLMModesLabel());
- UIUtilities.showNotification(R.string.bt_device_mode, requiredMode);
- }
-
- @Override
- public boolean useOwnRead() {
- // Bosch protocol responsible for reading the data
- return true;
- }
-
- @Override
- public boolean getOwnReadError() {
- return ownReadError;
- }
-
- @Override
- public void onError() {
- Log.e(Constants.LOG_TAG_BT, "Own protocol error");
- protocol.destroy();
- ownReadError = true;
- }
-}
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM100CBluetoothDevice.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM100CBluetoothDevice.java
deleted file mode 100644
index 2e6071c..0000000
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM100CBluetoothDevice.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm;
-
-import com.astoev.cave.survey.Constants;
-import com.astoev.cave.survey.R;
-import com.bosch.mtprotocol.MtMessage;
-import com.bosch.mtprotocol.glm100C.message.sync.SyncInputMessage;
-import com.bosch.mtprotocol.glm100C.message.sync.SyncOutputMessage;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static com.astoev.cave.survey.Constants.MeasureTypes.distance;
-import static com.astoev.cave.survey.Constants.MeasureTypes.slope;
-
-/**
- * Bosch GLM100c over comm connection.
- * Support for distance, and inclination.
- *
- * Created by astoev on 10/11/17.
- */
-
-public class BoschGLM100CBluetoothDevice extends AbstractBoschGLMBluetoothDevice {
-
- @Override
- public boolean isNameSupported(String aName) {
- return deviceNameStartsWith(aName, "BOSCH GLM100C ");
- }
-
- @Override
- public String getDescription() {
- return "Bosch GLM 100 C";
- }
-
- @Override
- protected List<Constants.MeasureTypes> getSupportedMeasureTypes() {
- // 100m laser and 360' clino
- return Arrays.asList(distance, slope);
- }
-
- @Override
- protected MtMessage createGLMConfigMessage() {
- SyncOutputMessage configMessage = new SyncOutputMessage();
- configMessage.setSyncControl(SyncOutputMessage.MODE_AUTOSYNC_CONTROL_ON);
- configMessage.setMode(getGLMModes().get(0));
- return configMessage;
- }
-
- @Override
- protected List<Integer> getGLMModes() {
- return Arrays.asList(SyncInputMessage.MEAS_MODE_SINGLE);
- }
-
- @Override
- protected int getGLMModesLabel() {
- return R.string.bt_device_mode_single;
- }
-
-}
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM50CBluetoothDevice.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM50CBluetoothDevice.java
deleted file mode 100644
index ee13a1a..0000000
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschGLM50CBluetoothDevice.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm;
-
-import com.astoev.cave.survey.Constants;
-import com.astoev.cave.survey.R;
-import com.bosch.mtprotocol.MtMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCInputMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCOutputMessage;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static com.astoev.cave.survey.Constants.MeasureTypes.distance;
-import static com.astoev.cave.survey.Constants.MeasureTypes.slope;
-
-/**
- * Bosch GLM50c over comm connection.
- *
- * Created by astoev on 12/13/17.
- */
-
-public class BoschGLM50CBluetoothDevice extends AbstractBoschGLMBluetoothDevice {
-
- @Override
- public boolean isNameSupported(String aName) {
- return deviceNameStartsWith(aName, "Bosch GLM50C ");
- }
-
- @Override
- public String getDescription() {
- return "Bosch GLM 50 C";
- }
-
-
- @Override
- protected List<Constants.MeasureTypes> getSupportedMeasureTypes() {
- // 50m laser and 360' clino
- return Arrays.asList(distance, slope);
- }
-
- @Override
- protected MtMessage createGLMConfigMessage() {
- EDCOutputMessage configMessage = new EDCOutputMessage();
- configMessage.setSyncControl(EDCOutputMessage.MODE_AUTOSYNC_CONTROL_ON);
- configMessage.setDevMode(EDCOutputMessage.READ_ONLY_MODE);
- // TODO auto enter indirect length mode
- return configMessage;
- }
-
- @Override
- protected List<Integer> getGLMModes() {
- return Arrays.asList(EDCInputMessage.MODE_INDIRECT_LENGTH,
- EDCInputMessage.MODE_SINGLE_DISTANCE);
- }
-
- @Override
- protected int getGLMModesLabel() {
- return R.string.bt_device_mode_single_or_indirect;
- }
-}
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR30CBluetoothDevice.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR30CBluetoothDevice.java
deleted file mode 100644
index 9b0972c..0000000
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR30CBluetoothDevice.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm;
-
-import com.astoev.cave.survey.Constants;
-import com.astoev.cave.survey.R;
-import com.bosch.mtprotocol.MtMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCInputMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCOutputMessage;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static com.astoev.cave.survey.Constants.MeasureTypes.distance;
-
-/**
- * Bosch PLR 30 C over comm.
- * Created by astoev on 12/24/15.
- */
-public class BoschPLR30CBluetoothDevice extends AbstractBoschGLMBluetoothDevice {
-
-
- @Override
- public boolean isNameSupported(String aName) {
- return deviceNameStartsWith(aName, "Bosch PLR30C");
- }
-
- @Override
- public String getDescription() {
- return "Bosch PLR 30 C";
- }
-
- @Override
- protected List<Constants.MeasureTypes> getSupportedMeasureTypes() {
- // only distance
- return Arrays.asList(distance);
- }
-
- @Override
- protected MtMessage createGLMConfigMessage() {
- EDCOutputMessage configMessage = new EDCOutputMessage();
- configMessage.setSyncControl(EDCOutputMessage.MODE_AUTOSYNC_CONTROL_ON);
- configMessage.setDevMode(EDCOutputMessage.READ_ONLY_MODE);
- return configMessage;
- }
-
- @Override
- protected List<Integer> getGLMModes() {
- return Arrays.asList(EDCInputMessage.MODE_SINGLE_DISTANCE);
- }
-
- @Override
- protected int getGLMModesLabel() {
- return R.string.bt_device_mode_single;
- }
-}
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR40CBluetoothDevice.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR40CBluetoothDevice.java
deleted file mode 100644
index c9761fe..0000000
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR40CBluetoothDevice.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm;
-
-import com.astoev.cave.survey.Constants;
-import com.astoev.cave.survey.R;
-import com.bosch.mtprotocol.MtMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCInputMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCOutputMessage;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static com.astoev.cave.survey.Constants.MeasureTypes.distance;
-
-/**
- * Bosch PLR 40 C over comm.
- * Created by astoev on 12/24/15.
- */
-public class BoschPLR40CBluetoothDevice extends AbstractBoschGLMBluetoothDevice {
-
-
- @Override
- public boolean isNameSupported(String aName) {
- return deviceNameStartsWith(aName, "Bosch PLR40C");
- }
-
- @Override
- public String getDescription() {
- return "Bosch PLR 40 C";
- }
-
- @Override
- protected List<Constants.MeasureTypes> getSupportedMeasureTypes() {
- // only distance
- return Arrays.asList(distance);
- }
-
-
- @Override
- protected MtMessage createGLMConfigMessage() {
- EDCOutputMessage configMessage = new EDCOutputMessage();
- configMessage.setSyncControl(EDCOutputMessage.MODE_AUTOSYNC_CONTROL_ON);
- configMessage.setDevMode(EDCOutputMessage.READ_ONLY_MODE);
- return configMessage;
- }
-
- @Override
- protected List<Integer> getGLMModes() {
- return Arrays.asList(EDCInputMessage.MODE_SINGLE_DISTANCE);
- }
-
- @Override
- protected int getGLMModesLabel() {
- return R.string.bt_device_mode_single;
- }
-}
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR50CBluetoothDevice.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR50CBluetoothDevice.java
deleted file mode 100644
index e6f1b48..0000000
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/BoschPLR50CBluetoothDevice.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm;
-
-import com.astoev.cave.survey.Constants;
-import com.astoev.cave.survey.R;
-import com.bosch.mtprotocol.MtMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCInputMessage;
-import com.bosch.mtprotocol.glm100C.message.edc.EDCOutputMessage;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static com.astoev.cave.survey.Constants.MeasureTypes.distance;
-import static com.astoev.cave.survey.Constants.MeasureTypes.slope;
-
-/**
- * Bosch PLR 50 C over comm.
- * Created by astoev on 12/24/15.
- */
-public class BoschPLR50CBluetoothDevice extends AbstractBoschGLMBluetoothDevice {
-
-
- @Override
- public boolean isNameSupported(String aName) {
- return deviceNameStartsWith(aName, "Bosch PLR50C");
- }
-
- @Override
- public String getDescription() {
- return "Bosch PLR 50 C";
- }
-
- @Override
- protected List<Constants.MeasureTypes> getSupportedMeasureTypes() {
- // 50m laser and 360' clino
- return Arrays.asList(distance, slope);
- }
-
- @Override
- protected MtMessage createGLMConfigMessage() {
- EDCOutputMessage configMessage = new EDCOutputMessage();
- configMessage.setSyncControl(EDCOutputMessage.MODE_AUTOSYNC_CONTROL_ON);
- configMessage.setDevMode(EDCOutputMessage.READ_ONLY_MODE);
- // TODO auto enter indirect length mode
- return configMessage;
- }
-
- @Override
- protected List<Integer> getGLMModes() {
- return Arrays.asList(EDCInputMessage.MODE_INDIRECT_LENGTH,
- EDCInputMessage.MODE_SINGLE_DISTANCE);
- }
-
- @Override
- protected int getGLMModesLabel() {
- return R.string.bt_device_mode_single_or_indirect;
- }
-}
diff --git a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/GLMBluetoothConnectionWrapper.java b/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/GLMBluetoothConnectionWrapper.java
deleted file mode 100644
index 2f8e4b2..0000000
--- a/src/main/java/com/astoev/cave/survey/service/bluetooth/device/comm/bosch/glm/GLMBluetoothConnectionWrapper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.astoev.cave.survey.service.bluetooth.device.comm.bosch.glm;
-
-import android.util.Log;
-
-import com.astoev.cave.survey.Constants;
-import com.bosch.mtprotocol.glm100C.connection.MtAsyncConnection;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * Created by astoev on 12/13/17.
- */
-
-public class GLMBluetoothConnectionWrapper implements MtAsyncConnection {
-
- private InputStream in;
- private OutputStream out;
- private AbstractBoschGLMBluetoothDevice deviceSpec;
-
- public GLMBluetoothConnectionWrapper(AbstractBoschGLMBluetoothDevice aDevice, InputStream aIn, OutputStream aOut) {
- in = aIn;
- out = aOut;
- deviceSpec = aDevice;
- }
-
- @Override
- public boolean isOpen() {
- // streams open before me
- return true;
- }
-
- @Override
- public void openConnection() {
- // stream already open
- }
-
- @Override
- public void closeConnection() {
- // error occured internally
- Log.e(Constants.LOG_TAG_BT, "Close connection requested");
- deviceSpec.onError();
- }
-
- @Override
- public int read(byte[] buffer) throws IOException {
- if (in != null) {
- return in.read(buffer);
- }
- return 0;
- }
-
- @Override
- public void write(byte[] data) throws IOException {
- if (out != null) {
- out.write(data);
- }
- }
-
- @Override
- public int getState() {
- return 0;
- }
-
- @Override
- public void addObserver(MTAsyncConnectionObserver observer) {
- // connection state managed outside me
- }
-
- @Override
- public void removeObserver(MTAsyncConnectionObserver observer) {
- // connection state managed outside me
- }
-}
--
2.25.1