Dear Jeff,
Wishing you are feeling better now.
This version properly builds using updated xHarbour bins and BCC 7.70 (you need an updated FWH version):
┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for xHarbour 23.10 - Oct. 2023 Harbour development power │▄
│ (c) FiveTech 1993-2023 for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8/10 │█
└────────────────────────────────────────────────────────────────────────────┘█
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
xHarbour 1.3.1 Intl. (SimpLex) (Build 20240108)
Copyright 1999-2023, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'jeff.prg' and generating preprocessed output to 'jeff.ppo'...
Generating C source output to 'jeff.c'...
Done.
Lines 9, Functions/Procedures 1, pCodes 15
Embarcadero C++ 7.70 for Win32 Copyright (c) 1993-2023 Embarcadero Technologies, Inc.
jeff.c:
Turbo Incremental Link 6.97 Copyright (c) 1997-2022 Embarcadero Technologies, Inc.
* Application successfully built *
jeff.prg
#include "FiveWin.ch"
function Main()
Test()
return nil
#pragma BEGINDUMP
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <windows.h>
#include <BluetoothAPIs.h>
#include <hbapi.h>
// Link with 'BluetoothApis.lib'
#define COD_MAJOR_DEVICE_CLASS_MASK 0x1F00
#define COD_MAJOR_DEVICE_CLASS_PERIPHERAL 0x08
HB_FUNC( TEST )
{
BLUETOOTH_DEVICE_INFO deviceInfo;
HANDLE hRadio = NULL;
BLUETOOTH_FIND_RADIO_PARAMS btfrp = { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) };
HBLUETOOTH_RADIO_FIND hFind = BluetoothFindFirstRadio(&btfrp, &hRadio);
BLUETOOTH_RADIO_INFO radioInfo = { sizeof(BLUETOOTH_RADIO_INFO) };
BLUETOOTH_DEVICE_SEARCH_PARAMS searchParams;
HBLUETOOTH_DEVICE_FIND hFindDevice;
if (hFind == NULL) {
MessageBox( 0, "BluetoothFindFirstRadio failed", "error", 0 );
return;
}
if (BluetoothGetRadioInfo(hRadio, &radioInfo) != ERROR_SUCCESS) {
MessageBox(0, "BluetoothGetRadioInfo failed", "error", 0 );
CloseHandle(hRadio);
return;
}
// Initialize the search parameters
ZeroMemory(&searchParams, sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS));
searchParams.dwSize = sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS);
searchParams.fReturnAuthenticated = TRUE;
searchParams.fReturnRemembered = TRUE;
searchParams.fReturnConnected = TRUE;
searchParams.fReturnUnknown = TRUE;
searchParams.fIssueInquiry = TRUE;
searchParams.cTimeoutMultiplier = 4; // 4 * 1.28s (default HCI inquiry time)
// Start the device discovery
hFindDevice = BluetoothFindFirstDevice(&searchParams, &deviceInfo);
if (hFindDevice == NULL) {
MessageBox( 0, "BluetoothFindFirstDevice failed", "error", 0 );
CloseHandle(hRadio);
return;
}
do {
// Check if the device is a BLE device
if ( ( deviceInfo.ulClassofDevice & COD_MAJOR_DEVICE_CLASS_MASK ) == COD_MAJOR_DEVICE_CLASS_PERIPHERAL) {
// Print information about the discovered BLE device
wprintf(L"Device name: %s\n", deviceInfo.szName);
wprintf(L"Device address: %02X:%02X:%02X:%02X:%02X:%02X\n",
deviceInfo.Address.rgBytes[5],
deviceInfo.Address.rgBytes[4],
deviceInfo.Address.rgBytes[3],
deviceInfo.Address.rgBytes[2],
deviceInfo.Address.rgBytes[1],
deviceInfo.Address.rgBytes[0]);
wprintf(L"Device class: 0x%08x\n", deviceInfo.ulClassofDevice);
wprintf(L"-----------------------------------------\n");
/*
// Connect to the BLE device
HANDLE hDevice = ( HANDLE ) BluetoothOpenDevice(&deviceInfo.Address, NULL);
if (hDevice == NULL) {
printf("BluetoothOpenDevice failed\n");
continue;
}
// Send data to the BLE device
UCHAR sendData[] = { 0x01, 0x02, 0x03 };
DWORD bytesSent;
if (!BluetoothWriteFile(hDevice, sendData, sizeof(sendData), &bytesSent, NULL)) {
printf("BluetoothWriteFile failed\n");
CloseHandle(hDevice);
continue;
}
// Receive data from the BLE device
UCHAR recvData[256];
DWORD bytesRead;
if (!BluetoothReadFile(hDevice, recvData, sizeof(recvData), &bytesRead, NULL)) {
printf("BluetoothReadFile failed\n");
CloseHandle(hDevice);
continue;
}
// Print received data
printf("Received data from the device: ");
for (DWORD i = 0; i < bytesRead; i++) {
printf("%02X ", recvData[i]);
}
printf("\n");
// Close the device handle
CloseHandle(hDevice);
*/
}
// Continue searching for more devices
} while (BluetoothFindNextDevice(hFindDevice, &deviceInfo));
// Close the device find handle
BluetoothFindDeviceClose(hFindDevice);
// Close the radio handle
// CloseHandle(hRadio);
// return 0;
}
#pragma ENDDUMP
It requires a bthprops.dll that I am searching for...