Page 1 of 2

Exception thrown

Posted: Tue Apr 11, 2006 9:35 am
by henryhui
Question 1
i try to get the bluetooth hardware address by using following statements.
Manager manager = Manager.GetManager();
Network network = manager.Network[0];
string localAddress = network.Server.Address.ToString();
it works only in Dell x50v, but fails in Dell x51, i am very confused.

Question2
in order to have a fast connection, i am now using ConnectDevice() and ConnectService() (is it correct???). How can i verfiy that i can successsfully connect to a device with specific mac address provided? since i have tried to power off one PPC, i found that ConnectDevice() can still be run.

Question3
let say, i have created and advertised a self-made service, how can i know the Service Channel Number and the name of service? can i define a specific Service Channel Number for my service?

Thank you very much

RE: Exception thrown

Posted: Tue Apr 11, 2006 11:28 am
by Jonas
1. What kind of exception do you receive?

2. ConnectDevice does not really connect to the device AFAIK. It just adds the device to the Network.Devices list, which allows you to make a ConnectService call. ConnectService on the other hand do not give you a Stream if the device can't be contacted (obviously [:)])

3. Here are some information about how to specify your service channel number.

http://www.franson.com/forum/topic.asp?TOPIC_ID=2219

Regards,
Jonas
Franson Support

RE: Exception thrown

Posted: Tue Apr 11, 2006 1:56 pm
by henryhui
thank you for yr reply.

i have tried to use "network.Server.Advertise(service, 100)", it worked on Dell x50v, but Failed on Dell x51.

the exception is [10049] Franson.BlueTools.BlueToolsException: Failed to bind the bluetooth socket

RE: Exception thrown

Posted: Tue Apr 11, 2006 2:45 pm
by Jonas
You get that error because the the Service Channel Number is already taken. Try another number than 100.

Regards,
Jonas
Franson Support

RE: Exception thrown

Posted: Tue Apr 11, 2006 2:56 pm
by henryhui
thank you!

But, how can i know what channel number is not in use?

RE: Exception thrown

Posted: Tue Apr 11, 2006 3:01 pm
by henryhui
i have change other numbers but it still got the same exception.

what can i do?

RE: Exception thrown

Posted: Tue Apr 11, 2006 3:14 pm
by Jonas
Values are only valid from 0-255 where 0 means pick a free one. But since you specifically wanted to pick a number I guessed you wanted to set it yourself?

Anyway, if to set it manually I had to try a few before finding one that worked on the x51...number 12 worked at least.

Regards,
Jonas
Franson Support

RE: Exception thrown

Posted: Tue Apr 11, 2006 3:33 pm
by henryhui
Thank you very much, finally i can solve the problem by following your suggestion.

later on, i will depoly my application other PPC, if i still use number 12, will it still work?

RE: Exception thrown

Posted: Tue Apr 11, 2006 3:37 pm
by Jonas
It will work if not some other application is already using number 12. Or if that PDA has that number reserved.

The best solution is really to use 0 (pick a free number)

Regards,
Jonas
Franson Support

RE: Exception thrown

Posted: Tue Apr 11, 2006 3:53 pm
by henryhui
thank you!

I use self-defined SCN since i found that as i perform service discovery, my service can not be discovered sucesssfully every time.

usually, it returns -1.

RE: Exception thrown

Posted: Tue Apr 11, 2006 4:44 pm
by henryhui
I am sorry that i found it doesnt work again. the exception is [10084] Franson.BlueTools.BlueToolsException: FAiled to bind the bluetooth socket.

i use self-defined number of service, since it can keep service discover, i found that the performance is better.

What can i do?

RE: Exception thrown

Posted: Tue Apr 11, 2006 4:52 pm
by johan
Dell x50v uses the WidComm stack
Dell x51 uses the MS stack

The WidComm stack upports SCN from 1 to 255 (0 = auto)

The MS stack only supports 1-99 (I think) or even less, maybe it was 1-32 (0 = auto)

Regards,
Johan

Franson Support

RE: Exception thrown

Posted: Wed Apr 12, 2006 1:29 pm
by henryhui
thank you for yr reply!

Question1
when i perform a soft reset, there is an error message "Sorry! Bluetooth can no loonger be used because the license is expired". but my license key is still valid.

Question2
as u suggested, i am now using channel number 12, when i advertise my service, it runs normally (both x50v and x51). when i attempt to create a stream via my service, it works only x51 -> x50v. for x50v -> 51, it throws "Argument out of range exception", "null reference exception". actually, two devices are running the same application, but why response so differnet?

RE: Exception thrown

Posted: Wed Apr 12, 2006 1:33 pm
by Jonas
What line is throwing the exception?

Regards,
Jonas
Franson Support

RE: Exception thrown

Posted: Wed Apr 12, 2006 2:16 pm
by henryhui
i found that while executing "rd.ConnectService(12, "Connection Service");", rd is declared as RemoteDevice, execption thrown. the exception is "Null Reference Exception"

after the exception, i found that my service was automatically invoked. i notified this because i have the following event listener

private void service_Advertised(object sender, BlueToolsEventArgs eventArgs)
{
mainForm.writeSystemStatus("Service Advertised !!!");
}