You can use the BS2_SetDeviceEventListener callback function to check if device is connected or disconnected.


http://kb.supremainc.com/bs2sdk/doku.php?id=en:bs2_setdeviceeventlistener


If you configure the ptrDeviceDisconnected with this function, you can find out when the device is disconnected. 

The complicated part is that you would have to manage each device's connection with the SDK program.



BS2_SetDeviceEventListener

Registers the callback function that gets called when finding a BioStar device from the subnet or the device's network connection status changes. 

Declaration

#include "BS_API.h"
 
int BS2_SetDeviceEventListener(void* context, OnDeviceFound ptrDeviceFound, OnDeviceAccepted ptrDeviceAccepted, OnDeviceConnected ptrDeviceConnected, OnDeviceDisconnected ptrDeviceDisconnected);

Parameter

  • [In] context : Context
  • [In] ptrDeviceFound : Callback function that is called when a new device has been found
  • [In] ptrDeviceAccepted : Callback function that is called when a device requests to connect to the BioStar application
  • [In] ptrDeviceConnected : Callback function that is called when the device is connected
  • [In] ptrDeviceDisconnected : Callback function that is called when the device is disconnected

Return Value

If successfully done, BS_SDK_SUCCESS will be returned.
If there is an error, the corresponding error code will be returned.