Bonjour,
Well I have spent hours, and eventually managed to connect to a bluetooth sensor.
The sensor requires no passkey, and is attached to a loadcell(scale), and sends out packets of data 15 bytes long every 200ms. I need to capture these packets of data on the handheld.
PS(I'm using WDMobileExpress12, purchased WDMobile12 on 30/07/2008, but heard nothing to date, and payment has gone off my bank account.)
I use the following code to to load a devices
HF with the available bluetooth devices.:
sListDevices is string
sADevice is string
sIDEXPRESS is string
sNameEXPRESS is string
sMACAddressEXPRESS is string
sListDevices = BTListDevice(btDetailedList)
FOR EACH string sADevice OF sListDevices SEPARATED BY CR
EXPRESS_DEVICES.EXPRESS_sDEVICEID = ExtractString(sADevice, 1)
EXPRESS_DEVICES.EXPRESS_sNAME = ExtractString(sADevice, 3)
EXPRESS_DEVICES.EXPRESS_sMACADDRESS = ExtractString(sADevice, 2)
HAdd(EXPRESS_DEVICES)
END
Next I connect to the device, after I select the correct one from a combo box populated with the Devices table.
Please note .. that you return MAcAddress in the following format with BTListDevices: '00:00:00:00:00:00', but when you connect using SocketConnectBlueTooth you require the MacAddress in the format:
'00-00-00-00-00-00' or '000000000000' and this took me ages to discover.
Why the '-', and not the standard ':'?
Now I connect:
bConnectedEXPRESS is boolean
sDataRead is string
nLineCom12EXPRESS is int
sMAcAddressEXPRESS is string
gsAMISCALEEXPRESS = "Sensor"
sMAcAddressEXPRESS = "00-04-3e-23-38-09"
IF SocketConnectBluetooth(gsAMISCALEEXPRESS,"SerialPortServiceClass_UUID",sMAcAddressEXPRESS) = False THEN
DelayBeforeClosing(1000)
Error("Unable to connect to Sensor socket", ErrorInfo(errFullDetails))
RETURN
END
It connects to the device, and I know it is working, as the blue light on the sensor PcBoard lights up.
The Sensor is available using the following service:
Serial Port(SPP)'KC-SPP' COM12
I tried using SocketRead, but without success.
I tried using Sopen and sRead, also no success.
So .. Can anybody out there help. Sorry I don't speak French, and I notice much more activity on the French usergroups, but hope that you guys will answer my questions here as well.
Thanks
Adrian