refactoring source code(not completed)

septerate morse machine and state machine
rewrite test code