Frameworks > Bluetooth Framework

Catastrophic failure while Pairing

<< < (3/3)

Mike Petrichenko:
Good day!

Did you receive my e-mail regarding the problem yesterday?

servel333:
I have received the email and found your suggestion to be correct.  For other forum readers:

The wclnet.wclBluetoothDevices list and wclnet.wclBluetoothDevice objects that are returned by the wclnet.wclBluetoothDiscovery.DiscoveryStarted event are not valid outside of the event.  To use the wclnet.wclBluetoothDevice objects outside of this context, you must create a new wclnet.wclBluetoothDevice and then call wclnet.wclBluetoothDevice.Asslign method.


    Dim deviceUsedOutsideDiscoveryCompleteEvent As wclnet.wclBluetoothDevice

    Private Sub _discovery_DiscoveryComplete(ByVal sender As Object, ByVal e As wclnet.BluetoothDiscoveryCompleteEventArgs) Handles _discovery.DiscoveryComplete

        deviceUsedOutsideDiscoveryCompleteEvent = New wclnet.wclBluetoothDevice
        deviceUsedOutsideDiscoveryCompleteEvent.Assign(e.Devices(0))
       
    End Sub


In addition, here is a question about the Assign method:


--- Quote from: Mike Petrichenko on April 05, 2008, 01:33:24 AM ---Good day!


--- Quote from: servel333 on April 04, 2008, 11:42:11 PM ---wclBluetoothDevice.Assign - what does this do?

--- End quote ---

The Assign method of any class simple copy the one class, passed as parameter into current one. Let say you have the instance of the wclBluetoothDevice class. And also you have the global variable represents the currently used device. So you may fast copy the instance to the global variable by using Assign method.

Actually, it is mostly usefull for VCL version (because unmanaged code). For .NET version you may simple store the required instance in the any other variable (and the CLR will manage the instances).

--- End quote ---

Thank you Mike for your help.

Navigation

[0] Message Index

[*] Previous page

Sitemap 1 2 3 4 5 6 7 
Go to full version