Advertisement
mikemate88

CNBWControl.cs

Jun 5th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 24.19 KB | None | 0 0
  1. // Decompiled with JetBrains decompiler
  2. // Type: Rinnai.NetworkerSystem.API.NBWControl.CNBWControl
  3. // Assembly: API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  4. // MVID: 9E1B7773-F300-4632-970B-75E74F11BA63
  5. // Assembly location: C:\Users\Mitch\Documents\rinnaitouchDecom\resources\assemblies\API.dll
  6.  
  7. using NetworkerSystem.NBWControlWIFIAccess;
  8. using Rinnai.NetworkerSystem.API.NBWControl.Settings;
  9. using Rinnai.NetworkerSystem.API.NBWControlWIFIAccess;
  10. using Rinnai.NetworkerSystem.API.Timing;
  11. using System;
  12.  
  13. namespace Rinnai.NetworkerSystem.API.NBWControl
  14. {
  15.   public class CNBWControl
  16.   {
  17.     private const string _CMD_CONFIG_RSP = "R";
  18.     private string _configCommand;
  19.     private CNBWControl.SettingsAccess _settingsAccess;
  20.     private const string _CMD_CONFIG_GET = "G";
  21.     private CTag _getCommandTag;
  22.     private const string _CMD_CONFIG_SET = "S";
  23.     private CTag _setCommandTag;
  24.  
  25.     public CNBWControl(string configCommand, Action<string> debugLog)
  26.     {
  27.       this.WIFI = new CWIFIInterface(debugLog);
  28.       this.WIFI.HostLocated += new EventHandler(this.WIFIInterface_HostLocated);
  29.       this.WIFI.HostLocateTimeout += new EventHandler(this.WIFIInterface_HostLocateTimeout);
  30.       this.WIFI.UDPBroadcastMessageReceived += new EventHandler<CBroadcastMessageReceivedEventArgs>(this.WIFIInterface_UDPBroadcastMessageReceived);
  31.       this.WIFI.HostConnectTimeout += new EventHandler(this.WIFIInterface_HostConnectTimeout);
  32.       this.WIFI.HostConnected += new EventHandler(this.WIFIInterface_HostConnected);
  33.       this.WIFI.HostDisconnected += new EventHandler(this.WIFIInterface_HostDisconnected);
  34.       this.WIFI.HostInactivityDetected += new EventHandler(this.WIFIInterface_HostInactivityDetected);
  35.       this.WIFI.UserInactivityDetected += new EventHandler(this.WIFIInterface_UserInactivityDetected1);
  36.       this.WIFI.TCPMessageReceived += new EventHandler<CMessageEventArgs>(this.WIFIInterface_MessageReceived);
  37.       this.HUB = new CHUBInterface(debugLog);
  38.       this.HUB.HostConnectTimeout += new EventHandler(this.HUBInterface_HostConnectTimeout);
  39.       this.HUB.HostConnected += new EventHandler(this.HUBInterface_HostConnected);
  40.       this.HUB.HostDisonnected += new EventHandler(this.HUBInterface_HostDisonnected);
  41.       this.HUB.HostInactivityDetected += new EventHandler(this.HUBInterface_HostInactivityDetected);
  42.       this.HUB.UserInactivityDetected += new EventHandler(this.HUBInterface_UserInactivityDetected);
  43.       this.HUB.MessageReceived += new EventHandler<CMessageEventArgs>(this.HUBInterface_MessageReceived);
  44.       this.HUB.MessageSentAcknowledged += new EventHandler<CMessageEventArgs>(this.HUBInterface_MessageSentAcknowledged);
  45.       this.Settings = new CSettings();
  46.       this._configCommand = configCommand;
  47.       this._settingsAccess.IsActive = false;
  48.       this._settingsAccess.CheckTimer = new CTimer100ms();
  49.       this._settingsAccess.CheckTimer.IntervalElapsed += new EventHandler(this.SettingsAccessCheckTimer_IntervalElapsed);
  50.       this._settingsAccess.CheckTimer.StartContinuousTimer();
  51.     }
  52.  
  53.     public CSettings Settings { get; }
  54.  
  55.     private void SettingsAccessCheckTimer_IntervalElapsed(object sender, EventArgs e)
  56.     {
  57.       if (!this._settingsAccess.IsActive)
  58.         return;
  59.       this._settingsAccess.TimeInterval += 100;
  60.       if (this._settingsAccess.TimeInterval >= 2500)
  61.       {
  62.         if (this._getCommandTag != null)
  63.           this.GetCommandResponse_Process("", true);
  64.         else
  65.           this.SetCommandResponse_Process("", true);
  66.       }
  67.     }
  68.  
  69.     public void SettingsAccessUpdateAfterResponseTextReceived(string responseText)
  70.     {
  71.       string str = responseText.Substring(0, 1);
  72.       if (str == "R")
  73.         return;
  74.       if (!(str == "G"))
  75.       {
  76.         if (!(str == "S"))
  77.           return;
  78.         this.SetCommandResponse_Process(responseText.Substring(1), false);
  79.       }
  80.       else
  81.         this.GetCommandResponse_Process(responseText.Substring(1), false);
  82.     }
  83.  
  84.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_WIFI_UserDefinedSSID;
  85.  
  86.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_WIFI_TCPNoMessageReceivedTimeout;
  87.  
  88.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_HUB_IOTHUBServicePrimaryKey;
  89.  
  90.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_HUB_IOTHUBServiceSecondaryKey;
  91.  
  92.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_HUB_DevicePrimaryKey;
  93.  
  94.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_HUB_EventHubEndpoint;
  95.  
  96.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_HUB_UserInactivityTimeout;
  97.  
  98.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_MQTT_Broker_ServerAddress;
  99.  
  100.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> GetSettingCommandResponse_MQTT_Config_ClientID;
  101.  
  102.     public void ConfigurationCommandIssue_GetUserDefinedSSID(string defaultAccessPassword)
  103.     {
  104.       this.GetCommandIssue(defaultAccessPassword, this.Settings.WIFI.SSID);
  105.     }
  106.  
  107.     public void ConfigurationCommandIssue_GetTCPNoMessageReceivedTimeout(
  108.       string defaultAccessPassword)
  109.     {
  110.       this.GetCommandIssue(defaultAccessPassword, this.Settings.WIFI.TCPNoMessageReceiveTimeout);
  111.     }
  112.  
  113.     public void ConfigurationCommandIssue_GetIOTHUBServicePrimaryKey(string defaultAccessPassword)
  114.     {
  115.       this.GetCommandIssue(defaultAccessPassword, this.Settings.HUB.IOTHUBServicePrimaryKey);
  116.     }
  117.  
  118.     public void ConfigurationCommandIssue_GetIOTHUBServiceSecondaryKey(string defaultAccessPassword)
  119.     {
  120.       this.GetCommandIssue(defaultAccessPassword, this.Settings.HUB.IOTHUBServiceSecondaryKey);
  121.     }
  122.  
  123.     public void ConfigurationCommandIssue_GetDevicePrimaryKey(string defaultAccessPassword)
  124.     {
  125.       this.GetCommandIssue(defaultAccessPassword, this.Settings.HUB.DevicePrimaryKey);
  126.     }
  127.  
  128.     public void ConfigurationCommandIssue_GetEventHubEndpoint(string defaultAccessPassword)
  129.     {
  130.       this.GetCommandIssue(defaultAccessPassword, this.Settings.HUB.EventHubEndpoint);
  131.     }
  132.  
  133.     public void ConfigurationCommandIssue_GetUserInactivityTimeout(string defaultAccessPassword)
  134.     {
  135.       this.GetCommandIssue(defaultAccessPassword, this.Settings.HUB.UserInactivityTimeout);
  136.     }
  137.  
  138.     public void ConfigurationCommandIssue_GetMQTTBrokerServerAddress(string defaultAccessPassword)
  139.     {
  140.       this.GetCommandIssue(defaultAccessPassword, this.Settings.MQTT.Broker.ServerAddress);
  141.     }
  142.  
  143.     public void ConfigurationCommandIssue_GetMQTTConfigClientID(string defaultAccessPassword)
  144.     {
  145.       this.GetCommandIssue(defaultAccessPassword, this.Settings.MQTT.Config.ClientID);
  146.     }
  147.  
  148.     private void GetCommandIssue(string defaultAccessPassword, CTag tag)
  149.     {
  150.       this._getCommandTag = tag;
  151.       this._setCommandTag = (CTag) null;
  152.       this.WIFI.SendTextMessage(this._configCommand + "G" + this.Settings.Other.DeviceDefaultPassword.Descriptor + defaultAccessPassword + tag.Descriptor + "\r");
  153.       this._settingsAccess.TimeInterval = 0;
  154.       this._settingsAccess.IsActive = true;
  155.     }
  156.  
  157.     private void GetCommandResponse_Process(string responseText, bool responseNotReceivedInTime)
  158.     {
  159.       this._settingsAccess.IsActive = false;
  160.       if (responseNotReceivedInTime)
  161.         this._getCommandTag.ValueGetState = CTag.VALUE_GET_STATE.NOT_GOT_NO_RESPONSE;
  162.       else
  163.         this._getCommandTag.UpdateAfterGetResponseReceived(responseText);
  164.       CNBWControl.CGetSetSettingCommandResponseEventArgs e = new CNBWControl.CGetSetSettingCommandResponseEventArgs(this._getCommandTag);
  165.       if (this._getCommandTag.Descriptor == this.Settings.WIFI.SSID.Descriptor)
  166.       {
  167.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> wifiUserDefinedSsid = this.GetSettingCommandResponse_WIFI_UserDefinedSSID;
  168.         if (wifiUserDefinedSsid == null)
  169.           return;
  170.         wifiUserDefinedSsid((object) this, e);
  171.       }
  172.       else if (this._getCommandTag.Descriptor == this.Settings.WIFI.TCPNoMessageReceiveTimeout.Descriptor)
  173.       {
  174.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> messageReceivedTimeout = this.GetSettingCommandResponse_WIFI_TCPNoMessageReceivedTimeout;
  175.         if (messageReceivedTimeout == null)
  176.           return;
  177.         messageReceivedTimeout((object) this, e);
  178.       }
  179.       else if (this._getCommandTag.Descriptor == this.Settings.HUB.IOTHUBServicePrimaryKey.Descriptor)
  180.       {
  181.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> servicePrimaryKey = this.GetSettingCommandResponse_HUB_IOTHUBServicePrimaryKey;
  182.         if (servicePrimaryKey == null)
  183.           return;
  184.         servicePrimaryKey((object) this, e);
  185.       }
  186.       else if (this._getCommandTag.Descriptor == this.Settings.HUB.IOTHUBServiceSecondaryKey.Descriptor)
  187.       {
  188.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> serviceSecondaryKey = this.GetSettingCommandResponse_HUB_IOTHUBServiceSecondaryKey;
  189.         if (serviceSecondaryKey == null)
  190.           return;
  191.         serviceSecondaryKey((object) this, e);
  192.       }
  193.       else if (this._getCommandTag.Descriptor == this.Settings.HUB.DevicePrimaryKey.Descriptor)
  194.       {
  195.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> devicePrimaryKey = this.GetSettingCommandResponse_HUB_DevicePrimaryKey;
  196.         if (devicePrimaryKey == null)
  197.           return;
  198.         devicePrimaryKey((object) this, e);
  199.       }
  200.       else if (this._getCommandTag.Descriptor == this.Settings.HUB.EventHubEndpoint.Descriptor)
  201.       {
  202.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> eventHubEndpoint = this.GetSettingCommandResponse_HUB_EventHubEndpoint;
  203.         if (eventHubEndpoint == null)
  204.           return;
  205.         eventHubEndpoint((object) this, e);
  206.       }
  207.       else if (this._getCommandTag.Descriptor == this.Settings.HUB.UserInactivityTimeout.Descriptor)
  208.       {
  209.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> inactivityTimeout = this.GetSettingCommandResponse_HUB_UserInactivityTimeout;
  210.         if (inactivityTimeout == null)
  211.           return;
  212.         inactivityTimeout((object) this, e);
  213.       }
  214.       else if (this._getCommandTag.Descriptor == this.Settings.MQTT.Broker.ServerAddress.Descriptor)
  215.       {
  216.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> brokerServerAddress = this.GetSettingCommandResponse_MQTT_Broker_ServerAddress;
  217.         if (brokerServerAddress == null)
  218.           return;
  219.         brokerServerAddress((object) this, e);
  220.       }
  221.       else
  222.       {
  223.         if (!(this._getCommandTag.Descriptor == this.Settings.MQTT.Config.ClientID.Descriptor))
  224.           return;
  225.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> mqttConfigClientId = this.GetSettingCommandResponse_MQTT_Config_ClientID;
  226.         if (mqttConfigClientId != null)
  227.           mqttConfigClientId((object) this, e);
  228.       }
  229.     }
  230.  
  231.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> SetSettingCommandResponse_WIFI_UserDefinedSSID;
  232.  
  233.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> SetSettingCommandResponse_WIFI_UserDefinedSSIDPassword;
  234.  
  235.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> SetSettingCommandResponse_WIFI_JoinType;
  236.  
  237.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> SetSettingCommandResponse_MQTTGeneral_EnableConnection;
  238.  
  239.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> SetSettingCommandResponse_Save;
  240.  
  241.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> SetSettingCommandResponse_Boot;
  242.  
  243.     public event EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> SetSettingCommandResponse_Hash;
  244.  
  245.     public void ConfigurationCommandIssue_SetUserDefinedSSID(
  246.       string defaultAccessPassword,
  247.       string userDefinedSSID)
  248.     {
  249.       this.SetCommandIssue(defaultAccessPassword, userDefinedSSID, this.Settings.WIFI.SSID);
  250.     }
  251.  
  252.     public void ConfigurationCommandIssue_SetUserDefinedSSIDPassword(
  253.       string defaultAccessPassword,
  254.       string userDefinedSSIDPassword)
  255.     {
  256.       this.SetCommandIssue(defaultAccessPassword, userDefinedSSIDPassword, this.Settings.WIFI.NewPassword);
  257.     }
  258.  
  259.     public void ConfigurationCommandIssue_SetNetworkJoinType(
  260.       string defaultAccessPassword,
  261.       bool operateAsAccessPoint)
  262.     {
  263.       string userDefinedSSID = !operateAsAccessPoint ? "1" : "7";
  264.       this.SetCommandIssue(defaultAccessPassword, userDefinedSSID, this.Settings.WIFI.JoinType);
  265.     }
  266.  
  267.     public void ConfigurationCommandIssue_SetMQTTGeneralEnableConnection(
  268.       string defaultAccessPassword,
  269.       bool enableConnection)
  270.     {
  271.       string userDefinedSSID = !enableConnection ? "N" : "Y";
  272.       this.SetCommandIssue(defaultAccessPassword, userDefinedSSID, this.Settings.MQTT.General.EnableConnection);
  273.     }
  274.  
  275.     public void ConfigurationCommandIssue_SaveSettingsAndReboot(string defaultAccessPassword)
  276.     {
  277.       this.SetCommandIssue(defaultAccessPassword, "", this.Settings.Save);
  278.     }
  279.  
  280.     public void ConfigurationCommandIssue_RebootWithNoSaveOfSettings(string defaultAccessPassword)
  281.     {
  282.       this.SetCommandIssue(defaultAccessPassword, "", this.Settings.Boot);
  283.     }
  284.  
  285.     public void ConfigurationCommandIssue_GenerateNewHASH(string defaultAccessPassword)
  286.     {
  287.       this.SetCommandIssue(defaultAccessPassword, "", this.Settings.Hash);
  288.     }
  289.  
  290.     private void SetCommandIssue(string defaultAccessPassword, string userDefinedSSID, CTag tag)
  291.     {
  292.       this._setCommandTag = tag;
  293.       this._getCommandTag = (CTag) null;
  294.       this.WIFI.SendTextMessage(this._configCommand + "S" + this.Settings.Other.DeviceDefaultPassword.Descriptor + defaultAccessPassword + tag.Descriptor + userDefinedSSID + "\r");
  295.       this._settingsAccess.TimeInterval = 0;
  296.       this._settingsAccess.IsActive = true;
  297.     }
  298.  
  299.     private void SetCommandResponse_Process(string responseText, bool responseNotReceivedInTime)
  300.     {
  301.       this._settingsAccess.IsActive = false;
  302.       if (responseNotReceivedInTime)
  303.         this._setCommandTag.ValueSetState = CTag.VALUE_SET_STATE.NOT_SET_NO_RESPONSE;
  304.       else
  305.         this._setCommandTag.UpdateAfterSetResponseReceived(responseText);
  306.       CNBWControl.CGetSetSettingCommandResponseEventArgs e = new CNBWControl.CGetSetSettingCommandResponseEventArgs(this._setCommandTag);
  307.       if (this._setCommandTag.Descriptor == this.Settings.WIFI.SSID.Descriptor)
  308.       {
  309.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> wifiUserDefinedSsid = this.SetSettingCommandResponse_WIFI_UserDefinedSSID;
  310.         if (wifiUserDefinedSsid == null)
  311.           return;
  312.         wifiUserDefinedSsid((object) this, e);
  313.       }
  314.       else if (this._setCommandTag.Descriptor == this.Settings.WIFI.NewPassword.Descriptor)
  315.       {
  316.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> definedSsidPassword = this.SetSettingCommandResponse_WIFI_UserDefinedSSIDPassword;
  317.         if (definedSsidPassword == null)
  318.           return;
  319.         definedSsidPassword((object) this, e);
  320.       }
  321.       else if (this._setCommandTag.Descriptor == this.Settings.WIFI.JoinType.Descriptor)
  322.       {
  323.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> responseWifiJoinType = this.SetSettingCommandResponse_WIFI_JoinType;
  324.         if (responseWifiJoinType == null)
  325.           return;
  326.         responseWifiJoinType((object) this, e);
  327.       }
  328.       else if (this._setCommandTag.Descriptor == this.Settings.MQTT.General.EnableConnection.Descriptor)
  329.       {
  330.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> enableConnection = this.SetSettingCommandResponse_MQTTGeneral_EnableConnection;
  331.         if (enableConnection == null)
  332.           return;
  333.         enableConnection((object) this, e);
  334.       }
  335.       else if (this._setCommandTag.Descriptor == this.Settings.Save.Descriptor)
  336.       {
  337.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> commandResponseSave = this.SetSettingCommandResponse_Save;
  338.         if (commandResponseSave == null)
  339.           return;
  340.         commandResponseSave((object) this, e);
  341.       }
  342.       else if (this._setCommandTag.Descriptor == this.Settings.Boot.Descriptor)
  343.       {
  344.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> commandResponseBoot = this.SetSettingCommandResponse_Boot;
  345.         if (commandResponseBoot == null)
  346.           return;
  347.         commandResponseBoot((object) this, e);
  348.       }
  349.       else
  350.       {
  351.         if (!(this._setCommandTag.Descriptor == this.Settings.Hash.Descriptor))
  352.           return;
  353.         EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs> commandResponseHash = this.SetSettingCommandResponse_Hash;
  354.         if (commandResponseHash != null)
  355.           commandResponseHash((object) this, e);
  356.       }
  357.     }
  358.  
  359.     public event EventHandler<CMessageEventArgs> WIFI_MessageReceived;
  360.  
  361.     public event EventHandler WIFI_HostInactivityDetected;
  362.  
  363.     public event EventHandler WIFI_UserInactivityDetected;
  364.  
  365.     public event EventHandler<CBroadcastMessageReceivedEventArgs> WIFI_UDPBroadcastMessageReceived;
  366.  
  367.     public CWIFIInterface WIFI { get; }
  368.  
  369.     public bool ModuleInConfigMode
  370.     {
  371.       get
  372.       {
  373.         return this.WIFI.ModuleInConfigMode;
  374.       }
  375.     }
  376.  
  377.     public byte ModuleVersion
  378.     {
  379.       get
  380.       {
  381.         return this.WIFI.ModuleVersion;
  382.       }
  383.     }
  384.  
  385.     public byte CC3200Version
  386.     {
  387.       get
  388.       {
  389.         return this.WIFI.CC3200Version;
  390.       }
  391.     }
  392.  
  393.     public CWIFIAccess.WLANAccessMode WiFiAccessMode
  394.     {
  395.       get
  396.       {
  397.         return this.WIFI.Mode;
  398.       }
  399.     }
  400.  
  401.     public byte[] HUBAccessHash
  402.     {
  403.       get
  404.       {
  405.         return this.WIFI.HUBAccessHash;
  406.       }
  407.     }
  408.  
  409.     public string DeviceDefaultPassword
  410.     {
  411.       get
  412.       {
  413.         return this.WIFI.DeviceDefaultPassword;
  414.       }
  415.     }
  416.  
  417.     public byte NumberOfScannedSSIDs
  418.     {
  419.       get
  420.       {
  421.         return this.WIFI.NumberOfScannedSSIDs;
  422.       }
  423.     }
  424.  
  425.     public CScannedSSID[] ScannedSSID
  426.     {
  427.       get
  428.       {
  429.         return this.WIFI.ScannedSSID;
  430.       }
  431.     }
  432.  
  433.     private void WIFIInterface_UserInactivityDetected1(object sender, EventArgs e)
  434.     {
  435.       EventHandler inactivityDetected = this.WIFI_UserInactivityDetected;
  436.       if (inactivityDetected == null)
  437.         return;
  438.       inactivityDetected((object) this, EventArgs.Empty);
  439.     }
  440.  
  441.     private void WIFIInterface_HostInactivityDetected(object sender, EventArgs e)
  442.     {
  443.       EventHandler inactivityDetected = this.WIFI_HostInactivityDetected;
  444.       if (inactivityDetected == null)
  445.         return;
  446.       inactivityDetected((object) this, EventArgs.Empty);
  447.     }
  448.  
  449.     private void WIFIInterface_MessageReceived(object sender, CMessageEventArgs e)
  450.     {
  451.       EventHandler<CMessageEventArgs> wifiMessageReceived = this.WIFI_MessageReceived;
  452.       if (wifiMessageReceived == null)
  453.         return;
  454.       wifiMessageReceived((object) this, e);
  455.     }
  456.  
  457.     private void WIFIInterface_UDPBroadcastMessageReceived(
  458.       object sender,
  459.       CBroadcastMessageReceivedEventArgs e)
  460.     {
  461.       EventHandler<CBroadcastMessageReceivedEventArgs> broadcastMessageReceived = this.WIFI_UDPBroadcastMessageReceived;
  462.       if (broadcastMessageReceived == null)
  463.         return;
  464.       broadcastMessageReceived((object) this, e);
  465.     }
  466.  
  467.     public event EventHandler WIFI_HostConnected;
  468.  
  469.     public event EventHandler WIFI_HostConnectTimeout;
  470.  
  471.     public event EventHandler WIFI_HostDisconnected;
  472.  
  473.     private void WIFIInterface_HostConnected(object sender, EventArgs e)
  474.     {
  475.       EventHandler wifiHostConnected = this.WIFI_HostConnected;
  476.       if (wifiHostConnected == null)
  477.         return;
  478.       wifiHostConnected((object) this, EventArgs.Empty);
  479.     }
  480.  
  481.     private void WIFIInterface_HostConnectTimeout(object sender, EventArgs e)
  482.     {
  483.       EventHandler hostConnectTimeout = this.WIFI_HostConnectTimeout;
  484.       if (hostConnectTimeout == null)
  485.         return;
  486.       hostConnectTimeout((object) this, EventArgs.Empty);
  487.     }
  488.  
  489.     private void WIFIInterface_HostDisconnected(object sender, EventArgs e)
  490.     {
  491.       EventHandler hostDisconnected = this.WIFI_HostDisconnected;
  492.       if (hostDisconnected == null)
  493.         return;
  494.       hostDisconnected((object) this, EventArgs.Empty);
  495.     }
  496.  
  497.     public event EventHandler WIFI_HostLocated;
  498.  
  499.     public event EventHandler WIFI_HostLocateTimeout;
  500.  
  501.     private void WIFIInterface_HostLocated(object sender, EventArgs e)
  502.     {
  503.       EventHandler wifiHostLocated = this.WIFI_HostLocated;
  504.       if (wifiHostLocated == null)
  505.         return;
  506.       wifiHostLocated((object) this, EventArgs.Empty);
  507.     }
  508.  
  509.     private void WIFIInterface_HostLocateTimeout(object sender, EventArgs e)
  510.     {
  511.       EventHandler hostLocateTimeout = this.WIFI_HostLocateTimeout;
  512.       if (hostLocateTimeout == null)
  513.         return;
  514.       hostLocateTimeout((object) this, EventArgs.Empty);
  515.     }
  516.  
  517.     public event EventHandler<CMessageEventArgs> HUB_MessageSentAcknowledged;
  518.  
  519.     public event EventHandler<CMessageEventArgs> HUB_MessageReceived;
  520.  
  521.     public event EventHandler HUB_HostInactivityDetected;
  522.  
  523.     public event EventHandler HUB_UserInactivityDetected;
  524.  
  525.     public event EventHandler HUB_HostDisconnected;
  526.  
  527.     public event EventHandler HUB_HostConnected;
  528.  
  529.     public event EventHandler HUB_HostConnectTimeout;
  530.  
  531.     public CHUBInterface HUB { get; }
  532.  
  533.     public byte[] GenerateHUBAccessHashAsArray(string ssid, string ssidPassword)
  534.     {
  535.       return this.HUB.GenerateHUBAccessHashAsArray(ssid, ssidPassword);
  536.     }
  537.  
  538.     private void HUBInterface_MessageSentAcknowledged(object sender, CMessageEventArgs e)
  539.     {
  540.       EventHandler<CMessageEventArgs> sentAcknowledged = this.HUB_MessageSentAcknowledged;
  541.       if (sentAcknowledged == null)
  542.         return;
  543.       sentAcknowledged((object) this, e);
  544.     }
  545.  
  546.     private void HUBInterface_MessageReceived(object sender, CMessageEventArgs e)
  547.     {
  548.       EventHandler<CMessageEventArgs> hubMessageReceived = this.HUB_MessageReceived;
  549.       if (hubMessageReceived == null)
  550.         return;
  551.       hubMessageReceived((object) this, e);
  552.     }
  553.  
  554.     private void HUBInterface_HostInactivityDetected(object sender, EventArgs e)
  555.     {
  556.       EventHandler inactivityDetected = this.HUB_HostInactivityDetected;
  557.       if (inactivityDetected == null)
  558.         return;
  559.       inactivityDetected((object) this, e);
  560.     }
  561.  
  562.     private void HUBInterface_UserInactivityDetected(object sender, EventArgs e)
  563.     {
  564.       EventHandler inactivityDetected = this.HUB_UserInactivityDetected;
  565.       if (inactivityDetected == null)
  566.         return;
  567.       inactivityDetected((object) this, e);
  568.     }
  569.  
  570.     private void HUBInterface_HostDisonnected(object sender, EventArgs e)
  571.     {
  572.       EventHandler hostDisconnected = this.HUB_HostDisconnected;
  573.       if (hostDisconnected == null)
  574.         return;
  575.       hostDisconnected((object) this, e);
  576.     }
  577.  
  578.     private void HUBInterface_HostConnected(object sender, EventArgs e)
  579.     {
  580.       EventHandler hubHostConnected = this.HUB_HostConnected;
  581.       if (hubHostConnected == null)
  582.         return;
  583.       hubHostConnected((object) this, e);
  584.     }
  585.  
  586.     private void HUBInterface_HostConnectTimeout(object sender, EventArgs e)
  587.     {
  588.       EventHandler hostConnectTimeout = this.HUB_HostConnectTimeout;
  589.       if (hostConnectTimeout == null)
  590.         return;
  591.       hostConnectTimeout((object) this, e);
  592.     }
  593.  
  594.     private struct SettingsAccess
  595.     {
  596.       public bool IsActive;
  597.       public CTimer100ms CheckTimer;
  598.       public int TimeInterval;
  599.     }
  600.  
  601.     public class CGetSetSettingCommandResponseEventArgs : EventArgs
  602.     {
  603.       public CGetSetSettingCommandResponseEventArgs(CTag tag)
  604.       {
  605.         this.TagResponse = (CTag) null;
  606.         this.TagResponse = tag;
  607.       }
  608.  
  609.       public CTag TagResponse { get; }
  610.     }
  611.   }
  612. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement