/// <summary> /// Executes the PUT 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 PUT(CoapMessage Request, CoapResponse Response) { if (this.Client.State == Lwm2mState.Bootstrap && this.Client.IsFromBootstrapServer(Request)) { if (!string.IsNullOrEmpty(Request.SubPath) && ushort.TryParse(Request.SubPath.Substring(1), out ushort InstanceId)) { Lwm2mSecurityObjectInstance Instance = new Lwm2mSecurityObjectInstance(InstanceId); this.Add(Instance); this.Client.Endpoint.Register(Instance); Instance.AfterRegister(this.Client); Request.Path += Request.SubPath; Request.SubPath = string.Empty; Instance.PUT(Request, Response); } else { Response.RST(CoapCode.BadRequest); } } else { Response.RST(CoapCode.Unauthorized); } }