Skip to content
Peter Foot edited this page Dec 12, 2023 · 33 revisions

32feet.NET - User's Guide / Tutorial / Examples

Version 4.1.40, December 2023

Bluetooth Classic (BR/EDR)

Discovery

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.

Client

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.

Server

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 consists of one or more services which then have one or more Characteristics which expose a particular value or logical 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.

Bluetooth Mesh

There is currently no intrinsic support for Bluetooth Mesh but you can communicate with a mesh using the proxy Mesh Service over Gatt.

Other Services

See a more detailed list of Bluetooth LE Services.

IrDA

InTheHand.Net.IrDA supports client and server IrDA connectivity for Windows. The Object model is based on Microsoft's IrDA implementation for Windows CE / .NET Compact Framework which was ported to desktop Windows in the original release of 32feet.NET. It will be very familiar if you have used TcpClient/TcpListener classes in .NET. Few devices will have the requisite hardware to use IrDA these days but you can use it if you attach a USB IrDA dongle and enable the IrDA Subsystem in Windows 10 and above. more details...

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. InTheHand.Net.Obex supports object exchange over Bluetooth RfComm, IrDA and TCP/IP.

Samples

Samples are migrating to their own repository here. Additional samples can be found in the samples folder. There is a very useful example project for Unity developers created by Jen-Chieh Shen.

Platforms

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.

Platforms which use a sandbox may require permissions to be defined in the app manifest and or requested at runtime. Read more about Permissions.

Feature Windows Android iOS tvOS watchOS macOS Linux Tizen
RFComm Client Yes Yes Yes* Planned Yes**
RFComm Server Yes Yes Yes**
Discovery Yes Yes Planned Planned
Discovery Picker Yes Yes Yes* Planned
Bluetooth LE Picker Yes Yes Yes
Gatt Client Yes Yes Yes Yes Yes Yes
Gatt Server Planned Planned Planned Planned
Obex Client Yes Planned Planned Planned
Obex Server Planned Planned
IrDA Client Yes
IrDA Server Yes
  • 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. ** Linux doesn't currently have SDP functionality so you can only connect to a known channel number.
Clone this wiki locally