bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with serial device


From: a2574
Subject: Problems with serial device
Date: Fri, 13 Dec 2002 14:37:39 GMT
User-agent: IMP/PHP3 Imap webMail Program 2.0.11

Hi!  I wrote a message a week ago cause I could use the ttystream()
class with exception handling. The program used to crash. I found the
solution (not actually a solution) I compiled my code with serial.cpp
and didnt link the whole library... This way it worked but I have more
problems now.

Im trying to communicate to a Laser device, This kind of device has not
an end of telegram packet so I have to use it by reading byte by byte. 

The problem is that when I set a Timeout it throws an Input error
whenever I try to read something.

This is the code: (I inerhit from ttystream for changing some staff)
---------------------------------------------------------

#ifndef _SERIAL_INTERFACE_H
#define _SERIAL_INTERFACE_H

#include<cc++/common.h>
#include<string>
#include<iostream>

class SerialInterface: public ost::ttystream{
 private:
 public:
  SerialInterface():ttystream(){
    this->setError(true);
    setPacketInput(1,1000);
  }

};


#endif  // _SERIAL_INTERFACE_H

-------------------------------------------------------
int main(){

unsigned char p;

SerialInterface *comm = new SerialInterafe(\"...\");

comm->setTimeout(10000);


*comm >> p;  // the program chrashes here with errInput (why??)
}


If I dont set the timeout it works right, but I need it for checking
whether the device is there. I guess this is the last chance... tyhe
library is not why I call a final release... since I downloaded the code
I have nothing but problems... If you could help me. I would be nice..

Thanks, Jose Fernandez



reply via email to

[Prev in Thread] Current Thread [Next in Thread]