Skip to content

Fixed GetMyObservables

Craig McDonald requested to merge feature/debug-fault-handling into devel

Description

The BurtSharp CoAP RobotClient has methods GetMyObservables() and IsMyObservable() to check if the client is subscribed to an observable. I had to make a minor change to make them work properly. First, a BlockingGetRequest is made for the list of registered observables at the coap route "/observables". Each of these observables has a route, ip address and port, and a token (byte array). The tokens are then checked against the process id of the current process running the client. The bytes indexed with 1 and 2 are the client process ID (byte[1] << 8 + byte[2]). When there is a match, that observable is added to the list of "my observables".

Now that this method works correctly, programs using RobotClient should be able to check if they still have ownership of a subscription, because if a different client program subscribes to the same observable then the token associated with that observable will change to match the new client process ID.

Other changes include adding the ParseFaults.cs sandbox program and updating the TestObservables.cs sandbox program to allow me to more easily debug this issue. TestObservables can be run at the same time as another program, like the TUI, to take away specific subscriptions and see what happens.

What to focus on

  • Use TestObservables to subscribe/unsubscribe to different observables and then check how the list of MyObservables changes by pressing "M".
Edited by Craig McDonald

Merge request reports