Code to retrieve data from device when ready