/// <summary>
        /// LWM2M Security object instance.
        /// </summary>
        /// <param name="InstanceId">ID of object instance.</param>
        public Lwm2mSecurityObjectInstance(ushort InstanceId)
            : base(0, InstanceId)
        {
            // E.1 LwM2M Object: LwM2M Security
            // http://www.openmobilealliance.org/release/LightweightM2M/V1_0-20170208-A/OMA-TS-LightweightM2M-V1_0-20170208-A.pdf

            this.serverUri                = new Lwm2mResourceString("Server", 0, InstanceId, 0, false, false, null);
            this.bootstrapServer          = new Lwm2mResourceBoolean("BootstrapServer", 0, InstanceId, 1, false, false, null);
            this.securityMode             = new Lwm2mResourceInteger("SecurityMode", 0, InstanceId, 2, false, false, null, false);
            this.publicKeyOrIdentity      = new Lwm2mResourceOpaque(null, 0, InstanceId, 3, false, false, null);
            this.serverPublicKey          = new Lwm2mResourceOpaque(null, 0, InstanceId, 4, false, false, null);
            this.secretKey                = new Lwm2mResourceOpaque(null, 0, InstanceId, 5, false, false, null);
            this.shortServerId            = new Lwm2mResourceInteger("ShortServerId", 0, InstanceId, 10, false, false, null, false);
            this.clientHoldOffTimeSeconds = new Lwm2mResourceInteger("ClientHoldOffTimeSeconds", 0, InstanceId, 11, false, false, null, false);

            this.serverUri.OnBeforeGet                += CheckFromBootstrapServer;
            this.bootstrapServer.OnBeforeGet          += CheckFromBootstrapServer;
            this.securityMode.OnBeforeGet             += CheckFromBootstrapServer;
            this.publicKeyOrIdentity.OnBeforeGet      += CheckFromBootstrapServer;
            this.serverPublicKey.OnBeforeGet          += CheckFromBootstrapServer;
            this.secretKey.OnBeforeGet                += CheckFromBootstrapServer;
            this.shortServerId.OnBeforeGet            += CheckFromBootstrapServer;
            this.clientHoldOffTimeSeconds.OnBeforeGet += CheckFromBootstrapServer;

            this.Add(this.serverUri);
            this.Add(this.bootstrapServer);
            this.Add(this.securityMode);
            this.Add(this.publicKeyOrIdentity);
            this.Add(this.serverPublicKey);
            this.Add(this.secretKey);
            this.Add(new Lwm2mResourceNotSupported(0, InstanceId, 6));              // SMS Security Mode
            this.Add(new Lwm2mResourceNotSupported(0, InstanceId, 7));              // SMS Binding Key Parameters
            this.Add(new Lwm2mResourceNotSupported(0, InstanceId, 8));              // SMS Binding Secret Key(s)
            this.Add(new Lwm2mResourceNotSupported(0, InstanceId, 9));              // LwM2M Server SMS Number
            this.Add(this.shortServerId);
            this.Add(this.clientHoldOffTimeSeconds);
            this.Add(new Lwm2mResourceNotSupported(0, InstanceId, 12));             //  BootstrapServer Account Timeout
        }
Beispiel #2
0
        /// <summary>
        /// LWM2M Server object instance.
        /// </summary>
        /// <param name="InstanceId">ID of object instance.</param>
        public Lwm2mServerObjectInstance(ushort InstanceId)
            : base(1, InstanceId)
        {
            // E.2 LwM2M Object: LwM2M Server
            // http://www.openmobilealliance.org/release/LightweightM2M/V1_0-20170208-A/OMA-TS-LightweightM2M-V1_0-20170208-A.pdf

            this.shortServerId             = new Lwm2mResourceInteger("ShortServerId", 1, InstanceId, 0, false, false, null, false);
            this.lifetimeSeconds           = new Lwm2mResourceInteger("LifetimeSeconds", 1, InstanceId, 1, true, false, null, false);
            this.notificationStoring       = new Lwm2mResourceBoolean("NotificationStoring", 1, InstanceId, 6, true, false, null);
            this.binding                   = new Lwm2mResourceString("Binding", 1, InstanceId, 7, true, false, null);
            this.registrationUpdateTrigger = new Lwm2mResourceCommand("RegistrationUpdateTrigger", 1, InstanceId, 8);

            this.registrationUpdateTrigger.OnExecute += RegistrationUpdateTrigger_OnExecute;

            this.Add(this.shortServerId);
            this.Add(this.lifetimeSeconds);
            this.Add(new Lwm2mResourceNotSupported(1, InstanceId, 2));              // Default Minimum Period
            this.Add(new Lwm2mResourceNotSupported(1, InstanceId, 3));              // Default Maximum Period
            this.Add(new Lwm2mResourceNotSupported(1, InstanceId, 4));              // Disable
            this.Add(new Lwm2mResourceNotSupported(1, InstanceId, 5));              // Disable Timeout
            this.Add(this.notificationStoring);
            this.Add(this.binding);
            this.Add(this.registrationUpdateTrigger);
        }