Exemplo n.º 1
0
        //======================================================================
        // GetStatus

        /// <summary>
        /// Returns the current server status.
        /// </summary>
        /// <returns>The current server status.</returns>
        public ServerStatus GetStatus()
        {
            lock (this)
            {
                if (m_proxy == null)
                {
                    throw new NotConnectedException();
                }

                OpcXml.Da10.RequestOptions options      = OpcXml.Da10.Request.GetRequestOptions(m_options.Locale, m_options.Filters);
                OpcXml.Da10.ServerStatus   remoteStatus = null;

                OpcXml.Da10.ReplyBase reply = m_proxy.GetStatus(
                    options.LocaleID,
                    options.ClientRequestHandle,
                    out remoteStatus);

                CacheResponse(m_options.Locale, reply, null);

                // fill in the last update time.
                ServerStatus status = OpcXml.Da10.Request.GetServerStatus(reply, remoteStatus);

                status.LastUpdateTime = m_lastUpdateTime;

                return(status);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the locales supported by the server
        /// </summary>
        /// <remarks>The first element in the array must be the default locale for the server.</remarks>
        /// <returns>An array of locales with the format "[languagecode]-[country/regioncode]".</returns>
        public string[] GetSupportedLocales()
        {
            lock (this)
            {
                if (m_proxy == null)
                {
                    throw new NotConnectedException();
                }

                OpcXml.Da10.ServerStatus status = null;

                OpcXml.Da10.ReplyBase reply = m_proxy.GetStatus(
                    m_options.Locale,
                    null,
                    out status);

                if (status != null && status.SupportedLocaleIDs != null)
                {
                    ArrayList locales = new ArrayList();

                    foreach (string locale in status.SupportedLocaleIDs)
                    {
                        if (locale != null)
                        {
                            locales.Add(locale);
                        }
                    }

                    return((string[])locales.ToArray(typeof(string)));
                }

                return(null);
            }
        }