[DEBUG] Fix assignation in if statement.

Replace (_port = port) with (_port == port).
[BUGFIX 0155827] Code cleanup and bug fixes.

- Internal API changes to pass the connection data to all methods.
- Do not unregister characteristics as long as other connections are
  still active.
- Remove unneeded methods and duplicate pointers.
- Various minor changes.