FrançaisEnglishEspañol
PC SOFTForums homeLast messagesOnline repository
PC SOFT
Find...
Perform the searchSearch in...
Newsgroup dedicated to WINDEV Mobile (current version), in English
BlueTooth Connects ok, but cannot read data.?
Aug., 04th 2008 at 07:57 AM
Adrian Wreyford
<wr...ed@absamail.co.za>


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

// Returns the list of the Bluetooth devices found nearby
sListDevices = BTListDevice(btDetailedList) //btSimpleList
// Browse the connected devices
FOR EACH string sADevice OF sListDevices SEPARATED BY CR
// Stores the device information
EXPRESS_DEVICES.EXPRESS_sDEVICEID = ExtractString(sADevice, 1)
EXPRESS_DEVICES.EXPRESS_sNAME = ExtractString(sADevice, 3)
EXPRESS_DEVICES.EXPRESS_sMACADDRESS = ExtractString(sADevice, 2)
// Fills the table with the devices
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 //COMBO_EXPRESS_WIN_Attach_SENSOR..Caption) = 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


Replies to this message:
Re: BlueTooth Connects ok, but cannot read data.?
Adrian, I was not aware that BTSTACK() wasn't available under Windev mobile. After reading "a little bit" the SDK for your device I'll suggest to try this: 1- Enable the bluetooth device with StartBlu ...
From sylvain - Aug., 27th 2008 - More »
Re: BlueTooth Connects ok, but cannot read data.?
Unfortunately the BTStack() command is not allowed in WinDevMobile. I've got a Cipher Lab 9400CE device, that runs Win CE 5.0. I can use API("9400CE_DLL.dll","StartBluetooth") to switch on the bluetoo ...
From Adrian Wreyford - Aug., 09th 2008 - More »
Re: BlueTooth Connects ok, but cannot read data.?
Did you test the stack used by the device and check if it's supported by Windev Just check with BtStack(), after reading avalaible documentation from Windev 12 it 's seem that you are using the right ...
From sylvain - Aug., 07th 2008 - More »
Re: BlueTooth Connects ok, but cannot read data.?
Good Morning, I will also have to use Bluetooth soon but I have no device for the moment. It's my understanding that SocketConnectBluetooth it's for network protocol communication so I don't think it ...
From sylvain - Aug., 06th 2008 - More »