Esempio n. 1
0
        public UITabBar(UIControllerWithSmartObjects uiController, SmartObject smartObject)
        {
            _uiController = uiController;
            _smartObject = smartObject;

            CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID);
            try
            {
                var count = 1U;
                while (true)
                {
                    var name = string.Format("Tab Button {0} Press", count);
                    if (_smartObject.BooleanOutput.Contains(name))
                    {
                        Buttons[count] = new UIButton(_smartObject, name, string.Format("Tab Button {0} Select", count));
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }

                CloudLog.Debug("{0} for SmartObject ID: {1} contains {2} items", GetType(), smartObject.ID,
                    Buttons.Count);
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error in {0}.ctor, {1}", GetType().Name, e.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Create an instance of a QsysCore
        /// </summary>
        /// <param name="deviceAddresses">The hostnames or ip addresses of the core(s)</param>
        /// <param name="port">Override the default TCP port of 1710</param>
        /// <param name="name"></param>
        public QsysCore(IList <string> deviceAddresses, string name, int port)
        {
            _name = name;
            try
            {
                _socket = new QsysSocket(deviceAddresses, port, name);
                _socket.StatusChanged += (client, status) =>
                {
                    _initialized        = status != SocketStatus.SOCKET_STATUS_CONNECTED;
                    DeviceCommunicating = status == SocketStatus.SOCKET_STATUS_CONNECTED;
                };

                _socket.RequestReceived  += SocketOnRequestReceived;
                _socket.ResponseReceived += SocketOnResponseReceived;
                CloudLog.Debug("{0} instance created with address(es) \"{1}\" port {2}", GetType().Name,
                               String.Join(",", deviceAddresses.ToArray()), port);
                CrestronConsole.AddNewConsoleCommand(parameters => DefaultChangeGroup.Invalidate(), "QSysUpdateAll",
                                                     "Invalidate the default change group in the core",
                                                     ConsoleAccessLevelEnum.AccessOperator);
            }
            catch (Exception e)
            {
                CloudLog.Error("Error in {0}.ctor(), {1}", GetType().Name, e.Message);
            }
        }
Esempio n. 3
0
        private string Get(string paramId)
        {
            var uri = new UriBuilder("http", _ipAddress, 80, string.Format("config"))
            {
                Query = string.Format("action=get&paramid={0}", paramId)
            };

#if true
            CloudLog.Debug("Request to KiPro: GET {0}", uri.Uri.ToString());
#endif
            var task     = _client.GetAsync(uri.Uri);
            var response = task.Await();
#if true
            CloudLog.Debug("Response from KiPro: Code {0}", response.StatusCode);
#endif
            response.EnsureSuccessStatusCode();

            var readTask = response.Content.ReadAsStringAsync();
            var content  = readTask.Await();
#if true
            CloudLog.Debug("Response content:\r\n{0}", content);
#endif
            var json = JToken.Parse(content);

            return(json["value"].Value <string>());
        }
Esempio n. 4
0
        protected virtual void OnSourceChange(SourceBase source)
        {
            CloudLog.Debug("{0} set to Source: {1}", this, source != null ? source.ToString() : "None");

            if (source == null || _displayDevice == null)
            {
                return;
            }
            if (!_displayDevice.Power)
            {
                CloudLog.Debug("{0} Power set to On!", this);
                _displayDevice.Power = true;
            }
            try
            {
                if (Room != null && Room.GetDisplayInputOverrideForSource(this, source) != DisplayDeviceInput.Unknown)
                {
                    RouteSourceDisplayDeviceInput(Room.GetDisplayInputOverrideForSource(this, source));
                }
                else if (source.DisplayDeviceInput != DisplayDeviceInput.Unknown)
                {
                    RouteSourceDisplayDeviceInput(source.DisplayDeviceInput);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error setting input for display");
            }
        }
Esempio n. 5
0
        protected virtual void OnDeviceConnect(int deviceCount)
        {
            CloudLog.Debug("{0} online deviceCount = {1}", Device, deviceCount);

            var oldCount = _deviceCount;

            _deviceCount = deviceCount;

            if (oldCount > 0)
            {
                return;
            }

            if (!System.Booted)
            {
                return;
            }

            if (Room != null && Room.Source != null)
            {
                UIShouldShowSource(Room.Source);
            }
            else
            {
                UIShouldShowHomePage(ShowHomePageEventType.OnDeviceConnect);
            }
        }
Esempio n. 6
0
        private void OnButtonEvent(IButton button, ButtonEventArgs args)
        {
            var    type = (UIKeypadButtonType)args.CollectionKey;
            string stringValue;

            switch (type)
            {
            case UIKeypadButtonType.Star:
                stringValue = "*";
                break;

            case UIKeypadButtonType.Hash:
                stringValue = "#";
                break;

            default:
                stringValue = args.CollectionKey.ToString(CultureInfo.InvariantCulture);
                break;
            }

            if (_buttonEvent == null)
            {
                return;
            }

            CloudLog.Debug("{0} {1}: {2}", GetType().Name, args.EventType, (UIKeypadButtonType)args.CollectionKey);

            _buttonEvent(this, new UIKeypadButtonEventArgs()
            {
                EventType        = args.EventType,
                KeypadButtonType = (UIKeypadButtonType)args.CollectionKey,
                StringValue      = stringValue,
                Value            = args.CollectionKey
            });
        }
Esempio n. 7
0
        internal void CreateOrUpdate(string macAddress, DeviceType type, string statusString)
        {
            ZeeVeeDeviceBase device = null;

            if (_devices.ContainsKey(macAddress))
            {
                _devices[macAddress].UpdateFromStatusString(statusString);
            }
            else
            {
                switch (type)
                {
                case DeviceType.Encoder:
                    device = new ZeeVeeEncoder(_server, macAddress, type);
                    break;

                case DeviceType.Decoder:
                    device = new ZeeVeeDecoder(_server, macAddress, type);
                    break;
                }

                if (device == null)
                {
                    return;
                }
                device.UpdateFromStatusString(statusString);

                CloudLog.Debug("Discovered {0}, MAC: {1}, Name: {2}, State: {3}",
                               device.GetType().Name, device.MacAddress, device.Name, device.State, device.UpTime);

                OnNewDeviceDiscovered(device, type);
            }
        }
Esempio n. 8
0
 private void ExtenderEthernetReservedSigsOnDeviceExtenderSigChange(DeviceExtender currentDeviceExtender, SigEventArgs args)
 {
     if (args.Event != eSigEvent.StringChange)
     {
         return;
     }
     CloudLog.Debug("{0} ExtenderEthernetReservedSigs, Sig Change, Number: {1}, Name {2}, Value {3}",
                    Device.Name, args.Sig.Number, args.Sig.Name, args.Sig.UShortValue);
 }
Esempio n. 9
0
        public void GetStatus()
        {
            try
            {
                //CloudLog.Debug("{0}.GetStatus() for address {1}", GetType().Name, _address);
                if (string.IsNullOrEmpty(_address) && _firstAttempt)
                {
                    _firstAttempt = false;
                    CloudLog.Error("Error with Solstice Pod, no address set, please check config");
                    return;
                }
                var uri = string.Format("http://{0}/api/stats?password={1}", _address, _password);
#if DEBUG
                CloudLog.Debug("Gettiing .. " + uri);
#endif
                _client.GetAsync(uri, (response, error) =>
                {
                    try
                    {
                        if (error == HTTP_CALLBACK_ERROR.COMPLETED)
                        {
#if DEBUG
                            Debug.WriteNormal(Debug.AnsiPurple + response + Debug.AnsiReset);
#endif
                            var data            = JToken.Parse(response);
                            var info            = data["m_displayInformation"];
                            _displayName        = info["m_displayName"].Value <string>();
                            _productName        = info["m_productName"].Value <string>();
                            _productVarient     = info["m_productVariant"].Value <string>();
                            Name                = _productName + " " + _productVarient + " (" + _displayName + ")";
                            DeviceCommunicating = true;
                            return;
                        }
                    }
                    catch (Exception e)
                    {
                        CloudLog.Error("Error with response from Solstice Pod at \"{0}\", {1}", _address, e.Message);
                    }

                    if (DeviceCommunicating || _firstAttempt)
                    {
                        _firstAttempt = false;
                        CloudLog.Error("Error waiting for response from Solstice Pod at \"{0}\"", _address);
                        DeviceCommunicating = false;
                    }
                });
            }
            catch (Exception e)
            {
                if (DeviceCommunicating || _firstAttempt)
                {
                    _firstAttempt = false;
                    CloudLog.Error("Error calling request for Solstice Pod at \"{0}\", {1}", _address, e.Message);
                    DeviceCommunicating = false;
                }
            }
        }
Esempio n. 10
0
        private void DeviceOnSigChange(BasicTriList currentDevice, SigEventArgs args)
        {
            if (args.Event != eSigEvent.BoolChange || args.Sig.Number != VisibleJoin.Number || !args.Sig.BoolValue)
            {
                return;
            }

            CloudLog.Debug("Page Feedback {0} = {1}", args.Sig.Number, args.Sig.BoolValue);
        }
Esempio n. 11
0
        internal QsysControl(ComponentBase component, string name, JToken data)
        {
            Component = component;
            component.Controls[name] = this;
            UpdateFromData(data);
#if DEBUG
            CloudLog.Debug("Created object: {0}", this);
#endif
        }
Esempio n. 12
0
 public void StartPlaying()
 {
     if (_sleepDelayTimer != null && !_sleepDelayTimer.Disposed)
     {
         _sleepDelayTimer.Dispose();
     }
     CloudLog.Debug("Codec is now being used");
     Wake();
 }
Esempio n. 13
0
 private void UIControllerOnActivity(UIController uiController)
 {
     if (!Visible || _timeOutTime.Equals(TimeSpan.Zero))
     {
         return;
     }
     CloudLog.Debug("{0} Activity - Resetting Timeout", GetType().Name);
     SetTimeOut(_timeOutTime);
 }
Esempio n. 14
0
        /// <summary>
        /// Fast switch a decoder to an encoder
        /// </summary>
        /// <param name="encoder">The ZyperHD Encoder, use null for none</param>
        /// <param name="decoder">The ZyperHD Decoder</param>
        public void JoinFastSwitched(ZeeVeeEncoder encoder, ZeeVeeDecoder decoder)
        {
            var encoderName = encoder != null ? encoder.Name : "none";

            CloudLog.Debug("ZeeVee switch: \"{0}\" => \"{1}\"", encoderName, decoder.Name);
            _socket.Send(string.Format("join {0} {1} fast-switched",
                                       encoderName,
                                       decoder.Name));
            _socket.Send(string.Format("show device status {0}", decoder.Name));
        }
Esempio n. 15
0
        private object ReceiveHandler(object userSpecific)
        {
            var clientIndex = (uint)userSpecific;

            CloudLog.Notice("{0} rx handler on TCP port {1}, is running for client index {2}", GetType().Name, _socket.PortNumber, clientIndex);

            try
            {
                OnClientConnect(clientIndex);
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }

            while (true)
            {
                try
                {
                    var count = _socket.ReceiveData(clientIndex);

                    if (count <= 0)
                    {
                        CloudLog.Debug("{0} - Client Index {1} Received data count of {2}, Disconnected? - Exiting Thread",
                                       GetType().Name, clientIndex, count);

                        try
                        {
                            OnClientDisconnect(clientIndex);
                        }
                        catch (Exception e)
                        {
                            CloudLog.Exception(e);
                        }

                        return(null);
                    }

                    OnClientReceive(clientIndex, _socket.GetIncomingDataBufferForSpecificClient(clientIndex), count);
                }
                catch (Exception e)
                {
                    CloudLog.Exception(e,
                                       "Error in {0} for client index {1}, closing connection and exiting rx handler thread",
                                       Thread.CurrentThread.Name, clientIndex);
                    if (_connections[clientIndex] == SocketStatus.SOCKET_STATUS_CONNECTED)
                    {
                        _socket.Disconnect(clientIndex);
                        return(null);
                    }
                }
            }
        }
Esempio n. 16
0
 private void ControlOnValueChange(QsysControl control, QsysControlValueChangeEventArgs args)
 {
     if (!(args.NewValue > 0) || !_controls.Values.Contains(control))
     {
         return;
     }
     _selectedInput = _controls.First(k => k.Value == control).Key;
     CloudLog.Debug("Router \"{0}\" Selected Input = {1}", Name, _selectedInput);
     if (SelectedInputChange != null)
     {
         SelectedInputChange(this, _selectedInput);
     }
 }
Esempio n. 17
0
        protected virtual void OnHasIntitialized(QsysCore core)
        {
            var handler = HasIntitialized;

#if DEBUG
            CloudLog.Debug("QsysCore has initialized");
            foreach (var component in this)
            {
                CloudLog.Debug("QsysCore Component: {0}", component);
            }
#endif
            if (handler != null)
            {
                handler(core);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Creates a base class for subpage referenece lists
        /// </summary>
        /// <param name="uiController">The UI Controller for the decice</param>
        /// <param name="smartObject">The smart object for the device</param>
        /// <param name="digitalJoinIncrement">The digital join increment, must be more than 0!</param>
        /// <param name="analogJoinIncrement">The analog join increment</param>
        /// <param name="serialJoinIncrement">The serial join increment, must be more than 0!</param>
        /// <param name="callBack">A 'CreateItemForIndexCallBack' delegate to create the items</param>
        protected UISubPageReferenceList(UIControllerWithSmartObjects uiController, SmartObject smartObject, uint digitalJoinIncrement, uint analogJoinIncrement,
                                         uint serialJoinIncrement, CreateItemForIndexCallBack callBack)
        {
            _uiController         = uiController;
            _smartObject          = smartObject;
            _digitalJoinIncrement = digitalJoinIncrement;
            _analogJoinIncrement  = analogJoinIncrement;
            _serialJoinIncrement  = serialJoinIncrement;

            _smartObject.SigChange += SmartObjectOnSigChange;

            if (_digitalJoinIncrement == 0 || _serialJoinIncrement == 0)
            {
                throw new Exception("Join increments must be at least 1 for digital and serial joins");
            }

            CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID);
            try
            {
                uint count = 1;
                while (true)
                {
                    var name = string.Format("Item {0} Visible", count);
                    if (_smartObject.BooleanInput.Contains(name))
                    {
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
                _maxNumberOfItems = count - 1;

                CloudLog.Debug("{0} for SmartObject ID: {1} contains {2} items", GetType(), smartObject.ID,
                               _maxNumberOfItems);

                for (uint i = 1; i <= _maxNumberOfItems; i++)
                {
                    _items[i] = callBack(this, i);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error in {0}.ctor, {1}", GetType().Name, e.Message);
            }
        }
Esempio n. 19
0
 public void StopPlaying()
 {
     CloudLog.Debug("Codec is no longer in use");
     if (Calls.ActiveCallsCount > 0)
     {
         HangupAll();
     }
     if (_supressSleep)
     {
         return;
     }
     _sleepDelayTimer = new CTimer(specific =>
     {
         _sleepDelayTimer.Dispose();
         Sleep();
     }, 5000);
 }
Esempio n. 20
0
        protected override void WillShow()
        {
            base.WillShow();

            _tabs.ButtonEvent           += TabsOnButtonEvent;
            _channelButtons.ButtonEvent += ChannelButtonsOnButtonEvent;

            if (_currentId == 0)
            {
                _tabs.SetInterlockedFeedback(1);
                _currentId = _receiverIds[1];
            }

            Device.BooleanInput[Digitals.IptvTabsVisible].BoolValue = _receiverIds.Count > 1;

            TripleCare.GetChannels(ConfigManager.Config.TriplePlayServerAddress, -1, (success, channels) =>
            {
                if (success && channels != null)
                {
                    var channelOrder = channels
                                       .OrderBy(c => c.Number)
                                       .Take((int)_channelList.MaxNumberOfItems)
                                       .ToArray();

                    CloudLog.Debug("Received {0} channels from server", channelOrder.Count());
                    try
                    {
                        _channelList.ClearList(true);
                        foreach (var channel in channelOrder)
                        {
                            _channelList.AddItem(channel.Name, channel, true);
                        }
                        _channelList.SetListSizeToItemCount();
                    }
                    catch (Exception e)
                    {
                        CloudLog.Exception(e, "Error loading channels into list");
                    }
                }
                else
                {
                    CloudLog.Warn("Could not load channel list from server");
                }
            });
        }
Esempio n. 21
0
        public void UpdateFromSwitcherVideoStatus(uint input, bool videoActive)
        {
            if (!SwitcherInputs.ContainsKey(1) || SwitcherInputs[1] != input)
            {
                return;
            }

            if (_videoInputActive == videoActive)
            {
                return;
            }

            _videoInputActive = videoActive;

            CloudLog.Debug("Source: \"{0}\", Video Present on input {1} = {2}", Name, input, videoActive);

            OnVideoStatusChangeDetected(this, _videoInputActive);
        }
Esempio n. 22
0
        /// <summary>
        /// The default Constructor.
        /// </summary>
        public UIKeypad(SmartObject smartObject)
        {
            CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID);

            _buttons = new ButtonCollection {
                { 0, new UIButton(smartObject, 10) }
            };
            for (uint cueIndex = 1; cueIndex <= 9; cueIndex++)
            {
                _buttons.Add(cueIndex, new UIButton(smartObject, cueIndex));
            }
            _buttons.Add(10, new UIButton(smartObject, 11));
            _buttons.Add(11, new UIButton(smartObject, 12));

            foreach (var button in _buttons)
            {
                button.HoldTime = TimeSpan.FromSeconds(1);
            }
        }
Esempio n. 23
0
        protected override void OnSigChange(GenericBase currentDevice, SigEventArgs args)
        {
            base.OnSigChange(currentDevice, args);
            if (args.Event == eSigEvent.StringChange && args.Sig == SerialOutputJoin)
            {
#if DEBUG
                //CloudLog.Debug("Text Entry {0} Text Change: {1}", SerialOutputJoin.Number, args.Sig.StringValue);
#endif
                _text = args.Sig.StringValue;
                OnKeyboardTextChanged(_text);
            }
            else if (args.Event == eSigEvent.BoolChange && args.Sig == EnterJoin && args.Sig.BoolValue)
            {
#if DEBUG
                CloudLog.Debug("Text Entry {0} Entered Text: {1}", SerialOutputJoin.Number, Text);
#endif
                OnKeyboardDidEnter(Text);
            }
        }
Esempio n. 24
0
        private void Set(string paramId, object value)
        {
            var uri = new UriBuilder("http", _ipAddress, 80, string.Format("config"))
            {
                Query = string.Format("action=set&paramid={0}&value={1}", paramId, value)
            };

#if true
            CloudLog.Debug("Request to KiPro: GET {0}", uri.Uri.ToString());
#endif
            var task = _client.GetAsync(uri.Uri);
            task.ContinueWith(delegate(Task <HttpResponseMessage> task1)
            {
                var response = task1.Await();
#if true
                CloudLog.Debug("Response from KiPro: Code {0}", response.StatusCode);
#endif
                var transportState = int.Parse(Get("eParamID_TransportState"));
                OnTransportModeChanged(this);
            });
        }
Esempio n. 25
0
        private void SocketOnSocketStatusChange(TCPServer myTcpServer, uint clientIndex, SocketStatus serverSocketStatus)
        {
            if (_connections == null)
            {
                _connections = new Dictionary <uint, SocketStatus>();
            }

            CloudLog.Debug("{0} Connection Status for ClientIndex {1}, {2}", GetType().Name, clientIndex, serverSocketStatus);

            _connections[clientIndex] = serverSocketStatus;

            if (serverSocketStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
            {
                return;
            }

            if (_threads == null)
            {
                _threads = new Dictionary <uint, Thread>();
            }

            if (!_threads.ContainsKey(clientIndex) ||
                _threads[clientIndex].ThreadState != Thread.eThreadStates.ThreadRunning)
            {
                try
                {
                    _threads[clientIndex] = new Thread(ReceiveHandler, clientIndex)
                    {
                        Name     = string.Format("{0} Rx Handler for client index {1}", GetType().Name, clientIndex),
                        Priority = Thread.eThreadPriority.HighPriority
                    };
                }
                catch (Exception e)
                {
                    CloudLog.Exception(e, "Error starting RX Handler thread for client index {0}", clientIndex);
                    _socket.Disconnect(clientIndex);
                }
            }
        }
Esempio n. 26
0
        protected override void SourceLoadProcess(SourceBase previousSource, SourceBase newSource)
        {
            if (newSource != null)
            {
                CloudLog.Debug("Loading source \"{0}\" in room \"{1}\"", newSource, this);
            }



            if (newSource != null)
            {
                if (SystemSwitcher != null && Config.SwitcherOutputCodecContent > 0 &&
                    ((ASource)newSource).SwitcherInputs.ContainsKey(1))
                {
                    SystemSwitcher.RouteVideo(((ASource)newSource).SwitcherInputs[1], Config.SwitcherOutputCodecContent);
                    SystemSwitcher.RouteAudio(((ASource)newSource).SwitcherInputs[1], Config.SwitcherOutputCodecContent);
                }
                Codec.Conference.Presentation.Start(SendingMode.LocalRemote);
            }
            else
            {
                if (SystemSwitcher != null && Config.SwitcherOutputCodecContent > 0)
                {
                    SystemSwitcher.RouteVideo(0, Config.SwitcherOutputCodecContent);
                    SystemSwitcher.RouteAudio(0, Config.SwitcherOutputCodecContent);
                }
                Codec.Conference.Presentation.Stop();
            }

            try
            {
                FusionShouldUpdateCoreParameters();
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
        }
Esempio n. 27
0
        internal ComponentBase(QsysCore core, JToken data)
        {
            try
            {
                Core        = core;
                Name        = data["Name"].Value <string>();
                _typeString = data["Type"].Value <string>();

                try
                {
                    Type =
                        (QsysComponentType)
                        Enum.Parse(typeof(QsysComponentType),
                                   Regex.Replace(_typeString, @"(?:^|_)([a-z])", m => m.Groups[1].ToString().ToUpper()),
                                   false);
                }
                catch
                {
                    Type = QsysComponentType.Unknown;
                }

                foreach (var property in data["Properties"])
                {
                    _properties[property["Name"].Value <string>()] = property["Value"].Value <string>();
                }
#if DEBUG
                var details = this + " created";
                details = details + "\r\nProperties:";
                details = Properties.Aggregate(details,
                                               (current, property) => current + string.Format("\r\n   - {0} = {1}", property.Key, property.Value));
                CloudLog.Debug(details);
#endif
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
        }
Esempio n. 28
0
        public UIDynamicButtonList(UIControllerWithSmartObjects uiController, SmartObject smartObject)
        {
            _uiController = uiController;
            _smartObject  = smartObject;

            _smartObject.SigChange += SmartObjectOnSigChange;

            CloudLog.Debug("{0}.ctor for SmartObject ID: {1}", GetType(), smartObject.ID);
            try
            {
                uint count = 1;
                while (true)
                {
                    var name = string.Format("Item {0} Visible", count);
                    if (_smartObject.BooleanInput.Contains(name))
                    {
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }
                _maxNumberOfItems = count - 1;

                CloudLog.Debug("{0} for SmartObject ID: {1} contains {2} items", GetType(), smartObject.ID,
                               _maxNumberOfItems);

                for (uint i = 1; i <= _maxNumberOfItems; i++)
                {
                    _items[i] = new UIDynamicButtonListItem(this, i);
                }
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error in {0}.ctor, {1}", GetType().Name, e.Message);
            }
        }
Esempio n. 29
0
        private object ListenForConnections(object userSpecific)
        {
            CloudLog.Notice("Started {0} connection handler", GetType().Name);

            while (!_programStopping)
            {
                CloudLog.Debug("{0} Waiting for connections...", GetType().Name);

                if (_socket.NumberOfClientsConnected < _socket.MaxNumberOfClientSupported)
                {
                    var result = _socket.WaitForConnection();
                    CloudLog.Debug("{0} Connection result: {1}", GetType().Name, result);
                }
                else
                {
                    CloudLog.Debug("{0} No more connections allowed", GetType().Name);
                    Thread.Sleep(10000);
                }
            }

            CloudLog.Notice("Exiting {0}", Thread.CurrentThread.Name);

            return(null);
        }
Esempio n. 30
0
 private void InternalClockInitialize()
 {
     _clockInitThread = new Thread(specific =>
     {
         CloudLog.Debug("InternalClockInitialize(), Waiting for seconds to be 0", GetType().Name);
         while (DateTime.Now.Second != 0)
         {
             Thread.Sleep(50);
             CrestronEnvironment.AllowOtherAppsToRun();
         }
         CloudLog.Notice("InternalClockInitialize(), Seconds should now be zero, time is now {1}, creating CTimer to track time",
                         GetType().Name,
                         DateTime.Now.ToString("T"));
         _clockTimer = new CTimer(s => OnTimeChange(), null, 60000, 60000);
         OnTimeChange();
         CloudLog.Info("InternalClockInitialize(), OnTimeChange() will be called every time time is 0 seconds", GetType().Name);
         return(null);
     }, null, Thread.eThreadStartOptions.CreateSuspended)
     {
         Name     = "Clock Init Thread",
         Priority = Thread.eThreadPriority.HighPriority
     };
     _clockInitThread.Start();
 }