Added state management on YMSCBPeripheral
Fixed crashing bug when writing characteristic