/// <summary> /// This method is called to handle a Threshold configuration request message /// </summary> /// <param name="m">The serialized Config_Thresholds message</param> public static void HandleConfigThresholds(Message m) { ConnectionHelper ch = Program.toMihf; ushort transactionID = m.MIHHeader.TransactionID; Payload.TLVIterator it = m.Payload.GetTLVIterator(); ID srcID = new ID(new OctetString(it.Next().Value)); ID dstID = new ID(new OctetString(it.Next().Value)); List <Link_Cfg_Param> lcparams = MIHDeserializer.DeserializeLinkCfgParamList(it.Next()); List <Link_Cfg_Status> lcstatus = new List <Link_Cfg_Status>(); foreach (Link_Cfg_Param param in lcparams) { if (param.Timer_Interval > 0 && param.Th_Action != TH_Action.CANCEL_THRESHOLD) { Reports.TimedReports.Add(new TimedReport(param.Link_Param_Type.AbsoluteType, param.Timer_Interval)); } switch (param.Th_Action) { case TH_Action.ONE_SHOT_THRESHOLD: foreach (Threshold t in param.ThresholdList) { try { Reports.OneShotThresholds.Add(new ActiveThreshold(t, param.Link_Param_Type.AbsoluteType)); lcstatus.Add(new Link_Cfg_Status(param.Link_Param_Type, t, true)); } catch (Exception e) { lcstatus.Add(new Link_Cfg_Status(param.Link_Param_Type, t, false)); } } break; case TH_Action.NORMAL_THRESHOLD: foreach (Threshold t in param.ThresholdList) { try { Reports.ActiveThresholds.Add(new ActiveThreshold(t, param.Link_Param_Type.AbsoluteType)); lcstatus.Add(new Link_Cfg_Status(param.Link_Param_Type, t, true)); } catch (Exception e) { lcstatus.Add(new Link_Cfg_Status(param.Link_Param_Type, t, false)); } } break; case TH_Action.CANCEL_THRESHOLD: Reports.Cancel(param); //TODO MORE break; } } ch.Send(ResponseBuilders.Configure_Thresholds_Response_Builder(dstID, srcID, m.MIHHeader.TransactionID, new Link_Configure_Thresholds_Confirm(STATUS.SUCCESS, lcstatus)).ByteValue); }