Re: [Svxlink-devel] Async changes
Brought to you by:
sm0svx
From: Tobias B. <sm...@us...> - 2010-02-14 18:03:46
|
On Sunday 14 February 2010 16:42:59 Adi Bier wrote: > >> The function " ioctl(fd, TIOCMGET,&pin) " detects the change of RXD so > >> it can be used as a "state change detector" without polling the serial > >> port and using new timers. > > > > But you need to call the ioctl to actually read the state of the RX pin. > > I don't see how this can be made event (select) based. > > Hi Tobias, > > as far as I could found out FdWatch is watching for changes on the port > that has been opened before > > rd_watch->activity.connect(slot(*this, &SerialDevice::onIncomingData)); > > and emits a signal if there is activity. The "activity" signal is emitted when at least one character has been received on the serial port. It is not emitted just because a pin changes. > onIncomingData is called up > each time so the function ioctl can be used to check the pin has changed. > It is already implemented into my test environment here and works well > for the ring detector, but I'm looking for a better way ... Isn't the reason it works that the modem is sending text at the same time as the ring pin is pulled? As far as I remember the modem usually send "RING" as text on incoming calls. 73's de SM0SVX / Tobias > Ok, will play a bit with that ;-) > > 73's de Adi, DL1HRC > > > Of course you could send > > a character to the serial port and then a normal character received > > notification occur but it's a strange way to trigger the reading of the > > serial port pins. It's a special case and should not be implemented in > > Async but rather in the class using Async::Serial. > > > > Possibly one could put a polling timer in the Serial class but I'm not > > sure it belongs there. When the pins are read you compare the state to > > the previously read value. If nothing have changed you don't emit the > > pinChanged signal. > > > > 73's de SM0SVX / Tobias |