libserial icon indicating copy to clipboard operation
libserial copied to clipboard

[Feature] Create a LibSerialStream from a C file descriptor [sf#2]

Open crayzeewulf opened this issue 10 years ago • 2 comments

*Reported by anonymous on 2008-07-27 05:44 UTC I want to use the library with RFCOMM (serial over bluetooth).

In that case, a C file descriptor is provided to communicate with the device.

There is a really simple example on this page: http://people.csail.mit.edu/albert/bluez-intro/x502.html (see the example 4-3 for instance).

Would it be possible to add a constructor to LibSerialStream to be able to construct the object from a file descriptor?

Thanks.

crayzeewulf avatar Jun 03 '15 21:06 crayzeewulf

Commented by crayzeewulf on 2008-07-28 23:27 UTC Logged In: YES user_id=645118 Originator: NO

I am not sure what will happen if one tries to call termios functions on a descriptor returned by socket(). Furthermore, the SerialPort implementation is dependent on the fact that the descriptor be opened with specified flags (O_RDWR|O_NOCTTY|O_NONBLOCK). Additionally, keeping the descriptor hidden from users of the class ensures that the descriptor is completely controlled by the class and does not, for example, get closed by someone else while it is in use.

However, this is an interesting idea and worth investigating. I will look into it further and post updates based on what I find.

crayzeewulf avatar Jun 03 '15 21:06 crayzeewulf

Updated by crayzeewulf on 2008-07-28 23:29 UTC

  • assigned_to: nobody --> crayzeewulf

crayzeewulf avatar Jun 03 '15 21:06 crayzeewulf