I had 2 different classes. One class is derived from
ajn::Observer::Listener, other - from
ajn::SessionListener. I am trying to handle the lifetime of BusObjects using these classes. If I use second (with AboutListener and SessionListener), I establish session when I receive Announced callback (device is online for me) and I delete device (set it offline) when I receive SessionLost(). For first class (Observer::Listener) I am using ObjectDiscovered and ObjectLost respectively.
The problem appears when I have following scenario:
- Device come up online - ObjectDiscovered() and Announced() are called.
- I simulate network problems - for example, turn off network cable from one of the devices.
- After some time ObjectLost() and SessionLost() are called (because of timeout). For now device is offline
- I put back cable back. But I don't receive neither ObjectDiscovered(), neither Announced(). But alljoyn can see the second device (I can see from alljoyn debug logs that alljoyn receives some information from remote device).
Is there any way to handle such situations, or may be there is a better way to track device online/offline status instead of described ones?