![]() |
IDTech Windows SDK Guide
3.2.4.393
API reference for Visual Studio .Net
|
The IDTech SDK can be use on Android platform when coding with Xamarin in Visual Studio.
Once you have established your Xamarin project (either Universal or Android only), right-click on your project and select "Manage NuGet Packages..."
Browse for "Xamarin.IDTech.AndroidBinding". Once located, install latest version for your project. This library has a dependency for our IDTechSDK_STD and our comm layer library Xamarin.IDTech.AndroidCommLib. Those additional two libraries will automatically be installed along with the Xamarin.IDTech.AndroidBinding library.
In the MainActivity onCreate routine for Android, execute Xamarin.IDTech.AndroidBinding.IDTechBinding.Init(this) BEFORE base.OnCreate.
In the MainActivity onCreate routine for Android, set this.RequestPermissions AFTER LoadApplication.
After the RequestPermission are established, enable the USB drivers in IDTechBinding by executing Xamarin.IDTech.AndroidBinding.IDTechBinding.enableUSB();
In your manifest of your Android Project, set the required permissions. You can set the manifest by editing Android Project Options ->Android Application->Required Permissions and select the following:
In the Shared (Main) project import IDTechSDK_STD from NuGet
USB device detection is automatic. The SDK callback will inform when devices are attached or detached from the system. No special considerations or coding needed
Using a Serial to USB adapter, you can attempt to connect to a serial device with the following method:
The first parameter is the type of device you would like to connect to. If you would like to connect to a MiniSmartII, you would pass IDT_DEVICE_Types.IDT_DEVICE_MINISMARTII
The second parameter is the baud rate. If you pass a value of 0, it will use the factory default baud rate. Otherwise, if the baud rate was changed, you specify it here (example 9600)
There are four groups of devices that can be used on Android: Bluetooth Low Energy, Audio Jack, USB, and Serial
You connect to a BLE device using the following method:
The first parameter is the device type. This can have one of three possible values: IDT_DEVICE_Types.IDT_DEVICE_VP3300 - VP3300, VP8300 IDT_DEVICE_Types.IDT_DEVICE_NEO2 - VP3600, VP3320, VP3350 (VP6800 BLE is currently not supported) IDT_DEVICE_Types.IDT_DEVICE_NONE - scan for name when no name provided
The second parameter is the device name that you would like to connect to.
If you don't specify a name (and set device type to IDT_DEVICE_Types.IDT_DEVICE_NONE), the SDK will scan the area and return a list of all found names. You can then use one of those names to attempt to connect to that device. When the SDK finishes scanning the area (2-3 seconds), it will return a callback DeviceState.BTListReady. You can then execute IDT_Device.getBLEDeviceList() to retrieve the list of device names found in the vicinity.
The first parameter is the type of device you would like to connect to. If you would like to connect to a MiniSmartII, you would pass IDT_DEVICE_Types.IDT_DEVICE_MINISMARTII
The second parameter is the baud rate. If you pass a value of 0, it will use the factory default baud rate. Otherwise, if the baud rate was changed, you specify it here (example 9600)
Here are the available devices to configure the SDK for the correct model audio jack product
Then when a plug insertion event is detected, you power up the device: