private static void OnLastStatus(LastStatus lastStatus) { if (lastStatus.ToString().ToLower() != "ok") { Console.WriteLine(lastStatus.ToString()); } }
/// <summary> /// Constructor /// </summary> /// <param name="mainWindow">main window</param> public OpenSessionDialog(IPoderosaMainWindow mainWindow) { _mainWindow = mainWindow; LastStatus lastStatus; if (_lastStatusStorage.Get(_mainWindow, out lastStatus)) { _lastStatus = lastStatus; } else { _lastStatus = new LastStatus(); } SuspendLayout(); InitializeComponent(); Localize(); SetupOpenSessionTabs(); ResumeLayout(); }
public override int GetHashCode() { unchecked { // Choose large primes to avoid hashing collisions const int HashingBase = (int)2166136261; const int HashingMultiplier = 16777619; int hash = HashingBase; hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, Id) ? Id.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, ServiceEntry) ? ServiceEntry.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, this.LastAlert) ? LastAlert.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, this.LastStatus) ? LastStatus.GetHashCode() : 0); return(hash); } }
private void FrameDataReceived(FrameData frameData) { uint properyId = frameData.PropertyId; if (properyId == SpinelProperties.PROP_LAST_STATUS) { LastStatus lastStatus = (LastStatus)Convert.ToInt32(frameData.Response); OnLastStatusHandler(lastStatus); return; } else if (properyId == SpinelProperties.PROP_STREAM_NET) { byte[] ipv6frame = (byte[])frameData.Response; if (OnPacketReceived != null) { OnPacketReceived(this, ipv6frame); } return; } else if (properyId == SpinelProperties.SPINEL_PROP_MAC_SCAN_STATE) { byte scanState = Convert.ToByte(frameData.Response); if (scanState == 0) { scanThread.Set(); } } else if (properyId == SpinelProperties.SPINEL_PROP_MAC_SCAN_BEACON) { ArrayList scanInfo = (ArrayList)frameData.Response; LowpanBeaconInfo lowpanBeaconInfo = new LowpanBeaconInfo(); lowpanBeaconInfo.Channel = (byte)scanInfo[0]; lowpanBeaconInfo.Rssi = (sbyte)scanInfo[1]; ArrayList tempObj = scanInfo[2] as ArrayList; SpinelEUI64 mac = (SpinelEUI64)tempObj[0]; lowpanBeaconInfo.HardwareAddress = new HardwareAddress(mac.bytes); lowpanBeaconInfo.ShortAddress = (ushort)tempObj[1]; lowpanBeaconInfo.PanId = (ushort)tempObj[2]; lowpanBeaconInfo.LQI = (byte)tempObj[3]; tempObj = scanInfo[3] as ArrayList; lowpanBeaconInfo.Protocol = (uint)tempObj[0]; lowpanBeaconInfo.Flags = (byte)tempObj[1]; lowpanBeaconInfo.NetworkName = (string)tempObj[2]; lowpanBeaconInfo.XpanId = (byte[])tempObj[3]; scanMacResult.Add(lowpanBeaconInfo); return; } else if (properyId == SpinelProperties.SPINEL_PROP_MAC_ENERGY_SCAN_RESULT) { ArrayList energyScan = (ArrayList)frameData.Response; LowpanChannelInfo lowpanChannelInfo = new LowpanChannelInfo(); lowpanChannelInfo.Channel = (byte)energyScan[0]; lowpanChannelInfo.Rssi = (sbyte)energyScan[1]; scanEnergyResult.Add(lowpanChannelInfo); return; } if (frameData.TID == 0x80) { switch (properyId) { case SpinelProperties.SPINEL_PROP_NET_ROLE: State newRole = (State)Convert.ToByte(frameData.Response); if (state != newRole) { state = newRole; OnLowpanStateChanged(); } break; case SpinelProperties.SPINEL_PROP_IPV6_LL_ADDR: if (frameData.Response == null) { ipLinkLocal = null; return; } SpinelIPv6Address ipaddrLL = (SpinelIPv6Address)frameData.Response; ipLinkLocal = new IPv6Address(ipaddrLL.bytes); if (OnIpChanged != null) { OnIpChanged(); } break; case SpinelProperties.SPINEL_PROP_IPV6_ML_ADDR: if (frameData.Response == null) { ipMeshLocal = null; return; } SpinelIPv6Address ipaddrML = (SpinelIPv6Address)frameData.Response; ipMeshLocal = new IPv6Address(ipaddrML.bytes); break; case SpinelProperties.SPINEL_PROP_IPV6_ADDRESS_TABLE: ipAddresses = NetUtilities.SpinelIPtoSystemIP((SpinelIPv6Address[])frameData.Response); break; case SpinelProperties.SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE: ipMulticastAddresses = NetUtilities.SpinelIPtoSystemIP((SpinelIPv6Address[])frameData.Response); break; //case SpinelProperties.PROP_NET_SAVED: //case SpinelProperties.PROP_NET_IF_UP: // break; //case SpinelProperties.PROP_NET_STACK_UP: // break; //case SpinelProperties.PROP_NET_NETWORK_NAME: //case SpinelProperties.PROP_NET_XPANID: //case SpinelProperties.PROP_NET_MASTER_KEY: //case SpinelProperties.PROP_NET_KEY_SEQUENCE_COUNTER: //case SpinelProperties.PROP_NET_PARTITION_ID: //case SpinelProperties.PROP_NET_KEY_SWITCH_GUARDTIME: // break; //case SpinelProperties.SPINEL_PROP_THREAD_LEADER_ADDR: //case SpinelProperties.SPINEL_PROP_THREAD_PARENT: //case SpinelProperties.SPINEL_PROP_THREAD_CHILD_TABLE: //case SpinelProperties.SPINEL_PROP_THREAD_LEADER_RID: //case SpinelProperties.SPINEL_PROP_THREAD_LEADER_WEIGHT: //case SpinelProperties.SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT: //case SpinelProperties.SPINEL_PROP_THREAD_NETWORK_DATA: //case SpinelProperties.SPINEL_PROP_THREAD_NETWORK_DATA_VERSION: //case SpinelProperties.SPINEL_PROP_THREAD_STABLE_NETWORK_DATA: //case SpinelProperties.SPINEL_PROP_THREAD_STABLE_NETWORK_DATA_VERSION: //case SpinelProperties.SPINEL_PROP_THREAD_ASSISTING_PORTS: //case SpinelProperties.SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE: //case SpinelProperties.SPINEL_PROP_THREAD_MODE: // break; //case SpinelProperties.SPINEL_PROP_THREAD_ON_MESH_NETS: // break; //case SpinelProperties.SPINEL_PROP_THREAD_OFF_MESH_ROUTES: // break; //case SpinelProperties.SPINEL_PROP_IPV6_ML_PREFIX: // break; //case SpinelProperties.SPINEL_PROP_IPV6_ROUTE_TABLE: //case SpinelProperties.SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD: //case SpinelProperties.SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD_MODE: // break; //case SpinelProperties.SPINEL_PROP_THREAD_CHILD_TIMEOUT: //case SpinelProperties.SPINEL_PROP_THREAD_RLOC16: //case SpinelProperties.SPINEL_PROP_THREAD_ROUTER_UPGRADE_THRESHOLD: //case SpinelProperties.SPINEL_PROP_THREAD_CONTEXT_REUSE_DELAY: //case SpinelProperties.SPINEL_PROP_THREAD_NETWORK_ID_TIMEOUT: //case SpinelProperties.SPINEL_PROP_THREAD_ACTIVE_ROUTER_IDS: //case SpinelProperties.SPINEL_PROP_THREAD_RLOC16_DEBUG_PASSTHRU: //case SpinelProperties.SPINEL_PROP_THREAD_ROUTER_ROLE_ENABLED: //case SpinelProperties.SPINEL_PROP_THREAD_ROUTER_DOWNGRADE_THRESHOLD: //case SpinelProperties.SPINEL_PROP_THREAD_ROUTER_SELECTION_JITTER: //case SpinelProperties.SPINEL_PROP_THREAD_PREFERRED_ROUTER_ID: //case SpinelProperties.SPINEL_PROP_THREAD_CHILD_COUNT_MAX: // break; //case SpinelProperties.SPINEL_PROP_THREAD_NEIGHBOR_TABLE: // break; //case SpinelProperties.SPINEL_PROP_THREAD_LEADER_NETWORK_DATA: // break; //case SpinelProperties.SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL: //case SpinelProperties.SPINEL_PROP_CHANNEL_MANAGER_DELAY: //case SpinelProperties.SPINEL_PROP_CHANNEL_MANAGER_SUPPORTED_CHANNELS: //case SpinelProperties.SPINEL_PROP_CHANNEL_MANAGER_FAVORED_CHANNELS: //case SpinelProperties.SPINEL_PROP_CHANNEL_MANAGER_CHANNEL_SELECT: //case SpinelProperties.SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_ENABLED: //case SpinelProperties.SPINEL_PROP_CHANNEL_MANAGER_AUTO_SELECT_INTERVAL: //case SpinelProperties.SPINEL_PROP_THREAD_NETWORK_TIME: //case SpinelProperties.SPINEL_PROP_TIME_SYNC_PERIOD: //case SpinelProperties.SPINEL_PROP_TIME_SYNC_XTAL_THRESHOLD: //case SpinelProperties.SPINEL_PROP_CHILD_SUPERVISION_INTERVAL: //case SpinelProperties.SPINEL_PROP_CHILD_SUPERVISION_CHECK_TIMEOUT: //case SpinelProperties.SPINEL_PROP_RCP_VERSION: //case SpinelProperties.SPINEL_PROP_SLAAC_ENABLED: // break; //case SpinelProperties.SPINEL_PROP_PARENT_RESPONSE_INFO: // break; //case SpinelProperties.PROP_LAST_STATUS: // LastStatus lastStatus = (LastStatus)Convert.ToInt32(frameData.Response); // OnLastStatusHandler(lastStatus); // break; default: break; } } }