MacSass
Posts: 58
Joined: Tue Feb 14, 2006 2:46 am
Location: Germany

Help on multiple service discovery

Sat Apr 01, 2006 4:04 am

Hi,

I need your help again on sending to multiple devices. I´m using
Receiver.DiscoverServicesAsync(ServiceType.OBEXObjectPush)
to discover if Objectpush is availalbe for the devices I have discovered earlier.
Unfortunately I only get my sub
Receiver_ServiceDiscoveryCompleted
only called once, although I started service discovery for several (up to 4) devices.
Searching through the forum I found that I seem to need to add an event handler for each new sercvicediscovery I initiate - unfortunately I´m not sure how to do that in VB.net.

Also the ObexFTPClientSample200 does not help, it mentions
' Add a DiscoveryListener so we get service discovery events

' Cancel any on-going device discovery (not that there should be any going on)
m_network.CancelDeviceDiscovery()

' only find OBEX FTP Services - this is done in UI-thread so let's do it asynchronously
m_deviceCurrent.DiscoverServicesAsync(ServiceType.OBEXFileTransfer)

But I don´t see where it would add the listener.

Can you help me with some example code that I need to have an event raised for every service discovery I initiate?

Thanks in advace - MacSass

Jonas
Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Help on multiple service discovery

Mon Apr 03, 2006 11:16 am

I do not use Visual Basic very often but if I remember correctly you must specify the event handlers in design time and it is impossible to do this at runtime, am I right?

To work around this I suggest you put the event handler in a class of its own and then create instances of this class for each device you want to run a service discovery. That way you can run the device.ServiceDiscovery(..) in that class and it would raise the event once for each instance you've created.

Regards,
Jonas
Franson Support

MacSass
Posts: 58
Joined: Tue Feb 14, 2006 2:46 am
Location: Germany

RE: Help on multiple service discovery

Tue Apr 04, 2006 4:07 am

Hi Jonas,

thanks for the reply - I´ll try to figure it out.

In case I need more help I´ll be back :-)

Regards - MacSass

Return to “BlueTools”