added some function to end to make it able to receive a messase from the central device.