コード例 #1
0
        /// <summary>
        /// If payload type is HMeasure.
        /// </summary>
        /// <returns>The payload of HMeasure type.</returns>
        public HMeasure GetPayloadAsHMeasure()
        {
            HMeasure payload = null;

            try
            {
                payload = new HMeasure(JObject.Parse(this["payload"].ToString()));
            }
            catch (Exception e)
            {
                Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString());
            }
            return(payload);
        }
コード例 #2
0
 public void SetPayload(HMeasure 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());
     }
 }
コード例 #3
0
ファイル: HClient.cs プロジェクト: RMani/hubiquitus4w8
 public HMessage BuildMessage(string actor, string type, HMeasure payload, HMessageOptions mOptions)
 {
     return InnerBuildMessage(actor, type, payload, mOptions);
 }
コード例 #4
0
ファイル: HClient.cs プロジェクト: RMani/hubiquitus4w8
        /// <summary>
        /// The client MUST be connected to access to this service.
        /// Allow a hubapp client to create a hMessage with a hMeasure payload.
        /// </summary>
        /// <param name="actor"></param>
        /// <param name="value"></param>
        /// <param name="unit"></param>
        /// <param name="mOptions"></param>
        /// <returns></returns>
        public HMessage BuildMeasure(string actor, string value, string unit, HMessageOptions mOptions)
        {
            if (actor == null || actor.Length <= 0)
                    throw new MissingAttrException("actor");
                if (value == null || value.Length <= 0)
                    throw new MissingAttrException("value");
                if (unit == null || unit.Length <= 0)
                    throw new MissingAttrException("unit");

                HMeasure hmeasure = new HMeasure();
                hmeasure.SetUnit(unit);
                hmeasure.SetValue(value);

                HMessage message = BuildMessage(actor, "hMeasure", hmeasure, mOptions);
                return message;
        }
コード例 #5
0
 public void SetPayload(HMeasure 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());
     }
 }
コード例 #6
0
 /// <summary>
 /// If payload type is HMeasure.
 /// </summary>
 /// <returns>The payload of HMeasure type.</returns>
 public HMeasure GetPayloadAsHMeasure()
 {
     HMeasure payload = null;
     try
     {
         payload = new HMeasure(JObject.Parse(this["payload"].ToString()));
     }
     catch (Exception e)
     {
         Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString());
     }
     return payload;
 }