@nish thanks, it works. But i have one more question. I confused with the example code. I tried to understand how the code understands the operating system and select the right classes for serial port.

If you have chance to look at the code, can you give me hint about that