Refactor serial backend to use in both rtu & ascii client