diagnostic output added

the program now check if the listener is connected to the service as
well as the device
also it checks if the device is valid and it checks is the listener was
added