add bluetooth restart mechanism and dynamic serial connection detection.