internal IndividualEnrollment(
            string registrationId,
            AttestationMechanism attestation,
            string deviceId,
            string iotHubHostName,
            TwinState initialTwinState,
            ProvisioningStatus?provisioningStatus,
            DateTime createdDateTimeUtc,
            DateTime lastUpdatedDateTimeUtc,
            string eTag,
            DeviceCapabilities capabilities)
        {
            if (attestation == null)
            {
                throw new ProvisioningServiceClientException("Service respond an individualEnrollment without attestation.");
            }

            try
            {
                RegistrationId         = registrationId;
                DeviceId               = deviceId;
                Attestation            = attestation.GetAttestation();
                IotHubHostName         = iotHubHostName;
                InitialTwinState       = initialTwinState;
                ProvisioningStatus     = provisioningStatus;
                CreatedDateTimeUtc     = createdDateTimeUtc;
                LastUpdatedDateTimeUtc = lastUpdatedDateTimeUtc;
                ETag         = eTag;
                Capabilities = capabilities;
            }
            catch (ArgumentException e)
            {
                throw new ProvisioningServiceClientException(e);
            }
        }
        private static DeviceRoles ReduceRolesToComplyWith(DeviceCapabilities capabilities, DeviceRoles roles)
        {
            var allowed = DeviceRoles.None;

            if ((capabilities & DeviceCapabilities.ControlKeypad) != 0)
            {
                allowed |= DeviceRoles.Keypad;
            }

            if ((capabilities & DeviceCapabilities.StartSensor) != 0 || (capabilities & DeviceCapabilities.TimeSensor) != 0)
            {
                allowed |= DeviceRoles.StartTimer;
            }

            if ((capabilities & DeviceCapabilities.IntermediateSensor) != 0 || (capabilities & DeviceCapabilities.TimeSensor) != 0)
            {
                allowed |= IntermediateTimers;
            }

            if ((capabilities & DeviceCapabilities.FinishSensor) != 0 || (capabilities & DeviceCapabilities.TimeSensor) != 0)
            {
                allowed |= DeviceRoles.FinishTimer;
            }

            if ((capabilities & DeviceCapabilities.Display) != 0)
            {
                allowed |= DeviceRoles.Display;
            }

            return(roles & allowed);
        }
        public static async Task <EnrollmentGroup> CreateEnrollmentGroupAsync(
            ProvisioningServiceClient provisioningServiceClient,
            AttestationMechanismType attestationType,
            string groupId,
            ReprovisionPolicy reprovisionPolicy,
            AllocationPolicy allocationPolicy,
            CustomAllocationDefinition customAllocationDefinition,
            ICollection <string> iothubs,
            DeviceCapabilities capabilities,
            MsTestLogger logger)
        {
            Attestation attestation;

            switch (attestationType)
            {
            case AttestationMechanismType.Tpm:
                throw new NotSupportedException("Group enrollments do not support tpm attestation");

            case AttestationMechanismType.SymmetricKey:
                string primaryKey   = CryptoKeyGenerator.GenerateKey(32);
                string secondaryKey = CryptoKeyGenerator.GenerateKey(32);
                attestation = new SymmetricKeyAttestation(primaryKey, secondaryKey);
                break;

            case AttestationMechanismType.X509:
            default:
                throw new NotSupportedException("Test code has not been written for testing this attestation type yet");
            }

            var enrollmentGroup = new EnrollmentGroup(groupId, attestation)
            {
                Capabilities               = capabilities,
                ReprovisionPolicy          = reprovisionPolicy,
                AllocationPolicy           = allocationPolicy,
                CustomAllocationDefinition = customAllocationDefinition,
                IotHubs = iothubs,
            };

            EnrollmentGroup createdEnrollmentGroup = null;
            await RetryOperationHelper
            .RetryOperationsAsync(
                async() =>
            {
                createdEnrollmentGroup = await provisioningServiceClient.CreateOrUpdateEnrollmentGroupAsync(enrollmentGroup).ConfigureAwait(false);
            },
                s_provisioningServiceRetryPolicy,
                s_retryableExceptions,
                logger)
            .ConfigureAwait(false);

            if (createdEnrollmentGroup == null)
            {
                throw new ArgumentException($"The enrollment entry with group Id {groupId} could not be created, exiting test.");
            }

            return(createdEnrollmentGroup);
        }
Ejemplo n.º 4
0
        public static IEnumerable <string> ToServiceCapabilities(this DeviceCapabilities capabilities)
        {
            Preconditions.CheckNotNull(capabilities, nameof(capabilities));
            var serviceCapabilities = new List <string>();

            if (capabilities.IotEdge)
            {
                serviceCapabilities.Add(Constants.IotEdgeIdentityCapability);
            }
            return(serviceCapabilities);
        }
Ejemplo n.º 5
0
 public Device(string ID, string friendlyname, EDeviceClass dclass, EDeviceProtocol proto, 
     DeviceCapabilities caps, Dictionary<string,string> args)
 {
     mParent = null;
     mID = ID;
     mFriendly = friendlyname;
     mProto = proto;
     mCaps = caps;
     mClass = dclass;
     mArgs = args;
 }
Ejemplo n.º 6
0
        private void initAllDevComp()
        {
            fpc    = new FunctionParameterCollection();
            devCap = new DeviceCapabilities();

            dev          = new Device();
            devcol       = new DeviceCollection();
            devEventColl = new DeviceEventCollection();
            devfuncColl  = new DeviceFunctionCollection();
            devPropColl  = new DevicePropertyCollection();
            devevent     = new DeviceEvent();
            devFunc      = new DeviceFunction();
            devProp      = new DeviceProperty();
        }
        public void When_notify_status_operation_is_received_it_must_raise_event_for_added_device()
        {
            // Arrange
            var        deviceAddress = new WirelessNetworkAddress("AABBCC");
            const bool getMembership = true;

            const DeviceCapabilities capabilities = DeviceCapabilities.ControlKeypad | DeviceCapabilities.NumericKeypad | DeviceCapabilities.StartSensor |
                                                    DeviceCapabilities.FinishSensor | DeviceCapabilities.IntermediateSensor;

            const DeviceRoles roles          = DeviceRoles.StartTimer | DeviceRoles.FinishTimer;
            const int         signalStrength = 25;
            const int         batteryStatus  = 83;
            const bool        isAligned      = true;
            const ClockSynchronizationStatus clockSynchronization = ClockSynchronizationStatus.RequiresSync;
            const bool hasVersionMismatch = false;

            using var testRunner = new CirceUsbLoopbackTestRunner <DeviceStatus>();

            testRunner.RemoteSessionManager.ConnectionStateChanged += (_, e) =>
            {
                if (e.State == ControllerConnectionState.Connected)
                {
                    testRunner.Connection.Send(new NotifyStatusOperation(deviceAddress, getMembership, capabilities, roles, signalStrength)
                    {
                        BatteryStatus        = batteryStatus,
                        IsAligned            = isAligned,
                        ClockSynchronization = clockSynchronization,
                        HasVersionMismatch   = false
                    });
                }
            };

            testRunner.RemoteSessionManager.DeviceTracker.DeviceAdded += (_, e) => testRunner.SignalSucceeded(e.Argument);

            // Act
            bool succeeded = testRunner.Start();

            // Assert
            succeeded.Should().Be(true, "<USB loopback cable must be connected and COM port must be correct.>");
            testRunner.Result.ShouldNotBeNull();
            testRunner.Result.DeviceAddress.Should().Be(deviceAddress);
            testRunner.Result.IsInNetwork.Should().Be(getMembership);
            testRunner.Result.Capabilities.Should().Be(capabilities);
            testRunner.Result.Roles.Should().Be(roles);
            testRunner.Result.SignalStrength.Should().Be(signalStrength);
            testRunner.Result.BatteryStatus.Should().Be(batteryStatus);
            testRunner.Result.IsAligned.Should().Be(isAligned);
            testRunner.Result.ClockSynchronization.Should().Be(clockSynchronization);
            testRunner.Result.HasVersionMismatch.Should().Be(hasVersionMismatch);
        }
        public DeviceStatus(WirelessNetworkAddress deviceAddress, bool isInNetwork, DeviceCapabilities capabilities, DeviceRoles roles, int signalStrength,
                            int?batteryStatus, bool?isAligned, ClockSynchronizationStatus?clockSynchronization, bool?hasVersionMismatch)
        {
            Guard.NotNull(deviceAddress, nameof(deviceAddress));

            DeviceAddress        = deviceAddress;
            IsInNetwork          = isInNetwork;
            Capabilities         = capabilities;
            Roles                = ReduceRolesToComplyWith(capabilities, roles);
            SignalStrength       = signalStrength;
            BatteryStatus        = batteryStatus;
            IsAligned            = isAligned;
            ClockSynchronization = clockSynchronization;
            HasVersionMismatch   = hasVersionMismatch;
        }
Ejemplo n.º 9
0
    /// <summary>
    /// This method checks if the access token is already present, and calls GetDeviceCapabilities() of RequestFactory.
    /// Else, it redirects the user to get the OAuth consent.
    /// </summary>
    private void GetDeviceCapabilities()
    {
        if (null != Session["CSDC_ACCESS_TOKEN"])
        {
            this.requestFactory.AuthorizeCredential = (OAuthToken)Session["CSDC_ACCESS_TOKEN"];
        }

        if (this.requestFactory.AuthorizeCredential == null)
        {
            Response.Redirect(this.requestFactory.GetOAuthRedirect().ToString());
        }

        DeviceCapabilities deviceCapabilities = this.requestFactory.GetDeviceCapabilities();

        this.DisplayDeviceCapabilities(deviceCapabilities);
    }
Ejemplo n.º 10
0
 public EdgeHubScopeDevice(
     string deviceId,
     string generationId,
     DeviceStatus status,
     AuthenticationMechanism authentication,
     DeviceCapabilities capabilities,
     string deviceScope,
     IEnumerable <string> parentScopes)
 {
     this.Id             = Preconditions.CheckNonWhiteSpace(deviceId, nameof(deviceId));
     this.GenerationId   = Preconditions.CheckNonWhiteSpace(generationId, nameof(generationId));
     this.Status         = Preconditions.CheckNotNull(status);
     this.Authentication = Preconditions.CheckNotNull(authentication);
     this.Capabilities   = Preconditions.CheckNotNull(capabilities);
     this.Scope          = deviceScope;
     this.ParentScopes   = parentScopes;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaPicker" /> class.
        /// </summary>
        public MediaPicker()
        {
            //if (!DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_MEDIALIB_PHOTO))
            //{
            //    throw new UnauthorizedAccessException(string.Format("Access to MediaPicker requires {0} to be defined in the manifest.", DeviceCapabilities.Capability.ID_CAP_MEDIALIB_PHOTO));
            //}

            _photoChooser.Completed  += InternalOnPhotoChosen;
            _cameraCapture.Completed += InternalOnPhotoChosen;

            _photoChooser.ShowCamera = false;

            IsCameraAvailable =             //DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_ISV_CAMERA) &&
                                (Camera.IsCameraTypeSupported(CameraType.Primary) || Camera.IsCameraTypeSupported(CameraType.FrontFacing));

            IsPhotosSupported = DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.IdCapMedialibPhoto);
            IsVideosSupported = IsCameraAvailable;
        }
 /// <summary>
 /// This method displays the Device Capabilities.
 /// </summary>
 /// <param name="deviceCapabilities">Device Capabilities</param>
 private void DisplayDeviceCapabilities(DeviceCapabilities deviceCapabilities)
 {
     if (null != deviceCapabilities)
     {
         lblTypeAllocationCode.Text = deviceCapabilities.deviceId.TypeAllocationCode;
         lblName.Text                 = deviceCapabilities.capabilities.Name;
         lblVendor.Text               = deviceCapabilities.capabilities.Vendor;
         lblModel.Text                = deviceCapabilities.capabilities.Model;
         lblFirmwareVersion.Text      = deviceCapabilities.capabilities.FirmwareVersion;
         lblUAProf.Text               = deviceCapabilities.capabilities.UaProf;
         lblMMSCapable.Text           = deviceCapabilities.capabilities.MmsCapable;
         lblAssistedGps.Text          = deviceCapabilities.capabilities.AssistedGps;
         lblLocationTechnology.Text   = deviceCapabilities.capabilities.LocationTechnology;
         lblDeviceBrowser.Text        = deviceCapabilities.capabilities.DeviceBrowser;
         lblWAPPush.Text              = deviceCapabilities.capabilities.WapPushCapable;
         tb_dc_output.Visible         = true;
         tbDeviceCapabilities.Visible = true;
     }
 }
        internal IndividualEnrollment(
            string registrationId,
            AttestationMechanism attestation,
            string deviceId,
            string iotHubHostName,
            TwinState initialTwinState,
            ProvisioningStatus?provisioningStatus,
            DateTime createdDateTimeUtc,
            DateTime lastUpdatedDateTimeUtc,
            string eTag,
            DeviceCapabilities capabilities)
        {
            /* SRS_INDIVIDUAL_ENROLLMENT_21_003: [The constructor shall throws ProvisioningServiceClientException if one of the
             *                                      provided parameters in JSON is not valid.] */
            if (attestation == null)
            {
                throw new ProvisioningServiceClientException("Service respond an individualEnrollment without attestation.");
            }

            try
            {
                /* SRS_INDIVIDUAL_ENROLLMENT_21_004: [The constructor shall store all parameters in the JSON.] */
                RegistrationId         = registrationId;
                DeviceId               = deviceId;
                Attestation            = attestation.GetAttestation();
                IotHubHostName         = iotHubHostName;
                InitialTwinState       = initialTwinState;
                ProvisioningStatus     = provisioningStatus;
                CreatedDateTimeUtc     = createdDateTimeUtc;
                LastUpdatedDateTimeUtc = lastUpdatedDateTimeUtc;
                ETag         = eTag;
                Capabilities = capabilities;
            }
            catch (ArgumentException e)
            {
                throw new ProvisioningServiceClientException(e);
            }
        }
        /// <summary>
        /// Initializes a new instance of the HardwareAdapterCapabilities class with the specifed Adapter.
        /// </summary>
        /// <param name="adapter">DirectX Adapter</param>
        public HardwareAdapterCapabilities(Adapter1 adapter)
            : base(adapter: adapter)
        {
            string adapterDescription = AdapterDescription1.Description.Trim();

            int pos = adapterDescription.IndexOf('\0'); // UH: In SharpDX 3.1, some adapters report description with many zero characters

            if (pos >= 0)
            {
                adapterDescription = adapterDescription.Substring(0, pos);
            }

            DisplayName = adapterDescription;

            try
            {
                DeviceCapabilities = DeviceCapabilities.QueryAdapter(adapter);

                DeviceInfoText = string.Format("Feature level: {0}; Video memory: {1:#,##0} MB",
                                               GetFeatureLevelText(DeviceCapabilities.FeatureLevel),
                                               AdapterDescription1.DedicatedVideoMemory / (1024 * 1024));


                IsSupported = this.DeviceCapabilities.FeatureLevel >= FeatureLevel.Level_10_0;

                if (!IsSupported)
                {
                    UnsupportedReason = "Adapter not supported because it does not supported feature level 10.0 or higher";
                }
            }
            catch (Exception ex)
            {
                IsSupported       = false;
                UnsupportedReason = "Error checking device capabilities:\r\n" + ex.Message;
            }
        }
Ejemplo n.º 15
0
        private void StartListening()
        {
            try
            {
                int sampleRate = 6000;
                int fftSize    = SelectedFftSize;
                int stepSize   = fftSize / 20;

                SpectrogamImageSource = null;
                listener?.Dispose();
                listener = new Listener(DeviceCapabilities.IndexOf(selectedDevice), sampleRate);

                spec = new Spectrogram.Spectrogram(sampleRate, fftSize, stepSize);
                spec.SetWindow(FftSharp.Window.Rectangular(fftSize));
                SpectrogramHeight = spec.Height;

                VerticalScaleImageSource = null;
                VerticalScaleImageSource = ImageHelpers.BitmapToImageSource(spec.GetVerticalScale(LEGEND_WIDTH));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exeption when attempting to start to listen: " + ex.Message);
            }
        }
 /// <summary>
 /// Convert capabilities to model
 /// </summary>
 /// <param name="capabilities"></param>
 /// <returns></returns>
 public static DeviceCapabilitiesModel ToModel(this DeviceCapabilities capabilities)
 {
     return(new DeviceCapabilitiesModel {
         IotEdge = capabilities.IotEdge
     });
 }
        private static bool AreCapabilitiesValid(DeviceCapabilities capabilities)
        {
            if (capabilities == DeviceCapabilities.None)
            {
                return false;
            }
            if ((capabilities & DeviceCapabilities.TimeSensor) != 0 && (capabilities != DeviceCapabilities.TimeSensor))
            {
                return false;
            }
            if ((capabilities & DeviceCapabilities.Display) != 0 && (capabilities != DeviceCapabilities.Display))
            {
                return false;
            }

            return true;
        }
Ejemplo n.º 18
0
    /// <summary>
    /// This method invokes DeviceInfo API of AT&amp;T platform to get the device information.
    /// </summary>
    private void GetDeviceInfo()
    {
        try
        {
            HttpWebRequest deviceInfoRequestObject = (HttpWebRequest)System.Net.WebRequest.Create(this.endPoint + "/rest/2/Devices/Info");
            deviceInfoRequestObject.Method = "GET";
            deviceInfoRequestObject.Headers.Add("Authorization", "Bearer " + Session["Cs_DC_App1_AccessToken"]);

            HttpWebResponse deviceInfoResponse = (HttpWebResponse)deviceInfoRequestObject.GetResponse();
            using (StreamReader accessTokenResponseStream = new StreamReader(deviceInfoResponse.GetResponseStream()))
            {
                string deviceInfo_jsonObj = accessTokenResponseStream.ReadToEnd();
                JavaScriptSerializer deserializeJsonObject = new JavaScriptSerializer();
                DeviceCapabilities   deserializedJsonObj   = (DeviceCapabilities)deserializeJsonObject.Deserialize(deviceInfo_jsonObj, typeof(DeviceCapabilities));
                if (deserializedJsonObj != null)
                {
                    lblTypeAllocationCode.Text = deserializedJsonObj.DeviceInfo.DeviceId.TypeAllocationCode;
                    lblName.Text                 = deserializedJsonObj.DeviceInfo.Capabilities.Name;
                    lblVendor.Text               = deserializedJsonObj.DeviceInfo.Capabilities.Vendor;
                    lblFirmwareVersion.Text      = deserializedJsonObj.DeviceInfo.Capabilities.FirmwareVersion;
                    lblUAProf.Text               = deserializedJsonObj.DeviceInfo.Capabilities.UaProf;
                    lblMMSCapable.Text           = deserializedJsonObj.DeviceInfo.Capabilities.MmsCapable;
                    lblAGPS.Text                 = deserializedJsonObj.DeviceInfo.Capabilities.AssistedGps;
                    lblLocationTechnology.Text   = deserializedJsonObj.DeviceInfo.Capabilities.LocationTechnology;
                    lblDeviceBrowser.Text        = deserializedJsonObj.DeviceInfo.Capabilities.DeviceBrowser;
                    lblWAPPush.Text              = deserializedJsonObj.DeviceInfo.Capabilities.WapPushCapable;
                    tbDeviceCapabSuccess.Visible = true;
                    tbDeviceCapabilities.Visible = true;
                }
                else
                {
                    lblErrorMessage.Text       = "No response from the platform.";
                    tbDeviceCapabError.Visible = true;
                }
            }
        }
        catch (WebException we)
        {
            string errorResponse = string.Empty;

            try
            {
                using (StreamReader sr2 = new StreamReader(we.Response.GetResponseStream()))
                {
                    errorResponse = sr2.ReadToEnd();
                    sr2.Close();
                }
            }
            catch
            {
                errorResponse = "Unable to get response";
            }

            lblErrorMessage.Text       = errorResponse + Environment.NewLine + we.Message;
            tbDeviceCapabError.Visible = true;
        }
        catch (Exception ex)
        {
            lblErrorMessage.Text       = ex.Message;
            tbDeviceCapabError.Visible = true;
        }
    }
        private void SetupDevice([NotNull] WirelessNetworkAddress oldAddress,
            [NotNull] WirelessNetworkAddress newAddress, DeviceCapabilities capabilities)
        {
            IWirelessDevice device;
            if (Devices.TryRemove(oldAddress, out device))
            {
                Devices[newAddress] = device;
                deviceChangeLogger.ChangeAddress(oldAddress, newAddress, capabilities);

                device.ChangeAddress(newAddress);
                ResetMediatorStatusAfterSetup();
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Checks for support for a capability
 /// </summary>
 /// <param name="capability">The DeviceCapabilties flag(s) to check</param>
 /// <returns>True if this device supports the given capabilit(y/ies), otherwise false</returns>
 public bool SupportsCapability(DeviceCapabilities capability)
 {
     return(this.Capabilities.HasFlag(capability));
 }
 public NetworkCompositionBuilder WithDeviceInRoles(WirelessNetworkAddress deviceAddress, DeviceCapabilities capabilities, DeviceRoles roles)
 {
     composition = composition.ChangeRolesFor(deviceAddress, capabilities, roles);
     return(this);
 }
Ejemplo n.º 22
0
        private async Task <SecurityProvider> CreateSecurityProviderFromName(AttestationType attestationType, EnrollmentType?enrollmentType, string groupId, ReprovisionPolicy reprovisionPolicy, AllocationPolicy allocationPolicy, CustomAllocationDefinition customAllocationDefinition, ICollection <string> iothubs, DeviceCapabilities capabilities = null)
        {
            _verboseLog.WriteLine($"{nameof(CreateSecurityProviderFromName)}({attestationType})");

            var provisioningServiceClient = ProvisioningServiceClient.CreateFromConnectionString(Configuration.Provisioning.ConnectionString);

            switch (attestationType)
            {
            case AttestationType.Tpm:
                string registrationId = AttestationTypeToString(attestationType) + "-registration-id-" + Guid.NewGuid();
                var    tpmSim         = new SecurityProviderTpmSimulator(registrationId);

                string base64Ek = Convert.ToBase64String(tpmSim.GetEndorsementKey());


                var provisioningService = ProvisioningServiceClient.CreateFromConnectionString(Configuration.Provisioning.ConnectionString);

                _log.WriteLine($"Getting enrollment: RegistrationID = {registrationId}");
                IndividualEnrollment individualEnrollment = new IndividualEnrollment(registrationId, new TpmAttestation(base64Ek))
                {
                    AllocationPolicy = allocationPolicy, ReprovisionPolicy = reprovisionPolicy, IotHubs = iothubs, CustomAllocationDefinition = customAllocationDefinition, Capabilities = capabilities
                };
                IndividualEnrollment enrollment = await provisioningService.CreateOrUpdateIndividualEnrollmentAsync(individualEnrollment).ConfigureAwait(false);

                var attestation = new TpmAttestation(base64Ek);
                enrollment.Attestation = attestation;
                _log.WriteLine($"Updating enrollment: RegistrationID = {registrationId} EK = '{base64Ek}'");
                await provisioningService.CreateOrUpdateIndividualEnrollmentAsync(enrollment).ConfigureAwait(false);

                return(tpmSim);

            case AttestationType.x509:

                X509Certificate2           certificate = null;
                X509Certificate2Collection collection  = null;
                switch (enrollmentType)
                {
                case EnrollmentType.Individual:
                    certificate = Configuration.Provisioning.GetIndividualEnrollmentCertificate();
                    break;

                case EnrollmentType.Group:
                    certificate = Configuration.Provisioning.GetGroupEnrollmentCertificate();
                    collection  = Configuration.Provisioning.GetGroupEnrollmentChain();
                    break;

                default:
                    throw new NotSupportedException($"Unknown X509 type: '{enrollmentType}'");
                }

                return(new SecurityProviderX509Certificate(certificate, collection));

            case AttestationType.SymmetricKey:
                switch (enrollmentType)
                {
                case EnrollmentType.Group:
                    EnrollmentGroup symmetricKeyEnrollmentGroup = await CreateEnrollmentGroup(provisioningServiceClient, AttestationType.SymmetricKey, groupId, reprovisionPolicy, allocationPolicy, customAllocationDefinition, iothubs, capabilities).ConfigureAwait(false);

                    Assert.IsTrue(symmetricKeyEnrollmentGroup.Attestation is SymmetricKeyAttestation);
                    SymmetricKeyAttestation symmetricKeyAttestation = (SymmetricKeyAttestation)symmetricKeyEnrollmentGroup.Attestation;
                    string registrationIdSymmetricKey  = IdPrefix + Guid.NewGuid();
                    string primaryKeyEnrollmentGroup   = symmetricKeyAttestation.PrimaryKey;
                    string secondaryKeyEnrollmentGroup = symmetricKeyAttestation.SecondaryKey;

                    string primaryKeyIndividual   = ProvisioningE2ETests.ComputeDerivedSymmetricKey(Convert.FromBase64String(primaryKeyEnrollmentGroup), registrationIdSymmetricKey);
                    string secondaryKeyIndividual = ProvisioningE2ETests.ComputeDerivedSymmetricKey(Convert.FromBase64String(secondaryKeyEnrollmentGroup), registrationIdSymmetricKey);

                    return(new SecurityProviderSymmetricKey(registrationIdSymmetricKey, primaryKeyIndividual, secondaryKeyIndividual));

                case EnrollmentType.Individual:
                    IndividualEnrollment symmetricKeyEnrollment = await CreateIndividualEnrollment(provisioningServiceClient, AttestationType.SymmetricKey, reprovisionPolicy, allocationPolicy, customAllocationDefinition, iothubs, capabilities).ConfigureAwait(false);

                    Assert.IsTrue(symmetricKeyEnrollment.Attestation is SymmetricKeyAttestation);
                    symmetricKeyAttestation = (SymmetricKeyAttestation)symmetricKeyEnrollment.Attestation;

                    registrationIdSymmetricKey = symmetricKeyEnrollment.RegistrationId;
                    string primaryKey   = symmetricKeyAttestation.PrimaryKey;
                    string secondaryKey = symmetricKeyAttestation.SecondaryKey;
                    return(new SecurityProviderSymmetricKey(registrationIdSymmetricKey, primaryKey, secondaryKey));

                default:
                    throw new NotSupportedException("Unrecognized enrollment type");
                }

            default:
                throw new NotSupportedException("Unrecognized attestation type");
            }

            throw new NotSupportedException($"Unknown security type: '{attestationType}'.");
        }
Ejemplo n.º 23
0
        private static string GetAdapterDetailsText(Adapter1 adapter, DeviceCapabilities deviceCapabilities, int indent = 0)
        {
            if (adapter == null)
            {
                throw new ArgumentNullException("oneAdapter");
            }

            var sb = new StringBuilder();

            string description = adapter.Description.Description;
            int    pos         = description.IndexOf('\0'); // UH: In SharpDX 3.1, some adapters report description with many zero characters

            if (pos >= 0)
            {
                description = description.Substring(0, pos);
            }

            sb.AppendFormat("{0}<Adapter Description=\"{1}\"\r\n", new String(' ', indent), description);

            sb.AppendFormat("{0}DeviceId=\"0x{1:X}\" VendorId=\"0x{2:X}\" SubSysId=\"0x{3:X}\" AdapterLuid=\"0x{4:X}\" Revision=\"{5}\" Flags=\"{6}\"\r\n{0}DedicatedVideoMemory=\"{7}\" DedicatedSystemMemory=\"{8}\" SharedSystemMemory=\"{9}\" >\r\n",
                            new String(' ', indent + 9),
                            adapter.Description.DeviceId, adapter.Description.VendorId, adapter.Description.SubsystemId, adapter.Description.Luid, adapter.Description.Revision, adapter.Description1.Flags,
                            adapter.Description.DedicatedVideoMemory,
                            adapter.Description.DedicatedSystemMemory,
                            adapter.Description.SharedSystemMemory);

            // According to http://msdn.microsoft.com/en-us/library/windows/desktop/bb174524%28v=vs.85%29.aspx
            // If you try to use CheckInterfaceSupport to check whether a Direct3D 11.x and later version interface is supported, CheckInterfaceSupport returns DXGI_ERROR_UNSUPPORTED.
            //adapter.IsInterfaceSupported<>()

            if (adapter.Outputs == null || adapter.Outputs.Length == 0)
            {
                sb.AppendFormat("{0}<Outputs />\r\n", new String(' ', indent + 4));
            }
            else
            {
                sb.AppendFormat("{0}<Outputs>\r\n", new String(' ', indent + 4));

                for (int j = 0; j < adapter.Outputs.Length; j++)
                {
                    var oneOutput     = adapter.Outputs[j];
                    var desktopBounds = oneOutput.Description.DesktopBounds;

                    int width, height;
                    width  = desktopBounds.Right - desktopBounds.Left;
                    height = desktopBounds.Bottom - desktopBounds.Top;

                    sb.AppendFormat("{0}<Output DeviceName=\"{1}\" AttachedToDesktop=\"{2}\" Width=\"{3}\" Height=\"{4}\" Rotation=\"{5}\" />\r\n",
                                    new String(' ', indent + 8), oneOutput.Description.DeviceName, oneOutput.Description.IsAttachedToDesktop, width, height, oneOutput.Description.Rotation);
                }

                sb.AppendFormat("{0}</Outputs>\r\n", new String(' ', indent + 4));
            }

            if (deviceCapabilities != null)
            {
                sb.AppendFormat("{0}<DeviceCapabilities IsDirectX11Supported=\"{1}\" FeatureLevel=\"{2}\" MaxSupportedMultisamplingCount=\"{3}\" />\r\n",
                                new String(' ', indent + 4), deviceCapabilities.IsDirectX11Supported, deviceCapabilities.FeatureLevel, deviceCapabilities.MaxSupportedMultisamplingCount);
            }

            sb.AppendFormat("{0}</Adapter>\r\n", new String(' ', indent));

            return(sb.ToString());
        }
Ejemplo n.º 24
0
 private static extern ErrorCode GetDriverCaps(IntPtr system, int id, out DeviceCapabilities caps, out int minfrequency, out int maxfrequency, out SpeakerMode controlpanelspeakermode);
        public static async Task<IndividualEnrollment> CreateIndividualEnrollment(ProvisioningServiceClient provisioningServiceClient, AttestationMechanismType attestationType, ReprovisionPolicy reprovisionPolicy, AllocationPolicy allocationPolicy, CustomAllocationDefinition customAllocationDefinition, ICollection<string> iotHubsToProvisionTo, DeviceCapabilities capabilities)
        {
            string registrationId = AttestationTypeToString(attestationType) + "-registration-id-" + Guid.NewGuid();
            Attestation attestation;
            IndividualEnrollment individualEnrollment;
            switch (attestationType)
            {
                case AttestationMechanismType.Tpm:
                    using (var tpmSim = new SecurityProviderTpmSimulator(registrationId))
                    {
                        string base64Ek = Convert.ToBase64String(tpmSim.GetEndorsementKey());
                        var provisioningService = ProvisioningServiceClient.CreateFromConnectionString(Configuration.Provisioning.ConnectionString);
                        individualEnrollment = new IndividualEnrollment(registrationId, new TpmAttestation(base64Ek))
                        {
                            Capabilities = capabilities,
                            AllocationPolicy = allocationPolicy,
                            ReprovisionPolicy = reprovisionPolicy,
                            CustomAllocationDefinition = customAllocationDefinition,
                            IotHubs = iotHubsToProvisionTo
                        };

                        IndividualEnrollment enrollment = await provisioningService.CreateOrUpdateIndividualEnrollmentAsync(individualEnrollment).ConfigureAwait(false);
                        attestation = new TpmAttestation(base64Ek);
                        enrollment.Attestation = attestation;
                        return await provisioningService.CreateOrUpdateIndividualEnrollmentAsync(enrollment).ConfigureAwait(false);
                    }
                case AttestationMechanismType.SymmetricKey:
                    string primaryKey = CryptoKeyGenerator.GenerateKey(32);
                    string secondaryKey = CryptoKeyGenerator.GenerateKey(32);
                    attestation = new SymmetricKeyAttestation(primaryKey, secondaryKey);
                    break;

                case AttestationMechanismType.X509:
                default:
                    throw new NotSupportedException("Test code has not been written for testing this attestation type yet");
            }

            individualEnrollment = new IndividualEnrollment(registrationId, attestation);
            individualEnrollment.Capabilities = capabilities;
            individualEnrollment.CustomAllocationDefinition = customAllocationDefinition;
            individualEnrollment.ReprovisionPolicy = reprovisionPolicy;
            individualEnrollment.IotHubs = iotHubsToProvisionTo;
            individualEnrollment.AllocationPolicy = allocationPolicy;
            return await provisioningServiceClient.CreateOrUpdateIndividualEnrollmentAsync(individualEnrollment).ConfigureAwait(false);
        }
Ejemplo n.º 26
0
 public DeviceCapabilityNotSupportedException(DeviceCapabilities capability, string message) : base(message)
 {
     Capability = capability;
 }
Ejemplo n.º 27
0
 public DeviceCapabilityNotSupportedException(DeviceCapabilities capability) : base()
 {
     Capability = capability;
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Create a Device instance from a config
        /// </summary>
        /// <param name="deviceConfig">The configuration of the device</param>
        /// <returns>The parsed device</returns>
        /// <exception cref="InvalidDeviceConfigException">If the configuration is invalid</exception>
        static Device Parse(dynamic deviceConfig)
        {
            Device device = null;

            // Collect values from config
            string  type = deviceConfig.type;
            string  name = deviceConfig.name;
            dynamic caps = deviceConfig.capabilities;
            IEnumerable <string> capabilitiesStrings = caps is IList?caps.Values <string>() : new string[0];

            // Check if we have a type
            if (type == null)
            {
                throw new InvalidDeviceConfigException("Invalid Device config: supplying a type is required");
            }

            // Find the type
            var fullTypeString = "Touchee.Devices." + type.ToTitleCase() + "Device";
            var deviceType     = typeof(Device);

            foreach (var ass in AppDomain.CurrentDomain.GetAssemblies())
            {
                var t = ass.GetType(fullTypeString);
                if (t != null)
                {
                    deviceType = t;
                    break;
                }
            }

            // Collect capabilities
            DeviceCapabilities capabilities = 0;

            foreach (var c in capabilitiesStrings)
            {
                try {
                    capabilities = capabilities | (DeviceCapabilities)Enum.Parse(typeof(DeviceCapabilities), c.ToCamelCase());
                }
                catch (ArgumentException) {
                    Logger.Log("Unknown DeviceCapability: " + c + ". Skipping it", Logger.LogLevel.Error);
                }
            }

            // Construct the device
            try {
                device = (Device)Activator.CreateInstance(deviceType, new object[] { type, name, capabilities });
            }
            catch (Exception e) {
                throw new InvalidDeviceConfigException("The device could not be instantiated. Is there a (string, string, DeviceCapabilities) constructor?", e);
            }

            // Apply config
            try {
                device.ApplyConfigBase(deviceConfig);
                device.ApplyConfig(deviceConfig);
            }
            catch (Exception e) {
                throw new InvalidDeviceConfigException("The configuration for the device " + device.Name + " could not be applied.", e);
            }

            // Save it
            device.Save();

            return(device);
        }
Ejemplo n.º 29
0
        private void LoadAllDevices()
        {
            if (File.Exists(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\Devices.xml"))
            {
                XElement root = XElement.Load(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\Devices.xml");
                root.Elements("Device").All <XElement>(xeDevices =>
                {
                    DeviceCapabilities devCap            = new DeviceCapabilities();
                    DeviceEventCollection devEventColl   = new DeviceEventCollection();
                    DeviceFunctionCollection devfuncColl = new DeviceFunctionCollection();
                    DevicePropertyCollection devPropColl = new DevicePropertyCollection();
                    xeDevices.Elements("Capabilities").Elements("events").Elements("event").All <XElement>(xe =>
                    {
                        devEventColl.AddDeviceEvent(xe.Attribute("id").Value, xe.Attribute("name").Value);
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("functions").Elements("function").All <XElement>(xe =>
                    {
                        devfuncColl.AddDeviceFunctions(xe.Attribute("id").Value,
                                                       xe.Attribute("functionname").Value,
                                                       fpc, /* this will taken care later*/
                                                       (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("returntype").Value.ToLower()));
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("properties").Elements("property").All <XElement>(xe =>
                    {
                        devPropColl.AddDeviceProperties(xe.Attribute("id").Value,
                                                        xe.Attribute("name").Value,
                                                        (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("type").Value.ToLower()),
                                                        Convert.ToBoolean(xe.Attribute("Readonly").Value));
                        return(true);
                    });

                    devCap.Events     = devEventColl;
                    devCap.Functions  = devfuncColl;
                    devCap.Properties = devPropColl;

                    devcol.AddDevice(xeDevices.Attribute("id").Value,
                                     xeDevices.Attribute("name").Value, devCap);
                    return(true);
                });
            }
            if (File.Exists(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\SOA.xml"))
            {
                XElement root = XElement.Load(@"\\192.168.0.37\MY101-Product X\07-Product Line\CSL\ComponentManager\SOA.xml");
                root.Elements("Device").All <XElement>(xeDevices =>
                {
                    DeviceCapabilities devCap            = new DeviceCapabilities();
                    DeviceEventCollection devEventColl   = new DeviceEventCollection();
                    DeviceFunctionCollection devfuncColl = new DeviceFunctionCollection();
                    DevicePropertyCollection devPropColl = new DevicePropertyCollection();
                    xeDevices.Elements("Capabilities").Elements("events").Elements("event").All <XElement>(xe =>
                    {
                        devEventColl.AddDeviceEvent(xe.Attribute("id").Value, xe.Attribute("name").Value);
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("functions").Elements("function").All <XElement>(xe =>
                    {
                        devfuncColl.AddDeviceFunctions(xe.Attribute("id").Value,
                                                       xe.Attribute("functionname").Value,
                                                       fpc, /* this will taken care later*/
                                                       (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("returntype").Value.ToLower()));
                        return(true);
                    });
                    xeDevices.Elements("Capabilities").Elements("properties").Elements("property").All <XElement>(xe =>
                    {
                        devPropColl.AddDeviceProperties(xe.Attribute("id").Value,
                                                        xe.Attribute("name").Value,
                                                        (ACTDataType)Enum.Parse(typeof(ACTDataType), "dt" + xe.Attribute("type").Value.ToLower()),
                                                        Convert.ToBoolean(xe.Attribute("Readonly").Value));
                        return(true);
                    });

                    devCap.Events     = devEventColl;
                    devCap.Functions  = devfuncColl;
                    devCap.Properties = devPropColl;

                    devcol.AddDevice(xeDevices.Attribute("id").Value,
                                     xeDevices.Attribute("name").Value, devCap);
                    return(true);
                });
            }
            AMAActionableObjects.FixedDeviceCollection = devcol;
        }
Ejemplo n.º 30
0
        string JSGFActionsFromCapabilities(DeviceCapabilities caps, CMUSphinx_GrammarDict cgd)
        {
            string capsName = "<caps_" + caps.CapsAsIntString + ">";
            if (caps_rules_jsgf.Keys.Contains(caps.Caps))
            {
                return caps_rules_jsgf[caps.Caps];
            }
            else
            {
                StringBuilder b = new StringBuilder();

                cgd.JSGFRuleStart(capsName, b);

                List<string> capsAsString = caps.Actions;
                if (capsAsString == null || capsAsString.Count == 0)
                {
                    cgd.JSGFRuleCancel(capsName, b);
                    return null;
                }
                cgd.JSGFRuleAddChoicesStart(b, capsAsString);
                cgd.JSGFRuleAddChoicesEnd(b);
                cgd.JSGFRuleEnd(capsName, b);

                caps_rules_jsgf.Add(caps.Caps, capsName);
            }
            //return new SrgsRuleRef(r, "action");
            return capsName;
        }
Ejemplo n.º 31
0
 /// <devdoc>
 ///     Retrieves device-specific information for this device.
 /// </devdoc>
 public int GetDeviceCapabilities(DeviceCapabilities capabilityIndex)
 {
     return(IntUnsafeNativeMethods.GetDeviceCaps(new HandleRef(this, this.Hdc), (int)capabilityIndex));
 }
Ejemplo n.º 32
0
 private void GetOutputDriverCapabilities(int Id, out DeviceCapabilities caps, out int minfrequency, out int maxfrequency, out SpeakerMode controlpanelspeakermode)
 {
     Errors.ThrowIfError(GetDriverCaps(DangerousGetHandle(), Id, out caps, out minfrequency, out maxfrequency, out controlpanelspeakermode));
 }
Ejemplo n.º 33
0
        private async Task ConfirmExpectedDeviceCapabilities(DeviceRegistrationResult result, Client.IAuthenticationMethod auth, DeviceCapabilities capabilities)
        {
            if (capabilities != null)
            {
                //hardcoding amqp since http does not support twin, but tests that call into this may use http
                using (DeviceClient iotClient = DeviceClient.Create(result.AssignedHub, auth, Client.TransportType.Amqp))
                {
                    //Confirm that the device twin reflects what the enrollment dictated
                    Twin twin = await iotClient.GetTwinAsync().ConfigureAwait(false);

                    Assert.AreEqual(capabilities.IotEdge, twin.Capabilities.IotEdge);
                }
            }
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Constructs a new Device instance
 /// </summary>
 /// <param name="type">The type of the device</param>
 /// <param name="name">The name of the device</param>
 /// <param name="capabilities">The capabilities of the device</param>
 public Device(string type, string name, DeviceCapabilities capabilities)
 {
     this.Type         = type;
     this.Name         = name;
     this.Capabilities = capabilities;
 }
Ejemplo n.º 35
0
 bool FSGActionsFromCapabilities(DeviceCapabilities caps, CMUSphinx_GrammarDict cgd, 
     ref CMUSphinx_FSGState startState, ref CMUSphinx_FSGState endState)
 {
     string capsName = "<caps_" + caps.CapsAsIntString + ">";
     if (caps_rules_fsg.Keys.Contains(caps.Caps))
     {
         startState = caps_rules_fsg[caps.Caps].Item1;
         endState = caps_rules_fsg[caps.Caps].Item2;
         return true;
     }
     List<string> capsAsString = caps.Actions;
     if (capsAsString == null || capsAsString.Count == 0)
     {
         startState = null;
         endState = null;
         return false;
     }
     CMUSphinx_FSGState start = cgd.FSGCreateOrphanState();
     CMUSphinx_FSGState end = cgd.FSGCreateOrphanState();
     foreach (string s in capsAsString)
     {
         cgd.FSGLinkStates(start, end, s);
     }
     caps_rules_fsg.Add(caps.Caps, new Tuple<CMUSphinx_FSGState,CMUSphinx_FSGState>(start, end));
     startState = start;
     endState = end;
     //return new SrgsRuleRef(r, "action");
     return true;
 }
 public static extern int HidP_GetCaps(IntPtr preparsed, out DeviceCapabilities caps);
Ejemplo n.º 37
0
 SrgsRuleRef SrgsActionsFromCapabilities(DeviceCapabilities caps, SrgsDocument doc)
 {
     SrgsRule r;
     if (caps_rules.Keys.Contains(caps.Caps))
     {
         r = caps_rules[caps.Caps];
     }
     else
     {
         List<string> capsAsString = caps.Actions;
         if (capsAsString == null || capsAsString.Count == 0) return null;
         SrgsOneOf actions = new SrgsOneOf();
         foreach (string s in capsAsString)
         {
             SrgsItem si = new SrgsItem(s);
             //si.Add(new SrgsSemanticInterpretationTag(" out = \"" + s + "\";"));
             si.Add(new SrgsNameValueTag("action", s));
             actions.Add(si);
         }
         r = new SrgsRule(AudioRecog_SAPI.SrgsCleanupID("caps_" + caps.CapsAsIntString), actions);
         doc.Rules.Add(r);
         caps_rules.Add(caps.Caps, r);
     }
     //return new SrgsRuleRef(r, "action");
     return new SrgsRuleRef(r);
 }
 public DeviceRolesWithCapabilities(DeviceCapabilities capabilities, DeviceRoles roles)
 {
     Capabilities = capabilities;
     Roles        = roles;
 }
Ejemplo n.º 39
0
 private void GetRecordDriverCapabilities(int id, out DeviceCapabilities caps, out int minfrequency, out int maxfrequency)
 {
     Errors.ThrowIfError(GetRecordDriverCaps(DangerousGetHandle(), id, out caps, out minfrequency, out maxfrequency));
 }
 public int GetDeviceCapabilities(DeviceCapabilities capabilityIndex)
 {
     return IntUnsafeNativeMethods.GetDeviceCaps(new HandleRef(this, this.Hdc), (int) capabilityIndex);
 }
Ejemplo n.º 41
0
 private static extern ErrorCode GetRecordDriverCaps(IntPtr system, int id, out DeviceCapabilities caps, out int minfrequency, out int maxfrequency);
 /// <summary>
 /// This method displays the Device Capabilities.
 /// </summary>
 /// <param name="deviceCapabilities">Device Capabilities</param>
 private void DisplayDeviceCapabilities(DeviceCapabilities deviceCapabilities)
 {
     if (null != deviceCapabilities)
     {
         lblTypeAllocationCode.Text = deviceCapabilities.deviceId.TypeAllocationCode;
         lblName.Text = deviceCapabilities.capabilities.Name;
         lblVendor.Text = deviceCapabilities.capabilities.Vendor;
         lblModel.Text = deviceCapabilities.capabilities.Model;
         lblFirmwareVersion.Text = deviceCapabilities.capabilities.FirmwareVersion;
         lblUAProf.Text = deviceCapabilities.capabilities.UaProf;
         lblMMSCapable.Text = deviceCapabilities.capabilities.MmsCapable;
         lblAssistedGps.Text = deviceCapabilities.capabilities.AssistedGps;
         lblLocationTechnology.Text = deviceCapabilities.capabilities.LocationTechnology;
         lblDeviceBrowser.Text = deviceCapabilities.capabilities.DeviceBrowser;
         lblWAPPush.Text = deviceCapabilities.capabilities.WapPushCapable;
         tb_dc_output.Visible = true;
         tbDeviceCapabilities.Visible = true;
     }
 }
        public static async Task<EnrollmentGroup> CreateEnrollmentGroup(ProvisioningServiceClient provisioningServiceClient, AttestationMechanismType attestationType, string groupId, ReprovisionPolicy reprovisionPolicy, AllocationPolicy allocationPolicy, CustomAllocationDefinition customAllocationDefinition, ICollection<string> iothubs, DeviceCapabilities capabilities)
        {
            Attestation attestation;
            switch (attestationType)
            {
                case AttestationMechanismType.Tpm:
                    throw new NotSupportedException("Group enrollments do not support tpm attestation");
                case AttestationMechanismType.SymmetricKey:
                    string primaryKey = CryptoKeyGenerator.GenerateKey(32);
                    string secondaryKey = CryptoKeyGenerator.GenerateKey(32);
                    attestation = new SymmetricKeyAttestation(primaryKey, secondaryKey);
                    break;

                case AttestationMechanismType.X509:
                default:
                    throw new NotSupportedException("Test code has not been written for testing this attestation type yet");
            }

            var enrollmentGroup = new EnrollmentGroup(groupId, attestation)
            {
                Capabilities = capabilities,
                ReprovisionPolicy = reprovisionPolicy,
                AllocationPolicy = allocationPolicy,
                CustomAllocationDefinition = customAllocationDefinition,
                IotHubs = iothubs,
            };

            return await provisioningServiceClient.CreateOrUpdateEnrollmentGroupAsync(enrollmentGroup).ConfigureAwait(false);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotifyStatusOperation" /> class with required parameters.
        /// </summary>
        /// <param name="originatingAddress">
        /// The originating address of the device in the wireless network.
        /// </param>
        /// <param name="getMembership">
        /// Indicates whether the device is part of the logical network configuration.
        /// </param>
        /// <param name="capabilities">
        /// The capabilities that the device can perform.
        /// </param>
        /// <param name="roles">
        /// The subset of <paramref name="capabilities" /> that the device currently performs in the logical network.
        /// </param>
        /// <param name="signalStrength">
        /// The wireless signal strength. Higher values indicate a better signal.
        /// </param>
        public NotifyStatusOperation([NotNull] WirelessNetworkAddress originatingAddress, bool getMembership,
            DeviceCapabilities capabilities, DeviceRoles roles, int signalStrength)
            : this()
        {
            Guard.NotNull(originatingAddress, nameof(originatingAddress));

            OriginatingAddress = originatingAddress;
            GetMembership = getMembership;
            Capabilities = capabilities;
            Roles = roles;
            SignalStrength = signalStrength;
        }