/// <summary> /// Control Subnet change event handler /// </summary> /// <param name="ethernet"></param> /// <param name="index"></param> /// <param name="type"></param> protected void OnControlSubnetInfoChange(ControlSubnetInfo ethernet, ushort index, ushort type) { var handler = ControlSubnetChange; if (handler != null) { var args = new ControlSubnetChangeEventArgs(ethernet, type); args.Index = index; ControlSubnetChange(this, args); } }
/// <summary> /// Gets the current control subnet info /// </summary> public void GetControlSubnetInfo() { OnBoolChange(true, 0, SystemInfoConstants.BusyBoolChange); var adapter = new ControlSubnetInfo(); try { // get cs adapter id var adapterId = CrestronEthernetHelper.GetAdapterdIdForSpecifiedAdapterType(EthernetAdapterType.EthernetCSAdapter); if (!adapterId.Equals(EthernetAdapterType.EthernetUnknownAdapter)) { adapter.Enabled = 1; adapter.IsInAutomaticMode = (ushort)(CrestronEthernetHelper.IsControlSubnetInAutomaticMode ? 1 : 0); adapter.MacAddress = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_MAC_ADDRESS, adapterId); adapter.IpAddress = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, adapterId); adapter.Subnet = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, adapterId); adapter.RouterPrefix = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CONTROL_SUBNET_ROUTER_PREFIX, adapterId); } } catch (Exception e) { adapter.Enabled = 0; adapter.IsInAutomaticMode = 0; adapter.MacAddress = "NA"; adapter.IpAddress = "NA"; adapter.Subnet = "NA"; adapter.RouterPrefix = "NA"; var msg = string.Format("GetControlSubnetInfo failed: {0}", e.Message); CrestronConsole.PrintLine(msg); //ErrorLog.Error(msg); } OnControlSubnetInfoChange(adapter, 0, SystemInfoConstants.ControlSubnetConfigChange); OnBoolChange(false, 0, SystemInfoConstants.BusyBoolChange); }
/// <summary> /// Constructor overload /// </summary> public ControlSubnetChangeEventArgs(ControlSubnetInfo controlSubnet, ushort type, ushort index) { Adapter = controlSubnet; Type = type; Index = index; }
/// <summary> /// Constructor overload /// </summary> public ControlSubnetChangeEventArgs(ControlSubnetInfo controlSubnet, ushort type) { Adapter = controlSubnet; Type = type; }