public virtual IEnumerator <ITask> SubscribeHandler(Subscribe subscribe) { SubscribeRequest request = subscribe.Body; Console.WriteLine("SubscribeHandler() received Subscription request from Subscriber=" + subscribe.Body.Subscriber + " for: " + request.MessageTypes); submgr.InsertSubscription insert = new submgr.InsertSubscription(request); insert.Body.FilterType = submgr.FilterType.Default; string valid = request.ValidOnly ? "True" : null; List <submgr.QueryType> query = new List <submgr.QueryType>(); if (request.MessageTypes == ChrMessageType.All || request.MessageTypes == ChrMessageType.None) { if (request.ValidOnly) { query.Add(new submgr.QueryType(null, valid)); } } else { // Subscriber supplied a bitmask requesting certain UM6 messages: if ((request.MessageTypes & ChrMessageType.GYRO_PROC) != 0) { query.Add(new submgr.QueryType(Tag_GYRO_PROC, valid)); } if ((request.MessageTypes & ChrMessageType.ACCEL_PROC) != 0) { query.Add(new submgr.QueryType(Tag_ACCEL_PROC, valid)); } if ((request.MessageTypes & ChrMessageType.MAG_PROC) != 0) { query.Add(new submgr.QueryType(Tag_MAG_PROC, valid)); } if ((request.MessageTypes & ChrMessageType.EULER) != 0) { query.Add(new submgr.QueryType(Tag_EULER, valid)); } if ((request.MessageTypes & ChrMessageType.QUAT) != 0) { query.Add(new submgr.QueryType(Tag_QUAT, valid)); } // add more types here to the query } if (query.Count > 0) { insert.Body.QueryList = query.ToArray(); } _subMgrPort.Post(insert); yield return(Arbiter.Choice( insert.ResponsePort, subscribe.ResponsePort.Post, subscribe.ResponsePort.Post )); }
/// <summary> /// Creates a new instance of Subscribe /// </summary> /// <param name="body">the request message body</param> /// <param name="responsePort">the response port for the request</param> public Subscribe(SubscribeRequest body, PortSet <SubscribeResponseType, Fault> responsePort) : base(body, responsePort) { }
/// <summary> /// Creates a new instance of Subscribe /// </summary> /// <param name="body">the request message body</param> public Subscribe(SubscribeRequest body) : base(body) { }