Пример #1
0
        protected override void CustomSetConfig(DeviceConfig config)
        {
            var newPropertiesConfig = JsonConvert.DeserializeObject <RoomOnToDefaultSourceWhenOccupiedConfig>(config.Properties.ToString());

            if (newPropertiesConfig != null)
            {
                PropertiesConfig = newPropertiesConfig;
            }

            ConfigWriter.UpdateDeviceConfig(config);

            SetUpDevice();
        }
Пример #2
0
        public static DeviceConfig Configure(DeviceConfig edgeConfig, LocalConfig localConfig)
        {
            metadataHandlers = new List <MetadataHandler>();
            metadataHandlers.Add(ConfigureTemplate);
            metadataHandlers.Add(ConfigureIoTHubConnectionString);
            metadataHandlers.Add(ConfigureStorageConnectionString);
            foreach (var handler in metadataHandlers)
            {
                edgeConfig = handler(edgeConfig, localConfig);
            }

            return(edgeConfig);
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmDeviceData(IAdminContext adminContext, CommApp commApp, DeviceConfig deviceConfig) :
     this()
 {
     this.adminContext = adminContext ?? throw new ArgumentNullException(nameof(adminContext));
     this.commApp      = commApp ?? throw new ArgumentNullException(nameof(commApp));
     this.deviceConfig = deviceConfig ?? throw new ArgumentNullException(nameof(deviceConfig));
     dataBox           = new RemoteLogBox(lbDeviceData)
     {
         FullLogView = true
     };
     frmDeviceCommand = null;
     isClosed         = false;
 }
Пример #4
0
 public void LoadFake()
 {
     AuthorizedDevices.Fake();
     DeviceConfig.Fake();
     EventConfig.Fake();
     //GlobalConfig.Fake();
     GsmConfig.Fake();
     ZoneConfig.Fake();
     UserConfig.Fake();
     InputConfig.Fake();
     OutputConfig.Fake();
     RelayConfig.Fake();
 }
Пример #5
0
        public async Task <bool> SetConfig(Camera c)
        {
            System.Diagnostics.Debug.Assert(c != null);
            var url = string.Format("http://{0}:{1}/setConfig", c.IP, c.Port);

            var para = new DeviceConfig()
            {
                companyName          = c.Company,
                displayModContent    = c.DisplayContent == null ? string.Empty : c.DisplayContent,
                displayModType       = c.DisplayMode,
                identifyDistance     = c.Identifydistance,
                identifyScores       = c.Identifyscore,
                intro                = c.Memo == null ? string.Empty : c.Memo,
                multiplayerDetection = c.MultiFaceDetect,
                saveIdentifyTime     = c.SaveIdentifyTime,
                //screendirection = c.ScreenDirection,
                comModContent             = c.SerialPortContent == null ? string.Empty : c.SerialPortContent,
                comModType                = c.SerialPortMode,
                slogan                    = c.Slogan == null ? string.Empty : c.Slogan,
                recStrangerType           = c.StrangerMode,
                recStrangerTimesThreshold = c.StrangerTimeThreshold,
                ttsModContent             = c.TTSContent == null ? string.Empty : c.TTSContent,
                ttsModType                = c.TTSMode,
                ttsModStrangerContent     = c.TTSStrangerContent == null ? string.Empty : c.TTSStrangerContent,
                ttsModStrangerType        = c.TTSStrangerMode,
            };
            var config = JsonSerializer <DeviceConfig> .Serialize(para);

            System.Diagnostics.Debug.WriteLine(config);
            KeyValuePair <string, string>[] data = new KeyValuePair <string, string> [2];
            data[0] = new KeyValuePair <string, string>("pass", c.Pwd);
            data[1] = new KeyValuePair <string, string>("config", config);
            var response = await web.Post(data, url);

            System.Diagnostics.Debug.WriteLine("+++++SetConfig++++");
            if (!string.IsNullOrEmpty(response))
            {
                var ret = JsonSerializer <ServiceResult <DeviceConfig> > .Deserialize(response);

                if (ret != null)
                {
                    if (ret.success)
                    {
                        return(true);
                    }
                    throw new Exception(ret.msg);
                }
            }

            return(false);
        }
Пример #6
0
        public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
            : base(key, name, device)
        {
            AirMedia = device;

            DeviceConfig = dc;

            PropertiesConfig = props;

            InputPorts  = new RoutingPortCollection <RoutingInputPort>();
            OutputPorts = new RoutingPortCollection <RoutingOutputPort>();

            InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this));

            InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this));

            InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this));

            InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.Video,
                                                eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this));

            if (AirMedia is Am300)
            {
                InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
                                                    eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this));
            }

            AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange);

            IsInSessionFeedback            = new BoolFeedback(new Func <bool>(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0));
            ErrorFeedback                  = new IntFeedback(new Func <int>(() => AirMedia.AirMedia.ErrorFeedback.UShortValue));
            NumberOfUsersConnectedFeedback = new IntFeedback(new Func <int>(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue));
            LoginCodeFeedback              = new IntFeedback(new Func <int>(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue));
            ConnectionAddressFeedback      = new StringFeedback(new Func <string>(() => AirMedia.AirMedia.ConnectionAddressFeedback.StringValue));
            HostnameFeedback               = new StringFeedback(new Func <string>(() => AirMedia.AirMedia.HostNameFeedback.StringValue));

            // TODO: Figure out if we can actually get the TSID/Serial
            SerialNumberFeedback = new StringFeedback(new Func <string>(() => "unknown"));

            AirMedia.DisplayControl.DisplayControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(DisplayControl_DisplayControlChange);

            VideoOutFeedback = new IntFeedback(new Func <int>(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback)));
            AutomaticInputRoutingEnabledFeedback = new BoolFeedback(new Func <bool>(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue));

            AirMedia.HdmiIn.StreamChange += new Crestron.SimplSharpPro.DeviceSupport.StreamEventHandler(HdmiIn_StreamChange);

            HdmiVideoSyncDetectedFeedback = new BoolFeedback(new Func <bool>(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue));
        }
Пример #7
0
        public ComPortClient(DeviceConfig _Config, IConnectionReport _ConnReport)
        {
            cfg        = _Config;
            ConnReport = _ConnReport;
            Parity p = Parity.None;

            switch (_Config.ParityBit)
            {
            case "Even":
                p = Parity.Even;
                break;

            case "Mark":
                p = Parity.Mark;
                break;

            case "None":
                p = Parity.None;
                break;

            case "Odd":
                p = Parity.Odd;
                break;

            case "Space":
                p = Parity.Space;
                break;
            }
            StopBits s = StopBits.One;

            switch (_Config.StopBit)
            {
            case "None":
                s = StopBits.None;
                break;

            case "One":
                s = StopBits.One;
                break;

            case "OnePointFive":
                s = StopBits.OnePointFive;
                break;

            case "Two":
                s = StopBits.Two;
                break;
            }

            port = new SerialPort(_Config.PortName, _Config.BaudRate, p, _Config.DataBits, s);
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public FrmConfig(AppDirs appDirs, int kpNum)
     : this()
 {
     this.appDirs      = appDirs ?? throw new ArgumentNullException("appDirs");
     this.kpNum        = kpNum;
     deviceConfig      = new DeviceConfig();
     configFileName    = "";
     modified          = false;
     changing          = false;
     maxCmdNum         = null;
     opcSession        = null;
     subscriptionsNode = null;
     commandsNode      = null;
 }
Пример #9
0
    private IEnumerator ShowHintStudyRushIE()
    {
        animStudyRush_1.SetTrigger("study_rush_skill");
        yield return(new WaitForSeconds(2));

        if (DeviceConfig.isAndroid())
        {
            animStudyRush_2_Android.SetTrigger("study_rush_skill");
        }
        else
        {
            animStudyRush_2_Pc.SetTrigger("study_rush_skill");
        }
    }
Пример #10
0
        public override EssentialsDevice BuildDevice(DeviceConfig dc)
        {
            Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
            var comm = CommFactory.CreateCommForDevice(dc);

            if (comm != null)
            {
                return(new PanasonicThDisplay(dc.Key, dc.Name, comm));
            }
            else
            {
                return(null);
            }
        }
Пример #11
0
        public override EssentialsDevice BuildDevice(DeviceConfig dc)
        {
            Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
            var comm = CommFactory.CreateCommForDevice(dc);

            if (comm != null)
            {
                return(new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value <string>()));
            }
            else
            {
                return(null);
            }
        }
Пример #12
0
 public static EssentialsControlPropertiesConfig GetControlPropertiesConfig(DeviceConfig deviceConfig)
 {
     try
     {
         return(JsonConvert.DeserializeObject <EssentialsControlPropertiesConfig>
                    (deviceConfig.Properties["control"].ToString()));
         //Debug.Console(2, "Control TEST: {0}", JsonConvert.SerializeObject(controlConfig));
     }
     catch (Exception e)
     {
         Debug.Console(0, "ERROR: [{0}] Control properties deserialize failed:\r{1}", deviceConfig.Key, e);
         return(null);
     }
 }
Пример #13
0
 private void btnPasteDevice_Click(object sender, EventArgs e)
 {
     // paste the copied device
     if (deviceClipboard == null)
     {
         lvDevicePolling.Focus();
     }
     else
     {
         DeviceConfig deviceConfig = deviceClipboard.DeepClone();
         deviceConfig.Parent = lineConfig;
         AddDeviceItem(deviceConfig);
     }
 }
Пример #14
0
 /// <summary>
 /// Factory for scene controller
 /// </summary>
 /// <param name="dc"></param>
 /// <returns></returns>
 public static SceneController GetSceneController(DeviceConfig dc)
 {
     try
     {
         var sc = new SceneController(dc.Key, dc.Name);
         sc.SceneItems = dc.Properties["items"].ToObject <List <SceneItem> >();
         return(sc);
     }
     catch (Exception e)
     {
         Debug.Console(0, Debug.ErrorLogLevel.Error, "Error creating scene controller '{0}': {1}", dc.Key, e);
         return(null);
     }
 }
        public void Probe_ReturnsProperActiveState_WhenCalled(bool expectedValue)
        {
            moqSerialConnection.Setup(e => e.Connect(It.IsAny <string>(), false)).Returns(expectedValue);

            DeviceConfig deviceConfig = new DeviceConfig()
            {
                Valid = true
            };

            deviceConfig.SetSerialDeviceConfig(serialConfig);

            subject.Probe(deviceConfig, deviceInformation, out bool actualValue);
            Assert.Equal(expectedValue, actualValue);
        }
Пример #16
0
        private static void PrintManualModeConfig(List <Pool> printedPools)
        {
            var manualMininigConfigs = new Dictionary <string, MiningConfig>();

            WriteLineColor(" MANUAL MODE CONFIG: ", ConsoleColor.Cyan);
            WriteLineColor(" Use the numbers above to set a pool.", ConsoleColor.DarkGray);
            WriteLineColor(" Or use \"0\" to disable the device.", ConsoleColor.DarkGray);
            Console.WriteLine();
            Console.CursorVisible = true;
            foreach (string deviceId in GetActiveDeviceIds())
            {
                DeviceConfig deviceConfig = null;
                Pool         selectedPool = null;
                bool         noPool       = false;
                while ((selectedPool == null || deviceConfig == null) && !noPool)
                {
                    Console.Write(" Set the pool for ");
                    WriteColor(deviceId, ConsoleColor.Yellow);
                    Console.Write(": ");

                    string userInput = Console.ReadLine();
                    if (int.TryParse(userInput, out int poolUserIndex))
                    {
                        if (poolUserIndex == 0)
                        {
                            noPool = true;
                        }
                        else if (poolUserIndex > 0 && poolUserIndex <= printedPools.Count)
                        {
                            selectedPool = printedPools[poolUserIndex - 1];
                            deviceConfig = GetDeviceConfigForPool(selectedPool, deviceId);
                            if (deviceConfig == null)
                            {
                                Console.WriteLine(" The selected pool is not valid for this device.");
                            }
                        }
                    }
                }

                if (!noPool)
                {
                    manualMininigConfigs[deviceConfig.FullDeviceId] = new MiningConfig(deviceConfig, selectedPool);
                }
            }
            Console.CursorVisible = false;

            _manualMininigConfigs = manualMininigConfigs;
            _miningSwitcherTaskCts?.Cancel();
            Console.WriteLine();
        }
Пример #17
0
        public EiscApiAdvanced(DeviceConfig dc) :
            base(dc.Key)
        {
            JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();

            PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
            //PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());

            Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem);

            Eisc.SigChange += Eisc_SigChange;

            Eisc.Register();

            AddPostActivationAction( () =>
            {
                Debug.Console(1, this, "Linking Devices...");

                foreach (var d in PropertiesConfig.Devices)
                {
                    var device = DeviceManager.GetDeviceForKey(d.DeviceKey);

                    if (device == null) continue;

                    Debug.Console(1, this, "Linking Device: '{0}'", device.Key);

                    if (typeof (IBridge).IsAssignableFrom(device.GetType().GetCType()))
                    {
                        var basicBridge = device as IBridge;
                        if (basicBridge != null)
                        {
                            Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
                                "Linking EiscApiAdvanced {0} to device {1} using obsolete join map. Please update the device's join map.",
                                Key, device.Key);
                            basicBridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
                        }
                        continue;
                    }

                    if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
                    {
                        continue;
                    }
                    var bridge = device as IBridgeAdvanced;
                    if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
                }

                
            });
        }
Пример #18
0
 /// <summary>
 /// Creates a tree node that represents the device.
 /// </summary>
 public TreeNode CreateDeviceNode(CommApp commApp, DeviceConfig deviceConfig)
 {
     return(new TreeNode(CommUtils.GetDeviceTitle(deviceConfig))
     {
         ImageKey = ImageKey.Device,
         SelectedImageKey = ImageKey.Device,
         ContextMenuStrip = menuControl.DeviceMenu,
         Tag = new CommNodeTag(commApp, deviceConfig, CommNodeType.Device)
         {
             FormType = typeof(FrmDeviceData),
             FormArgs = new object[] { adminContext, commApp, deviceConfig }
         }
     });
 }
Пример #19
0
 public void CancelUpdateMode()
 {
     ClearInputControls();
     RefreshGrid();
     _deviceConfigUnderUpdate = null;
     EnableControlsForNonUpdateMode();
     if (UpdateModeChanged != null)
     {
         UpdateModeChanged(new DeviceConfigControlStateChangedArgs()
         {
             Enabled = false
         });                                                                               //No longer in update mode.
     }
 }
Пример #20
0
        /// <summary>
        /// 系统资源初始化
        /// </summary>
        public static void Startup(string processName, string moduleName = "")
        {
            ConfigPath  = Path.GetFullPath($"{BasePath}../../Cfg");
            ProcessName = processName;
            ModuleName  = moduleName;

            if (!Directory.Exists(ConfigPath))
            {
                Directory.CreateDirectory(ConfigPath);
            }

            MainConfigFile   = Path.Combine(ConfigPath, $"Main.json");
            DeviceConfigFile = Path.Combine(ConfigPath, $"{ProcessName}.device.xml");

            Logger.Main.Info($"加载主配置文件{SysConf.MainConfigFile}");
            Main = JsonExtension.GetDefKey(SysConf.MainConfigFile, "MAIN", new SysConfModel());

            if (File.Exists(SysConf.DeviceConfigFile))
            {
                var dc = XmlExtension.LoadXMLFile <DeviceConfig>(SysConf.DeviceConfigFile);
                if (dc.IsSuccess)
                {
                    Logger.Main.Info($"加载设备配置文件: {SysConf.DeviceConfigFile} 成功");
                    Device = dc.Data;
                    Device.Recombine();
                    //foreach (var d in Device.Devices)
                    //{
                    //    foreach (var p in d.Value.Properties)
                    //    {
                    //        System.Console.WriteLine(p.Value.Id);
                    //    }
                    //}
                }
                else
                {
                    Logger.Main.Error($"加载设备配置文件: {SysConf.DeviceConfigFile} 失败");
                }
            }

            if (SysConf.Main.RunEnv != "EVOC")
            {
                RunInEvoc = false;
            }

            KeyPlant        = $"LD:{Main.Factory.Id}:{Main.Plant.Id}";
            KeyAssemblyLine = $"{KeyPlant}:{Main.AssemblyLine.Id}";

            SysBootStrapper.Initialize("");
            ServiceManager.Start();
        }
Пример #21
0
        public void CanGetValidDevices()
        {
            DeviceEnumerator e = new DeviceEnumerator(new Context());

            Assert.True(e.ValidDevices.Count > 0);
            DeviceConfig d = e.ValidDevices[0];

            Assert.True(d.Id.IsNotNullOrEmpty());
            Assert.True(d.Config.IsNotNullOrEmpty());
            Assert.True(d.Description.IsNotNullOrEmpty());
            Assert.True(d.Details.IsNotNullOrEmpty());
            Assert.True(e.GetConfigSource().IsNotNullOrEmpty());
            e.Free();
        }
Пример #22
0
        public override EssentialsDevice BuildDevice(DeviceConfig dc)
        {
            Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device");
            var ir = IRPortHelper.GetIrPort(dc.Properties);

            if (ir != null)
            {
                var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
                display.IrPulseTime = 200;       // Set default pulse time for IR commands.
                return(display);
            }

            return(null);
        }
Пример #23
0
        /// <summary>
        ///
        /// </summary>
        public MockVC(DeviceConfig config)
            : base(config)
        {
            PropertiesConfig = JsonConvert.DeserializeObject <VideoCodec.MockVcPropertiesConfig>(config.Properties.ToString());

            CodecInfo = new MockCodecInfo();

            // Get favoritesw
            if (PropertiesConfig.Favorites != null)
            {
                CallFavorites           = new CodecCallFavorites();
                CallFavorites.Favorites = PropertiesConfig.Favorites;
            }

            DirectoryBrowseHistory = new List <CodecDirectory>();

            // Debug helpers
            MuteFeedback.OutputChange            += (o, a) => Debug.Console(1, this, "Mute={0}", _IsMuted);
            PrivacyModeIsOnFeedback.OutputChange += (o, a) => Debug.Console(1, this, "Privacy={0}", _PrivacyModeIsOn);
            SharingSourceFeedback.OutputChange   += (o, a) => Debug.Console(1, this, "SharingSource={0}", _SharingSource);
            VolumeLevelFeedback.OutputChange     += (o, a) => Debug.Console(1, this, "Volume={0}", _VolumeLevel);

            CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => DirectoryBrowseHistory.Count > 0);

            CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();

            CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 0, this);
            InputPorts.Add(CodecOsdIn);
            HdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 1, this);
            InputPorts.Add(HdmiIn1);
            HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2, this);
            InputPorts.Add(HdmiIn2);
            HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this);
            OutputPorts.Add(HdmiOut);

            CallHistory = new CodecCallHistory();
            for (int i = 0; i < 10; i++)
            {
                var call = new CodecCallHistory.CallHistoryEntry();
                call.Name   = "Call " + i;
                call.Number = i + "@call.com";
                CallHistory.RecentCalls.Add(call);
            }
            // eventually fire history event here

            SetupCameras();

            SetIsReady();
        }
Пример #24
0
 /// <summary>
 /// Gets the selected list view item and the corresponding device configuration.
 /// </summary>
 private bool GetSelectedItem(out ListViewItem item, out DeviceConfig deviceConfig)
 {
     if (lvDevicePolling.SelectedItems.Count > 0)
     {
         item         = lvDevicePolling.SelectedItems[0];
         deviceConfig = (DeviceConfig)item.Tag;
         return(true);
     }
     else
     {
         item         = null;
         deviceConfig = null;
         return(false);
     }
 }
Пример #25
0
        private bool loggingFlag;                  // indicates that a ready message should be logged


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DevHttpNotifLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
            : base(commContext, lineContext, deviceConfig)
        {
            CanSendCommands    = true;
            ConnectionRequired = false;

            stopwatch    = new Stopwatch();
            config       = new NotifDeviceConfig();
            addressBook  = null;
            paramUri     = null;
            paramContent = null;
            httpClient   = null;
            isReady      = false;
            loggingFlag  = false;
        }
Пример #26
0
        public VideoCodecBase(DeviceConfig config)
            : base(config)
        {
            StandbyIsOnFeedback        = new BoolFeedback(StandbyIsOnFeedbackFunc);
            PrivacyModeIsOnFeedback    = new BoolFeedback(PrivacyModeIsOnFeedbackFunc);
            VolumeLevelFeedback        = new IntFeedback(VolumeLevelFeedbackFunc);
            MuteFeedback               = new BoolFeedback(MuteFeedbackFunc);
            SharingSourceFeedback      = new StringFeedback(SharingSourceFeedbackFunc);
            SharingContentIsOnFeedback = new BoolFeedback(SharingContentIsOnFeedbackFunc);

            InputPorts  = new RoutingPortCollection <RoutingInputPort>();
            OutputPorts = new RoutingPortCollection <RoutingOutputPort>();

            ActiveCalls = new List <CodecActiveCallItem>();
        }
Пример #27
0
        public override EssentialsDevice BuildDevice(DeviceConfig dc)
        {
            Debug.Console(1, "Factory Attempting to create new SetTopBox Device");
            var irCont = IRPortHelper.GetIrOutputPortController(dc);
            var config = dc.Properties.ToObject <SetTopBoxPropertiesConfig>();
            var stb    = new IRSetTopBoxBase(dc.Key, dc.Name, irCont, config);

            var listName = dc.Properties.Value <string>("presetsList");

            if (listName != null)
            {
                stb.LoadPresets(listName);
            }
            return(stb);
        }
Пример #28
0
        public void UpdateDeviceConfig(DeviceConfig entity, UpdateDeviceConfigModel model)
        {
            model.CopyTo(entity);

            entity.RemoveOldEventsJobSettings = JsonConvert.SerializeObject(
                model.RemoveOldEventsJobSettingsObj);
            entity.SendUnsentEventsJobSettings = JsonConvert.SerializeObject(
                model.SendUnsentEventsJobSettingsObj);

            if (!string.IsNullOrWhiteSpace(model.KafkaPasswordReset))
            {
                entity.KafkaPassword = model.KafkaPasswordReset;
            }
            PrepareUpdate(entity);
        }
Пример #29
0
        /// <summary>
        /// Sets the Config, calls CustomSetConfig and fires the ConfigChanged event
        /// </summary>
        /// <param name="config"></param>
        public void SetConfig(DeviceConfig config)
        {
            Config = config;

            SetNameHelper(config);

            CustomSetConfig(config);

            var handler = ConfigChanged;

            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }
Пример #30
0
        private void SerialPorts_SerialPortAdded(object sender, SerialPortChangedEventArgs e)
        {
            if (!IsLoaded || isConnecting || DevicePort != null)
            {
                return;
            }
            isConnecting = true;

            Thread.Sleep(100); // Allow the device to finish starting up
            DevicePort = Helpers.ConnectToDevice(e.SerialPortID);
            Thread.Sleep(100);

            if (DevicePort != null)
            {
                DeviceConfig config = Helpers.ReadDeviceConfig(DevicePort);
                if (config != null)
                {
                    LabelID.Content                     = "Device MAC Address: " + config.MACAddress;
                    TextBoxNetworkName.Text             = config.NetworkName;
                    CheckBoxIsEnterprise.IsChecked      = config.IsEnterpriseNetwork;
                    TextBoxNetworkUsername.Text         = config.NetworkUsername;
                    PasswordBoxNetworkPassword.Password = config.NetworkPassword;
                    TextBoxLoggerAddress.Text           = config.LoggerAddress;
                    TextBoxLoggerPort.Text              = config.LoggerPort.ToString();
                    SliderNetworkTimeout.Value          = config.NetworkTimeout;
                    SliderLoggerTimeout.Value           = config.LoggerTimeout;

                    LoadDeviceTime(false);

                    ButtonSave.IsEnabled         = false;
                    GridConfigOverlay.Visibility = Visibility.Visible;
                    TextBoxNetworkName.Focus();
                }
                else
                {
                    if (DevicePort != null)
                    {
                        DevicePort.Close();
                        DevicePort   = null;
                        isConnecting = false;
                    }

                    MessageBox.Show("Unable to read device configuration.");
                }
            }

            isConnecting = false;
        }
Пример #31
0
   public static extern bool GetDeviceConfig(int GroupID, int DeviceNum, ref DeviceConfig DevCfg, 
 bool GetDriverCopy);
Пример #32
0
 /// <summary>
 /// fill device's properties
 /// </summary>
 /// <param name="dev"></param>
 private void FillProperties(DeviceConfig dev)
 {
     lbManufactory.Text = string.Format("Manufactory: {0} ", dev.Manufactory);
     lbType.Text = string.Format("Device Type: {0} ", dev.Type);
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < dev.AddressCollection.Length; i++)
     {
         sb.AppendFormat("{0} (0x{0:X2})  ", dev.AddressCollection[i]);
     }
     lbAddress.Text = string.Format("Address Collection: {0} ", sb.ToString());
     lbGeneralCall.Text = dev.GeneralCall ? "Support General Call" : "Do NOT support General Call";
     lbGeneralCall.ForeColor = dev.GeneralCall ? Color.Black : Color.Red;
 }
Пример #33
0
        /// <summary>
        /// Fill Commands tree with 
        /// </summary>
        private void FillCommandsTree(DeviceConfig dev)
        {

            tvCommands.Nodes.Clear();
            DeviceCommandsGroup cmds = dev.Commands;
            if (cmds.Commands != null)
            {
                foreach (DeviceCommandBase cmd in cmds.Commands)
                {
                    TreeNode node = FillCommandsTreeSubNode(cmd);
                    tvCommands.Nodes.Add(node);
                }
            }
            ctlI2CAddress1.Addr7 = dev.Address;
        }
Пример #34
0
 public static extern bool SetDeviceConfig(int GroupID, int DeviceNum, ref DeviceConfig DevCfg);
 public void Add(DeviceConfig conf)
 {
     BaseAdd(conf);
 }
 public void Remove(DeviceConfig conf)
 {
     BaseRemove(conf.Id);
 }