Thursday, October 14, 2010

DiscoverServices : Failure in find service API calls : Can't find PInvoke DLL 'BTInterface.dll'.

I have been coding against the new Motorola MC65 and the Motorola ES400 - devices that will port onto the new Windows Embedded Handheld when released later this year.

I was attempting to pair with an embedded bluetooth device using the EMDK v2.3 - an EMDK that has worked on previous Motorola devices such as the MC75.

When attempting to pair using the Symbol.WPAN.Bluetooth.Bluetooth class, the device receives the pair message but then the EMDK throws ab Exception with message "DiscoverServices : Failure in find service API calls : Can't find PInvoke DLL 'BTInterface.dll'."

The stack trace looks like this:
   at ag.l(RemoteDevice A_0)
at ag.n(RemoteDevice A_0)
at ag.j(RemoteDevice A_0)
at Symbol.WPAN.Bluetooth.RemoteDevice.Pair(String AuthenticationPIN)

I can confirm, once upgrading to the latest version of the EMDK v2.4 fixes this issue (v2.04 of the Symbol.WPAN.dll assembly).

You can download the EMDK v2.4 for .NET here: http://support.symbol.com/support/search.do?cmd=displayKC&docType=kc&externalId=12874&sliceId=&dialogID=196190455&stateId=1%200%20196186434

9 comments:

Christian Resma Helle said...

In case you didn't know, most Motorola devices supports 2 bluetooth stacks: Microsoft and StoneStreet.

You can switch between them. I have a blog post that describes it a bit more if you're interested

http://christian-helle.blogspot.com/2010/10/motorola-dual-bluetooth-stack-support.html

Simon Hart said...

Hi Christian,

Thanks for the link that will be very helpful. Yes that is correct most Motorola devices do support Stonestreet and Microsoft stacks. But Motorola recomend to use the Microsoft stack and that the Stonestreet is only included for backwards compatibility reasons only.

cheers
Simon

Christian Resma Helle said...

Hi Simon,

I've never tried StoneStreet, but their EMDK does a good abstraction over the BT stack layer.

Did you by any chance attend the Motorola AppForum a few weeks ago in Vienna? I mostly got my information from there. I can send you the slides from their presentation if in case you did not attend (and if your interested)

Regards,
Christian

Simon Hart said...

I've used both API's they are ok, it would be better if they implemented interfaces on the whole EMDK so you can actually run automated unit and integration tests. In the past I've had to write adapters just for test reasons.

I didn't attend the AppForum in Vienna - although I would have liked to attend but moving jobs recently prevented me from attending. Same goes with PDC next week.

I'd be interested in those slides, thanks.

Can you please send them to: simon at simonrhart.com

thanks
Simon

Anonymous said...

There is one other cause of this that I found. It may be obvious if you know what you're doing, but if you're hacking your way through like me you may hit this.

Here is what I did that caused the error:

1. Refresh the list of remote devices
2. Disable bluetooth
3. Delete favorites files (btfavorites.dat and btexplorer.dat)
4. Enable bluetooth
5. Try to pair one of the devices in the list

I'm not sure if deleting the favorites has anything to do with it (bad legacy code I have to support at the moment), but hopefully that helps someone else...

Simon Hart said...

@Anon:

Thanks for your post.

Simon

Anonymous said...

root cause is missing BTInterface.dll file in windows folder of device. So the fix will be copy this BTInterface.dll to window folder

Arno Reiland said...

I'm trying to use the POWERTOOLS class from the latest EMDK V2.7 to pair the BT devices (RS507 and MC3090). In instanciating the ScanAndPairTools I get the error "PInvoke-DLL 'EMDKServices.DLL' not found. The DLL is in the Windows Directory and all the dependecies seem to be there also. Do you have any ideas?

Trevor C. Owens said...

Hello mates. If you mind I may recommend you a source where I can find a lot of different dll files. Recently, I was trying to solve annoying d3dx9_38 missing error and this source http://fix4dll.com/d3dx9_38_dll helped me a lot. Give a shot maybe you will get lucky.