replace c interface with c++ for serial