MonitoredItem on LocalizedText: unexpected notification received on session for another locale
Description
When connecting several sessions with different preferred locales and creating monitored items on localized text values, writing a new value in a locale leads sessions with other locales to receive unexpected data change. This is unexpected and only the case on data change, the first value notified is the one expected on monitored item creation.
Analysis
The subscription mechanism for notification is based on data changes events created by the write service. The write service provides 2 values: previous value prior to write and new value after the write operation. To obtain the new value, the same mechanism that for read service was used without user access level evaluation and without index range but the preferred locales of the session using write mechanism was used to create a single LocalizedText value for preferred locale. Since the data changes apply to all connected sessions that create a monitored item on a node attribute, the preferred locale shall be evaluated only when evaluating / creating the notification for a dedicated session.
Implementation
In write service: add a dedicated function to retrieve the raw value when reading the updated new value that will contain all defined locales for a LocalizedText value. In addition it make explicit the fact that index range is not used neither.
In subscription service: add mechanism to compute the LocalizedText values using preferred locale for the subscription to compare the values and trigger a notification.