public static void HandleParamsReport(Wlan.WlanNotificationData notifyData) { NativeWifi.WlanClient.WlanInterface wlanIface = null;// = GenericInfo.WlanInterface; foreach (NativeWifi.WlanClient.WlanInterface wli in Information.GenericInfo.ClientInstance.Interfaces) { if (wli.InterfaceGuid == notifyData.interfaceGuid) { if (wli.NetworkInterface.GetPhysicalAddress().Equals(PhysicalAddress.Parse(Program.MAC.Replace(":", "-").ToUpper()))) //Event filtering { wlanIface = wli; } } } if (wlanIface != null) { ConnectionHelper ch = Program.toMihf; ID myLinkID = new ID(new OctetString(GenericInfo.myID)); ID mihfID = new ID(new OctetString(GenericInfo.mihfID)); if (Subscriptions.List.Link_Parameters_Report) //Generic subscription { ch.Send(MessageBuilders.Link_Parameters_Report_Indication_MsgBuilder( myLinkID, mihfID, wlanIface.CurrentConnection.wlanAssociationAttributes.Dot11Bssid, wlanIface.CurrentConnection.wlanAssociationAttributes.dot11Ssid.SSID, Link_Param_Abs_Type.GEN_Sig_Strenth, Link_Param_Gen.SignalStrength_1).ByteValue); } Reports.CheckThresholds(Link_Param_Abs_Type.GEN_Sig_Strenth, (int)wlanIface.RSSI); } }
public static void PeriodicReport(Object stateInfo) { Console.WriteLine("Periodic report called"); Link_Param_Abs_Type lpat = (Link_Param_Abs_Type)stateInfo; Console.WriteLine("Reporting param type " + lpat); switch (lpat) { case Link_Param_Abs_Type.GEN_Sig_Strenth: Program.toMihf.Send(MessageBuilders.Link_Parameters_Report_Indication_MsgBuilder( new ID(new OctetString(GenericInfo.myID)), new ID(new OctetString(GenericInfo.mihfID)), GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.Dot11Bssid, GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.dot11Ssid.SSID, Link_Param_Abs_Type.GEN_Sig_Strenth, Link_Param_Gen.SignalStrength_1).ByteValue); break; case Link_Param_Abs_Type.GEN_Data_Rate: Program.toMihf.Send(MessageBuilders.Link_Parameters_Report_Indication_MsgBuilder( new ID(new OctetString(GenericInfo.myID)), new ID(new OctetString(GenericInfo.mihfID)), GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.Dot11Bssid, GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.dot11Ssid.SSID, Link_Param_Abs_Type.GEN_Data_Rate, Link_Param_Gen.DataRate_0).ByteValue); break; case Link_Param_Abs_Type.GEN_Packet_Error_Rate: Program.toMihf.Send(MessageBuilders.Link_Parameters_Report_Indication_MsgBuilder( new ID(new OctetString(GenericInfo.myID)), new ID(new OctetString(GenericInfo.mihfID)), GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.Dot11Bssid, GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.dot11Ssid.SSID, Link_Param_Abs_Type.GEN_Packet_Error_Rate, Link_Param_Gen.PacketErrorRate_4).ByteValue); break; //TODO other params } }
public static void CheckThresholds(Link_Param_Abs_Type type, int value) { foreach (ActiveThreshold a in OneShotThresholds) { if (a.Param_Type == type) { if (a.CheckIfCrossed(value)) { Program.toMihf.Send(MessageBuilders.Link_Parameters_Report_Indication_MsgBuilder( new ID(new OctetString(GenericInfo.myID)), new ID(new OctetString(GenericInfo.mihfID)), GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.Dot11Bssid, GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.dot11Ssid.SSID, type, GenericInfo.GetValueForParam(type)).ByteValue); OneShotThresholds.Remove(a); } } } foreach (ActiveThreshold a in ActiveThresholds) { if (a.Param_Type == type) { if (a.CheckIfCrossed(value)) { Program.toMihf.Send(MessageBuilders.Link_Parameters_Report_Indication_MsgBuilder( new ID(new OctetString(GenericInfo.myID)), new ID(new OctetString(GenericInfo.mihfID)), GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.Dot11Bssid, GenericInfo.WlanInterfaceInstance.CurrentConnection.wlanAssociationAttributes.dot11Ssid.SSID, type, GenericInfo.GetValueForParam(type)).ByteValue); } } } }