Overview
Features
Download
Documentation
Community
Add-Ons & Services

Error when configuring a serial port using IO::SerialConfig

Please post support and help requests here.

Error when configuring a serial port using IO::SerialConfig

Postby Amine » 16 May 2007, 17:50

When I try to create de SerialConfiguration Object I have this error:
[Error] Invalid argument: SerialConfigImpl::setParityCharImpl( )
I am under windows and I am using VC++ expres. I found this comment in the source file
enum Parity
{
//on Windows, PARITY_* conflicts with
//system macros, hence PAR_*
PAR_NONE = PARITY_NONE_IMPL,
PAR_ODD = PARITY_ODD_IMPL,
PAR_EVEN = PARITY_EVEN_IMPL,
PAR_MARK = PARITY_MARK_IMPL,
PAR_SPACE = PARITY_SPACE_IMPL
};
When I create the SerialConfig object I use only the bits rate parameter, for the other parameters I use the default values.
Thank you for helping me another time.
Amine
 
Posts: 18
Joined: 20 Mar 2007, 14:08

Re: Error when configuring a serial port using IO::SerialConfig

Postby alex » 18 May 2007, 00:42

> When I try to create de SerialConfiguration Object I have this error:
> [Error] Invalid argument: SerialConfigImpl::setParityCharImpl( )

> When I create the SerialConfig object I use only the bits rate parameter, for the other parameters I use the default values.

I tried the code below with SVN code and it forks fine for me.

Code: Select all

SerialConfig sc(SerialConfig::BPS_9600);   
Serial com1("COM1", sc);   
Serial com2("COM2", sc);   
com1.write('x');
assert('x' == com2.read());

SerialOutputStream sos(com1);
SerialInputStream sis(com2);
sos << "1234567890
";
std::string s;
sis >> s;
assert("1234567890" == s);


Obviously, to run this successfully you'll need two serial ports on the same machine connected with a null modem cable.
alex
 
Posts: 1116
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Re: Error when configuring a serial port using IO::SerialConfig

Postby Amine » 19 May 2007, 11:29

sorry, it was my fault. I didn't pay attention to the SerialConfig Constructor SerialConfig(BPSRate bpsRate,DataBits dataBits=DATA_BITS_EIGHT,char parity='N',StartBits startBits=START_ONE,StopBits stopBits=STOP_ONE,FlowControl flowControl=FLOW_CTRL_HARDWARE,unsigned char xOnChar=0,unsigned char xOffChar=0,bool useEOF=true,unsigned char eof=DEFAULT_EOF,int bufferSize=1,int timeout=5000);
I was using the enum SerialConfig::Parity instead of char.

Thank you for the support.
Amine
 
Posts: 18
Joined: 20 Mar 2007, 14:08


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron