Author Topic: Language reference guide  (Read 4196 times)

Offline josh.payne

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Language reference guide
« on: October 18, 2006, 04:51:30 PM »
Hi

I have just downloaded the Bluetooth Framework X Free file and was wondering if a language reference guide is available. I am using the framework in VB6 and have managed to search for devices using the following code:

device_address = BFBluetoothDiscoveryX1.SelectDevice(False).Address

This code brings up a select "Bluetooth devices in the local area" box, from which you can select your device. I am having trouble writing the code to connect to the address previous obtained, what is the code which I should be writing to carry out this function. I am try to set up a serial port service connection between two devices.

Thanks
Josh




BluetoothFrameworkX.ocx

Offline josh.payne

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Language reference guide
« Reply #1 on: October 18, 2006, 04:56:40 PM »
Sorry forgot to mention the program which I am producing in VB6 is to interface with IVT's BlueSoleil

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Language reference guide
« Reply #2 on: October 18, 2006, 06:14:38 PM »
It is easy. Just use the following code.
BFSerialPortClientX.BluetoothTransport.Address = Address

where Address - previously obtained address from Discovery component.

then call Open method

BFSerialPortClientX.Open

P.S. It includes help file.
« Last Edit: October 18, 2006, 06:17:53 PM by Mike Petrichenko »
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline josh.payne

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Language reference guide
« Reply #3 on: October 19, 2006, 01:29:35 PM »
Thankyou very much for your help Mike, that part of the program now works. A couple of other questions though, how do I extract two properties from a command for example:

device_address and device_name = BFBluetoothDiscoveryX1.SelectDevice(False).Address and Name

The problem I am having is that if I just copy the whole command twice, then the program asks you to select you Bluetooth device twice. Is there a way to obtain both bits of data in one command?



My second question is what code should I use to set a varible for the signal strength for the compnent: BFSignalX1

Is it correct to use BFSignalX1.Level = signal_level to set the level of the component

Thankyou very much for your help, it is greatly appreciated
Josh

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Language reference guide
« Reply #4 on: October 19, 2006, 02:54:08 PM »
This code can help you:
Dim Device as BFBluetoothDeviceX

Device = BFBluetoothDiscoveryX.SelectDevice(False)
device_address = Device.Address
device_name = Device.Name
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline josh.payne

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Language reference guide
« Reply #5 on: October 19, 2006, 05:16:03 PM »
Sorry one final thing, my program was working and for some reason it has now stopped, could you tell me if the following is the correct way to set up a serial connection with the selected device:

Dim device_address As String
device_address = BFBluetoothDiscoveryX1.SelectDevice(False).Address
       
    BFSerialPortClientX1.BluetoothTransport.Address = device_addess
   
    BFSerialPortClientX1.Open

Would you be able to add to the code you posted previously, so that when a device is selected the address and name is put into a variable as well as the serial connection  being setup.

Thanks

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Language reference guide
« Reply #6 on: October 19, 2006, 05:31:45 PM »
Any time!

Yes. This is correct way.
I do not completelly undersand what you mean. But I think you need the following.
Declare variables in global section
Dim Device as BFBluetoothDeviceX

Then in procedure write following code

Set Device = BFBluetoothDiscoveryX.SelectDevice(False)

if TypeName(Device) <> "Nothing" then
  BFBluetoothSerialPortClientX.Address = Device.Address
  BFBluetoothSerialPortClientX.Open
end if

Then you can use Device variable in any place of your code whitout preveously selecting the device.

Also you can use OnDisconnect event to detect when remote device disconnected.

P.S. If I not answer to your question, please re-ask. Thank you :)
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline josh.payne

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Language reference guide
« Reply #7 on: October 20, 2006, 02:18:18 PM »
Hi Mike,

I am still having trouble with the code for some reason. When I click the button "Command1", the "Select Bluetooth Device" window appears and I am able to select the required device. When I click "OK" I get the following error:

Run-time error '438':
Object doesnt support





The code I am using is as follows:



Dim Device As BFBluetoothDeviceX


Private Sub Command1_Click()

Set Device = BFBluetoothDiscoveryX1.SelectDevice(False)

If TypeName(Device) <> "Nothing" Then
  BFSerialPortClientX1.Address = Device.Address
  BFSerialPortClientX1.Open
End If

End Sub


I have executed the "reg.bat" file and this has successfully loaded the componets into VB6. I dont see any problem with the code, I was wondering if you could see anything which might be problematic.

Thanks once again
Josh

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Language reference guide
« Reply #8 on: October 20, 2006, 02:58:01 PM »
Here is:
http://www.btframework.com/demo.zip
the samples for ActiveX.
See BluetoothDiscovery demo and FileTransfer demo.

Feel free to ask. :)
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline josh.payne

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Language reference guide
« Reply #9 on: October 25, 2006, 10:26:38 AM »
Hi Mike,

The hyperlink you gave me was dead and I could not find a demo for Bluetooth discovery. Could you tell me where to look for the demo.

Thankyou
Josh

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Language reference guide
« Reply #10 on: October 25, 2006, 11:19:21 AM »
You can download demos with ActiveX version by following link:
http://www.btframework.com/files/demo/bfxfree.zip
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline josh.payne

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Language reference guide
« Reply #11 on: October 25, 2006, 12:11:55 PM »
Hi Mike,

One final question! The code at the bottom works in my program, however.....


When cmd_discover is clicked I can select the Bluetooth device and a serial connection is setup (opened).
After a few seconds I get the following error and the serial connection is closed:


Run time error '_2147418113 (8000FFF)':
System Error. Code 5.
Access is denied




My programs code is below:


Dim Device_Address As String


Private Sub cmd_discover_Click()

Device_Address = BFBluetoothDiscoveryX1.SelectDevice(False).Address

BFSerialPortClientX1.BluetoothTransport.Address = Device_Address

BFSerialPortClientX1.Open

End Sub



Can you think of any reason why this is happening???



The function I wish my program to perform is:

Select a Bluetooth device
Create a serial link with the device
Use Hyperterminal to communicate between devices with the connection setup using my program

Thanks
Josh

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: Language reference guide
« Reply #12 on: October 25, 2006, 12:30:37 PM »
Serial Port connection require authentication.
You can make it manually or you can use TBFAuthenticator component.
Look how it used in my other demo applications.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager