コード例 #1
0
ファイル: HClient.cs プロジェクト: sunchenliang/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);
        }