added ble_error function as well as error state variable, I am using ble_error 

I think the ble_error function will be useful for resetting the hardware in case of error condition