Hi,
For a project I am working on I would like to have the Toradex act as a Bluetooth server.
I used the BluetoothUSB flash installer that Toradex provided and in the Control Panel I now have a “Bluetooth Device Properties”-option which works and detects other devices via the Bluetooth USB dongle.
However when I try to use the dongle in code, I get an error.
The Includes are:
winsock2.h,
ws2bth.h,
bt_sdp.h,
bthapi.h,
bt_api.h,
winioctl.h,
windows.h
This is the code:
int Main(int argc, char **argv)
{
WSADATA wsd;
if (WSAStartup(MAKEWORD(2, 2), &wsd)){
wprintf(L"Initialization of socket subsystem failed! Error = %d\n", WSAGetLastError());
return 0;
}
SOCKET server = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
if(server == INVALID_SOCKET){
printf("socket failed, error %d\n", WSAGetLastError());
return 0;
}
return 0;
}
This compiles, but when running it fails at the socket creation.
GetLastError returns 10043, which means WSAEPROTONOSUPPORT.
A quick search gives me this list with error codes:
I have no idea what I’m doing wrong.
The code runs on a normal laptop with bluetooth, so I suspect it has something to do with the driver or so.
Any help is appreciated!
Kind Regards,
Kevin