Migrate StateMachine to be started inside ScannerService.

Works somewhat.