internal bool Register(Lwm2mClient Client) { if (!this.shortServerId.IntegerValue.HasValue) { return(false); } Lwm2mSecurityObjectInstance SecurityInfo = Client.GetSecurityInfo( (ushort)this.shortServerId.IntegerValue.Value); if (SecurityInfo is null) { return(false); } Lwm2mServerReference Ref = SecurityInfo.GetServerReference(false); if (Ref is null) { return(false); } Client.Register(this.lifetimeSeconds.IntegerValue.HasValue ? (int)this.lifetimeSeconds.IntegerValue.Value : 86400, Ref); return(true); }
/// <summary> /// Called after the resource has been registered on a CoAP Endpoint. /// </summary> /// <param name="Client">LWM2M Client</param> public virtual void AfterRegister(Lwm2mClient Client) { foreach (Lwm2mResource Resource in this.Resources) { Client.CoapEndpoint.Register(Resource); Resource.AfterRegister(); } try { this.OnAfterRegister?.Invoke(this, new EventArgs()); } catch (Exception ex) { Log.Critical(ex); } }
/// <summary> /// Called after the resource has been registered on a CoAP Endpoint. /// </summary> /// <param name="Client">LWM2M Client</param> public override void AfterRegister(Lwm2mClient Client) { base.AfterRegister(Client); this.TriggerAll(new TimeSpan(0, 0, 1)); }
public BootstreapResource(Lwm2mClient Client) : base("/bs") { this.client = Client; }