32feet.NET - User's Guide / Tutorial / Examples
Version 4.0, January 2019
Bluetooth Classic (BR/EDR)
Discovery of classic Bluetooth devices can be done either programmatically where you present the results to the user in your own way, or via a picker component which presents a platform standard component to the user.
RFComm connections are exposed programmatically as Sockets and will be familiar to any developer who has worked with other network communications. You can create your own profile and define your own data structures or use one of the RFComm based Bluetooth classic profiles.
In order to expose a service to which other devices may connect you need to create a valid SDP record and open a listening socket.
Virtual Serial Ports
Separate from the Serial Port Profile for Bluetooth, which defines a serial style connection between devices, some platforms such as Windows support creating a virtual COM port. This appears natively on the system as a hardware port but represents a Bluetooth connection to a device supporting Serial Port Profile. Because of the additional overhead and legacy code you shouldn't use Virtual Serial Ports unless you really need to. For example, if you have an old client app which you can't change and it requires a COM port to operate.
Bluetooth Low Energy (Gatt)
Bluetooth Low Energy consists of one or more services which then have one or more Characteristics which expose a particular value or logic set of values for the remote device. Each Characteristic may support Read/Write/Notify functionality. Rather than maintaining an open connection with a remote device you can monitor these change notifications.
There is currently no intrinsic support for Bluetooth Mesh but you communicate with a mesh using the proxy Mesh Service over Gatt (Bluetooth LE).
Some specific higher-level profiles may be exposed with specific APIs for simplicity.
Object Exchange (Obex)
Object Exchange allows an app to send or retrieve files using a standard protocol that is supported by a number of standard Bluetooth devices such as Printers, Cameras etc. The OBEX protocol is a highly compact format inspired by FTP and runs over an RFComm connection.
32feet.NET supports a number of different platforms and exposes the same .NET API. Not all functionality is available to all platforms and you much check that particular features are supported to avoid exceptions at runtime.
- iOS only supports Bluetooth Classic devices which are designed to Apple's Made for iOS (MFI) specification. Currently you can only connect to the first exported service name on the peripheral. Therefore you can use the BluetoothClient to connect to a single function device like a thermal printer but not any arbitrary service running on a device or another platform.