mikemate88

CNetworker.cs

Jun 5th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 47.32 KB | None | 0 0
  1. // Decompiled with JetBrains decompiler
  2. // Type: Rinnai.NetworkerSystem.API.CNetworker
  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;
  9. using Rinnai.NetworkerSystem.API.NBWControl.Settings;
  10. using Rinnai.NetworkerSystem.API.NBWControlWIFIAccess;
  11. using Rinnai.NetworkerSystem.API.NetworkerSystemAccess.Functional.Cooling;
  12. using Rinnai.NetworkerSystem.API.NetworkerSystemAccess.Functional.Evpcool;
  13. using Rinnai.NetworkerSystem.API.NetworkerSystemAccess.Functional.Heating;
  14. using Rinnai.NetworkerSystem.API.NetworkerSystemAccess.Functional.System;
  15. using Rinnai.NetworkerSystem.API.NetworkerSystemAccess.Interface;
  16. using Rinnai.NetworkerSystem.API.NetworkerSystemAccess.TransferControl;
  17. using Rinnai.NetworkerSystem.API.Timing;
  18. using System;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21.  
  22. namespace Rinnai.NetworkerSystem.API
  23. {
  24.   public class CNetworker
  25.   {
  26.     private bool _waitingForFirstCommand = true;
  27.     private CNBWControl _nbwControl;
  28.     private CCommandInterface _commandInterface;
  29.     private CSystem _system;
  30.     private CMode _mode;
  31.     private CContainer _rxContainer;
  32.     private CTransferControl _transferControl;
  33.     private CTimer _commandIssueTxResponseTimeoutTimer;
  34.     private int _sequenceControlTxValue;
  35.     private int _sequenceControlRxValue;
  36.     private CNetworker.CONNECT_TYPE _connectType;
  37.     private int _commandResponseTimeoutSeconds;
  38.     private const string _CMD_CONFIG = "C";
  39.     private const string _CMD_NETWORKER = "N";
  40.  
  41.     public CNetworker()
  42.     {
  43.       this._nbwControl = new CNBWControl("C", (Action<string>) (message =>
  44.       {
  45.         EventHandler<string> networkerDebugMessage = this.Networker_DebugMessage;
  46.         if (networkerDebugMessage == null)
  47.           return;
  48.         networkerDebugMessage((object) this, message);
  49.       }));
  50.       this._nbwControl.WIFI_MessageReceived += new EventHandler<CMessageEventArgs>(this.NBWControl_WIFI_MessageReceived);
  51.       this._nbwControl.WIFI_HostConnected += new EventHandler(this.NBWControl_WIFI_HostConnected);
  52.       this._nbwControl.WIFI_HostInactivityDetected += new EventHandler(this.NBWControl_WIFI_HostInactivityDetected);
  53.       this._nbwControl.WIFI_UserInactivityDetected += new EventHandler(this.NBWControl_WIFI_UserInactivityDetected);
  54.       this._nbwControl.WIFI_HostConnectTimeout += new EventHandler(this.NBWControl_WIFI_HostConnectTimeout);
  55.       this._nbwControl.WIFI_HostDisconnected += new EventHandler(this.NBWControl_WIFI_HostDisconnected);
  56.       this._nbwControl.WIFI_HostLocated += new EventHandler(this.NBWControl_WIFI_HostLocated);
  57.       this._nbwControl.WIFI_HostLocateTimeout += new EventHandler(this.NBWControl_WIFI_HostLocateTimeout);
  58.       this._nbwControl.HUB.MessageSentAcknowledged += new EventHandler<CMessageEventArgs>(this.NBWControl_HUB_MessageSentAcknowledged);
  59.       this._nbwControl.HUB.MessageReceived += new EventHandler<CMessageEventArgs>(this.NBWControl_HUB_MessageReceived);
  60.       this._nbwControl.HUB.HostConnected += new EventHandler(this.NBWControl_HUB_HostConnected);
  61.       this._nbwControl.HUB.HostInactivityDetected += new EventHandler(this.NBWControl_HUB_HostInactivityDetected);
  62.       this._nbwControl.HUB.UserInactivityDetected += new EventHandler(this.NBWControl_HUB_UserInactivityDetected);
  63.       this._nbwControl.HUB.HostConnectTimeout += new EventHandler(this.NBWControl_HUB_HostConnectTimeout);
  64.       this._nbwControl.HUB.HostDisonnected += new EventHandler(this.NBWControl_HUB_HostDisonnected);
  65.       this._nbwControl.GetSettingCommandResponse_WIFI_UserDefinedSSID += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_WIFI_UserDefinedSSID);
  66.       this._nbwControl.GetSettingCommandResponse_WIFI_TCPNoMessageReceivedTimeout += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_WIFI_TCPNoMessageReceivedTimeout);
  67.       this._nbwControl.GetSettingCommandResponse_HUB_DevicePrimaryKey += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_HUB_DevicePrimaryKey);
  68.       this._nbwControl.GetSettingCommandResponse_HUB_EventHubEndpoint += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_HUB_EventHubEndpoint);
  69.       this._nbwControl.GetSettingCommandResponse_HUB_UserInactivityTimeout += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_HUB_UserInactivityTimeout);
  70.       this._nbwControl.GetSettingCommandResponse_HUB_IOTHUBServicePrimaryKey += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_HUB_IOTHUBServicePrimaryKey);
  71.       this._nbwControl.GetSettingCommandResponse_HUB_IOTHUBServiceSecondaryKey += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_HUB_IOTHUBServiceSecondaryKey);
  72.       this._nbwControl.GetSettingCommandResponse_MQTT_Broker_ServerAddress += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_MQTT_Broker_ServerAddress);
  73.       this._nbwControl.GetSettingCommandResponse_MQTT_Config_ClientID += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_GetSettingCommandResponse_MQTT_Config_ClientID);
  74.       this._nbwControl.SetSettingCommandResponse_WIFI_UserDefinedSSID += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_SetSettingCommandResponse_WIFI_UserDefinedSSID);
  75.       this._nbwControl.SetSettingCommandResponse_WIFI_UserDefinedSSIDPassword += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_SetSettingCommandResponse_WIFI_UserDefinedSSIDPassword);
  76.       this._nbwControl.SetSettingCommandResponse_WIFI_JoinType += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_SetSettingCommandResponse_WIFI_JoinType);
  77.       this._nbwControl.SetSettingCommandResponse_MQTTGeneral_EnableConnection += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_SetSettingCommandResponse_MQTTGeneral_EnableConnection);
  78.       this._nbwControl.SetSettingCommandResponse_Save += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_SetSettingCommandResponse_Save);
  79.       this._nbwControl.SetSettingCommandResponse_Boot += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_SetSettingCommandResponse_Boot);
  80.       this._nbwControl.SetSettingCommandResponse_Hash += new EventHandler<CNBWControl.CGetSetSettingCommandResponseEventArgs>(this.NBWControl_SetSettingCommandResponse_Hash);
  81.       this.CommandInterpreter_Init();
  82.       this.SystemFunctional_Init();
  83.       this.Connection_Init();
  84.     }
  85.  
  86.     public bool NBWControlModuleInConfigMode
  87.     {
  88.       get
  89.       {
  90.         return this._nbwControl.ModuleInConfigMode;
  91.       }
  92.     }
  93.  
  94.     public byte NBWControlModuleVersion
  95.     {
  96.       get
  97.       {
  98.         return this._nbwControl.ModuleVersion;
  99.       }
  100.     }
  101.  
  102.     public byte NBWControlCC3200Version
  103.     {
  104.       get
  105.       {
  106.         return this._nbwControl.CC3200Version;
  107.       }
  108.     }
  109.  
  110.     public CWIFIAccess.WLANAccessMode NBWControlWiFiAccessMode
  111.     {
  112.       get
  113.       {
  114.         return this._nbwControl.WiFiAccessMode;
  115.       }
  116.     }
  117.  
  118.     public byte[] NBWControlHUBAccessHash
  119.     {
  120.       get
  121.       {
  122.         return this._nbwControl.HUBAccessHash;
  123.       }
  124.     }
  125.  
  126.     public string DeviceDefaultPassword
  127.     {
  128.       get
  129.       {
  130.         return this._nbwControl.DeviceDefaultPassword;
  131.       }
  132.     }
  133.  
  134.     public byte NBWControlNumberOfScannedSSIDs
  135.     {
  136.       get
  137.       {
  138.         return this._nbwControl.NumberOfScannedSSIDs;
  139.       }
  140.     }
  141.  
  142.     public CScannedSSID[] NBWControlScannedSSID
  143.     {
  144.       get
  145.       {
  146.         return this._nbwControl.ScannedSSID;
  147.       }
  148.     }
  149.  
  150.     public byte[] GenerateHUBAccessHashAsArray(string ssid, string ssidPassword)
  151.     {
  152.       return this._nbwControl.GenerateHUBAccessHashAsArray(ssid, ssidPassword);
  153.     }
  154.  
  155.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetUserDefinedSSID;
  156.  
  157.     public event EventHandler NBWControl_ConfigCommandResponseError_GetUserDefinedSSID;
  158.  
  159.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetTCPNoMessageReceivedTimeout;
  160.  
  161.     public event EventHandler NBWControl_ConfigCommandResponseError_GetTCPNoMessageReceivedTimeout;
  162.  
  163.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetIOTHUBServicePrimaryKey;
  164.  
  165.     public event EventHandler NBWControl_ConfigCommandResponseError_GetIOTHUBServicePrimaryKey;
  166.  
  167.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetIOTHUBServiceSecondaryKey;
  168.  
  169.     public event EventHandler NBWControl_ConfigCommandResponseError_GetIOTHUBServiceSecondaryKey;
  170.  
  171.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetDevicePrimaryKey;
  172.  
  173.     public event EventHandler NBWControl_ConfigCommandResponseError_GetDevicePrimaryKey;
  174.  
  175.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetEventHubEndpoint;
  176.  
  177.     public event EventHandler NBWControl_ConfigCommandResponseError_GetEventHubEndpoint;
  178.  
  179.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetUserInactivityTimeout;
  180.  
  181.     public event EventHandler NBWControl_ConfigCommandResponseError_GetUserInactivityTimeout;
  182.  
  183.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetMQTTBrokerServerAddress;
  184.  
  185.     public event EventHandler NBWControl_ConfigCommandResponseError_GetMQTTBrokerServerAddress;
  186.  
  187.     public event EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> NBWControl_ConfigCommandResponseValid_GetMQTTConfigClientID;
  188.  
  189.     public event EventHandler NBWControl_ConfigCommandResponseError_GetMQTTConfigClientID;
  190.  
  191.     public void NBWControl_ConfigurationCommandIssue_GetUserDefinedSSID(string defaultAccessPassword)
  192.     {
  193.       this._nbwControl.ConfigurationCommandIssue_GetUserDefinedSSID(defaultAccessPassword);
  194.     }
  195.  
  196.     private void NBWControl_GetSettingCommandResponse_WIFI_UserDefinedSSID(
  197.       object sender,
  198.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  199.     {
  200.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  201.       {
  202.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  203.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> getUserDefinedSsid = this.NBWControl_ConfigCommandResponseValid_GetUserDefinedSSID;
  204.         if (getUserDefinedSsid == null)
  205.           return;
  206.         getUserDefinedSsid((object) this, e1);
  207.       }
  208.       else
  209.       {
  210.         EventHandler getUserDefinedSsid = this.NBWControl_ConfigCommandResponseError_GetUserDefinedSSID;
  211.         if (getUserDefinedSsid != null)
  212.           getUserDefinedSsid((object) this, (EventArgs) null);
  213.       }
  214.     }
  215.  
  216.     public void NBWControl_ConfigurationCommandIssue_GetTCPNoMessageReceivedTimeout(
  217.       string defaultAccessPassword)
  218.     {
  219.       this._nbwControl.ConfigurationCommandIssue_GetTCPNoMessageReceivedTimeout(defaultAccessPassword);
  220.     }
  221.  
  222.     private void NBWControl_GetSettingCommandResponse_WIFI_TCPNoMessageReceivedTimeout(
  223.       object sender,
  224.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  225.     {
  226.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  227.       {
  228.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  229.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> messageReceivedTimeout = this.NBWControl_ConfigCommandResponseValid_GetTCPNoMessageReceivedTimeout;
  230.         if (messageReceivedTimeout == null)
  231.           return;
  232.         messageReceivedTimeout((object) this, e1);
  233.       }
  234.       else
  235.       {
  236.         EventHandler messageReceivedTimeout = this.NBWControl_ConfigCommandResponseError_GetTCPNoMessageReceivedTimeout;
  237.         if (messageReceivedTimeout != null)
  238.           messageReceivedTimeout((object) this, (EventArgs) null);
  239.       }
  240.     }
  241.  
  242.     public void NBWControl_ConfigurationCommandIssue_GetIOTHUBServicePrimaryKey(
  243.       string defaultAccessPassword)
  244.     {
  245.       this._nbwControl.ConfigurationCommandIssue_GetIOTHUBServicePrimaryKey(defaultAccessPassword);
  246.     }
  247.  
  248.     private void NBWControl_GetSettingCommandResponse_HUB_IOTHUBServicePrimaryKey(
  249.       object sender,
  250.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  251.     {
  252.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  253.       {
  254.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  255.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> servicePrimaryKey = this.NBWControl_ConfigCommandResponseValid_GetIOTHUBServicePrimaryKey;
  256.         if (servicePrimaryKey == null)
  257.           return;
  258.         servicePrimaryKey((object) this, e1);
  259.       }
  260.       else
  261.       {
  262.         EventHandler servicePrimaryKey = this.NBWControl_ConfigCommandResponseError_GetIOTHUBServicePrimaryKey;
  263.         if (servicePrimaryKey != null)
  264.           servicePrimaryKey((object) this, (EventArgs) null);
  265.       }
  266.     }
  267.  
  268.     public void NBWControl_ConfigurationCommandIssue_GetIOTHUBServiceSecondaryKey(
  269.       string defaultAccessPassword)
  270.     {
  271.       this._nbwControl.ConfigurationCommandIssue_GetIOTHUBServiceSecondaryKey(defaultAccessPassword);
  272.     }
  273.  
  274.     private void NBWControl_GetSettingCommandResponse_HUB_IOTHUBServiceSecondaryKey(
  275.       object sender,
  276.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  277.     {
  278.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  279.       {
  280.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  281.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> serviceSecondaryKey = this.NBWControl_ConfigCommandResponseValid_GetIOTHUBServiceSecondaryKey;
  282.         if (serviceSecondaryKey == null)
  283.           return;
  284.         serviceSecondaryKey((object) this, e1);
  285.       }
  286.       else
  287.       {
  288.         EventHandler serviceSecondaryKey = this.NBWControl_ConfigCommandResponseError_GetIOTHUBServiceSecondaryKey;
  289.         if (serviceSecondaryKey != null)
  290.           serviceSecondaryKey((object) this, (EventArgs) null);
  291.       }
  292.     }
  293.  
  294.     public void NBWControl_ConfigurationCommandIssue_GetDevicePrimaryKey(
  295.       string defaultAccessPassword)
  296.     {
  297.       this._nbwControl.ConfigurationCommandIssue_GetDevicePrimaryKey(defaultAccessPassword);
  298.     }
  299.  
  300.     private void NBWControl_GetSettingCommandResponse_HUB_DevicePrimaryKey(
  301.       object sender,
  302.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  303.     {
  304.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  305.       {
  306.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  307.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> devicePrimaryKey = this.NBWControl_ConfigCommandResponseValid_GetDevicePrimaryKey;
  308.         if (devicePrimaryKey == null)
  309.           return;
  310.         devicePrimaryKey((object) this, e1);
  311.       }
  312.       else
  313.       {
  314.         EventHandler devicePrimaryKey = this.NBWControl_ConfigCommandResponseError_GetDevicePrimaryKey;
  315.         if (devicePrimaryKey != null)
  316.           devicePrimaryKey((object) this, (EventArgs) null);
  317.       }
  318.     }
  319.  
  320.     public void NBWControl_ConfigurationCommandIssue_GetEventHubEndpoint(
  321.       string defaultAccessPassword)
  322.     {
  323.       this._nbwControl.ConfigurationCommandIssue_GetEventHubEndpoint(defaultAccessPassword);
  324.     }
  325.  
  326.     private void NBWControl_GetSettingCommandResponse_HUB_EventHubEndpoint(
  327.       object sender,
  328.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  329.     {
  330.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  331.       {
  332.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  333.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> eventHubEndpoint = this.NBWControl_ConfigCommandResponseValid_GetEventHubEndpoint;
  334.         if (eventHubEndpoint == null)
  335.           return;
  336.         eventHubEndpoint((object) this, e1);
  337.       }
  338.       else
  339.       {
  340.         EventHandler eventHubEndpoint = this.NBWControl_ConfigCommandResponseError_GetEventHubEndpoint;
  341.         if (eventHubEndpoint != null)
  342.           eventHubEndpoint((object) this, (EventArgs) null);
  343.       }
  344.     }
  345.  
  346.     public void NBWControl_ConfigurationCommandIssue_GetUserInactivityTimeout(
  347.       string defaultAccessPassword)
  348.     {
  349.       this._nbwControl.ConfigurationCommandIssue_GetUserInactivityTimeout(defaultAccessPassword);
  350.     }
  351.  
  352.     private void NBWControl_GetSettingCommandResponse_HUB_UserInactivityTimeout(
  353.       object sender,
  354.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  355.     {
  356.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  357.       {
  358.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  359.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> inactivityTimeout = this.NBWControl_ConfigCommandResponseValid_GetUserInactivityTimeout;
  360.         if (inactivityTimeout == null)
  361.           return;
  362.         inactivityTimeout((object) this, e1);
  363.       }
  364.       else
  365.       {
  366.         EventHandler inactivityTimeout = this.NBWControl_ConfigCommandResponseError_GetUserInactivityTimeout;
  367.         if (inactivityTimeout != null)
  368.           inactivityTimeout((object) this, (EventArgs) null);
  369.       }
  370.     }
  371.  
  372.     public void NBWControl_ConfigurationCommandIssue_GetMQTTBrokerServerAddress(
  373.       string defaultAccessPassword)
  374.     {
  375.       this._nbwControl.ConfigurationCommandIssue_GetMQTTBrokerServerAddress(defaultAccessPassword);
  376.     }
  377.  
  378.     private void NBWControl_GetSettingCommandResponse_MQTT_Broker_ServerAddress(
  379.       object sender,
  380.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  381.     {
  382.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  383.       {
  384.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  385.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> brokerServerAddress = this.NBWControl_ConfigCommandResponseValid_GetMQTTBrokerServerAddress;
  386.         if (brokerServerAddress == null)
  387.           return;
  388.         brokerServerAddress((object) this, e1);
  389.       }
  390.       else
  391.       {
  392.         EventHandler brokerServerAddress = this.NBWControl_ConfigCommandResponseError_GetMQTTBrokerServerAddress;
  393.         if (brokerServerAddress != null)
  394.           brokerServerAddress((object) this, (EventArgs) null);
  395.       }
  396.     }
  397.  
  398.     public void NBWControl_ConfigurationCommandIssue_GetMQTTConfigClientID(
  399.       string defaultAccessPassword)
  400.     {
  401.       this._nbwControl.ConfigurationCommandIssue_GetMQTTConfigClientID(defaultAccessPassword);
  402.     }
  403.  
  404.     private void NBWControl_GetSettingCommandResponse_MQTT_Config_ClientID(
  405.       object sender,
  406.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  407.     {
  408.       if (e.TagResponse.ValueGetState == CTag.VALUE_GET_STATE.GOT)
  409.       {
  410.         CNetworker.CNetworkerNBWControlSettingAccessEventArgs e1 = new CNetworker.CNetworkerNBWControlSettingAccessEventArgs(e.TagResponse.Value);
  411.         EventHandler<CNetworker.CNetworkerNBWControlSettingAccessEventArgs> mqttConfigClientId = this.NBWControl_ConfigCommandResponseValid_GetMQTTConfigClientID;
  412.         if (mqttConfigClientId == null)
  413.           return;
  414.         mqttConfigClientId((object) this, e1);
  415.       }
  416.       else
  417.       {
  418.         EventHandler mqttConfigClientId = this.NBWControl_ConfigCommandResponseError_GetMQTTConfigClientID;
  419.         if (mqttConfigClientId != null)
  420.           mqttConfigClientId((object) this, (EventArgs) null);
  421.       }
  422.     }
  423.  
  424.     public event EventHandler NBWControl_ConfigCommandResponseValid_SetUserDefinedSSID;
  425.  
  426.     public event EventHandler NBWControl_ConfigCommandResponseError_SetUserDefinedSSID;
  427.  
  428.     public event EventHandler NBWControl_ConfigCommandResponseValid_SetUserDefinedSSIDPassword;
  429.  
  430.     public event EventHandler NBWControl_ConfigCommandResponseError_SetUserDefinedSSIDPassword;
  431.  
  432.     public event EventHandler NBWControl_ConfigCommandResponseValid_SetNetworkJoinType;
  433.  
  434.     public event EventHandler NBWControl_ConfigCommandResponseError_SetNetworkJoinType;
  435.  
  436.     public event EventHandler NBWControl_ConfigCommandResponseValid_SetMQTTGeneralEnableConnection;
  437.  
  438.     public event EventHandler NBWControl_ConfigCommandResponseError_SetMQTTGeneralEnableConnection;
  439.  
  440.     public event EventHandler NBWControl_ConfigCommandResponseValid_SaveSettings;
  441.  
  442.     public event EventHandler NBWControl_ConfigCommandResponseError_SaveSettings;
  443.  
  444.     public event EventHandler NBWControl_ConfigCommandResponseValid_RebootNoSaveSettings;
  445.  
  446.     public event EventHandler NBWControl_ConfigCommandResponseError_RebootNoSaveSettings;
  447.  
  448.     public event EventHandler NBWControl_ConfigCommandResponseValid_GenerateNewHUBAccessHash;
  449.  
  450.     public event EventHandler NBWControl_ConfigCommandResponseError_GenerateNewHUBAccessHash;
  451.  
  452.     public void NBWControl_ConfigurationCommandIssue_SetUserDefinedSSID(
  453.       string defaultAccessPassword,
  454.       string userDefinedSSID)
  455.     {
  456.       this._nbwControl.ConfigurationCommandIssue_SetUserDefinedSSID(defaultAccessPassword, userDefinedSSID);
  457.     }
  458.  
  459.     private void NBWControl_SetSettingCommandResponse_WIFI_UserDefinedSSID(
  460.       object sender,
  461.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  462.     {
  463.       if (e.TagResponse.ValueSetState == CTag.VALUE_SET_STATE.SET)
  464.       {
  465.         EventHandler setUserDefinedSsid = this.NBWControl_ConfigCommandResponseValid_SetUserDefinedSSID;
  466.         if (setUserDefinedSsid == null)
  467.           return;
  468.         setUserDefinedSsid((object) this, (EventArgs) null);
  469.       }
  470.       else
  471.       {
  472.         EventHandler setUserDefinedSsid = this.NBWControl_ConfigCommandResponseError_SetUserDefinedSSID;
  473.         if (setUserDefinedSsid != null)
  474.           setUserDefinedSsid((object) this, (EventArgs) null);
  475.       }
  476.     }
  477.  
  478.     public void NBWControl_ConfigurationCommandIssue_SetUserDefinedSSIDPassword(
  479.       string defaultAccessPassword,
  480.       string userDefinedSSIDPassword)
  481.     {
  482.       this._nbwControl.ConfigurationCommandIssue_SetUserDefinedSSIDPassword(defaultAccessPassword, userDefinedSSIDPassword);
  483.     }
  484.  
  485.     private void NBWControl_SetSettingCommandResponse_WIFI_UserDefinedSSIDPassword(
  486.       object sender,
  487.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  488.     {
  489.       if (e.TagResponse.ValueSetState == CTag.VALUE_SET_STATE.SET)
  490.       {
  491.         EventHandler definedSsidPassword = this.NBWControl_ConfigCommandResponseValid_SetUserDefinedSSIDPassword;
  492.         if (definedSsidPassword == null)
  493.           return;
  494.         definedSsidPassword((object) this, (EventArgs) null);
  495.       }
  496.       else
  497.       {
  498.         EventHandler definedSsidPassword = this.NBWControl_ConfigCommandResponseError_SetUserDefinedSSIDPassword;
  499.         if (definedSsidPassword != null)
  500.           definedSsidPassword((object) this, (EventArgs) null);
  501.       }
  502.     }
  503.  
  504.     public void NBWControl_ConfigurationCommandIssue_SetNetworkJoinType(
  505.       string defaultAccessPassword,
  506.       bool operateAsAccessPoint)
  507.     {
  508.       this._nbwControl.ConfigurationCommandIssue_SetNetworkJoinType(defaultAccessPassword, operateAsAccessPoint);
  509.     }
  510.  
  511.     private void NBWControl_SetSettingCommandResponse_WIFI_JoinType(
  512.       object sender,
  513.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  514.     {
  515.       if (e.TagResponse.ValueSetState == CTag.VALUE_SET_STATE.SET)
  516.       {
  517.         EventHandler setNetworkJoinType = this.NBWControl_ConfigCommandResponseValid_SetNetworkJoinType;
  518.         if (setNetworkJoinType == null)
  519.           return;
  520.         setNetworkJoinType((object) this, (EventArgs) null);
  521.       }
  522.       else
  523.       {
  524.         EventHandler setNetworkJoinType = this.NBWControl_ConfigCommandResponseError_SetNetworkJoinType;
  525.         if (setNetworkJoinType != null)
  526.           setNetworkJoinType((object) this, (EventArgs) null);
  527.       }
  528.     }
  529.  
  530.     public void NBWControl_ConfigurationCommandIssue_SetMQTTGeneralEnableConnectionOption(
  531.       string defaultAccessPassword,
  532.       bool enableConnection)
  533.     {
  534.       this._nbwControl.ConfigurationCommandIssue_SetMQTTGeneralEnableConnection(defaultAccessPassword, enableConnection);
  535.     }
  536.  
  537.     private void NBWControl_SetSettingCommandResponse_MQTTGeneral_EnableConnection(
  538.       object sender,
  539.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  540.     {
  541.       if (e.TagResponse.ValueSetState == CTag.VALUE_SET_STATE.SET)
  542.       {
  543.         EventHandler enableConnection = this.NBWControl_ConfigCommandResponseValid_SetMQTTGeneralEnableConnection;
  544.         if (enableConnection == null)
  545.           return;
  546.         enableConnection((object) this, (EventArgs) null);
  547.       }
  548.       else
  549.       {
  550.         EventHandler enableConnection = this.NBWControl_ConfigCommandResponseError_SetMQTTGeneralEnableConnection;
  551.         if (enableConnection != null)
  552.           enableConnection((object) this, (EventArgs) null);
  553.       }
  554.     }
  555.  
  556.     public void NBWControl_ConfigurationCommandIssue_SaveSettings(string defaultAccessPassword)
  557.     {
  558.       this._nbwControl.ConfigurationCommandIssue_SaveSettingsAndReboot(defaultAccessPassword);
  559.     }
  560.  
  561.     private void NBWControl_SetSettingCommandResponse_Save(
  562.       object sender,
  563.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  564.     {
  565.       if (e.TagResponse.ValueSetState == CTag.VALUE_SET_STATE.SET)
  566.       {
  567.         EventHandler validSaveSettings = this.NBWControl_ConfigCommandResponseValid_SaveSettings;
  568.         if (validSaveSettings == null)
  569.           return;
  570.         validSaveSettings((object) this, (EventArgs) null);
  571.       }
  572.       else
  573.       {
  574.         EventHandler errorSaveSettings = this.NBWControl_ConfigCommandResponseError_SaveSettings;
  575.         if (errorSaveSettings != null)
  576.           errorSaveSettings((object) this, (EventArgs) null);
  577.       }
  578.     }
  579.  
  580.     public void NBWControl_ConfigurationCommandIssue_RebootNoSaveSettings(
  581.       string defaultAccessPassword)
  582.     {
  583.       this._nbwControl.ConfigurationCommandIssue_RebootWithNoSaveOfSettings(defaultAccessPassword);
  584.     }
  585.  
  586.     private void NBWControl_SetSettingCommandResponse_Boot(
  587.       object sender,
  588.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  589.     {
  590.       if (e.TagResponse.ValueSetState == CTag.VALUE_SET_STATE.SET)
  591.       {
  592.         EventHandler rebootNoSaveSettings = this.NBWControl_ConfigCommandResponseValid_RebootNoSaveSettings;
  593.         if (rebootNoSaveSettings == null)
  594.           return;
  595.         rebootNoSaveSettings((object) this, (EventArgs) null);
  596.       }
  597.       else
  598.       {
  599.         EventHandler rebootNoSaveSettings = this.NBWControl_ConfigCommandResponseError_RebootNoSaveSettings;
  600.         if (rebootNoSaveSettings != null)
  601.           rebootNoSaveSettings((object) this, (EventArgs) null);
  602.       }
  603.     }
  604.  
  605.     public void NBWControl_ConfigurationCommandIssue_GenerateNewHUBAccessHash(
  606.       string defaultAccessPassword)
  607.     {
  608.       this._nbwControl.ConfigurationCommandIssue_GenerateNewHASH(defaultAccessPassword);
  609.     }
  610.  
  611.     private void NBWControl_SetSettingCommandResponse_Hash(
  612.       object sender,
  613.       CNBWControl.CGetSetSettingCommandResponseEventArgs e)
  614.     {
  615.       if (e.TagResponse.ValueSetState == CTag.VALUE_SET_STATE.SET)
  616.       {
  617.         EventHandler newHubAccessHash = this.NBWControl_ConfigCommandResponseValid_GenerateNewHUBAccessHash;
  618.         if (newHubAccessHash == null)
  619.           return;
  620.         newHubAccessHash((object) this, (EventArgs) null);
  621.       }
  622.       else
  623.       {
  624.         EventHandler newHubAccessHash = this.NBWControl_ConfigCommandResponseError_GenerateNewHUBAccessHash;
  625.         if (newHubAccessHash != null)
  626.           newHubAccessHash((object) this, (EventArgs) null);
  627.       }
  628.     }
  629.  
  630.     public CSystem System
  631.     {
  632.       get
  633.       {
  634.         return this._system;
  635.       }
  636.     }
  637.  
  638.     public CHeating Heating
  639.     {
  640.       get
  641.       {
  642.         return this._mode.Heating;
  643.       }
  644.     }
  645.  
  646.     public CCooling Cooling
  647.     {
  648.       get
  649.       {
  650.         return this._mode.Cooling;
  651.       }
  652.     }
  653.  
  654.     public CEvpCool EvpCool
  655.     {
  656.       get
  657.       {
  658.         return this._mode.Evpcool;
  659.       }
  660.     }
  661.  
  662.     private void SystemFunctional_Init()
  663.     {
  664.       this._system = new CSystem(this._commandInterface, this._transferControl, this._rxContainer);
  665.       this._mode = new CMode(this._commandInterface, this._transferControl, this._rxContainer);
  666.     }
  667.  
  668.     public event EventHandler<CNetworkerCommandTextEventArgs> CommandTextTx;
  669.  
  670.     public event EventHandler CommandTextTransferCompletedSuccessfully;
  671.  
  672.     public event EventHandler CommandTextTransferCompletedWithoutSuccess;
  673.  
  674.     public CTransferControl CommandTransfer
  675.     {
  676.       get
  677.       {
  678.         return this._transferControl;
  679.       }
  680.     }
  681.  
  682.     private void CommandInterpreter_Init()
  683.     {
  684.       this._commandInterface = new CCommandInterface();
  685.       this._rxContainer = new CContainer(this._commandInterface);
  686.       this._transferControl = new CTransferControl();
  687.       this._transferControl.CommandTextToBeIssued += new EventHandler<CTransferControlCommandTextToBeIssuedEventArgs>(this.TransferControl_CommandTextToBeIssued);
  688.       this._transferControl.CompletedSuccessfully += new EventHandler(this.TransferControl_CompletedSuccessfully);
  689.       this._transferControl.CompletedWithoutSuccess += new EventHandler(this.TransferControl_CompletedWithoutSuccess);
  690.       this._commandIssueTxResponseTimeoutTimer = new CTimer();
  691.       this._commandIssueTxResponseTimeoutTimer.IntervalElapsed += new EventHandler<CTimerIntervalElapsedEventArgs>(this.CommandIssueTxResponseTimeoutTimer_IntervalElapsed);
  692.       this._waitingForFirstCommand = true;
  693.     }
  694.  
  695.     private void CommandIssueTxResponseTimeoutTimer_IntervalElapsed(
  696.       object sender,
  697.       CTimerIntervalElapsedEventArgs e)
  698.     {
  699.       if (!e.TimeLimitReached)
  700.         return;
  701.       this._transferControl.ResponseVerificationUpdate(true);
  702.     }
  703.  
  704.     private string SequenceControlValueTxUpdate()
  705.     {
  706.       if (this._sequenceControlTxValue == 999999)
  707.         this._sequenceControlTxValue = 1;
  708.       else
  709.         ++this._sequenceControlTxValue;
  710.       if (this._sequenceControlTxValue < 10)
  711.         return "00000" + this._sequenceControlTxValue.ToString();
  712.       if (this._sequenceControlTxValue < 100)
  713.         return "0000" + this._sequenceControlTxValue.ToString();
  714.       if (this._sequenceControlTxValue < 1000)
  715.         return "000" + this._sequenceControlTxValue.ToString();
  716.       if (this._sequenceControlTxValue < 10000)
  717.         return "00" + this._sequenceControlTxValue.ToString();
  718.       if (this._sequenceControlTxValue < 100000)
  719.         return "0" + this._sequenceControlTxValue.ToString();
  720.       return this._sequenceControlTxValue.ToString() ?? "";
  721.     }
  722.  
  723.     private int SequenceControlValueRxUpdate(string sequenceControlValue)
  724.     {
  725.       int num1 = 0;
  726.       int num2;
  727.       try
  728.       {
  729.         int num3 = (int) sequenceControlValue[0] - 48;
  730.         num2 = num1 + 100000 * num3 + 10000 * ((int) sequenceControlValue[1] - 48) + 1000 * ((int) sequenceControlValue[2] - 48) + 100 * ((int) sequenceControlValue[3] - 48) + 10 * ((int) sequenceControlValue[4] - 48) + ((int) sequenceControlValue[5] - 48);
  731.       }
  732.       catch
  733.       {
  734.         num2 = 0;
  735.       }
  736.       return num2;
  737.     }
  738.  
  739.     private void TransferControl_CommandTextToBeIssued(
  740.       object sender,
  741.       CTransferControlCommandTextToBeIssuedEventArgs e)
  742.     {
  743.       CNetworkerCommandTextEventArgs e1 = new CNetworkerCommandTextEventArgs(e.CommandText);
  744.       if ((uint) (this._connectType - 1) > 1U)
  745.         return;
  746.       if (this._connectType == CNetworker.CONNECT_TYPE.TCP)
  747.         this._nbwControl.WIFI.SendTextMessage("N" + this.SequenceControlValueTxUpdate() + e.CommandText);
  748.       else
  749.         this._nbwControl.HUB.SendTextMessage("N" + this.SequenceControlValueTxUpdate() + e.CommandText);
  750.       this._commandIssueTxResponseTimeoutTimer.Start(true, this._commandResponseTimeoutSeconds);
  751.       EventHandler<CNetworkerCommandTextEventArgs> commandTextTx = this.CommandTextTx;
  752.       if (commandTextTx == null)
  753.         return;
  754.       commandTextTx((object) this, e1);
  755.     }
  756.  
  757.     private void TransferControl_CompletedSuccessfully(object sender, EventArgs e)
  758.     {
  759.       this._commandIssueTxResponseTimeoutTimer.Stop();
  760.       EventHandler completedSuccessfully = this.CommandTextTransferCompletedSuccessfully;
  761.       if (completedSuccessfully == null)
  762.         return;
  763.       completedSuccessfully((object) this, EventArgs.Empty);
  764.     }
  765.  
  766.     private void TransferControl_CompletedWithoutSuccess(object sender, EventArgs e)
  767.     {
  768.       EventHandler completedWithoutSuccess = this.CommandTextTransferCompletedWithoutSuccess;
  769.       if (completedWithoutSuccess == null)
  770.         return;
  771.       completedWithoutSuccess((object) this, EventArgs.Empty);
  772.     }
  773.  
  774.     private void UpdateUsingCommandTextReceived(string commandText)
  775.     {
  776.       this._rxContainer.DefineCommandText(commandText);
  777.       this._rxContainer.GroupStartPosition(CContainer.RMTAXS_COMMON_GROUP_TYPES.GROUP_1, 1);
  778.       this._rxContainer.GroupEndPosition(CContainer.RMTAXS_COMMON_GROUP_TYPES.GROUP_1, 1);
  779.       while (this._rxContainer.DefinedNextGroupDetails(CContainer.RMTAXS_COMMON_GROUP_TYPES.GROUP_1))
  780.       {
  781.         string str = this._rxContainer.GroupDescriptor(CContainer.RMTAXS_COMMON_GROUP_TYPES.GROUP_1);
  782.         if (str == this._system.Group1Descriptor)
  783.           this._system.UpdateUsingCommandTextReceived();
  784.         else if (str == this._mode.Heating.Group1Descriptor)
  785.           this._mode.Heating.UpdateUsingCommandTextReceived();
  786.         else if (str == this._mode.Evpcool.Group1Descriptor)
  787.           this._mode.Evpcool.UpdateUsingCommandTextReceived();
  788.         else if (str == this._mode.Cooling.Group1Descriptor)
  789.           this._mode.Cooling.UpdateUsingCommandTextReceived();
  790.       }
  791.       this._transferControl.ResponseVerificationUpdate(false);
  792.     }
  793.  
  794.     public event EventHandler Networker_NBWControl_TCPConnectionEstablished;
  795.  
  796.     public event EventHandler Networker_NBWControl_HUBConnectionEstablished;
  797.  
  798.     public event EventHandler Networker_NBWControl_NoConnectionEstablished;
  799.  
  800.     public event EventHandler Networker_NBWControl_HostInactivityDetected;
  801.  
  802.     public event EventHandler Networker_NBWControl_UserInactivityDetected;
  803.  
  804.     public event EventHandler Networker_NBWControl_HostConnectDisconnect;
  805.  
  806.     public async Task<bool> AccessedUsingNetworkConnection(
  807.       CNetworker.NETWORK_CONNECT_MODE networkConnectMode,
  808.       CConnectionDetails connectionDetails)
  809.     {
  810.       EventHandler<string> networkerDebugMessage = this.Networker_DebugMessage;
  811.       if (networkerDebugMessage != null)
  812.         networkerDebugMessage((object) this, string.Format("Connecting - Mode: {0}", (object) networkConnectMode));
  813.       this._commandResponseTimeoutSeconds = connectionDetails.CommandResponseTimeoutSeconds;
  814.       this._connectType = CNetworker.CONNECT_TYPE.NONE;
  815.       if (networkConnectMode != CNetworker.NETWORK_CONNECT_MODE.HUB_ONLY)
  816.       {
  817.         bool flag = await this._nbwControl.WIFI.EstablishedConnection(connectionDetails.WIFI);
  818.         if (flag)
  819.         {
  820.           this._waitingForFirstCommand = true;
  821.           this._connectType = CNetworker.CONNECT_TYPE.TCP;
  822.           EventHandler connectionEstablished = this.Networker_NBWControl_TCPConnectionEstablished;
  823.           if (connectionEstablished != null)
  824.             connectionEstablished((object) this, EventArgs.Empty);
  825.           return true;
  826.         }
  827.         if (networkConnectMode == CNetworker.NETWORK_CONNECT_MODE.WIFI_ONLY)
  828.         {
  829.           EventHandler connectionEstablished = this.Networker_NBWControl_NoConnectionEstablished;
  830.           if (connectionEstablished != null)
  831.             connectionEstablished((object) this, EventArgs.Empty);
  832.           return false;
  833.         }
  834.       }
  835.       bool flag1 = await this._nbwControl.HUB.EstablishedConnection(connectionDetails);
  836.       if (flag1)
  837.       {
  838.         this._waitingForFirstCommand = true;
  839.         this._connectType = CNetworker.CONNECT_TYPE.HUB;
  840.         EventHandler connectionEstablished = this.Networker_NBWControl_HUBConnectionEstablished;
  841.         if (connectionEstablished != null)
  842.           connectionEstablished((object) this, EventArgs.Empty);
  843.         return true;
  844.       }
  845.       EventHandler connectionEstablished1 = this.Networker_NBWControl_NoConnectionEstablished;
  846.       if (connectionEstablished1 != null)
  847.         connectionEstablished1((object) this, EventArgs.Empty);
  848.       return false;
  849.     }
  850.  
  851.     public bool Connected
  852.     {
  853.       get
  854.       {
  855.         switch (this._connectType)
  856.         {
  857.           case CNetworker.CONNECT_TYPE.TCP:
  858.             return this._nbwControl.WIFI.ConnectedToHost;
  859.           case CNetworker.CONNECT_TYPE.HUB:
  860.             return this._nbwControl.HUB.ConnectedToHost;
  861.           default:
  862.             return false;
  863.         }
  864.       }
  865.     }
  866.  
  867.     public bool ConnectedUsingTCP
  868.     {
  869.       get
  870.       {
  871.         return this._connectType == CNetworker.CONNECT_TYPE.TCP;
  872.       }
  873.     }
  874.  
  875.     public bool ConnectedUsingHUB
  876.     {
  877.       get
  878.       {
  879.         return this._connectType == CNetworker.CONNECT_TYPE.HUB;
  880.       }
  881.     }
  882.  
  883.     public void Disconnect()
  884.     {
  885.       switch (this._connectType)
  886.       {
  887.         case CNetworker.CONNECT_TYPE.TCP:
  888.           this._nbwControl.WIFI.CloseConnection();
  889.           break;
  890.         case CNetworker.CONNECT_TYPE.HUB:
  891.           this._nbwControl.HUB.CloseConnection();
  892.           break;
  893.       }
  894.     }
  895.  
  896.     private void Connection_Init()
  897.     {
  898.       this._connectType = CNetworker.CONNECT_TYPE.NONE;
  899.     }
  900.  
  901.     public event EventHandler<string> Networker_DebugMessage;
  902.  
  903.     public event EventHandler Networker_NBWControl_WIFI_HostLocateFound;
  904.  
  905.     public event EventHandler Networker_NBWControl_WIFI_HostLocateError;
  906.  
  907.     public event EventHandler Networker_NBWControl_WIFI_HostConnectFound;
  908.  
  909.     public event EventHandler Networker_NBWControl_WIFI_HostConnectError;
  910.  
  911.     public event EventHandler Networker_NBWControl_WIFI_HostInactivityDetected;
  912.  
  913.     public event EventHandler Networker_NBWControl_WIFI_UserInactivityDetected;
  914.  
  915.     public event EventHandler Networker_NBWControl_WIFI_HostConnectDisconnect;
  916.  
  917.     private void NBWControl_WIFI_HostLocated(object sender, EventArgs e)
  918.     {
  919.       EventHandler wifiHostLocateFound = this.Networker_NBWControl_WIFI_HostLocateFound;
  920.       if (wifiHostLocateFound == null)
  921.         return;
  922.       wifiHostLocateFound((object) this, e);
  923.     }
  924.  
  925.     private void NBWControl_WIFI_HostLocateTimeout(object sender, EventArgs e)
  926.     {
  927.       EventHandler wifiHostLocateError = this.Networker_NBWControl_WIFI_HostLocateError;
  928.       if (wifiHostLocateError == null)
  929.         return;
  930.       wifiHostLocateError((object) this, e);
  931.     }
  932.  
  933.     private void NBWControl_WIFI_HostConnected(object sender, EventArgs e)
  934.     {
  935.       EventHandler hostConnectFound = this.Networker_NBWControl_WIFI_HostConnectFound;
  936.       if (hostConnectFound == null)
  937.         return;
  938.       hostConnectFound((object) this, e);
  939.     }
  940.  
  941.     private void NBWControl_WIFI_HostConnectTimeout(object sender, EventArgs e)
  942.     {
  943.       EventHandler hostConnectError = this.Networker_NBWControl_WIFI_HostConnectError;
  944.       if (hostConnectError == null)
  945.         return;
  946.       hostConnectError((object) this, e);
  947.     }
  948.  
  949.     private void NBWControl_WIFI_HostDisconnected(object sender, EventArgs e)
  950.     {
  951.       EventHandler connectDisconnect1 = this.Networker_NBWControl_WIFI_HostConnectDisconnect;
  952.       if (connectDisconnect1 != null)
  953.         connectDisconnect1((object) this, e);
  954.       EventHandler connectDisconnect2 = this.Networker_NBWControl_HostConnectDisconnect;
  955.       if (connectDisconnect2 == null)
  956.         return;
  957.       connectDisconnect2((object) this, e);
  958.     }
  959.  
  960.     private void NBWControl_WIFI_HostInactivityDetected(object sender, EventArgs e)
  961.     {
  962.       EventHandler inactivityDetected1 = this.Networker_NBWControl_WIFI_HostInactivityDetected;
  963.       if (inactivityDetected1 != null)
  964.         inactivityDetected1((object) this, e);
  965.       EventHandler inactivityDetected2 = this.Networker_NBWControl_HostInactivityDetected;
  966.       if (inactivityDetected2 == null)
  967.         return;
  968.       inactivityDetected2((object) this, e);
  969.     }
  970.  
  971.     private void NBWControl_WIFI_UserInactivityDetected(object sender, EventArgs e)
  972.     {
  973.       EventHandler inactivityDetected1 = this.Networker_NBWControl_WIFI_UserInactivityDetected;
  974.       if (inactivityDetected1 != null)
  975.         inactivityDetected1((object) this, e);
  976.       EventHandler inactivityDetected2 = this.Networker_NBWControl_UserInactivityDetected;
  977.       if (inactivityDetected2 == null)
  978.         return;
  979.       inactivityDetected2((object) this, e);
  980.     }
  981.  
  982.     public event EventHandler Networker_NBWControl_HUB_HostConnectFound;
  983.  
  984.     public event EventHandler Networker_NBWControl_HUB_HostConnectError;
  985.  
  986.     public event EventHandler Networker_NBWControl_HUB_HostInactivityDetected;
  987.  
  988.     public event EventHandler Networker_NBWControl_HUB_UserInactivityDetected;
  989.  
  990.     public event EventHandler Networker_NBWControl_HUB_HostConnectDisconnect;
  991.  
  992.     private void NBWControl_HUB_HostConnected(object sender, EventArgs e)
  993.     {
  994.       EventHandler hostConnectFound = this.Networker_NBWControl_HUB_HostConnectFound;
  995.       if (hostConnectFound == null)
  996.         return;
  997.       hostConnectFound((object) this, e);
  998.     }
  999.  
  1000.     private void NBWControl_HUB_HostConnectTimeout(object sender, EventArgs e)
  1001.     {
  1002.       EventHandler hostConnectError = this.Networker_NBWControl_HUB_HostConnectError;
  1003.       if (hostConnectError == null)
  1004.         return;
  1005.       hostConnectError((object) this, e);
  1006.     }
  1007.  
  1008.     private void NBWControl_HUB_HostDisonnected(object sender, EventArgs e)
  1009.     {
  1010.       EventHandler connectDisconnect1 = this.Networker_NBWControl_HUB_HostConnectDisconnect;
  1011.       if (connectDisconnect1 != null)
  1012.         connectDisconnect1((object) this, e);
  1013.       EventHandler connectDisconnect2 = this.Networker_NBWControl_HostConnectDisconnect;
  1014.       if (connectDisconnect2 == null)
  1015.         return;
  1016.       connectDisconnect2((object) this, e);
  1017.     }
  1018.  
  1019.     private void NBWControl_HUB_HostInactivityDetected(object sender, EventArgs e)
  1020.     {
  1021.       EventHandler inactivityDetected1 = this.Networker_NBWControl_HUB_HostInactivityDetected;
  1022.       if (inactivityDetected1 != null)
  1023.         inactivityDetected1((object) this, e);
  1024.       EventHandler inactivityDetected2 = this.Networker_NBWControl_HostInactivityDetected;
  1025.       if (inactivityDetected2 == null)
  1026.         return;
  1027.       inactivityDetected2((object) this, e);
  1028.     }
  1029.  
  1030.     private void NBWControl_HUB_UserInactivityDetected(object sender, EventArgs e)
  1031.     {
  1032.       EventHandler inactivityDetected1 = this.Networker_NBWControl_HUB_UserInactivityDetected;
  1033.       if (inactivityDetected1 != null)
  1034.         inactivityDetected1((object) this, e);
  1035.       EventHandler inactivityDetected2 = this.Networker_NBWControl_UserInactivityDetected;
  1036.       if (inactivityDetected2 == null)
  1037.         return;
  1038.       inactivityDetected2((object) this, e);
  1039.     }
  1040.  
  1041.     public event EventHandler<CNBWControlConfigurationCommandTextEventArgs> NBWControlConfigurationCommandTextRx;
  1042.  
  1043.     public event EventHandler<CNetworkerCommandTextEventArgs> CommandTextRx;
  1044.  
  1045.     public event EventHandler<CMessageEventArgs> HUBMessageSentAcknowledged;
  1046.  
  1047.     private void ProcessNetworkerMessageReceived(string responseText)
  1048.     {
  1049.       this._sequenceControlRxValue = this.SequenceControlValueRxUpdate(responseText.Substring(1, 6));
  1050.       if (this._waitingForFirstCommand)
  1051.       {
  1052.         this._sequenceControlTxValue = this._sequenceControlRxValue;
  1053.         this._waitingForFirstCommand = false;
  1054.       }
  1055.       string commandText = responseText.Substring(7).Trim();
  1056.       if (this._sequenceControlRxValue >= this._sequenceControlTxValue)
  1057.       {
  1058.         this._sequenceControlTxValue = this._sequenceControlRxValue;
  1059.         this.UpdateUsingCommandTextReceived(commandText);
  1060.       }
  1061.       CNetworkerCommandTextEventArgs e = new CNetworkerCommandTextEventArgs(commandText);
  1062.       EventHandler<CNetworkerCommandTextEventArgs> commandTextRx = this.CommandTextRx;
  1063.       if (commandTextRx == null)
  1064.         return;
  1065.       commandTextRx((object) this, e);
  1066.     }
  1067.  
  1068.     private void NBWControl_WIFI_MessageReceived(object sender, CMessageEventArgs e)
  1069.     {
  1070.       string responseText = Encoding.UTF8.GetString(e.Packet.Buffer, 0, e.Packet.BufferLength);
  1071.       string str1 = responseText.Substring(0, 1);
  1072.       if (!(str1 == "C"))
  1073.       {
  1074.         if (!(str1 == "N"))
  1075.           return;
  1076.         this.ProcessNetworkerMessageReceived(responseText);
  1077.       }
  1078.       else
  1079.       {
  1080.         string str2 = responseText.Substring(1);
  1081.         this._nbwControl.SettingsAccessUpdateAfterResponseTextReceived(str2);
  1082.         CNBWControlConfigurationCommandTextEventArgs e1 = new CNBWControlConfigurationCommandTextEventArgs(str2);
  1083.         EventHandler<CNBWControlConfigurationCommandTextEventArgs> configurationCommandTextRx = this.NBWControlConfigurationCommandTextRx;
  1084.         if (configurationCommandTextRx == null)
  1085.           return;
  1086.         configurationCommandTextRx((object) this, e1);
  1087.       }
  1088.     }
  1089.  
  1090.     private void NBWControl_HUB_MessageReceived(object sender, CMessageEventArgs e)
  1091.     {
  1092.       string responseText = Encoding.UTF8.GetString(e.Packet.Buffer, 0, e.Packet.BufferLength);
  1093.       if (!(responseText.Substring(0, 1) == "N"))
  1094.         return;
  1095.       this.ProcessNetworkerMessageReceived(responseText);
  1096.     }
  1097.  
  1098.     private void NBWControl_HUB_MessageSentAcknowledged(object sender, CMessageEventArgs e)
  1099.     {
  1100.       EventHandler<CMessageEventArgs> sentAcknowledged = this.HUBMessageSentAcknowledged;
  1101.       if (sentAcknowledged == null)
  1102.         return;
  1103.       sentAcknowledged((object) this, e);
  1104.     }
  1105.  
  1106.     public class CNetworkerNBWControlSettingAccessEventArgs : EventArgs
  1107.     {
  1108.       private string _commandResponseData;
  1109.  
  1110.       public CNetworkerNBWControlSettingAccessEventArgs(string commandResponseData)
  1111.       {
  1112.         this._commandResponseData = commandResponseData;
  1113.       }
  1114.  
  1115.       public string CommandResponseData
  1116.       {
  1117.         get
  1118.         {
  1119.           return this._commandResponseData;
  1120.         }
  1121.       }
  1122.     }
  1123.  
  1124.     public enum NETWORK_CONNECT_MODE
  1125.     {
  1126.       WIFI_ONLY,
  1127.       HUB_ONLY,
  1128.       HUB_AFTER_WIFI,
  1129.     }
  1130.  
  1131.     public enum CONNECT_TYPE
  1132.     {
  1133.       NONE,
  1134.       TCP,
  1135.       HUB,
  1136.       USB,
  1137.     }
  1138.   }
  1139. }
Advertisement
Add Comment
Please, Sign In to add comment