Exemple #1
0
        /// <summary>
        /// If payload type is HAck.
        /// </summary>
        /// <returns>The payload of HAck type.</returns>
        public HAck GetPayloadAsHAck()
        {
            HAck payload = null;

            try
            {
                payload = new HAck(JObject.Parse(this["payload"].ToString()));
            }
            catch (Exception e)
            {
                Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString());
            }
            return(payload);
        }
Exemple #2
0
 public void SetPayload(HAck payload)
 {
     try
     {
         if (payload == null)
         {
             this.Remove("payload");
         }
         else
         {
             this["payload"] = payload;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the payload attribute", e.ToString());
     }
 }
Exemple #3
0
 public HMessage BuildMessage(string actor, string type, HAck payload, HMessageOptions mOptions)
 {
     return InnerBuildMessage(actor, type, payload, mOptions);
 }
Exemple #4
0
        //HAckValue à faire
        /// <summary>
        /// The client MUST be connected to access to this service.
        /// Allow a hubapp client to create a hMessage with a hAck payload.
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="ref"></param>
        /// <param name="ackValue">
        /// The following values are authorized :
        /// “recv” / HAckValue.RECV : means that the message has been received by the participant (on at least one of its devices)
        /// “read” / HAckValue.READ : means that the message has been read by the participant
        /// </param>
        /// <param name="mOptions"></param>
        /// <returns></returns>
        public HMessage BuildAck(string actor, string @ref, string ackValue, HMessageOptions mOptions)
        {
            if (actor == null || actor.Length <= 0)
                throw new MissingAttrException("actor");
            if (@ref == null || @ref.Length <= 0)
                throw new MissingAttrException("ref");
            if (ackValue == null)
                throw new MissingAttrException("ack");
            if (HUtil.CheckAck(ackValue))
                throw new Exception("only 'recv' and 'read' are authorized for ack");

            HAck hack = new HAck();
            hack.SetAck(ackValue);
            if (mOptions == null)
                mOptions = new HMessageOptions();
            mOptions.Ref = @ref;
            HMessage message = BuildMessage(actor, "hAck", hack, mOptions);
            return message;
        }
 public void SetPayload(HAck payload)
 {
     try
     {
         if (payload == null)
         {
             this.Remove("payload");
         }
         else
         {
             this["payload"] = payload;
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the payload attribute", e.ToString());
     }
 }
 /// <summary>
 /// If payload type is HAck.
 /// </summary>
 /// <returns>The payload of HAck type.</returns>
 public HAck GetPayloadAsHAck()
 {
     HAck payload = null;
     try
     {
         payload = new HAck(JObject.Parse(this["payload"].ToString()));
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString());
     }
     return payload;
 }