public void OnTimer(ThreadTimer ctx)           // thread:timer
        {
            string result;

            if (name != null)
            {
                result = service.Login(name, pwd);
                name   = null;
                pwd    = null;

                ___log.Debug("Login: "******"Login: "******".facility.status.timeout_ms"]);
                    ___log.Debug("timeout: " + timeout);

                    string s;
                    settings.TryGetValue("status.init", out s);
                    service.SetStatus(s);
                    Log("Status: " + s);
                    status = STATUS_ONLINE;
                    timer.SetTimeout(timeout);
                    //timer.Touch();
                    listener.OnDataAsync();
                }
                else
                {
                    status = STATUS_OFF;
                    timer.SetTimeout(-1);
                    //timer.Stop();
                }

                listener.OnRefreshAsync();
            }

            if (status == STATUS_DESTROYED || status == STATUS_OFF)
            {
                return;
            }

            result = service.Poll();

            service.GetData(ref service_data);

            if (result == Service.RESULT_CALL)
            {
                Log("Request: " + result);
                //status = STATUS_CALL;
            }
            else if (result == Service.RESULT_RSCR)
            {
                Log("Request: " + result);
                if (uctx_status.root == null || uctx_status.root == UCTX.STATUS_DESTROYED)
                {
                    uctx.Start(this, service.GetSettings(), service_data.command.Substring(Service.RESULT_RSCR.Length + 1));
                }
            }

            listener.OnRefreshAsync();

            if (result == Service.RESULT_CALL)
            {
                listener.OnCallAsync();
            }
        }
 public void OnStart(ThreadTimer ctx)           // thread:timer
 {
     is_timer_active = true;
 }
 public void OnStop(ThreadTimer ctx)           // thread:timer
 {
     is_timer_active = false;
     InternalStop();
 }