Emit the property changed signals only when the properties really change
There are two alternatives to place the check: before and after the syscalls.
The rationale behind this patch is when the serialport is closed, the port is
not locked anymore, and essentially a scam program or a developer accidentally
could change the underlying property values for the hardware or virtualized
software.
Unfortunately, as the object is not yet desroyed at that point, there
might be an inconsistent state for reopening. There is a valid use case for
such a behavior in my commercial project when I keep one object around in a
modem class, and I keep reopening that without destroying the object stored on
the stack.
This patch also established an internal storage for the DTR/RTS, and policy
signals to be emitted properly only when changed.
-------------------------------------------------------------------------------
There are also very hypothetical imaginary use cases as well, but that does not
make too much sense as one can come up with an example for vice and versa. Here
you can find two opposite examples below.
One bad driver causing issues while checking after the syscalls:
1) Bad Serial driver
2) Try to set the same value
3) The driver is erroneous and when trying to set the same, it gets to
undefined value and state.
4) User faces an error when trying to read or/and writ.
One bad driver causing issues while checking before the syscalls:
1) Bad Serial driver
2) Try to detect the settings
3) The detected setting is erronous as the hardware or serial driver reports
undefined or wrong value.
4) The property value cannot be changed anymore.
So, it is hard to say which one to support, and in general we should not
support guesses that we do not know if they occur, or how they could. However,
the change after closing is a valid concern.
Change-Id: I90402c16ea943d7a92f2beffa2b1785ef6012da5
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>