Ejemplo n.º 1
0
 /// <summary>
 /// Executes the DELETE method on the resource.
 /// </summary>
 /// <param name="Request">CoAP Request</param>
 /// <param name="Response">CoAP Response</param>
 /// <exception cref="CoapException">If an error occurred when processing the method.</exception>
 public void DELETE(CoapMessage Request, CoapResponse Response)
 {
     if (this.Object.Client.State == Lwm2mState.Bootstrap &&
         this.Object.Client.IsFromBootstrapServer(Request))
     {
         Task T = this.DeleteBootstrapInfo();
         Response.ACK(CoapCode.Deleted);
     }
     else
     {
         Response.RST(CoapCode.Unauthorized);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Executes the DELETE method on the resource.
        /// </summary>
        /// <param name="Request">CoAP Request</param>
        /// <param name="Response">CoAP Response</param>
        /// <exception cref="CoapException">If an error occurred when processing the method.</exception>
        public void DELETE(CoapMessage Request, CoapResponse Response)
        {
            if (this.state != Lwm2mState.Bootstrap)
            {
                if (this.IsFromBootstrapServer(Request))
                {
                    this.State = Lwm2mState.Bootstrap;
                }
                else
                {
                    Response.RST(CoapCode.Unauthorized);
                    return;
                }
            }

            Task T = this.DeleteBootstrapInfo();

            Response.ACK(CoapCode.Deleted);
        }