Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /// <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);
            }
        }
Ejemplo n.º 3
0
 /// <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));
 }
Ejemplo n.º 4
0
 public BootstreapResource(Lwm2mClient Client)
     : base("/bs")
 {
     this.client = Client;
 }