Ejemplo n.º 1
0
 /// <summary>
 /// Set the status of the acknowledgement.
 /// </summary>
 /// <param name="ack"></param>
 public void SetAck(string ack)
 {
     try
     {
         if (ack == null)
         {
             this.Remove("ack");
         }
         else
         {
             if (HUtil.CheckAck(ack))
             {
                 Debug.WriteLine("{0} : only 'recv' and 'read' are authorized for ack");
             }
             else
             {
                 this["ack"] = ack;
             }
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not update the ack attribute", e.ToString());
     }
 }
Ejemplo n.º 2
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);
        }