Add a reference to the remoteDevice in onConnected and onDisconnected.