<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
This permission will automaticaly inserted by module de.appwerft.bluetoothmanager
This file contains all BT-commands and will automaticaly imported from modules asset folder.
The SDK need for work a licence key. Currently you can use the public known key (also part of this module) or you can an own one. In this case you can put it into tiapp.xml:
<property
name="DISTO_KEY"
type="String">1Xj1z6thybdW/O+Jc6XG2ExVzYuY3GF4h+</property>
const LeicaSDK = require("de.appwerft.disto");
const BTManager = require("de.appwerft.bluetoothmanager");
if (LeicaSDK.verifyPermissions() == true) {
LeicaSDK
.setLogLevel(LeicaSDK.DEBUG)
.setTimeout(10000)
.init();
LeicaSDK.Devicemanager.findAvailableDevices({
onfound : (e) => {
const currentDevive = e.device;
currentDevice.connect({
ondata : (data) => {
console.log(data);
},
onconnect : () => {
currentDevice.startTracking();
}
});
}
});
}
- DEVICE_TYPE_BLE
- DEVICE_TYPE_DISTO
- DEVICE_TYPE_YETI
- DEVICE_CONNECTION_STATE_CONNECTED
- DEVICE_CONNECTION_STATE_DISCONNECTED
- DEVICE_STATE_NORMAL
- DEVICE_STATE_UPDATE
- CONNECTION_TYPE_WIFI_AP
- CONNECTION_TYPE_WIFI_HOTSPOT
const BT = require("de.appwerft.bluetoothmanager");
var state = BT.getAvailability();
The result can be:
- NOTAVAILABLE
- DISABLED
- ENABLED
In case two you can enable BT by:
import BT from "de.appwerft.bluetoothmanager";
BT.enable({
onsuccess : handleDisto, // result is name and address of BT on device
onerror : e => {}
});
This opens a system dialog and the user can grant (or not)
Possible results are:
- NOTAVAILABLE
- DISABLED
- ENABLED
This constants are part of sub module Bluetooth.
If false then you cannot use this device.
If false you can start enable()
This method has an object with to callbacks: onsuccess
and onerror
.
Alternatively you can overwrite the onSuccess property:
Bluetooth.onSuccess = (e) => {
// Disto work
};
Reads the commands.json
in modules assets folder. You can use a String paramter for filename. commands.json
is default.
import Disto from 'de.appwerft.disto';
Disto.setLogLevel(Disto.DEBUG).setTimeout(10000).init();
DeviceManager ist available under LeicaSDK.Devicemanager
- onfound: Function
Return a list of device. For every device you can the methods below:
Start one measurement.
Start continously measurement
no comment
As mentioned this module only works for Yeti-protocol. On request we can extend the module for usage with other protocols.