Update from https://mbed.org/users/johnb/code/XBeeApi/rev/eccf4725930c