[Question] Bluetooth socket recv #318
Replies: 2 comments
-
Hmm.... I don't see anything obviously wrong, but I've done little sockets programming before. Is there a way I can repro this somehow and see the error you're getting? I have now added sockets API support to win32 on the builds in the import 'package:win32/win32.dart';
import 'package:win32/winsock2.dart' as winsock2; Then you can call |
Beta Was this translation helpful? Give feedback.
-
Hi, @timsneath thank you for package, final address = calloc<SOCKADDR_BTH>()
..ref.addressFamily = winsock2.AF_BTH
..ref.btAddr = deviceAddress
..ref.serviceClassId.setGUID(serviceId)
..ref.port = BT_PORT_ANY;
winsock2.connect(
bluetoothSocket,
address.cast<winsock2.SOCKADDR>(),
sizeOf<SOCKADDR_BTH>(),
); |
Beta Was this translation helpful? Give feedback.
-
Hi Tim,
Thanks for all the effort you've put into this project. It's some great work. I do have a question about the bluetooth and socket level programming using this library, and was hoping you could give me some pointers.
Using the functions and classes in bthprops I'm able to succesfully ascertain all of the connected devices to a Windows machine. However, I'm having the hardest time figuring out how to connect to a bluetooth device.
I'm able to successfully create a socket using the below block of code using dart:ffi.
However, when I try to
connect
to the socket I keep getting an error code: -1. Below is my current set up for attempting to connect to the socket. I've hardcoded the address, and serviceClassId to the GUID returned byBluetoothEnumerateInstalledServices
.The endgame is to be able to read or
recv
from the socket incoming data from the bluetooth device. Any help is greatly appreciated.Beta Was this translation helpful? Give feedback.
All reactions