This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DiscoverServices() causing OpenRemotePipes() to fail

Based on the nRFUart demo, I added a masterEmulator.DiscoverServices() block before the DiscoverPipes() block in a very similar manner. Purposed is to be able to get more information about available services and descriptors of the device, similar to MCP:

Collection BleServices; [...] try { BleServices = masterEmulator.DiscoverServices(); if(DiscoverServicesCompleted != null) DiscoverServicesCompleted(this, EventArgs.Empty); } [...]

The issue starts when I disconnect from the device and then do a connect to another (or the same) device: I can still open the pipes but when I request data from "descriptor" pipes, e.g. firmware information or manufacturer name, I get only empty strings! I can "fix" this by removing the call for DiscoverServices().

Is there anything else I have to do rather than InitiateDisconnect() and wait for OnDisconnected()?

The API documentation mentions that DiscoverServices() is not encouraged to be used. Why?

It all works fine the first time I run through that code

Related